ch.elca.el4j.services.remoting
Class AbstractRemotingProtocol

java.lang.Object
  extended by ch.elca.el4j.services.remoting.AbstractRemotingProtocol
All Implemented Interfaces:
DisposableBean, InitializingBean, ApplicationContextAware
Direct Known Subclasses:
AbstractInetSocketAddressProtocol, LoadBalancingProtocol, RemotingDisabled

public abstract class AbstractRemotingProtocol
extends Object
implements ApplicationContextAware, InitializingBean, DisposableBean

This abstract class defines a base for remote protocols. It contains basically the host name and port number.

Author:
Martin Zeltner (MZE)
File-location:
AbstractRemotingProtocol
Last check-in date:
2010-11-02 11:44:37 +0100 (Di, 02. Nov 2010) by swisswheel for revision 4204

Field Summary
protected  ApplicationContext m_parentApplicationContext
          With this ApplicationContext the current bean has been created.
 
Constructor Summary
AbstractRemotingProtocol()
           
 
Method Summary
 void checkRemotingExporter(RemotingServiceExporter serviceExporter)
          Checks whether the service exporter is configured properly to be used with this protocol.
 void checkRemotingProxy(RemotingProxyFactoryBean proxyFactory)
          Checks whether the proxy factory is configured properly to be used with this protocol.
abstract  Object createExporterBean(RemotingServiceExporter exporterBean, Class serviceInterfaceWithContext, Object serviceProxy)
          Method to create the exporter bean.
abstract  Object createProxyBean(RemotingProxyFactoryBean proxyBean, Class serviceInterfaceWithContext)
          Method to create the proxy bean.
 void destroy()
          Destroys the child app contexts if they are disposable.
 void finalizeExporterDependentBeans(RemotingServiceExporter exporterBean)
          This method will be used to finalize the preinstantiated beans, which depends on the exporter bean.
 Set<ApplicationContext> getChlidApplicationContexts()
           
 ClientContextInvocationHandler getClientContextInvocationHandler(Object innerProxyBean, Class serviceInterfaceWithContext)
          Creates a invocation handler used on the client proxy.
abstract  Class getExporterObjectType()
          Method to get the class type of the exporter object.
 ImplicitContextPassingRegistry getImplicitContextPassingRegistry()
           
 ProtocolSpecificConfiguration getProtocolSpecificConfiguration()
           
 boolean getProtocolSpecificContextPassing()
          Does this protocol handle context passing on its own?
 Class[] getProxyInterface(Class serviceInterface)
          Defines the interface implemented by the Proxy that wraps the enriched service interface.
abstract  Class getProxyObjectType()
          Method to get the class type of the proxy object.
 boolean isDoNotForcePreInstantiationOfExporterObject()
           
 void prepareExporterDependentBeans(RemotingServiceExporter exporterBean)
          This method will be called to preinstantiate beans, which depends on the exporter bean.
protected  boolean registerChildApplicationContext(ApplicationContext applicationContext)
          Registers the given app context as child.
 void setApplicationContext(ApplicationContext applicationContext)
          
 void setDoNotForcePreInstantiationOfExporterObject(boolean doNotForcePreInstantiationOfExporterObject)
          If it is set to true, the exporter object (if singleton), will not be pre-instantiated.
 void setImplicitContextPassingRegistry(ImplicitContextPassingRegistry implicitContextPassingRegistry)
           
 void setProtocolSpecificConfiguration(ProtocolSpecificConfiguration protocolSpecificConfiguration)
           
 void setProtocolSpecificContextPassing(boolean protocolSpecificContextPassing)
          Set if this protocol should handle the context passing on its own.
protected  boolean unregisterChildApplicationContext(ApplicationContext applicationContext)
          Unregisters the given app context as child.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
 

Field Detail

m_parentApplicationContext

protected ApplicationContext m_parentApplicationContext
With this ApplicationContext the current bean has been created.

Constructor Detail

AbstractRemotingProtocol

public AbstractRemotingProtocol()
Method Detail

getProtocolSpecificContextPassing

public boolean getProtocolSpecificContextPassing()
Does this protocol handle context passing on its own?

Returns:
Whether this protocol handles the context

setProtocolSpecificContextPassing

public void setProtocolSpecificContextPassing(boolean protocolSpecificContextPassing)
Set if this protocol should handle the context passing on its own. Enabling this will disable generic context passing, therefore only use this if the protocol handles the context.

Parameters:
protocolSpecificContextPassing - Should the context be handled?

getImplicitContextPassingRegistry

public ImplicitContextPassingRegistry getImplicitContextPassingRegistry()
Returns:
Returns the implicitContextPassingRegistry.

setImplicitContextPassingRegistry

public void setImplicitContextPassingRegistry(ImplicitContextPassingRegistry implicitContextPassingRegistry)
Parameters:
implicitContextPassingRegistry - The implicitContextPassingRegistry to set.

getProtocolSpecificConfiguration

public ProtocolSpecificConfiguration getProtocolSpecificConfiguration()
Returns:
Returns the protocolSpecificConfiguration.

setProtocolSpecificConfiguration

public void setProtocolSpecificConfiguration(ProtocolSpecificConfiguration protocolSpecificConfiguration)
Parameters:
protocolSpecificConfiguration - The protocolSpecificConfiguration to set.

createProxyBean

public abstract Object createProxyBean(RemotingProxyFactoryBean proxyBean,
                                       Class serviceInterfaceWithContext)
Method to create the proxy bean.

Parameters:
proxyBean - Is the bean where the method gets information about the proxy bean.
serviceInterfaceWithContext - Is the modified interface.
Returns:
Returns the created proxy bean.

createExporterBean

public abstract Object createExporterBean(RemotingServiceExporter exporterBean,
                                          Class serviceInterfaceWithContext,
                                          Object serviceProxy)
Method to create the exporter bean.

Parameters:
exporterBean - Is the bean where the method gets information about the exporter bean.
serviceInterfaceWithContext - Is the modified interface.
serviceProxy - Is the bean which has to wrapped.
Returns:
Returns the generated exporter bean.

getProxyObjectType

public abstract Class getProxyObjectType()
Method to get the class type of the proxy object.

Returns:
Returns the class type.

getExporterObjectType

public abstract Class getExporterObjectType()
Method to get the class type of the exporter object.

Returns:
Returns the class type.

prepareExporterDependentBeans

public void prepareExporterDependentBeans(RemotingServiceExporter exporterBean)
This method will be called to preinstantiate beans, which depends on the exporter bean.

Parameters:
exporterBean - Is the reference to the dependent bean.

finalizeExporterDependentBeans

public void finalizeExporterDependentBeans(RemotingServiceExporter exporterBean)
This method will be used to finalize the preinstantiated beans, which depends on the exporter bean.

Parameters:
exporterBean - Is the reference to the dependent bean.

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)

Specified by:
setApplicationContext in interface ApplicationContextAware

getProxyInterface

public Class[] getProxyInterface(Class serviceInterface)
Defines the interface implemented by the Proxy that wraps the enriched service interface. Subclasses can override this method to supply protocol specific interfaces.

Parameters:
serviceInterface - The service interface to wrap.
Returns:
Returns the interfaces implemented by the proxy.

getClientContextInvocationHandler

public ClientContextInvocationHandler getClientContextInvocationHandler(Object innerProxyBean,
                                                                        Class serviceInterfaceWithContext)
Creates a invocation handler used on the client proxy. Subclasses can override this method to supply protocol specific behaviour.

Parameters:
innerProxyBean - The inner proxy to wrap.
serviceInterfaceWithContext - The inner proxy's interface.
Returns:
Returns an invocation handler for the given inner proxy and its interface.

checkRemotingExporter

public void checkRemotingExporter(RemotingServiceExporter serviceExporter)
                           throws Exception
Checks whether the service exporter is configured properly to be used with this protocol. Pre-instantiates the object of the given exporter if it is singleton. This was the default behaviour in SPring 1.2.x. Subclasses may override this behaviour.

Parameters:
serviceExporter - The remoting service exporter that is using this protocol.
Throws:
Exception - Whenever something goes wrong.

checkRemotingProxy

public void checkRemotingProxy(RemotingProxyFactoryBean proxyFactory)
                        throws Exception
Checks whether the proxy factory is configured properly to be used with this protocol. Does nothing by default. Subclasses may override this behaviour.

Parameters:
proxyFactory - The remoting proxy factory that is using this protocol.
Throws:
Exception - Whenever something goes wrong.

destroy

public void destroy()
             throws Exception
Destroys the child app contexts if they are disposable.

Specified by:
destroy in interface DisposableBean
Throws:
Exception

registerChildApplicationContext

protected boolean registerChildApplicationContext(ApplicationContext applicationContext)
Registers the given app context as child.

Parameters:
applicationContext - To register.
Returns:
Returns true if registration was successfully.

unregisterChildApplicationContext

protected boolean unregisterChildApplicationContext(ApplicationContext applicationContext)
Unregisters the given app context as child.

Parameters:
applicationContext - To unregister.
Returns:
Returns true if unregistration was successfully.

getChlidApplicationContexts

public Set<ApplicationContext> getChlidApplicationContexts()
Returns:
Returns the set of the registered child app contexts.

isDoNotForcePreInstantiationOfExporterObject

public boolean isDoNotForcePreInstantiationOfExporterObject()
Returns:
Returns the doNotForcePreInstantiationOfExporterObject.

setDoNotForcePreInstantiationOfExporterObject

public void setDoNotForcePreInstantiationOfExporterObject(boolean doNotForcePreInstantiationOfExporterObject)
If it is set to true, the exporter object (if singleton), will not be pre-instantiated. By default singleton exporter objects will be pre-instantiated.

Parameters:
doNotForcePreInstantiationOfExporterObject - Is the doNotForcePreInstantiationOfExporterObject to set.


Copyright © 2005-2011 ELCA. All Rights Reserved.