|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.engine.cluster.simpledomain.DomainToMaster
public final class DomainToMaster
Finds the master of a message depending on the domain attribute of the message key tag.
This is a simple demo implementation for clustering, the plugin can be loaded depending on the mime type of a message, we register it here for all messages, see getMessages(). Switch on logging with '-trace[cluster] true'
Field Summary | |
---|---|
private ServerScope |
glob
|
private static java.util.logging.Logger |
log
|
private java.lang.String |
ME
|
Constructor Summary | |
---|---|
DomainToMaster()
|
Method Summary | |
---|---|
NodeMasterInfo |
getMasterId(NodeMasterInfo nodeMasterInfo,
MsgUnit msgUnit)
Find out who is the master of the provided message. |
java.lang.String[] |
getMimeExtended()
Get the content MIME version number for which this plugin applies |
java.lang.String[] |
getMimeTypes()
Get the content MIME type for which this plugin applies |
java.lang.String |
getName()
Get a human readable name of this implementation |
java.lang.String |
getType()
Return plugin type for Plugin loader |
java.lang.String |
getVersion()
Return plugin version for Plugin loader |
void |
init(Global glob,
PluginInfo pluginInfo)
This method is called by the PluginManager (enforced by I_Plugin). |
void |
initialize(ServerScope glob,
ClusterManager clusterManager)
This is called after instantiation of the plugin |
void |
reset()
Is called when new configuration arrived, notify the plugin to empty its cache or do whatever it needs to do. |
void |
shutdown()
Cleans up the resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String ME
private ServerScope glob
private static java.util.logging.Logger log
Constructor Detail |
---|
public DomainToMaster()
Method Detail |
---|
public void initialize(ServerScope glob, ClusterManager clusterManager)
initialize
in interface I_MapMsgToMasterId
glob
- The Global handle of this xmlBlaster server instance.public void reset()
reset
in interface I_MapMsgToMasterId
public void init(Global glob, PluginInfo pluginInfo)
init
in interface I_Plugin
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)
public java.lang.String getType()
getType
in interface I_Plugin
public java.lang.String getVersion()
getVersion
in interface I_Plugin
public java.lang.String[] getMimeTypes()
getMimeTypes
in interface I_MapMsgToMasterId
public java.lang.String[] getMimeExtended()
getMimeExtended
in interface I_MapMsgToMasterId
public java.lang.String getName()
getName
in interface I_MapMsgToMasterId
public NodeMasterInfo getMasterId(NodeMasterInfo nodeMasterInfo, MsgUnit msgUnit) throws XmlBlasterException
<clusternode id='heron'> <master type='DomainToMaster' version='0.9'> <![CDATA[ <key type='DOMAIN' domain='RUGBY'/> <key type='XPATH'>//GAME</key> ]]> <filter type='ContentLength'> 8000 </filter> <filter type='ContainsChecker' version='7.1' xy='true'> rugby </filter> </master> </clusternode>If the attribute domain='RUGBY' and the meta informations contains the tag <GAME> and the message is shorter 8000 bytes and the message content contains a token 'rugby' the cluster node 'heron' is chosen as the master of the message.
getMasterId
in interface I_MapMsgToMasterId
msgUnit
- The messagenodeMasterInfo
- The mapping rule to find the master
nodeMasterInfo.getClusterNode()
and the xmlBlasterConnection
to the master node with nodeMasterInfo.getClusterNode().getXmlBlasterAccess()
XmlBlasterException
public void shutdown() throws XmlBlasterException
I_Plugin
shutdown
in interface I_Plugin
XmlBlasterException
- if an exception occurs. The exception is
handled by the RunLevelManager depending on how the plugin has been
configured with the action:
<action do='STOP' onShutdownRunlevel='2' sequence='5'
onFail='resource.configuration.pluginFailed'>
If onFail is defined to something, the RunLevelManager will stop.
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |