xmlBlaster 2.2.0 API

org.xmlBlaster.engine.cluster
Class NodeMasterInfo

java.lang.Object
  extended by org.xmlBlaster.engine.cluster.NodeMasterInfo
All Implemented Interfaces:
java.lang.Comparable, NodeMasterInfoMBean

public final class NodeMasterInfo
extends java.lang.Object
implements java.lang.Comparable, NodeMasterInfoMBean

Here we have the rules to find out who is the master of a message.

The rules are configurable with such a message:

 <!-- Messages of type "__sys__cluster.node.master[heron]": -->

 <master stratum='0' refid='bilbo' type='DomainToMaster' version='1.0'>
    <![CDATA[
       <key domain='rugby'/>
    ]]>
 </master>
 
Here the plugin 'DomainToMaster' with version '1.0' is chosen, this is mapped with the xmlBlaster.properties entry
 MapMsgToMasterPlugin[DomainToMaster][1.0]=org.xmlBlaster.engine.cluster.simpledomain.DomainToMaster
 
to the real java implementation.


Field Summary
private  boolean acceptDefault
           
private  boolean acceptOtherDefault
           
private  ClusterNode clusterNode
           
private  ContextNode contextNode
           
private  int count
           
private static int counter
           
static boolean DEFAULT_acceptDefault
           
static boolean DEFAULT_acceptOtherDefault
           
static java.lang.String DEFAULT_version
          The version of the plugin
private  boolean dirtyRead
           
protected  AccessFilterQos[] filterArr
           
protected  AccessFilterQos[] filterArr0
           
protected  java.util.ArrayList filterList
           
private  boolean inKey
           
private  int inMaster
          for SAX parsing
private  QueryKeyData[] keyArr
           
private  QueryKeyData[] keyArr0
           
protected  java.util.ArrayList keyList
           
private static java.util.logging.Logger log
           
private  java.lang.Object mbeanHandle
          My JMX registration
private  java.lang.String ME
          Unique name for logging
private  java.lang.String refId
           
private  ServerScope serverScope
           
private  int stratum
           
private  AccessFilterQos tmpFilter
           
private  QueryKeyData tmpKey
           
private  java.lang.String type
           
private  java.lang.String version
           
 
Constructor Summary
NodeMasterInfo(ServerScope glob, ClusterNode clusterNode)
          Create a NodeMasterInfo belonging to the given cluster node.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Enforced by interface Comparable, does sorting of NodeMasterInfo instances in a treeSet with stratum
 java.lang.String destroy()
          For JMX only.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String name, java.lang.StringBuffer character)
          Handle SAX parsed end element
 AccessFilterQos[] getAccessFilterArr()
          Access the cluster master filters
 ClusterNode getClusterNode()
          Access my manager
 java.lang.String getConfiguration()
          The XML markup for JMX.
 int getCount()
          Unique number (in this JVM)
 java.lang.String getId()
          Convenience method, delegates to clusterNode.getNodeId().getId().
 java.lang.String getKeyMappingFirstLog()
           
 QueryKeyData[] getKeyMappings()
          Get the key based rules
 NodeId getNodeId()
          Convenience method, delegates to clusterNode.getNodeId().
 java.lang.String getRefId()
           
 int getStratum()
          The distance of the node to the master.
 java.lang.String getType()
          The plugin type.
 java.lang.String getVersion()
          The plugin version.
 boolean isAcceptDefault()
          Are we master for messages with the default domain?
 boolean isAcceptOtherDefault()
          Are we master for messages with default domain from other nodes?
 boolean isDirtyRead()
           
 void setAcceptDefault(boolean acceptDefault)
          Are we master for default domains?
 void setAcceptOtherDefault(boolean acceptOtherDefault)
          Are we master for default domains of other nodes?
 java.lang.String setConfiguration(java.lang.String xml)
          Reconfigure node routing via JMX (transient only).
 void setDirtyRead(boolean dirtyRead)
           
 void setRefId(java.lang.String refId)
           
 void setStratum(int stratum)
          The distance of the node to the master.
 void setType(java.lang.String type)
          The plugin type.
 void setVersion(java.lang.String version)
          The plugin version.
 void shutdown()
           
 boolean startElement(java.lang.String uri, java.lang.String localName, java.lang.String name, java.lang.StringBuffer character, org.xml.sax.Attributes attrs)
          Called for SAX master start tag
 java.lang.String toString()
           
 java.lang.String toXml()
          Dump state of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset, boolean forceAllAttributes)
          Dump state of this object into a XML ASCII string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ME

private java.lang.String ME
Unique name for logging


serverScope

private final ServerScope serverScope

log

private static java.util.logging.Logger log

clusterNode

private final ClusterNode clusterNode

counter

private static int counter

count

private final int count

stratum

private int stratum

DEFAULT_acceptDefault

public static final boolean DEFAULT_acceptDefault
See Also:
Constant Field Values

acceptDefault

private boolean acceptDefault

DEFAULT_acceptOtherDefault

public static final boolean DEFAULT_acceptOtherDefault
See Also:
Constant Field Values

acceptOtherDefault

private boolean acceptOtherDefault

refId

private java.lang.String refId

type

private java.lang.String type

DEFAULT_version

public static final java.lang.String DEFAULT_version
The version of the plugin

See Also:
Constant Field Values

version

private java.lang.String version

dirtyRead

private boolean dirtyRead

inMaster

private int inMaster
for SAX parsing


tmpFilter

private transient AccessFilterQos tmpFilter

filterList

protected java.util.ArrayList filterList

filterArr

protected transient AccessFilterQos[] filterArr

filterArr0

protected final transient AccessFilterQos[] filterArr0

tmpKey

private transient QueryKeyData tmpKey

keyList

protected java.util.ArrayList keyList

keyArr

private QueryKeyData[] keyArr

keyArr0

private final transient QueryKeyData[] keyArr0

inKey

private transient boolean inKey

contextNode

private ContextNode contextNode

mbeanHandle

private java.lang.Object mbeanHandle
My JMX registration

Constructor Detail

NodeMasterInfo

public NodeMasterInfo(ServerScope glob,
                      ClusterNode clusterNode)
               throws XmlBlasterException
Create a NodeMasterInfo belonging to the given cluster node.

One instance of this is created for each <master> tag

Throws:
XmlBlasterException
Method Detail

getCount

public int getCount()
Unique number (in this JVM)


getClusterNode

public ClusterNode getClusterNode()
Access my manager

Returns:
The clusterNode which takes care of me

getNodeId

public NodeId getNodeId()
Convenience method, delegates to clusterNode.getNodeId().

Returns:
My node id object

getId

public java.lang.String getId()
Convenience method, delegates to clusterNode.getNodeId().getId().

Returns:
My node id String

getKeyMappings

public QueryKeyData[] getKeyMappings()
Get the key based rules

Returns:
never null

getKeyMappingFirstLog

public java.lang.String getKeyMappingFirstLog()

getAccessFilterArr

public final AccessFilterQos[] getAccessFilterArr()
Access the cluster master filters

Returns:
never null but length == 0 if none is specified.

setStratum

public void setStratum(int stratum)
The distance of the node to the master.

Specified by:
setStratum in interface NodeMasterInfoMBean
Parameters:
0 - is the master, 1 is the direct slave, 2 is the slave of the slave ...

getStratum

public int getStratum()
The distance of the node to the master.

Specified by:
getStratum in interface NodeMasterInfoMBean
Returns:
0 is the master, 1 is the direct slave, 2 is the slave of the slave ...

setRefId

public void setRefId(java.lang.String refId)

getRefId

public java.lang.String getRefId()

setType

public void setType(java.lang.String type)
The plugin type.


getType

public java.lang.String getType()
The plugin type.

Returns:
Defaults to "DomainToMaster"

setVersion

public void setVersion(java.lang.String version)
The plugin version.


getVersion

public java.lang.String getVersion()
The plugin version.

Returns:
Defaults to "1.0"

setAcceptDefault

public void setAcceptDefault(boolean acceptDefault)
Are we master for default domains?

Specified by:
setAcceptDefault in interface NodeMasterInfoMBean

isAcceptDefault

public boolean isAcceptDefault()
Are we master for messages with the default domain?

Specified by:
isAcceptDefault in interface NodeMasterInfoMBean

setAcceptOtherDefault

public void setAcceptOtherDefault(boolean acceptOtherDefault)
Are we master for default domains of other nodes?

Specified by:
setAcceptOtherDefault in interface NodeMasterInfoMBean

isAcceptOtherDefault

public boolean isAcceptOtherDefault()
Are we master for messages with default domain from other nodes?

Specified by:
isAcceptOtherDefault in interface NodeMasterInfoMBean

isDirtyRead

public boolean isDirtyRead()
Specified by:
isDirtyRead in interface NodeMasterInfoMBean
Returns:
true if cluster slaves cache forwarded publish messages
See Also:
The cluster.dirtyRead requirement

setDirtyRead

public void setDirtyRead(boolean dirtyRead)
Specified by:
setDirtyRead in interface NodeMasterInfoMBean
Parameters:
dirtyRead - true if cluster slaves cache forwarded publish messages
See Also:
The cluster.dirtyRead requirement

startElement

public final boolean startElement(java.lang.String uri,
                                  java.lang.String localName,
                                  java.lang.String name,
                                  java.lang.StringBuffer character,
                                  org.xml.sax.Attributes attrs)
Called for SAX master start tag

Returns:
true if ok, false on error

endElement

public final void endElement(java.lang.String uri,
                             java.lang.String localName,
                             java.lang.String name,
                             java.lang.StringBuffer character)
Handle SAX parsed end element


getConfiguration

public java.lang.String getConfiguration()
The XML markup for JMX.

Specified by:
getConfiguration in interface NodeMasterInfoMBean

setConfiguration

public java.lang.String setConfiguration(java.lang.String xml)
Reconfigure node routing via JMX (transient only). Is not activated and not intensively tested

Specified by:
setConfiguration in interface NodeMasterInfoMBean

destroy

public java.lang.String destroy()
For JMX only.

Specified by:
destroy in interface NodeMasterInfoMBean
Returns:

shutdown

public void shutdown()

toXml

public final java.lang.String toXml()
Dump state of this object into a XML ASCII string.


toXml

public final java.lang.String toXml(java.lang.String extraOffset,
                                    boolean forceAllAttributes)
Dump state of this object into a XML ASCII string.
Only none default values are dumped for performance reasons

Parameters:
extraOffset - indenting of tags for nice output
Returns:
The xml representation

compareTo

public int compareTo(java.lang.Object obj)
Enforced by interface Comparable, does sorting of NodeMasterInfo instances in a treeSet with stratum

Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.