com.caucho.ejb.server
Class AbstractEjbBeanManager<X>

java.lang.Object
  extended by com.caucho.ejb.server.AbstractEjbBeanManager<X>
All Implemented Interfaces:
EnvironmentBean
Direct Known Subclasses:
AbstractSessionManager, MessageManager

public abstract class AbstractEjbBeanManager<X>
extends java.lang.Object
implements EnvironmentBean

Base server for a single home/object bean pair.


Field Summary
protected  java.lang.Class<X> _ejbClass
           
protected  EjbManager _ejbManager
           
protected  java.lang.String _filename
           
protected  int _line
           
protected  java.lang.String _location
           
protected  java.lang.String _mappedName
           
protected  UserTransaction _ut
           
 
Constructor Summary
AbstractEjbBeanManager(EjbManager ejbManager, java.lang.String ejbName, java.lang.String moduleName, AnnotatedType<X> rawAnnotatedType, AnnotatedType<X> annotatedType)
          Creates a new server container
 
Method Summary
 void bind()
           
protected  void bindContext()
           
protected  void bindInjection()
           
protected  EjbInjectionTarget<X> createInjectionTarget()
           
 void destroy()
          Cleans up the server on shutdown
 void destroy(java.lang.Object instance, CreationalContextImpl<?> env)
           
 void destroyInstance(X instance)
          Initialize an instance
 java.lang.String encodeId(java.lang.Object primaryKey)
          Returns the encoded id.
 ConfigException error(java.lang.String msg)
           
 AnnotatedType<X> getAnnotatedType()
           
 DynamicClassLoader getClassLoader()
          Gets the class loader
 AbstractContext<X> getContext()
           
 AbstractContext<?> getContext(java.lang.Object key)
           
abstract  AbstractContext<?> getContext(java.lang.Object key, boolean forceLoad)
          Returns the context with the given key
 Bean<X> getDeployBean()
           
 java.lang.Class<X> getEjbClass()
          Sets the ejb class
 EjbManager getEjbContainer()
          Returns the owning container.
 java.lang.String getEJBName()
          Returns the ejb's name
 java.lang.String getId()
          Returns the id, module-path#ejb-name.
 InjectManager getInjectManager()
           
 java.util.ArrayList<AnnotatedType<? super X>> getLocalApi()
           
 AnnotatedType<X> getLocalBean()
           
abstract
<T> java.lang.Object
getLocalJndiProxy(java.lang.Class<T> api)
          Returns the local jndi proxy for the given API
abstract
<T> T
getLocalProxy(java.lang.Class<T> api)
          Returns the a new local stub for the given API
 java.lang.String getMappedName()
          Returns the mapped name.
 InjectManager getModuleInjectManager()
           
 java.lang.String getModuleName()
          Returns the module that defined this ejb.
 java.lang.String getProtocolId()
          The name to use for remoting protocols, such as IIOP and Hessian.
 java.lang.String getProtocolId(java.lang.Class<?> cl)
          The name to use for remoting protocols, such as IIOP and Hessian.
 AnnotatedType<X> getRawAnnotatedType()
           
 java.util.ArrayList<AnnotatedType<? super X>> getRemoteApi()
           
 java.util.ArrayList<java.lang.Class<?>> getRemoteApiList()
          Returns the remote object list.
abstract
<T> T
getRemoteObject(java.lang.Class<T> api, java.lang.String protocol)
          Returns the remote skeleton for the given API
 ConfigProgram getServerProgram()
          Sets the server program.
 TimerService getTimerService()
          Returns the timer service.
 long getTransactionTimeout()
          Gets the transaction timeout.
protected  java.lang.String getType()
           
 UserTransaction getUserTransaction()
           
 boolean hasRemoteObject()
          Returns true if there is any remote object.
 void init()
           
 void invalidateCache()
          Invalidates caches.
 boolean isContainerTransaction()
          Returns true if container transaction is used.
 boolean isDead()
          Returns true if the server is dead.
 boolean isDependValid(java.util.ArrayList<AbstractEjbBeanManager<?>> bindList)
           
 java.lang.Object lookup(java.lang.String jndiName)
          Looks up the JNDI object.
 X newInstance(CreationalContextImpl<X> env)
           
protected  void postStart()
           
protected  void registerInjection()
           
 void setAroundInvoke(AroundInvokeConfig aroundInvoke)
           
 void setBusinessLocal(java.lang.Class<?> local)
           
 void setConfigLocation(java.lang.String filename, int line)
           
 void setContainerTransaction(boolean isContainerTransaction)
          Sets true if container transaction is used.
 void setEjbClass(java.lang.Class<X> cl)
          Sets the ejb class
 void setId(java.lang.String id)
          Sets the id, module-path#ejb-name.
 void setLocation(java.lang.String location)
           
 void setMappedName(java.lang.String mappedName)
          Sets the mapped name, default is to use the EJBName.
 void setRemoteApiList(java.util.ArrayList<java.lang.Class<?>> list)
          Sets the remote object list.
 void setResourceList(java.util.ArrayList<ResourceGroupConfig> resourceList)
           
 void setServerProgram(ConfigProgram serverProgram)
          Sets the server program.
 void setTransactionTimeout(long timeout)
          Sets the transaction timeout.
 boolean start()
           
 void timeout(Timer timer)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_ejbManager

protected final EjbManager _ejbManager

_ut

protected final UserTransaction _ut

_filename

protected java.lang.String _filename

_line

protected int _line

_location

protected java.lang.String _location

_ejbClass

protected java.lang.Class<X> _ejbClass

_mappedName

protected java.lang.String _mappedName
Constructor Detail

AbstractEjbBeanManager

public AbstractEjbBeanManager(EjbManager ejbManager,
                              java.lang.String ejbName,
                              java.lang.String moduleName,
                              AnnotatedType<X> rawAnnotatedType,
                              AnnotatedType<X> annotatedType)
Creates a new server container

Parameters:
manager - the owning server container
Method Detail

createInjectionTarget

protected EjbInjectionTarget<X> createInjectionTarget()

getId

public java.lang.String getId()
Returns the id, module-path#ejb-name.


getModuleInjectManager

public InjectManager getModuleInjectManager()

getInjectManager

public InjectManager getInjectManager()

setId

public void setId(java.lang.String id)
Sets the id, module-path#ejb-name.


setConfigLocation

public void setConfigLocation(java.lang.String filename,
                              int line)

setLocation

public void setLocation(java.lang.String location)

getType

protected java.lang.String getType()

getDeployBean

public Bean<X> getDeployBean()

setAroundInvoke

public void setAroundInvoke(AroundInvokeConfig aroundInvoke)

getEJBName

public java.lang.String getEJBName()
Returns the ejb's name


getModuleName

public java.lang.String getModuleName()
Returns the module that defined this ejb.


setMappedName

public void setMappedName(java.lang.String mappedName)
Sets the mapped name, default is to use the EJBName. This is the name for both JNDI and the protocols such as IIOP and Hessian.


getMappedName

public java.lang.String getMappedName()
Returns the mapped name.


getProtocolId

public java.lang.String getProtocolId()
The name to use for remoting protocols, such as IIOP and Hessian.


getProtocolId

public java.lang.String getProtocolId(java.lang.Class<?> cl)
The name to use for remoting protocols, such as IIOP and Hessian.


getRawAnnotatedType

public AnnotatedType<X> getRawAnnotatedType()

getAnnotatedType

public AnnotatedType<X> getAnnotatedType()

setEjbClass

public void setEjbClass(java.lang.Class<X> cl)
Sets the ejb class


getEjbClass

public java.lang.Class<X> getEjbClass()
Sets the ejb class


setRemoteApiList

public void setRemoteApiList(java.util.ArrayList<java.lang.Class<?>> list)
Sets the remote object list.


getRemoteApiList

public java.util.ArrayList<java.lang.Class<?>> getRemoteApiList()
Returns the remote object list.


hasRemoteObject

public boolean hasRemoteObject()
Returns true if there is any remote object.


getLocalApi

public java.util.ArrayList<AnnotatedType<? super X>> getLocalApi()

getRemoteApi

public java.util.ArrayList<AnnotatedType<? super X>> getRemoteApi()

getLocalBean

public AnnotatedType<X> getLocalBean()

encodeId

public java.lang.String encodeId(java.lang.Object primaryKey)
Returns the encoded id.


isDependValid

public boolean isDependValid(java.util.ArrayList<AbstractEjbBeanManager<?>> bindList)
Parameters:
bindList -
Returns:

lookup

public java.lang.Object lookup(java.lang.String jndiName)
Looks up the JNDI object.


getUserTransaction

public UserTransaction getUserTransaction()

getEjbContainer

public EjbManager getEjbContainer()
Returns the owning container.


setServerProgram

public void setServerProgram(ConfigProgram serverProgram)
Sets the server program.


getServerProgram

public ConfigProgram getServerProgram()
Sets the server program.


setTransactionTimeout

public void setTransactionTimeout(long timeout)
Sets the transaction timeout.


getTransactionTimeout

public long getTransactionTimeout()
Gets the transaction timeout.


setBusinessLocal

@Configurable
public void setBusinessLocal(java.lang.Class<?> local)

getTimerService

public TimerService getTimerService()
Returns the timer service.


invalidateCache

public void invalidateCache()
Invalidates caches.


getClassLoader

public DynamicClassLoader getClassLoader()
Gets the class loader

Specified by:
getClassLoader in interface EnvironmentBean

bind

public void bind()

getRemoteObject

public abstract <T> T getRemoteObject(java.lang.Class<T> api,
                                      java.lang.String protocol)
Returns the remote skeleton for the given API

Parameters:
api - the bean's api to return a value for
protocol - the remote protocol

getLocalProxy

public abstract <T> T getLocalProxy(java.lang.Class<T> api)
Returns the a new local stub for the given API

Parameters:
api - the bean's api to return a value for

getLocalJndiProxy

public abstract <T> java.lang.Object getLocalJndiProxy(java.lang.Class<T> api)
Returns the local jndi proxy for the given API

Parameters:
api - the bean's api to return a value for

getContext

public AbstractContext<X> getContext()

getContext

public AbstractContext<?> getContext(java.lang.Object key)
                              throws FinderException
Throws:
FinderException

getContext

public abstract AbstractContext<?> getContext(java.lang.Object key,
                                              boolean forceLoad)
                                       throws FinderException
Returns the context with the given key

Throws:
FinderException

timeout

public void timeout(Timer timer)

init

public void init()
          throws java.lang.Exception
Throws:
java.lang.Exception

newInstance

public X newInstance(CreationalContextImpl<X> env)

destroy

public void destroy(java.lang.Object instance,
                    CreationalContextImpl<?> env)

destroyInstance

public void destroyInstance(X instance)
Initialize an instance


start

public boolean start()
              throws java.lang.Exception
Throws:
java.lang.Exception

bindContext

protected void bindContext()

registerInjection

protected void registerInjection()

bindInjection

protected void bindInjection()

postStart

protected void postStart()

isContainerTransaction

public boolean isContainerTransaction()
Returns true if container transaction is used.


setContainerTransaction

public void setContainerTransaction(boolean isContainerTransaction)
Sets true if container transaction is used.


setResourceList

public void setResourceList(java.util.ArrayList<ResourceGroupConfig> resourceList)

isDead

public boolean isDead()
Returns true if the server is dead.


destroy

public void destroy()
Cleans up the server on shutdown


error

public ConfigException error(java.lang.String msg)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object