org.openejb.client
Class StatefulEJBObjectHandler

java.lang.Object
  extended byorg.openejb.client.EJBInvocationHandler
      extended byorg.openejb.client.EJBObjectHandler
          extended byorg.openejb.client.StatefulEJBObjectHandler
All Implemented Interfaces:
net.sf.cglib.proxy.Callback, InvocationHandler, net.sf.cglib.proxy.MethodInterceptor, RequestMethods, ResponseCodes, Serializable

public class StatefulEJBObjectHandler
extends EJBObjectHandler

Since:
11/25/2001
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.openejb.client.EJBObjectHandler
GETEJBHOME, GETHANDLE, GETHANDLER, GETPRIMARYKEY, ISIDENTICAL, registryId, REMOVE
 
Fields inherited from class org.openejb.client.EJBInvocationHandler
ejb, EQUALS, HASHCODE, inProxyMap, isInvalidReference, liveHandleRegistry, primaryKey, request, server, 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
StatefulEJBObjectHandler()
           
StatefulEJBObjectHandler(EJBMetaDataImpl ejb, ServerMetaData server)
           
StatefulEJBObjectHandler(EJBMetaDataImpl ejb, ServerMetaData server, Object primaryKey)
           
 
Method Summary
protected  Object getPrimaryKey(Method method, Object[] args, Object proxy)
          5.8.3 getPrimaryKey()
 Object getRegistryId()
          The Registry id is a logical identifier that is used as a key when placing EjbObjectProxyHanlders into the BaseEjbProxyHanlder's liveHandleRegistry.
protected  Object isIdentical(Method method, Object[] args, Object proxy)
          
protected  Object remove(Method method, Object[] args, Object proxy)
           
 
Methods inherited from class org.openejb.client.EJBObjectHandler
_invoke, businessMethod, createEJBObjectHandler, createEJBObjectProxy, getEJBHome, getHandle, setEJBHomeProxy
 
Methods inherited from class org.openejb.client.EJBInvocationHandler
getMethod, intercept, invalidateAllHandlers, invalidateReference, invoke, print, println, registerHandler, request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatefulEJBObjectHandler

public StatefulEJBObjectHandler()

StatefulEJBObjectHandler

public StatefulEJBObjectHandler(EJBMetaDataImpl ejb,
                                ServerMetaData server)

StatefulEJBObjectHandler

public StatefulEJBObjectHandler(EJBMetaDataImpl ejb,
                                ServerMetaData server,
                                Object primaryKey)
Method Detail

getRegistryId

public Object getRegistryId()
Description copied from class: EJBObjectHandler
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 EJBInvocationHandler.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.

Specified by:
getRegistryId in class EJBObjectHandler

getPrimaryKey

protected Object getPrimaryKey(Method method,
                               Object[] args,
                               Object proxy)
                        throws Throwable
5.8.3 getPrimaryKey()

The object identifier of a session object is, in general, opaque to the client. The result of getPrimaryKey() on a session EJBObject reference results in java.rmi.RemoteException.

Specified by:
getPrimaryKey in class EJBObjectHandler
Parameters:
method -
args -
proxy -
Returns:
Throws:
Throwable

isIdentical

protected Object isIdentical(Method method,
                             Object[] args,
                             Object proxy)
                      throws Throwable

5.8.2 Stateless session beans

All session objects of the same stateless session bean within the same home have the same object identity, which is assigned by the container. If a stateless session bean is deployed multiple times (each deployment results in the creation of a distinct home), session objects from different homes will have a different identity.

The isIdentical(EJBObject otherEJBObject) method always returns true when used to compare object references of two session objects of the same stateless session bean. The following example illustrates the use of the isIdentical method for a stateless session object.

 FooHome fooHome = ...; // obtain home of a stateless session bean
 Foo foo1 = fooHome.create();
 Foo foo2 = fooHome.create();
 if (foo1.isIdentical(foo1)) {// this test returns true
 ...
 }
 if (foo1.isIdentical(foo2)) {// this test returns true
 ...
 }
 

Specified by:
isIdentical in class EJBObjectHandler
Parameters:
method -
args -
proxy -
Returns:
Throws:
Throwable

remove

protected Object remove(Method method,
                        Object[] args,
                        Object proxy)
                 throws Throwable
Specified by:
remove in class EJBObjectHandler
Throws:
Throwable


Copyright © 1999-2005 OpenEJB. All Rights Reserved.