net.sf.crispy.impl.rmi
Class RmiInvocationHandlerImpl

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended bynet.sf.crispy.impl.rmi.RmiInvocationHandlerImpl
All Implemented Interfaces:
java.rmi.Remote, RmiInvocationHandler, java.io.Serializable, ServiceEndpoint, SingleServiceContainer

public class RmiInvocationHandlerImpl
extends java.rmi.server.UnicastRemoteObject
implements RmiInvocationHandler, ServiceEndpoint, SingleServiceContainer

This is the central Invocation Handler for all client calls. You must register the service. The invoke methode make the call per reflection API.

Author:
Linke
See Also:
Serialized Form

Field Summary
protected static org.apache.commons.logging.Log log
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RmiInvocationHandlerImpl()
           
 
Method Summary
 void addService(java.lang.String pvServiceInterfaceName, java.lang.Object pvServiceImpl)
          Add service implementation.
 void addService(java.lang.String pvServiceInterfaceName, java.lang.String pvServiceImplName)
          Create a instance from the service impl class name.
 InterceptorHandler createNewInterceptorHandlerInstance()
          Hint:Every call from this method must get a new instance from InterceptorHandler!
 java.lang.Object doInvoke(java.lang.Object pvServiceImpl, java.lang.reflect.Method pvMethod, java.lang.Object[] pvArgs, InterceptorHandler pvInterceptorHandler)
          Execute the service with the InvocationHandler with delegate to doInvoke.
 InterceptorHandlerCreator getInterceptorHandlerCreator()
          Get a implementation for the interface InterceptorHandlerCreator.
 java.lang.Object getService(java.lang.String pvServiceInterfaceName)
          Find the service impl.
 int getServiceSize()
          Size of services in the container.
 java.lang.Object invoke(java.lang.String pvClassName, java.lang.String pvMethodName, java.util.Vector pvParams)
           
 void removeService(java.lang.String pvServiceInterfaceName)
          Remove the service from the container.
 void setInterceptorHandlerCreator(InterceptorHandlerCreator pvCreator)
          Set a implementation for the interface InterceptorHandlerCreator.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
Constructor Detail

RmiInvocationHandlerImpl

public RmiInvocationHandlerImpl()
                         throws java.rmi.RemoteException
Method Detail

invoke

public java.lang.Object invoke(java.lang.String pvClassName,
                               java.lang.String pvMethodName,
                               java.util.Vector pvParams)
                        throws java.rmi.RemoteException,
                               java.lang.Exception
Specified by:
invoke in interface RmiInvocationHandler
Throws:
java.rmi.RemoteException
java.lang.Exception
See Also:
RmiInvocationHandler.invoke(java.lang.String, java.lang.String, java.util.Vector)

addService

public void addService(java.lang.String pvServiceInterfaceName,
                       java.lang.Object pvServiceImpl)
Description copied from interface: SingleServiceContainer
Add service implementation.

Specified by:
addService in interface SingleServiceContainer
Parameters:
pvServiceInterfaceName - Is the key in a map.
pvServiceImpl - Is the value in a map.

addService

public void addService(java.lang.String pvServiceInterfaceName,
                       java.lang.String pvServiceImplName)
Description copied from interface: SingleServiceContainer
Create a instance from the service impl class name.

Specified by:
addService in interface SingleServiceContainer
Parameters:
pvServiceInterfaceName - Is the key in a map.
pvServiceImplName - Is the class name from the service impl.

removeService

public void removeService(java.lang.String pvServiceInterfaceName)
Description copied from interface: SingleServiceContainer
Remove the service from the container.

Specified by:
removeService in interface SingleServiceContainer
Parameters:
pvServiceInterfaceName - Is the key in a map.

getService

public java.lang.Object getService(java.lang.String pvServiceInterfaceName)
Description copied from interface: SingleServiceContainer
Find the service impl.

Specified by:
getService in interface SingleServiceContainer
Parameters:
pvServiceInterfaceName - Is the key in a map.
Returns:
The service impl or null.

getServiceSize

public int getServiceSize()
Description copied from interface: SingleServiceContainer
Size of services in the container.

Specified by:
getServiceSize in interface SingleServiceContainer
Returns:
Size of services.

doInvoke

public java.lang.Object doInvoke(java.lang.Object pvServiceImpl,
                                 java.lang.reflect.Method pvMethod,
                                 java.lang.Object[] pvArgs,
                                 InterceptorHandler pvInterceptorHandler)
Description copied from interface: ServiceEndpoint
Execute the service with the InvocationHandler with delegate to doInvoke. If parameter InterceptorHandler is null, then is calling the method createNewInterceptorHandlerInstance, else is using the parameter InterceptorHandler.

Specified by:
doInvoke in interface ServiceEndpoint
Parameters:
pvServiceImpl -
pvMethod -
pvArgs -
pvInterceptorHandler -
Returns:
The result from the method execution.

setInterceptorHandlerCreator

public void setInterceptorHandlerCreator(InterceptorHandlerCreator pvCreator)
Description copied from interface: ServiceEndpoint
Set a implementation for the interface InterceptorHandlerCreator. It is equally with the method createNewInterceptorHandlerInstance.

Specified by:
setInterceptorHandlerCreator in interface ServiceEndpoint
Parameters:
pvCreator -

getInterceptorHandlerCreator

public InterceptorHandlerCreator getInterceptorHandlerCreator()
Description copied from interface: ServiceEndpoint
Get a implementation for the interface InterceptorHandlerCreator.

Specified by:
getInterceptorHandlerCreator in interface ServiceEndpoint
Returns:
The InterceptorHandlerCreator implementation.

createNewInterceptorHandlerInstance

public InterceptorHandler createNewInterceptorHandlerInstance()
Description copied from interface: ServiceEndpoint
Hint:Every call from this method must get a new instance from InterceptorHandler!

Specified by:
createNewInterceptorHandlerInstance in interface ServiceEndpoint
Returns:
The desired implementation with registered interceptors.


Copyright © 2005-2006 Crispy. All Rights Reserved.