ist.palcom.assembly.manager
Class NewResourceManager

java.lang.Object
  extended by ist.palcom.services.AbstractService
      extended by ist.palcom.assembly.manager.NewResourceManager
All Implemented Interfaces:
IResourceManager, Service, IHgraphNode

public class NewResourceManager
extends AbstractService
implements IResourceManager

A class responsible for providing Assemblies with resources This is the multi-threaded version, with one thread monitoring each request. Currently, only connections are supported: An assembly sends requests for connections, and the ResourceManager responds with an ConnectionInfo, if the connection is possible (i.e., the required services have been discovered) If established resources go down, dependent assemblies are informed For alternative resources, if a better alternative appears, dependent assemblies are informed that a change is possible


Field Summary
static java.lang.String SERVICE_NAME
           
 
Fields inherited from class ist.palcom.services.AbstractService
_node, connectionsMonitor, context, info, siid
 
Fields inherited from interface ist.palcom.assemblies.IResourceManager
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
NewResourceManager(DeviceContext context)
          This constructor makes it possible to start the ResourceManager from the ServiceManager
NewResourceManager(DeviceContext context, java.lang.String serviceName)
           
 
Method Summary
 ServiceID getServiceID()
           
protected  void infoReceived(AInfoEvent event)
           
protected  void processResourceRequest(ResourceRequestEvent rre)
           
 void putEvent(ResourceRequestEvent event)
           
 boolean serviceExpRefersToSingle(ServiceExp se)
           
 boolean servicesAreSingle(ServiceExp prov, ServiceExp cust)
          Check if a pair of serviceExp:s refer to single (i.e., not alternative) declarations
 void start()
          Start the service.
 void stop()
           
protected  void tryLoadingSoftwareComponent(AbstractResourceAddress smadr, AbstractResourceAddress wanted)
           
 
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
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
See Also:
Constant Field Values
Constructor Detail

NewResourceManager

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

NewResourceManager

public NewResourceManager(DeviceContext context)
                   throws java.io.IOException
This constructor makes it possible to start the ResourceManager from the ServiceManager

Throws:
java.io.IOException
Method Detail

getServiceID

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

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 IResourceManager
Overrides:
start in class AbstractService
Throws:
java.io.IOException

stop

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

infoReceived

protected void infoReceived(AInfoEvent event)

processResourceRequest

protected void processResourceRequest(ResourceRequestEvent rre)

servicesAreSingle

public boolean servicesAreSingle(ServiceExp prov,
                                 ServiceExp cust)
Check if a pair of serviceExp:s refer to single (i.e., not alternative) declarations

Specified by:
servicesAreSingle in interface IResourceManager

serviceExpRefersToSingle

public boolean serviceExpRefersToSingle(ServiceExp se)
Specified by:
serviceExpRefersToSingle in interface IResourceManager

putEvent

public void putEvent(ResourceRequestEvent event)
Specified by:
putEvent in interface IResourceManager

tryLoadingSoftwareComponent

protected void tryLoadingSoftwareComponent(AbstractResourceAddress smadr,
                                           AbstractResourceAddress wanted)