org.openejb.core.ivm
Class EjbObjectProxyHandler
java.lang.Object
org.openejb.core.ivm.BaseEjbProxyHandler
org.openejb.core.ivm.EjbObjectProxyHandler
- All Implemented Interfaces:
- 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
|
Method Summary |
Object |
_invoke(Object p,
Method m,
Object[] a)
Overridden by subclasses and called by BaseEjbProxyHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) . |
protected Object |
_writeReplace(Object proxy)
The writeReplace method is invoked on the proxy when it enters the
serialization process. |
protected Object |
businessMethod(Method method,
Object[] args,
Object proxy)
|
protected Object |
getEJBHome(Method method,
Object[] args,
Object proxy)
|
protected Object |
getHandle(Method method,
Object[] args,
Object proxy)
|
protected abstract Object |
getPrimaryKey(Method method,
Object[] args,
Object proxy)
|
ProxyInfo |
getProxyInfo()
|
abstract 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 Object |
isIdentical(Method method,
Object[] args,
Object proxy)
|
protected abstract Object |
remove(Method method,
Object[] args,
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 |
logger
protected static final org.apache.log4j.Category logger
EjbObjectProxyHandler
public EjbObjectProxyHandler(RpcContainer container,
Object pk,
Object depID)
getRegistryId
public abstract 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 Object _invoke(Object p,
Method m,
Object[] a)
throws 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:
Throwable
getEJBHome
protected Object getEJBHome(Method method,
Object[] args,
Object proxy)
throws Throwable
- Throws:
Throwable
getHandle
protected Object getHandle(Method method,
Object[] args,
Object proxy)
throws Throwable
- Throws:
Throwable
getProxyInfo
public ProxyInfo getProxyInfo()
- Specified by:
getProxyInfo
in class BaseEjbProxyHandler
_writeReplace
protected Object _writeReplace(Object proxy)
throws 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:
ObjectStreamException
getPrimaryKey
protected abstract Object getPrimaryKey(Method method,
Object[] args,
Object proxy)
throws Throwable
- Throws:
Throwable
isIdentical
protected abstract Object isIdentical(Method method,
Object[] args,
Object proxy)
throws Throwable
- Throws:
Throwable
remove
protected abstract Object remove(Method method,
Object[] args,
Object proxy)
throws Throwable
- Throws:
Throwable
businessMethod
protected Object businessMethod(Method method,
Object[] args,
Object proxy)
throws Throwable
- Throws:
Throwable
Copyright © 1999-2012 OpenEJB. All Rights Reserved.