org.objectweb.easybeans.rpc
Class AbsInvocationHandler

java.lang.Object
  extended by org.objectweb.easybeans.rpc.AbsInvocationHandler
All Implemented Interfaces:
java.io.Serializable, java.lang.reflect.InvocationHandler
Direct Known Subclasses:
ClientRPCInvocationHandler, LocalCallInvocationHandler

public abstract class AbsInvocationHandler
extends java.lang.Object
implements java.lang.reflect.InvocationHandler, java.io.Serializable

Abstract class used by remote or local invocation handler.

Author:
Florent Benoit
See Also:
Serialized Form

Field Summary
private  java.lang.Long beanId
          Bean id.
private  java.lang.String containerId
          Container id.
private  java.lang.String factoryName
          Factory name.
private  java.util.Map<java.lang.reflect.Method,java.lang.Long> hashedMethods
          Map between method and its hash.
 
Constructor Summary
AbsInvocationHandler(java.lang.String containerId, java.lang.String factoryName)
          Build a new Invocation handler.
 
Method Summary
protected  java.lang.Long getBeanId()
          Gets the bean id.
protected  java.lang.String getContainerId()
           
protected  java.lang.String getFactoryName()
           
protected  java.util.Map<java.lang.reflect.Method,java.lang.Long> getHashedMethods()
           
protected  java.lang.Object handleObjectMethods(java.lang.reflect.Method method, java.lang.Object[] args)
          Manages all methods of java.lang.Object class.
protected  void setBeanId(java.lang.Long beanId)
          Sets the id of the bean.
protected  void setContainerId(java.lang.String containerId)
          Sets the container ID.
protected  void setFactoryName(java.lang.String factoryName)
          Sets the factory's name.
protected  void setHashedMethods(java.util.Map<java.lang.reflect.Method,java.lang.Long> hashedMethods)
          Sets the hashed methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.reflect.InvocationHandler
invoke
 

Field Detail

containerId

private java.lang.String containerId
Container id.


factoryName

private java.lang.String factoryName
Factory name.


beanId

private java.lang.Long beanId
Bean id.


hashedMethods

private transient java.util.Map<java.lang.reflect.Method,java.lang.Long> hashedMethods
Map between method and its hash.

Constructor Detail

AbsInvocationHandler

public AbsInvocationHandler(java.lang.String containerId,
                            java.lang.String factoryName)
Build a new Invocation handler.

Parameters:
containerId - the id of the container that will be called on the remote side.
factoryName - the name of the remote factory.
Method Detail

handleObjectMethods

protected java.lang.Object handleObjectMethods(java.lang.reflect.Method method,
                                               java.lang.Object[] args)
Manages all methods of java.lang.Object class.

Parameters:
method - the Method instance corresponding to the interface method invoked on the proxy instance. The declaring class of the Method object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.
args - an array of objects containing the values of the arguments passed in the method invocation on the proxy instance
Returns:
the value of the called method.

setBeanId

protected void setBeanId(java.lang.Long beanId)
Sets the id of the bean.

Parameters:
beanId - the new ID.

setHashedMethods

protected void setHashedMethods(java.util.Map<java.lang.reflect.Method,java.lang.Long> hashedMethods)
Sets the hashed methods.

Parameters:
hashedMethods - the hash for each method.

getBeanId

protected java.lang.Long getBeanId()
Gets the bean id.

Returns:
the bean id.

getContainerId

protected java.lang.String getContainerId()
Returns:
the container id.

getFactoryName

protected java.lang.String getFactoryName()
Returns:
the name of the factory.

getHashedMethods

protected java.util.Map<java.lang.reflect.Method,java.lang.Long> getHashedMethods()
Returns:
the hashes for each method.

setContainerId

protected void setContainerId(java.lang.String containerId)
Sets the container ID.

Parameters:
containerId - the identifier of the container.

setFactoryName

protected void setFactoryName(java.lang.String factoryName)
Sets the factory's name.

Parameters:
factoryName - the name of the factory.