org.openejb.core.ivm
Class EjbObjectProxyHandler

java.lang.Object
  extended by org.openejb.core.ivm.BaseEjbProxyHandler
      extended by org.openejb.core.ivm.EjbObjectProxyHandler
All Implemented Interfaces:
java.io.Serializable, InvocationHandler
Direct Known Subclasses:
EntityEjbObjectHandler, StatefulEjbObjectHandler, StatelessEjbObjectHandler

public abstract class EjbObjectProxyHandler
extends BaseEjbProxyHandler

This InvocationHandler and its proxy are serializable and can be used by HomeHandle, Handle, and MetaData to persist and revive handles. It maintains its original client identity which allows the container to be more discerning about allowing the revieed proxy to be used. See StatefulContaer manager for more details.

Author:
David Blevins, Richard Monson-Haefel
See Also:
Serialized Form

Field Summary
protected static org.apache.log4j.Category logger
           
 
Fields inherited from class org.openejb.core.ivm.BaseEjbProxyHandler
container, deploymentID, deploymentInfo, doIntraVmCopy, inProxyMap, isInvalidReference, liveHandleRegistry, primaryKey
 
Constructor Summary
EjbObjectProxyHandler(RpcContainer container, java.lang.Object pk, java.lang.Object depID)
           
 
Method Summary
 java.lang.Object _invoke(java.lang.Object p, java.lang.reflect.Method m, java.lang.Object[] a)
          Overridden by subclasses and called by BaseEjbProxyHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]).
protected  java.lang.Object _writeReplace(java.lang.Object proxy)
          The writeReplace method is invoked on the proxy when it enters the serialization process.
protected  java.lang.Object businessMethod(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           
protected  java.lang.Object getEJBHome(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           
protected  java.lang.Object getHandle(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           
protected abstract  java.lang.Object getPrimaryKey(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           
 ProxyInfo getProxyInfo()
           
abstract  java.lang.Object getRegistryId()
          The Registry id is a logical identifier that is used as a key when placing EjbObjectProxyHanlders into the BaseEjbProxyHanlder's liveHandleRegistry.
protected abstract  java.lang.Object isIdentical(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           
protected abstract  java.lang.Object remove(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           
 
Methods inherited from class org.openejb.core.ivm.BaseEjbProxyHandler
checkAuthorization, copyArgs, copyObj, equals, getThreadSpecificSecurityIdentity, hashCode, invalidateAllHandlers, invalidateReference, invoke, isLocal, registerHandler, setIntraVmCopyMode, setLocal, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Category logger
Constructor Detail

EjbObjectProxyHandler

public EjbObjectProxyHandler(RpcContainer container,
                             java.lang.Object pk,
                             java.lang.Object depID)
Method Detail

getRegistryId

public abstract java.lang.Object getRegistryId()
The Registry id is a logical identifier that is used as a key when placing EjbObjectProxyHanlders into the BaseEjbProxyHanlder's liveHandleRegistry. EjbObjectProxyHanlders that represent the same bean identity (keyed by the registry id) will be stored together so that they can be removed together when the BaseEjbProxyHandler.invalidateAllHandlers is invoked. This method is implemented by the subclasses to return an id that logically identifies bean identity for a specific deployment id and container. For example, the EntityEjbObjectHandler overrides this method to return a compound key composed of the bean's primary key, deployment id, and container id. This uniquely identifies the bean identity that is proxied by this handler. Another example is the StatefulEjbObjectHanlder which overrides this method to return the stateful bean's hidden primary key, which is a java.rmi.dgc.VMID.


_invoke

public java.lang.Object _invoke(java.lang.Object p,
                                java.lang.reflect.Method m,
                                java.lang.Object[] a)
                         throws java.lang.Throwable
Description copied from class: BaseEjbProxyHandler
Overridden by subclasses and called by BaseEjbProxyHandler.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.

Specified by:
_invoke in class BaseEjbProxyHandler
Parameters:
p - The Proxy subclass that is the bean's EJBObject or EJBHome.
m - The bean method that the caller is attempting to invoke.
a - The arguments to the method being invoked.
Returns:
The result of invoking the appropriate method on the bean instance.
Throws:
java.lang.Throwable

getEJBHome

protected java.lang.Object getEJBHome(java.lang.reflect.Method method,
                                      java.lang.Object[] args,
                                      java.lang.Object proxy)
                               throws java.lang.Throwable
Throws:
java.lang.Throwable

getHandle

protected java.lang.Object getHandle(java.lang.reflect.Method method,
                                     java.lang.Object[] args,
                                     java.lang.Object proxy)
                              throws java.lang.Throwable
Throws:
java.lang.Throwable

getProxyInfo

public ProxyInfo getProxyInfo()
Specified by:
getProxyInfo in class BaseEjbProxyHandler

_writeReplace

protected java.lang.Object _writeReplace(java.lang.Object proxy)
                                  throws java.io.ObjectStreamException
The writeReplace method is invoked on the proxy when it enters the serialization process. The call is passed to the handler, then delegated to this method. If the proxy is being copied between bean instances in a RPC call we use the IntraVmArtifact. This object is immutable and does not need to be dereferenced; therefore, we have no need to actually serialize this object. If the proxy is referenced by a stateful bean that is being passivated by the container we allow this object to be serialized. If the proxy is being serialized in any other context, we know that its destination is outside the core container system. This is the responsibility of the Application Server and one of its proxies is serialized to the stream in place of the IntraVmProxy.

Specified by:
_writeReplace in class BaseEjbProxyHandler
Parameters:
proxy -
Returns:
Object
Throws:
java.io.ObjectStreamException

getPrimaryKey

protected abstract java.lang.Object getPrimaryKey(java.lang.reflect.Method method,
                                                  java.lang.Object[] args,
                                                  java.lang.Object proxy)
                                           throws java.lang.Throwable
Throws:
java.lang.Throwable

isIdentical

protected abstract java.lang.Object isIdentical(java.lang.reflect.Method method,
                                                java.lang.Object[] args,
                                                java.lang.Object proxy)
                                         throws java.lang.Throwable
Throws:
java.lang.Throwable

remove

protected abstract java.lang.Object remove(java.lang.reflect.Method method,
                                           java.lang.Object[] args,
                                           java.lang.Object proxy)
                                    throws java.lang.Throwable
Throws:
java.lang.Throwable

businessMethod

protected java.lang.Object businessMethod(java.lang.reflect.Method method,
                                          java.lang.Object[] args,
                                          java.lang.Object proxy)
                                   throws java.lang.Throwable
Throws:
java.lang.Throwable


Copyright © 1999-2011 OpenEJB. All Rights Reserved.