|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--org.mmbase.module.builders.vwms.Vwm
Virtual Web Master base object. Most VWM's inherit fromt his base class. The Vwm contains routines for performing tasks at certain intervals. The interval is determined from the maintime value in the Vwms builder (Maintenance time in seconds), Each interval, the vwm invokes the ProbeCall() method. VWMs perform periodic maintenance by overrideing the probeCall method (the default doesn't do anything). A VWM is also called a 'Bot'.
| Field Summary | |
protected java.lang.String |
name
Name of the VWM. |
protected VwmProbe |
probe
Scheduler of tasks depending on VWMtask nodes associated with this Vwm. |
protected int |
sleeptime
Sleep time in seconds. |
protected Vwms |
Vwms
The VWMs builder that holds the VWM's node. |
protected MMObjectNode |
wvmnode
The creation node of this VWM. |
| Constructor Summary | |
Vwm()
|
|
| Method Summary | |
boolean |
addClient(VwmCallBackInterface client)
Add a client to the listen queue of the wvm. |
protected boolean |
claim(MMObjectNode node)
Signals that the task node is claimed. |
protected void |
debug(java.lang.String msg)
|
protected boolean |
failed(MMObjectNode node)
Signals that the task to be performed failed. |
java.lang.String |
getName()
Returns the name of the VWM. |
MMObjectNode |
getVwmNode()
Retrieves the creation node of this VWM. |
void |
init(MMObjectNode vwmnode,
Vwms Vwms)
Initialize the Vwm. |
boolean |
nodeLocalChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Called when a remote node is changed. |
boolean |
nodeRemoteChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Called when a local node is changed. |
protected java.util.Hashtable |
parseProperties(java.lang.String props)
Converts a string of properties to a Hashtable. |
protected boolean |
performed(MMObjectNode node)
Signals that the task to be performed was successful and has finished. |
boolean |
performTask(MMObjectNode node)
Performs maintenance based on a Vwmtasknode. |
boolean |
probeCall()
Performs periodic maintenance. |
boolean |
putTask(MMObjectNode node)
Adds a new task to the list of taks to perform. |
boolean |
releaseClient(VwmCallBackInterface client)
Release a client from the listen queue of the wvm. |
protected boolean |
rollback(MMObjectNode node)
Signals that the task should be performed again (possibly after an initial failure). |
void |
run()
VWM maintenance scheduler. |
void |
start()
Starts the thread for the Vwm. |
void |
stop()
Stops the Vwm's thread. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected VwmProbe probe
protected int sleeptime
protected MMObjectNode wvmnode
protected java.lang.String name
protected Vwms Vwms
parent attribute of the vwm node (but a bit easier in use).getVwmNode()| Constructor Detail |
public Vwm()
| Method Detail |
protected void debug(java.lang.String msg)
public void init(MMObjectNode vwmnode,
Vwms Vwms)
init in interface VwmInterfacevwmnode - Vwms - The VWMs builder. It is not really necessary as this is the same as the parent attribute of vwmnode.public void start()
public void stop()
public void run()
probeCall() method, after which the thread sleeps for a number of seconds as set in sleeptime.run in interface java.lang.Runnablepublic boolean addClient(VwmCallBackInterface client)
addClient in interface VwmInterfaceclient - The client-object to addtrue if the client was added, false if it already existed in the queue.public boolean releaseClient(VwmCallBackInterface client)
releaseClient in interface VwmInterfaceclient - The client-object to releasetrue if the client was released, false if it did not exist in the queue.public boolean probeCall()
run() method.
Since this does not actually do anything, perhaps this method should be abstract.probeCall in interface VwmProbeInterfacetrue if maintenance was performed, false otherwisepublic boolean putTask(MMObjectNode node)
node - the node describing the task (from the Vwmtasks builder)true is the task was succesfully added.public java.lang.String getName()
getName in interface VwmProbeInterfacepublic boolean performTask(MMObjectNode node)
probe object assoviated with the VWM.
the default method sets a status field to indicate an error, and sends an error email.
Perhaps this method should be abstract.performTask in interface VwmProbeInterfacenode - The Vwmtask node that describes the task to be performed.true if maintenance was performed, false if it failedprotected boolean claim(MMObjectNode node)
node - The VwmTask node that describes the tasktrue if teh task's state was cahnged, false if it fails.protected boolean rollback(MMObjectNode node)
node - The VwmTask node that describes the tasktrue if teh task's state was cahnged, false if it fails.protected boolean failed(MMObjectNode node)
node - The VwmTask node that describes the tasktrue if the task's state was cahnged, false if it fails.protected boolean performed(MMObjectNode node)
node - The VwmTask node that describes the tasktrue if teh task's state was cahnged, false if it fails.protected java.util.Hashtable parseProperties(java.lang.String props)
props - the properties stringhashtable with the property name=value pairs.public MMObjectNode getVwmNode()
public boolean nodeRemoteChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
nodeRemoteChanged in interface MMBaseObservermachine - Name of the machine that changed the node.number - Number of the changed node as a Stringbuilder - type of the changed nodectype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=newtrue if maintenance was performed, false (the default) otherwise
public boolean nodeLocalChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
nodeLocalChanged in interface MMBaseObservermachine - Name of the machine that changed the node.number - Number of the changed node as a Stringbuilder - type of the changed nodectype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=newtrue if maintenance was performed, false (the default) otherwise
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||