ist.palcom.contingency.manager
Class ContingencyManager

java.lang.Object
  extended by ist.palcom.services.AbstractService
      extended by ist.palcom.contingency.manager.ContingencyManager
All Implemented Interfaces:
IContingencyManager, Service, IHgraphNode

public class ContingencyManager
extends AbstractService
implements IContingencyManager

Implements basic logic that handles contingency events occurring on the monitored assembly. Contingency manager receives a request to monitor an assembly via getting the assembly's description from the assembly manager. Consequently, it selects resources and contingencies that will be monitored on them. Contingency manager registers listeners on the occurrence of these contingency events at the contingency monitor. In case a contingency event happens, the contingency manager will be informed and handles the event accordingly.


Nested Class Summary
static class ContingencyManager.ContingencyManagerState
           
 
Field Summary
 
Fields inherited from class ist.palcom.services.AbstractService
_node, connectionsMonitor, context, info, siid
 
Fields inherited from interface ist.palcom.contingency.manager.IContingencyManager
SERVICE_NAME, URN_SUFFIX
 
Fields inherited from interface ist.palcom.hgraph.IHgraphNode
CHILD_NAME_CLASH, CIRCULARITY_CLASH, COMMAND_OR_NODE_MISSING, ERROR, HANDLER_MISSING, INVOKATOR_MISSING, LISTENER_MISSING, NODE_NOT_CHILD, PATH_MISSING, SIBLING_ALREADY_EXISTS, SIBLING_NONEXISTENT, SIBLING_REFERENCE_ALREADY_EXISTS, SIBLING_REFERENCE_NONEXISTENT, STATUS_OK, VALUE_ALREADY_EXISTS, VALUE_NOT_PRESENT
 
Constructor Summary
ContingencyManager(DeviceContext context, java.lang.String serviceName)
           
 
Method Summary
static ServiceProxy createServiceProxy(java.lang.String serviceName)
           
 ist.palcom.contingency.manager.ContingencyManager.ContingencyThread getContingencyThread()
          Return a thread responsible for dealing with contingency issues.
 ServiceID getServiceID()
           
 void monitorAssembly(PRDAssemblyVer ai)
           
 void putContingencyEvent(ContingencyEvent event)
          Receive a contingency event for handling.
 void putEvent(Event event)
           
 void registerContingencyMonitoringThread(PalcomThread t)
          Register a thread that receives requests for contingency event monitoring.
 void registerEditCommandReceiverThread(PalcomThread t)
          Register a thread that receives edit commands to apply changes to the PRDAssembly.
 void registerResourceDirectoryThread(PalcomThread t)
          Register a thread to query for resources.
 void start()
          Start the service.
 void stop()
           
 void stopMonitoringAssembly(PRDAssemblyVer ai)
          Stops monitoring the assembly.
 void unregisterContingencyMonitoringThread(PalcomThread t)
          Unregister the thread receiving requests for contingency event monitoring.
 void unregisterEditCommandReceiverThread(PalcomThread t)
          Unregister the thread receiving edit commands.
 void unregisterResourceDirectoryThread(PalcomThread t)
          Unregister the thread receiving queries for resources.
 
Methods inherited from class ist.palcom.services.AbstractService
addNodeChild, addServiceProxyListener, connectionClosed, connectionCreated, connectTo, disconnectFrom, getChildIterator, getConnections, getFuncFunc, getNodeName, getNodeParent, getPath, getRemoteServiceProxy, getSelector, getServiceInfo, getServiceInstanceID, getServiceProxy, getSiblingFunc, getValueFunc, hasChildNamed, isAncestorOf, remoteServiceProxyIterator, removeNodeChild, removeServiceProxyListener, sendToAll, setGroupID, setLocalSID, setName, setNodeName, setNodeParent, setServiceInstanceID, setServiceProxy, setStatus, setTopic, toXML, toXMLFull, toXMLFullRecursively, toXMLRecursively, updatePath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContingencyManager

public ContingencyManager(DeviceContext context,
                          java.lang.String serviceName)
                   throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getServiceID

public ServiceID getServiceID()
Specified by:
getServiceID in class AbstractService
Returns:
the ServiceID of the service.

createServiceProxy

public static ServiceProxy createServiceProxy(java.lang.String serviceName)

putEvent

public void putEvent(Event event)

putContingencyEvent

public void putContingencyEvent(ContingencyEvent event)
Description copied from interface: IContingencyManager
Receive a contingency event for handling.

Specified by:
putContingencyEvent in interface IContingencyManager

start

public void start()
           throws java.io.IOException
Description copied from class: AbstractService
Start the service. The LocalSID must be set before calling this method (through a constructor, or through a call to the setLocalSID method). If the service is started already, nothing happens. The DiscoveryManager will be updated with info about the service.

Specified by:
start in interface IContingencyManager
Overrides:
start in class AbstractService
Throws:
java.io.IOException

stop

public void stop()
          throws java.io.IOException
Specified by:
stop in interface IContingencyManager
Overrides:
stop in class AbstractService
Throws:
java.io.IOException

registerEditCommandReceiverThread

public void registerEditCommandReceiverThread(PalcomThread t)
Description copied from interface: IContingencyManager
Register a thread that receives edit commands to apply changes to the PRDAssembly.

Specified by:
registerEditCommandReceiverThread in interface IContingencyManager
Parameters:
t - - The receiver thread.

unregisterEditCommandReceiverThread

public void unregisterEditCommandReceiverThread(PalcomThread t)
Description copied from interface: IContingencyManager
Unregister the thread receiving edit commands.

Specified by:
unregisterEditCommandReceiverThread in interface IContingencyManager
Parameters:
t - - The receiver thread.

registerContingencyMonitoringThread

public void registerContingencyMonitoringThread(PalcomThread t)
Description copied from interface: IContingencyManager
Register a thread that receives requests for contingency event monitoring.

Specified by:
registerContingencyMonitoringThread in interface IContingencyManager
Parameters:
t - - The receiver thread.

unregisterContingencyMonitoringThread

public void unregisterContingencyMonitoringThread(PalcomThread t)
Description copied from interface: IContingencyManager
Unregister the thread receiving requests for contingency event monitoring.

Specified by:
unregisterContingencyMonitoringThread in interface IContingencyManager
Parameters:
t - - The receiver thread.

registerResourceDirectoryThread

public void registerResourceDirectoryThread(PalcomThread t)
Description copied from interface: IContingencyManager
Register a thread to query for resources.

Specified by:
registerResourceDirectoryThread in interface IContingencyManager
Parameters:
t - - The receiver thread.

unregisterResourceDirectoryThread

public void unregisterResourceDirectoryThread(PalcomThread t)
Description copied from interface: IContingencyManager
Unregister the thread receiving queries for resources.

Specified by:
unregisterResourceDirectoryThread in interface IContingencyManager
Parameters:
t - - The receiver thread.

getContingencyThread

public ist.palcom.contingency.manager.ContingencyManager.ContingencyThread getContingencyThread()
Description copied from interface: IContingencyManager
Return a thread responsible for dealing with contingency issues.

Specified by:
getContingencyThread in interface IContingencyManager
Returns:
The contingency thread.

monitorAssembly

public void monitorAssembly(PRDAssemblyVer ai)
Specified by:
monitorAssembly in interface IContingencyManager

stopMonitoringAssembly

public void stopMonitoringAssembly(PRDAssemblyVer ai)
Description copied from interface: IContingencyManager
Stops monitoring the assembly.

Specified by:
stopMonitoringAssembly in interface IContingencyManager