|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sdm.quasar.client.core.common.services.AbstractServiceManager
Abstract base class for service managers. This implementation is independent of the possible tagging interface of the services.
| Field Summary | |
protected static int |
DIRECT
|
protected static int |
FROM_PARENT
|
protected static int |
HIERARCHY
|
protected ID |
virtualRootNode
The ID of the root node that is represented by the
#parentServiceProvider. |
| Constructor Summary | |
protected |
AbstractServiceManager(java.lang.Class taggingInterface,
HierarchyProvider hierarchyProvider)
Constructor that initializes this service manager without forwarding to an ServiceManager. |
protected |
AbstractServiceManager(java.lang.Class taggingInterface,
HierarchyProvider hierarchyProvider,
ID virtualRootNode,
ServiceProvider parentServiceProvider)
Constructor that initializes this service manager with a forwarding to an ServiceManager for requests concerning
the given virtual root node. |
| Method Summary | |
void |
dispose()
Disposes the component. |
protected java.lang.Object |
genericFindServiceInHierarchy(ID id,
ID rootID,
java.lang.Class service)
Returns the first implementation of a desired service in the hierarchy starting from the node with the given id to the specified root node. |
protected java.lang.Object[] |
genericGetAllServiceImplementations(ID id,
java.lang.Class service)
|
protected java.lang.Class[] |
genericGetAllServices(ID id)
Returns all service key classes for the specified node. |
protected java.lang.Object |
genericGetServiceDirect(ID id,
java.lang.Class service)
Returns the implementation of a desired service registered at the node with the given id. |
protected boolean |
genericHasServiceDirect(ID id,
java.lang.Class service)
Tests whether a specific node offers a service. |
protected boolean |
genericHasServiceInHierarchy(ID id,
ID rootID,
java.lang.Class service)
Tests whether the service is offered in the hierarchy starting from the node with the given id to the specified root node. |
protected void |
genericRegisterService(ID providerId,
java.lang.Class service,
java.lang.Object implementation,
int serviceMode)
Registers a service for the node with the given id. |
protected void |
genericUnregisterService(ID providerId,
java.lang.Class service,
java.lang.Object implementation)
Unregisters a service for a given node. |
protected boolean |
hasID(ID id)
Tests whether the given ID represents a known node in the hierarchy that
is used by this service manager. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int FROM_PARENT
protected static final int DIRECT
protected static final int HIERARCHY
protected ID virtualRootNode
ID of the root node that is represented by the
#parentServiceProvider. This value may be null.
If it is not null, then all find/get-requests to that node are forwarded to that node and all register-requests to that node are blocked as illegal. If it is null, there are no restrictions placed on the registration of services and no forward is used.
| Constructor Detail |
protected AbstractServiceManager(java.lang.Class taggingInterface,
HierarchyProvider hierarchyProvider)
ServiceManager.
taggingInterface - the required tagging interface class
or null if no tagging interface is required.hierarchyProvider - the HierarchyProvider that governs the hierarchy
that is used to organize the services.
protected AbstractServiceManager(java.lang.Class taggingInterface,
HierarchyProvider hierarchyProvider,
ID virtualRootNode,
ServiceProvider parentServiceProvider)
ServiceManager for requests concerning
the given virtual root node. See virtualRootNode for more information.
taggingInterface - the required tagging interface class
or null if no tagging interface is required.hierarchyProvider - the HierarchyProvider that governs the hierarchy
that is used to organize the services.virtualRootNode - the id of the virtual root nodeparentServiceProvider - the ServiceManager
to which requests concerning the virtual root node are forwarded.| Method Detail |
protected void genericRegisterService(ID providerId,
java.lang.Class service,
java.lang.Object implementation,
int serviceMode)
#taggingInterface, and the
implementation implement that interface.
If there is already an implementation registered for that service, that implementation is replaced by the passed as a parameter.
Please note that a a registered service should be unregistered when the life cycle of the provider ends.
providerId - the id of the node where the service should be registeredservice - the interface that defines the serviceimplementation - the implementation of the serviceserviceMode - the service mode, this implementation should be installed for
(one of FROM_PARENT, DIRECT or HIERARCHY).
java.lang.IllegalArgumentException - if the providerId is unknown,
service is not an interface or does not extend
#taggingInterface, or the implementation does not
implement the interface that defines the service.protected boolean hasID(ID id)
ID represents a known node in the hierarchy that
is used by this service manager.
id - the ID to be tested
ID represents a known node within the hierarchy
protected void genericUnregisterService(ID providerId,
java.lang.Class service,
java.lang.Object implementation)
If the service is not registered for the given node or the given implementation is not the one that is registered, nothing happens.
Therefore, if a service implementation is replaced by another implementation, the unregistering of the first implementation is harmless since the second implementation will stay registered. However, if the second implementation is unregistered first, then no service will be available, even though the first service implementation hasn't been unregistered yet.
providerId - the id of the node where the service should be unregisteredservice - the interface that defines the serviceimplementation - the registered implementation of the service
java.lang.IllegalArgumentException - if the providerId is unknown,
service is not an interface or does not extend #taggingInterface, or the
implementation does not implement the interface that defines the service.
protected boolean genericHasServiceInHierarchy(ID id,
ID rootID,
java.lang.Class service)
id - the id of the node at which the search starts towards the root noderootID - the root id where to stop looking for a parent provider (may
be null or not contained in id's hierarchy tree, which will be
threated at the root of the current hierarchy tree)service - the class of the service interface that is searched for
java.lang.IllegalArgumentException - if the id is unknown or if the
service class is not an interface that extends Service.
protected java.lang.Object genericFindServiceInHierarchy(ID id,
ID rootID,
java.lang.Class service)
id - the id of the node at which the search starts towards the root noderootID - the root id where to stop looking for a parent provider (may
be null or not contained in id's hierarchy tree, which will be
threated at the root of the current hierarchy tree)service - the class of the service interface that is searched for
java.lang.IllegalArgumentException - if the id is unknown, if the
service class is not an interface that extends Service, or if
the service is not available.
protected boolean genericHasServiceDirect(ID id,
java.lang.Class service)
id - the id of the nodeservice - the class of the service interface that is searched for
java.lang.IllegalArgumentException - if the id is unknown or if the
service class is not an interface that extends #taggingInterface.
protected java.lang.Object genericGetServiceDirect(ID id,
java.lang.Class service)
id - the id of the nodeservice - the class of the service interface that is requested
java.lang.IllegalArgumentException - if the id is unknown, if the
service class is not an interface that extends #taggingInterface, or if
the service is not available at the given nodeprotected java.lang.Class[] genericGetAllServices(ID id)
id - the id of the node
protected java.lang.Object[] genericGetAllServiceImplementations(ID id,
java.lang.Class service)
public void dispose()
throws DisposeException
Disposable
Important:
This method is called by an administrating component
and must never be called directly.
The implementation should release any resources or objects allocated and
any services registered. Furthermore, this method should be developed
carefully to free a maximum of resources even when the system may
have become unstable. In case of one or multiple errors, you should collect
them in a DisposeException, continue with the execution,
and throw it at the end of the method.
Note: The implementation must not return before the component is disposed. Any threads or asynchronous calls started must be completed before this method returns.
dispose in interface DisposableDisposeException - if there was one or more errors while
disposing the component.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||