com.sdm.quasar.client.core.server.impl.plugins
Class ComponentServerProxyPlugin

java.lang.Object
  extended bycom.sdm.quasar.client.core.server.impl.plugins.ComponentServerProxyPlugin
All Implemented Interfaces:
ServerProxyPlugin

public class ComponentServerProxyPlugin
extends java.lang.Object
implements ServerProxyPlugin

A ServerProxyPlugin, that controls the lifecycle of components on access to services, that are provided by these components. No component model is defined here - this plugin just controls the lifecycle of a component by calling the ComponentDefinition.createComponent(Object) method, whenever a compoent must be created and intialized in order to register the real service implementations. The service implementations also will not be managed by this plugin; this can be done by other plugins.

Version:
1.$Revision$
Author:
Thomas Wolf

Nested Class Summary
 
Nested classes inherited from class com.sdm.quasar.client.core.server.impl.ServerProxyPlugin
ServerProxyPlugin.ServerProxyPluginCallback
 
Constructor Summary
ComponentServerProxyPlugin()
          Creates a new ComponentServerProxyPlugin.
 
Method Summary
 ComponentDefinition getComponentDefinition(java.lang.Object componentId)
          Returns ComponentDefinition, for the component with the given component-id.
 java.lang.Object getComponentId4Service(java.lang.Class serviceClass)
          Returns the registered component id for the service class given, if a service- component-mapping is defined for that service.
 boolean hasServerService(java.lang.Class service, ServerProxyPlugin.ServerProxyPluginCallback serverProxyPluginCallback)
          Tests, whether a service is registered with the service manager.
 boolean isComponentCreated(java.lang.Object componentId)
          Returns true, if the component with the given component id is created, returns false otherwise.
 java.lang.Object processServerServiceCall(java.lang.Class serverInterface, java.lang.reflect.Method method, java.lang.Object[] args, ServerProxyPlugin.ServerProxyPluginCallback serverProxyPluginCallback)
           
 void registerComponent(java.lang.Object componentId, ComponentDefinition componentDefinition)
          Registers a ComponentDefinition for a component-id.
 void registerService(java.lang.String serviceClassName, java.lang.Object componentId)
          Registers a service to be provided by an component with the given id.
 void registerServicesAndComponentsWithReader(ComponentDefinitionReader componentDefinitionReader)
          Adds component and service definitions using the ComponentDefinitionReader to this ComponentServerProxyPlugin.
 void unregisterComponent(java.lang.Object componentId)
          Unregisters a previously registered ComponentDefinition for the component-id given.
 void unregisterService(java.lang.String serviceClassName)
          Unregisters a service to component mapping previously created via registerService(String, Object).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentServerProxyPlugin

public ComponentServerProxyPlugin()
Creates a new ComponentServerProxyPlugin.

Method Detail

registerService

public void registerService(java.lang.String serviceClassName,
                            java.lang.Object componentId)
Registers a service to be provided by an component with the given id.

Parameters:
serviceClassName - the service name (full qualified class name of the interface, not null)
componentId - the component id (not null)

unregisterService

public void unregisterService(java.lang.String serviceClassName)
Unregisters a service to component mapping previously created via registerService(String, Object).

Parameters:
serviceClassName - the service name (full qualified class name of the interface, not null)

getComponentId4Service

public java.lang.Object getComponentId4Service(java.lang.Class serviceClass)
Returns the registered component id for the service class given, if a service- component-mapping is defined for that service.

Parameters:
serviceClass - the service class to look for an component id
Returns:
the component id for that service or null, if no service- component mapping is defined for that service class

registerComponent

public void registerComponent(java.lang.Object componentId,
                              ComponentDefinition componentDefinition)
Registers a ComponentDefinition for a component-id. The ComponentDefinition will be created, when the first service-access is done.

Parameters:
componentId - the component-id (not null)
componentDefinition - the ComponentDefinition (not null)

unregisterComponent

public void unregisterComponent(java.lang.Object componentId)
Unregisters a previously registered ComponentDefinition for the component-id given. The ComponentDefinition is destroyed at this time.

Parameters:
componentId - the component-id (not null)

registerServicesAndComponentsWithReader

public void registerServicesAndComponentsWithReader(ComponentDefinitionReader componentDefinitionReader)
                                             throws java.io.IOException
Adds component and service definitions using the ComponentDefinitionReader to this ComponentServerProxyPlugin.

Parameters:
componentDefinitionReader - the ComponentDefinitionReader to be used for reading the component and service definitions (not null)
Throws:
java.io.IOException - if an exception occurs while reading the definitions.

isComponentCreated

public boolean isComponentCreated(java.lang.Object componentId)
Returns true, if the component with the given component id is created, returns false otherwise.

Parameters:
componentId - the component-id (not null)
Throws:
java.lang.IllegalArgumentException - if the component-id is unknown (see registerComponent(Object, ComponentDefinition))

getComponentDefinition

public ComponentDefinition getComponentDefinition(java.lang.Object componentId)
Returns ComponentDefinition, for the component with the given component-id.

Parameters:
componentId - the component-id (not null)
Returns:
the ComponentDefinition for the component-id
Throws:
java.lang.IllegalArgumentException - if the component-id is unknown (see registerComponent(Object, ComponentDefinition))

hasServerService

public boolean hasServerService(java.lang.Class service,
                                ServerProxyPlugin.ServerProxyPluginCallback serverProxyPluginCallback)
Description copied from interface: ServerProxyPlugin
Tests, whether a service is registered with the service manager.

Specified by:
hasServerService in interface ServerProxyPlugin
Parameters:
service - the interface that defines the service
Returns:
true, iff an implementation is registered for the given service.
See Also:
ServerProxyPlugin.hasServerService(java.lang.Class, com.sdm.quasar.client.core.server.impl.ServerProxyPlugin.ServerProxyPluginCallback)

processServerServiceCall

public java.lang.Object processServerServiceCall(java.lang.Class serverInterface,
                                                 java.lang.reflect.Method method,
                                                 java.lang.Object[] args,
                                                 ServerProxyPlugin.ServerProxyPluginCallback serverProxyPluginCallback)
                                          throws java.lang.Throwable
Specified by:
processServerServiceCall in interface ServerProxyPlugin
Parameters:
serverInterface -
method -
args -
serverProxyPluginCallback - a ServerProxyPlugin.ServerProxyPluginCallback to access the subsequent ServerProxyPlugins without knowing them
Returns:
Throws:
java.lang.Throwable
See Also:
ServerProxyPlugin.processServerServiceCall(java.lang.Class, java.lang.reflect.Method, java.lang.Object[], com.sdm.quasar.client.core.server.impl.ServerProxyPlugin.ServerProxyPluginCallback)