org.openejb.client
Class EJBInvocationHandler

java.lang.Object
  extended by org.openejb.client.EJBInvocationHandler
All Implemented Interfaces:
java.io.Serializable, InvocationHandler, RequestMethods, ResponseCodes
Direct Known Subclasses:
EJBHomeHandler, EJBObjectHandler

public abstract class EJBInvocationHandler
extends java.lang.Object
implements InvocationHandler, java.io.Serializable, ResponseCodes, RequestMethods

TODO: Add comments

Author:
David Blevins
See Also:
Serialized Form

Field Summary
protected  ClientMetaData client
          The ClientMetaData object containing the information aquired from the server after authenticating.
protected  EJBMetaDataImpl ejb
          The EJBMetaDataImpl object of the bean deployment that this invocation handler represents.
protected static java.lang.reflect.Method EQUALS
           
protected static java.lang.reflect.Method HASHCODE
           
protected  boolean inProxyMap
          TODO: Add comments
protected  boolean isInvalidReference
          TODO: Add comments
protected static java.util.Hashtable liveHandleRegistry
          Keeps track of live EJBInvocationHandler in this VM.
protected  java.lang.Object primaryKey
          The primary key of the bean deployment or null if the deployment is a bean type that doesn't require a primary key
protected  EJBRequest request
          TODO: Add comments
protected  ServerMetaData server
          The ServerMetaData object containing the information needed to send invokations to the EJB Server.
protected static java.lang.reflect.Method TOSTRING
           
 
Fields inherited from interface org.openejb.client.ResponseCodes
AUTH_DENIED, AUTH_GRANTED, AUTH_REDIRECT, EJB_APP_EXCEPTION, EJB_ERROR, EJB_OK, EJB_OK_CREATE, EJB_OK_FOUND, EJB_OK_FOUND_COLLECTION, EJB_OK_FOUND_ENUMERATION, EJB_OK_NOT_FOUND, EJB_SYS_EXCEPTION, JNDI_CONTEXT, JNDI_EJBHOME, JNDI_ENUMERATION, JNDI_ERROR, JNDI_NAMING_EXCEPTION, JNDI_NOT_FOUND, JNDI_OK, JNDI_RUNTIME_EXCEPTION
 
Fields inherited from interface org.openejb.client.RequestMethods
AUTH_REQUEST, EJB_HOME_CREATE, EJB_HOME_FIND, EJB_HOME_GET_EJB_META_DATA, EJB_HOME_GET_HOME_HANDLE, EJB_HOME_REMOVE_BY_HANDLE, EJB_HOME_REMOVE_BY_PKEY, EJB_OBJECT_BUSINESS_METHOD, EJB_OBJECT_GET_EJB_HOME, EJB_OBJECT_GET_HANDLE, EJB_OBJECT_GET_PRIMARY_KEY, EJB_OBJECT_IS_IDENTICAL, EJB_OBJECT_REMOVE, EJB_REQUEST, JNDI_LIST, JNDI_LIST_BINDINGS, JNDI_LOOKUP, JNDI_REQUEST, STOP_REQUEST_quit, STOP_REQUEST_Quit, STOP_REQUEST_stop, STOP_REQUEST_Stop
 
Constructor Summary
EJBInvocationHandler()
          TODO: Add comments
EJBInvocationHandler(EJBMetaDataImpl ejb, ServerMetaData server, ClientMetaData client)
           
EJBInvocationHandler(EJBMetaDataImpl ejb, ServerMetaData server, ClientMetaData client, java.lang.Object primaryKey)
           
 
Method Summary
protected abstract  java.lang.Object _invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Overridden by subclasses and called by invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]).
protected static java.lang.reflect.Method getMethod(java.lang.Class c, java.lang.String method, java.lang.Class[] params)
           
protected static void invalidateAllHandlers(java.lang.Object key)
          TODO: Add comments
protected  void invalidateReference()
          Invalidates this reference so that it can not be used as a proxy for the bean identity.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          TODO: Add comments
static void print(java.lang.String s)
           
static void println(java.lang.String s)
           
protected static void registerHandler(java.lang.Object key, EJBInvocationHandler handler)
          TODO: Add comments
protected  EJBResponse request(EJBRequest req)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EQUALS

protected static final java.lang.reflect.Method EQUALS

HASHCODE

protected static final java.lang.reflect.Method HASHCODE

TOSTRING

protected static final java.lang.reflect.Method TOSTRING

liveHandleRegistry

protected static final java.util.Hashtable liveHandleRegistry
Keeps track of live EJBInvocationHandler in this VM. So that related handlers can be removed if necessary. Currently this registry is only used to track live EJBInvocationHandlers. The EJBObjectHandlers are tracked to allow remove() operations and invalidate exceptions to be propagated to the proper handler instances. There are several scenarios where this is useful:

inProxyMap

protected transient boolean inProxyMap
TODO: Add comments


isInvalidReference

protected transient boolean isInvalidReference
TODO: Add comments


request

protected transient EJBRequest request
TODO: Add comments


ejb

protected transient EJBMetaDataImpl ejb
The EJBMetaDataImpl object of the bean deployment that this invocation handler represents.


server

protected transient ServerMetaData server
The ServerMetaData object containing the information needed to send invokations to the EJB Server.


client

protected transient ClientMetaData client
The ClientMetaData object containing the information aquired from the server after authenticating.


primaryKey

protected transient java.lang.Object primaryKey
The primary key of the bean deployment or null if the deployment is a bean type that doesn't require a primary key

Constructor Detail

EJBInvocationHandler

public EJBInvocationHandler()
TODO: Add comments


EJBInvocationHandler

public EJBInvocationHandler(EJBMetaDataImpl ejb,
                            ServerMetaData server,
                            ClientMetaData client)

EJBInvocationHandler

public EJBInvocationHandler(EJBMetaDataImpl ejb,
                            ServerMetaData server,
                            ClientMetaData client,
                            java.lang.Object primaryKey)
Method Detail

getMethod

protected static java.lang.reflect.Method getMethod(java.lang.Class c,
                                                    java.lang.String method,
                                                    java.lang.Class[] params)

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
TODO: Add comments

Specified by:
invoke in interface InvocationHandler
Parameters:
proxy - The Proxy object that represents this bean deployment's EJBObject or EJBHome.
method - The EJBHome or EJBObject method the caller is invoking.
args - The parameters to the mehtod being invoked
Returns:
The result of invoking the appropriate method on the bean instance.
Throws:
java.lang.Throwable

_invoke

protected abstract java.lang.Object _invoke(java.lang.Object proxy,
                                            java.lang.reflect.Method method,
                                            java.lang.Object[] args)
                                     throws java.lang.Throwable
Overridden by subclasses and called by invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]). Subclasses implement the main behavior of calling invoke on the Container that the bean deployment lives in.

Parameters:
proxy - The Proxy subclass that is the bean's EJBObject or EJBHome.
method - The bean method that the caller is attempting to invoke.
args - The arguments to the method being invoked.
Returns:
The result of invoking the appropriate method on the bean instance.
Throws:
java.lang.Throwable

print

public static void print(java.lang.String s)

println

public static void println(java.lang.String s)

request

protected EJBResponse request(EJBRequest req)
                       throws java.lang.Exception
Throws:
java.lang.Exception

invalidateReference

protected void invalidateReference()
Invalidates this reference so that it can not be used as a proxy for the bean identity. This method may be called when an InvalidateReferenceException is thrown by the container or when the bean identity associated with this proxy is explicitly removed, by calling one of the remove( ) methods.


invalidateAllHandlers

protected static void invalidateAllHandlers(java.lang.Object key)
TODO: Add comments

Parameters:
key -

registerHandler

protected static void registerHandler(java.lang.Object key,
                                      EJBInvocationHandler handler)
TODO: Add comments

Parameters:
key -
handler -


Copyright © 1999-2011 OpenEJB. All Rights Reserved.