org.jboss.ejb.plugins.jrmp.interfaces
Class AbstractHandle

java.lang.Object
  |
  +--org.jboss.ejb.plugins.jrmp.interfaces.AbstractHandle
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
EntityHandleImpl, HomeHandleImpl, StatefulHandleImpl, StatelessHandleImpl

public abstract class AbstractHandle
extends java.lang.Object
implements java.io.Serializable

An abstract base handle class from which all handles extend from.

Version:
$Revision: 1.1 $
Author:
Jason Dillon <jason@planet57.com>
See Also:
Serialized Form

Field Summary
protected  InitialContextHandle initialContextHandle
          A handle used to restore the correct naming context.
protected  java.lang.String name
          JNDI name used for lookups.
 
Constructor Summary
AbstractHandle(InitialContextHandle handle, java.lang.String name)
          Initialize.
AbstractHandle(java.lang.String name)
          Initialize, creating a new initial context handle object.
 
Method Summary
protected  javax.naming.InitialContext createInitialContext()
          Create an InitialContext using the saved environment or create a vanilla InitialContext when the enviroment is null.
protected  javax.ejb.EJBObject getEJBObject(java.lang.String name, java.lang.Class[] types, java.lang.Object[] args)
          Helper to perform the actual lookup and reflection.
protected  javax.ejb.EJBHome lookupEJBHome()
          Get the EJBHome reference at the configured JNDI name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name
JNDI name used for lookups.

initialContextHandle

protected final InitialContextHandle initialContextHandle
A handle used to restore the correct naming context.
Constructor Detail

AbstractHandle

public AbstractHandle(InitialContextHandle handle,
                      java.lang.String name)
Initialize.
Parameters:
handle - The initial context handle that will be used to restore the naming context or null to use a fresh InitialContext object.
name - A JNDI name.

AbstractHandle

public AbstractHandle(java.lang.String name)
Initialize, creating a new initial context handle object.
Parameters:
name - A JNDI name.
Method Detail

createInitialContext

protected javax.naming.InitialContext createInitialContext()
                                                    throws javax.naming.NamingException
Create an InitialContext using the saved environment or create a vanilla InitialContext when the enviroment is null.
Returns:
InitialContext suitable for the bean that this is a proxy for.
Throws:
javax.naming.NamingException - Failed to create InitialContext.

lookupEJBHome

protected javax.ejb.EJBHome lookupEJBHome()
                                   throws javax.naming.NamingException
Get the EJBHome reference at the configured JNDI name.
Returns:
EJBHome reference.
Throws:
javax.naming.NamingException - Failed to lookup EJBHome.
java.lang.ClassCastException - Object at specified name is not an instance of EJBHome.

getEJBObject

protected javax.ejb.EJBObject getEJBObject(java.lang.String name,
                                           java.lang.Class[] types,
                                           java.lang.Object[] args)
                                    throws java.rmi.ServerException
Helper to perform the actual lookup and reflection.
Parameters:
name - The name of the method that is to be used.
types - The signature of the method.
args - The arguments to the method.
Returns:
An EJBObject.
Throws:
java.rmi.ServerException - Could not get EJBObject.


Copyright © 2000 The JBoss Organization. All Rights Reserved.