org.openejb.client
Class EJBHomeHandler

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

public abstract class EJBHomeHandler
extends EJBInvocationHandler
implements java.io.Externalizable

Handles invocations from an EJBHomeProxy.

Author:
David Blevins
See Also:
Serialized Form

Field Summary
protected static java.lang.reflect.Method GETEJBMETADATA
           
protected static java.lang.reflect.Method GETHANDLER
           
protected static java.lang.reflect.Method GETHOMEHANDLE
           
protected static java.lang.reflect.Method REMOVE_W_HAND
           
protected static java.lang.reflect.Method REMOVE_W_KEY
           
 
Fields inherited from class org.openejb.client.EJBInvocationHandler
client, 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
EJBHomeHandler()
          Constructs an EJBHomeHandler to handle invocations from an EJBHomeProxy.
EJBHomeHandler(EJBMetaDataImpl ejb, ServerMetaData server, ClientMetaData client)
           
 
Method Summary
protected  java.lang.Object _invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Overridden by subclasses and called by EJBInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]).
protected  java.lang.Object create(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           Creates a new EJBObject and returns it to the caller.
static EJBHomeHandler createEJBHomeHandler(EJBMetaDataImpl ejb, ServerMetaData server, ClientMetaData client)
           
 EJBHomeProxy createEJBHomeProxy()
           
protected abstract  java.lang.Object findX(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           Locates and returns a new EJBObject or a collection of EJBObjects.
protected  java.lang.Object getEJBMetaData(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           Returns an EJBMetaData implementation that is valid inside this virtual machine.
protected  java.lang.Object getHomeHandle(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           Returns a HomeHandle implementation that is valid inside this virtual machine.
 void readExternal(java.io.ObjectInput in)
          The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
protected abstract  java.lang.Object removeByPrimaryKey(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           Attempts to remove an EJBObject from the container system.
protected abstract  java.lang.Object removeWithHandle(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object proxy)
           Attempts to remove an EJBObject from the container system.
 void writeExternal(java.io.ObjectOutput out)
          The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
 
Methods inherited from class org.openejb.client.EJBInvocationHandler
getMethod, 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
 

Field Detail

GETEJBMETADATA

protected static final java.lang.reflect.Method GETEJBMETADATA

GETHOMEHANDLE

protected static final java.lang.reflect.Method GETHOMEHANDLE

REMOVE_W_KEY

protected static final java.lang.reflect.Method REMOVE_W_KEY

REMOVE_W_HAND

protected static final java.lang.reflect.Method REMOVE_W_HAND

GETHANDLER

protected static final java.lang.reflect.Method GETHANDLER
Constructor Detail

EJBHomeHandler

public EJBHomeHandler()
Constructs an EJBHomeHandler to handle invocations from an EJBHomeProxy.


EJBHomeHandler

public EJBHomeHandler(EJBMetaDataImpl ejb,
                      ServerMetaData server,
                      ClientMetaData client)
Method Detail

createEJBHomeHandler

public static EJBHomeHandler createEJBHomeHandler(EJBMetaDataImpl ejb,
                                                  ServerMetaData server,
                                                  ClientMetaData client)

createEJBHomeProxy

public EJBHomeProxy createEJBHomeProxy()

_invoke

protected java.lang.Object _invoke(java.lang.Object proxy,
                                   java.lang.reflect.Method method,
                                   java.lang.Object[] args)
                            throws java.lang.Throwable
Description copied from class: EJBInvocationHandler
Overridden by subclasses and called by EJBInvocationHandler.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 EJBInvocationHandler
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

create

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

Creates a new EJBObject and returns it to the caller. The EJBObject is a new proxy with a new handler. This implementation should not be sent outside the virtual machine.

This method propogates to the container system.

The create method is required to be defined by the bean's home interface.

Parameters:
method -
args -
proxy -
Returns:
Returns an new EJBObject proxy and handler
Throws:
java.lang.Throwable

findX

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

Locates and returns a new EJBObject or a collection of EJBObjects. The EJBObject(s) is a new proxy with a new handler. This implementation should not be sent outside the virtual machine.

This method propogates to the container system.

The find method is required to be defined by the bean's home interface of Entity beans.

Parameters:
method -
args -
proxy -
Returns:
Returns an new EJBObject proxy and handler
Throws:
java.lang.Throwable

getEJBMetaData

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

Returns an EJBMetaData implementation that is valid inside this virtual machine. This implementation should not be sent outside the virtual machine.

This method does not propogate to the container system.

getMetaData is a method of javax.ejb.EJBHome

Checks if the caller is authorized to invoke the javax.ejb.EJBHome.getMetaData on the EJBHome of the deployment.

Returns:
Returns an IntraVmMetaData
Throws:
java.lang.Throwable
See Also:
EJBHome, EJBHome.getEJBMetaData()

getHomeHandle

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

Returns a HomeHandle implementation that is valid inside this virtual machine. This implementation should not be sent outside the virtual machine.

This method does not propogate to the container system.

getHomeHandle is a method of javax.ejb.EJBHome

Checks if the caller is authorized to invoke the javax.ejb.EJBHome.getHomeHandle on the EJBHome of the deployment.

Parameters:
proxy -
Returns:
Returns an IntraVmHandle
Throws:
java.lang.Throwable
See Also:
EJBHome, EJBHome.getHomeHandle()

removeWithHandle

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

Attempts to remove an EJBObject from the container system. The EJBObject to be removed is represented by the javax.ejb.Handle object passed into the remove method in the EJBHome.

This method propogates to the container system.

remove(Handle handle) is a method of javax.ejb.EJBHome

Checks if the caller is authorized to invoke the javax.ejb.EJBHome.remove on the EJBHome of the deployment.

Parameters:
method -
args -
Returns:
Returns null
Throws:
java.lang.Throwable
See Also:
EJBHome, EJBHome.remove(javax.ejb.Handle)

removeByPrimaryKey

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

Attempts to remove an EJBObject from the container system. The EJBObject to be removed is represented by the primaryKey passed into the remove method of the EJBHome.

This method propogates to the container system.

remove(Object primary) is a method of javax.ejb.EJBHome

Checks if the caller is authorized to invoke the javax.ejb.EJBHome.remove on the EJBHome of the deployment.

Parameters:
method -
args -
Returns:
Returns null
Throws:
java.lang.Throwable
See Also:
EJBHome, EJBHome.remove(javax.ejb.Handle)

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - the stream to read data from in order to restore the object
Throws:
java.io.IOException - if I/O errors occur
java.lang.ClassNotFoundException - If the class for an object being restored cannot be found.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - the stream to write the object to
Throws:
java.io.IOException - Includes any I/O exceptions that may occur


Copyright © 1999-2011 OpenEJB. All Rights Reserved.