org.apache.beehive.controls.system.ejb
Class EJBControlImpl

Object
  extended by EJBControlImpl
All Implemented Interfaces:
Serializable, Extensible, EJBControl
Direct Known Subclasses:
EntityEJBControlImpl, SessionEJBControlImpl

public abstract class EJBControlImpl
extends Object
implements EJBControl, Extensible, Serializable

The Enterprise Java Bean Control implementation class

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface EJBControl
EJBControl.EJBHome, EJBControl.JNDIContextEnv
 
Field Summary
protected  Handle _beanHandle
           
protected  Object _beanInstance
           
protected  Class _beanInterface
           
protected  int _beanType
           
protected  Context _context
           
protected  Class _controlInterface
           
protected  Object _homeInstance
           
protected  Class _homeInterface
           
protected  String _jndiName
           
protected  Throwable _lastException
           
static int ENTITY_BEAN
           
static String JNDI_APPSCOPED_PREFIX
           
static String JNDI_GLOBAL_PREFIX
           
static int SESSION_BEAN
           
 
Constructor Summary
EJBControlImpl()
           
 
Method Summary
protected  Object beanNarrow(Object obj)
           
protected  Method findEjbMethod(Method controlBeanMethod, Class ejbInterface)
          Find the method which has the same signature in the specified class.
 Object getEJBBeanInstance()
          EJBControl.getEJBBeanInstance()
 Throwable getEJBException()
          EJBControl.getEJBException()
 Object getEJBHomeInstance()
          EJBControl.getEJBHomeInstance()
protected  Context getInitialContext()
           
 boolean hasEJBBeanInstance()
          EJBControl.getEJBBeanInstance()
protected  Object homeNarrow(Object obj)
           
 Object invoke(Method m, Object[] args)
          Extensible.invoke Handles all extended interface methods (i.e.
protected  boolean isControlBeanMethod(Method m)
          Return true if the method is from the ControlBean.
protected static boolean isCreateMethod(Method m)
           
protected static boolean isFinderMethod(Method m)
           
protected  boolean isHomeMethod(Method m)
           
protected static boolean isRemoveMethod(Method m)
           
protected  boolean isSelectorMethod(Method m)
           
protected  Method mapControlBeanMethodToEJB(Method m)
          Map a control bean method to an EJB method.
protected static boolean methodThrows(Method m, Class exceptionClass)
           
 void onAcquire()
           
 void onCreate()
           
 void onRelease()
           
 void onReset()
           
protected  void releaseBeanInstance(boolean alreadyRemoved)
           
protected abstract  Object resolveBeanInstance()
           
protected  Object resolveBeanInstanceFromHandle()
           
protected  boolean saveBeanInstance()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SESSION_BEAN

public static final int SESSION_BEAN
See Also:
Constant Field Values

ENTITY_BEAN

public static final int ENTITY_BEAN
See Also:
Constant Field Values

JNDI_GLOBAL_PREFIX

public static final String JNDI_GLOBAL_PREFIX
See Also:
Constant Field Values

JNDI_APPSCOPED_PREFIX

public static final String JNDI_APPSCOPED_PREFIX
See Also:
Constant Field Values

_controlInterface

protected Class _controlInterface

_homeInterface

protected Class _homeInterface

_beanInterface

protected Class _beanInterface

_beanType

protected int _beanType

_jndiName

protected String _jndiName

_beanHandle

protected Handle _beanHandle

_context

protected transient Context _context

_lastException

protected transient Throwable _lastException

_beanInstance

protected transient Object _beanInstance

_homeInstance

protected transient Object _homeInstance
Constructor Detail

EJBControlImpl

public EJBControlImpl()
Method Detail

onCreate

public void onCreate()

methodThrows

protected static boolean methodThrows(Method m,
                                      Class exceptionClass)

isHomeMethod

protected boolean isHomeMethod(Method m)

isControlBeanMethod

protected boolean isControlBeanMethod(Method m)
Return true if the method is from the ControlBean.

Parameters:
m - Method to check.

mapControlBeanMethodToEJB

protected Method mapControlBeanMethodToEJB(Method m)
Map a control bean method to an EJB method.

Parameters:
m - The control bean method.
Returns:
The corresponding method of the EJB.

findEjbMethod

protected Method findEjbMethod(Method controlBeanMethod,
                               Class ejbInterface)
Find the method which has the same signature in the specified class.

Parameters:
controlBeanMethod - Method signature find.
ejbInterface - Class to search for method signature.
Returns:
Method from ejbInterface if found, null if not found.

isCreateMethod

protected static boolean isCreateMethod(Method m)

isFinderMethod

protected static boolean isFinderMethod(Method m)

isSelectorMethod

protected boolean isSelectorMethod(Method m)

isRemoveMethod

protected static boolean isRemoveMethod(Method m)

homeNarrow

protected Object homeNarrow(Object obj)

beanNarrow

protected Object beanNarrow(Object obj)

resolveBeanInstance

protected abstract Object resolveBeanInstance()

resolveBeanInstanceFromHandle

protected Object resolveBeanInstanceFromHandle()

saveBeanInstance

protected boolean saveBeanInstance()

releaseBeanInstance

protected void releaseBeanInstance(boolean alreadyRemoved)

getInitialContext

protected Context getInitialContext()
                             throws NamingException
Throws:
NamingException

onAcquire

public void onAcquire()

onRelease

public void onRelease()

onReset

public void onReset()

invoke

public Object invoke(Method m,
                     Object[] args)
              throws Throwable
Extensible.invoke Handles all extended interface methods (i.e. EJB home and remote interface invocation)

Specified by:
invoke in interface Extensible
Throws:
Throwable

getEJBHomeInstance

public Object getEJBHomeInstance()
EJBControl.getEJBHomeInstance()

Specified by:
getEJBHomeInstance in interface EJBControl

hasEJBBeanInstance

public boolean hasEJBBeanInstance()
EJBControl.getEJBBeanInstance()

Specified by:
hasEJBBeanInstance in interface EJBControl

getEJBBeanInstance

public Object getEJBBeanInstance()
EJBControl.getEJBBeanInstance()

Specified by:
getEJBBeanInstance in interface EJBControl

getEJBException

public Throwable getEJBException()
EJBControl.getEJBException()

Specified by:
getEJBException in interface EJBControl