com.sdm.quasar.client.core.common.services
Class ServiceNode

java.lang.Object
  extended bycom.sdm.quasar.client.core.common.services.ServiceNode

public class ServiceNode
extends java.lang.Object

Manages the services a node (an ID) offers in the hierarchy. This implementation can be used for any tagging interface of the services.


Constructor Summary
ServiceNode(java.lang.Class taggingInterface)
          Constructor.
 
Method Summary
 java.lang.Object[] getAllServiceImplementations(java.lang.Class service)
          Returns all registered serviceimplementations of this node for the service class given
 java.lang.Class[] getAllServices()
          Returns all service key classes for this ServiceNode.
 java.lang.Object getService(java.lang.Class service, boolean hierachyAccess)
          Returns the implementation for the given service.
 boolean hasService(java.lang.Class service, boolean hierachyAccess)
          Tests whether a service exists
 void registerService(java.lang.Class service, java.lang.Object implementation, int serviceMode)
          Registers a service in this node.
 void unregisterService(java.lang.Class service, java.lang.Object implementation)
          Unregisters a service in this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceNode

public ServiceNode(java.lang.Class taggingInterface)
Constructor.

Parameters:
taggingInterface - the required tagging interface class or null if no tagging interface is required.
Method Detail

registerService

public void registerService(java.lang.Class service,
                            java.lang.Object implementation,
                            int serviceMode)
Registers a service in this node.

Parameters:
service - the service interface class
implementation - the service implementation
serviceMode - the service mode, this implementation should be installed for (one of #FROM_PARENT, #DIRECT or #HIERARCHY).

unregisterService

public void unregisterService(java.lang.Class service,
                              java.lang.Object implementation)
Unregisters a service in this node.

Parameters:
service - the service interface class
implementation - the service implementation

hasService

public boolean hasService(java.lang.Class service,
                          boolean hierachyAccess)
Tests whether a service exists

Parameters:
service - the service interface class
hierachyAccess - if true, the access to the service is done by looking up the hierachy, if false it is an external access
Returns:
true if the service is registered

getService

public java.lang.Object getService(java.lang.Class service,
                                   boolean hierachyAccess)
Returns the implementation for the given service. An assertion will be thrown when the service is not registered.

Parameters:
service - the service interface class
hierachyAccess - if true, the access to the service is done by looking up the hierachy, if false it is an external access
Returns:
the implementation of the service

getAllServices

public java.lang.Class[] getAllServices()
Returns all service key classes for this ServiceNode.


getAllServiceImplementations

public java.lang.Object[] getAllServiceImplementations(java.lang.Class service)
Returns all registered serviceimplementations of this node for the service class given

Parameters:
service - the service class
Returns:
an array with all service-implementations. The index is AbstractServiceManager.FROM_PARENT, AbstractServiceManager.DIRECT and AbstractServiceManager.HIERARCHY