org.jboss.ejb
Class Container

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.ejb.Container
All Implemented Interfaces:
AllowedOperationsFlags (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src)
Direct Known Subclasses:
EntityContainer (src) , MessageDrivenContainer (src) , SessionContainer (src)

public abstract class Container
extends ServiceMBeanSupport (src)
implements AllowedOperationsFlags (src)

This is the base class for all EJB-containers in JBoss. A Container functions as the central hub of all metadata and plugins. Through this the container plugins can get hold of the other plugins and any metadata they need.

The EJBDeployer creates instances of subclasses of this class and calls the appropriate initialization methods.

A Container does not perform any significant work, but instead delegates to the plugins to provide for all kinds of algorithmic functionality.

See Also:
EJBDeployer (src)

Nested Class Summary
protected  class Container.AbstractContainerInterceptor (src)
          The base class for container interceptors.
 
Field Summary
static java.lang.String BASE_EJB_CONTAINER_NAME
           
protected  java.lang.Class beanClass
          This is the EnterpriseBean class
protected  java.lang.ClassLoader classLoader
          This is the classloader of this container.
protected  long createCount
          The number of create invocations that have been made
static ObjectName (src) EJB_CONTAINER_QUERY_NAME
           
protected static java.lang.reflect.Method EJB_TIMEOUT
          A reference to TimedObject.ejbTimeout(javax.ejb.Timer).
protected  EjbModule (src) ejbModule
          This is the application that this container is a part of
protected static java.lang.reflect.Method EJBOBJECT_REMOVE
           
protected  java.lang.Class homeInterface
          This is the Home interface class
protected  InvocationStatistics (src) invokeStats
          Time statistics for the invoke(Invocation) methods
protected  java.lang.String jaccContextID
          The JACC context id for the container
protected  java.lang.ClassLoader localClassLoader
          This is the local classloader of this container.
protected  java.lang.Class localHomeInterface
          The local home interface class
protected  java.lang.Class localInterface
          The local inteface class
protected  LocalProxyFactory (src) localProxyFactory
          ???
protected  BeanLockManager (src) lockManager
          This is the bean lock manager that is to be used
protected  java.util.Map marshalledInvocationMapping
          Maps for MarshalledInvocation mapping
protected  BeanMetaData (src) metaData
          This is the new metadata.
static ObjectName (src) ORB_NAME
           
protected  java.util.HashMap proxyFactories
          HashMap for the invoker bindings
protected  java.lang.ThreadLocal proxyFactoryTL
          The Proxy factory is set in the Invocation.
protected  java.lang.Class remoteInterface
          This is the Remote interface class
protected  long removeCount
          The number of create invocations that have been made
protected  RealmMapping (src) rm
          This is the realm mapping
protected  java.lang.Object securityProxy
          The custom security proxy used by the SecurityInterceptor
protected  AuthenticationManager (src) sm
          This is the SecurityManager
protected  TransactionManager (src) tm
          This is the TransactionManager
protected  java.lang.ClassLoader webClassLoader
          The class loader for remote dynamic classloading
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags (src)
IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
Container()
           
 
Method Summary
abstract  void addInterceptor(Interceptor (src)  in)
           
 void addProxyFactory(java.lang.String invokerBinding, EJBProxyFactory (src)  factory)
           
 java.lang.Object createBeanClassInstance()
          Returns a new instance of the bean class or a subclass of the bean class.
protected  void createService()
          The EJBDeployer calls this method.
protected  void destroyService()
          A default implementation of destroying the container service (no-op).
 java.lang.Class getBeanClass()
          Returns the bean class instance of this container.
 BeanMetaData (src) getBeanMetaData()
          Returns the metadata of this container.
 java.lang.ClassLoader getClassLoader()
          Returns the classloader for this container.
 long getCreateCount()
          Gets the number of create invocations that have been made
 DeploymentInfo (src) getDeploymentInfo()
          Gets the DeploymentInfo for this Container
 EjbModule (src) getEjbModule()
          Gets the application deployment unit for this container.
 javax.naming.Context getEnvContext()
          Get the components environment context
 java.lang.Class getHomeClass()
          this actually should be called remotehome, but for interface compliance purposes we keep it like that
 InvocationStatistics (src) getInvokeStats()
          Gets the invocation statistics collection
 java.lang.String getJaccContextID()
           
 ObjectName (src) getJmxName()
          Build a JMX name using the pattern jboss.j2ee:service=EJB,jndiName=[jndiName] where the [jndiName] is either the bean remote home JNDI binding, or the local home JNDI binding if the bean has no remote interfaces.
 java.lang.Class getLocalClass()
           
 java.lang.ClassLoader getLocalClassLoader()
          Returns the local classloader for this container.
 java.lang.Class getLocalHomeClass()
           
 BeanLockManager (src) getLockManager()
           
 MessageDestinationMetaData (src) getMessageDestination(java.lang.String link)
           
 java.util.Set getMethodPermissions(java.lang.reflect.Method m, InvocationType (src)  iface)
          Returns the permissions for a method.
 EJBProxyFactory (src) getProxyFactory()
           
 RealmMapping (src) getRealmMapping()
           
 java.lang.Class getRemoteClass()
           
 long getRemoveCount()
          Gets the number of remove invocations that have been made
 AuthenticationManager (src) getSecurityManager()
           
 java.lang.Object getSecurityProxy()
           
 TimerService (src) getTimerService(java.lang.Object pKey)
          Creates the single Timer Servic for this container if not already created
 TransactionManager (src) getTransactionManager()
          Returns this container's transaction manager.
 java.lang.ClassLoader getWebClassLoader()
          Get the class loader for dynamic class loading via http.
abstract  java.lang.Object internalInvoke(Invocation (src)  mi)
          This method is called when a method call comes in on an EJBObject.
abstract  java.lang.Object internalInvokeHome(Invocation (src)  mi)
          This method is called when a method call comes in on the Home object.
 java.lang.Object invoke(Invocation (src)  mi)
          The detached invoker operation.
 boolean isCallByValue()
          Whether the bean is call by value
 EJBProxyFactory (src) lookupProxyFactory(java.lang.String binding)
           
 void removeTimerService(java.lang.Object pKey)
          Removes Timer Servic for this container
 void setBeanMetaData(BeanMetaData (src)  metaData)
          Sets the meta data for this container.
 void setClassLoader(java.lang.ClassLoader cl)
          Sets the class loader for this container.
 void setDeploymentInfo(DeploymentInfo (src)  di)
          Sets the DeploymentInfo of this Container
 void setEjbModule(EjbModule (src)  app)
          Sets the application deployment unit for this container.
 void setJaccContextID(java.lang.String id)
           
 void setLocalClassLoader(java.lang.ClassLoader cl)
          Sets the local class loader for this container.
 void setLockManager(BeanLockManager (src)  lockManager)
           
 void setProxyFactory(java.lang.Object factory)
           
 void setRealmMapping(RealmMapping (src)  rm)
           
 void setSecurityManager(AuthenticationManager (src)  sm)
           
 void setSecurityProxy(java.lang.Object proxy)
           
 void setTransactionManager(TransactionManager (src)  tm)
          Sets a transaction manager for this container.
 void setWebClassLoader(java.lang.ClassLoader webClassLoader)
          Set the class loader for dynamic class loading via http.
protected  void startService()
          A default implementation of starting the container service.
protected  void stopService()
          A default implementation of stopping the container service (no-op).
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, destroy, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_EJB_CONTAINER_NAME

public static final java.lang.String BASE_EJB_CONTAINER_NAME
See Also:
Constant Field Values (src)

ORB_NAME

public static final ObjectName (src)  ORB_NAME

EJB_CONTAINER_QUERY_NAME

public static final ObjectName (src)  EJB_CONTAINER_QUERY_NAME

EJBOBJECT_REMOVE

protected static final java.lang.reflect.Method EJBOBJECT_REMOVE

EJB_TIMEOUT

protected static final java.lang.reflect.Method EJB_TIMEOUT
A reference to TimedObject.ejbTimeout(javax.ejb.Timer).


ejbModule

protected EjbModule (src)  ejbModule
This is the application that this container is a part of


localClassLoader

protected java.lang.ClassLoader localClassLoader
This is the local classloader of this container. Used for loading resources that must come from the local jar file for the container. NOT for loading classes!


classLoader

protected java.lang.ClassLoader classLoader
This is the classloader of this container. All classes and resources that the bean uses will be loaded from here. By doing this we make the bean re-deployable


webClassLoader

protected java.lang.ClassLoader webClassLoader
The class loader for remote dynamic classloading


metaData

protected BeanMetaData (src)  metaData
This is the new metadata. it includes information from both ejb-jar and jboss.xml the metadata for the application can be accessed trough metaData.getApplicationMetaData()


beanClass

protected java.lang.Class beanClass
This is the EnterpriseBean class


homeInterface

protected java.lang.Class homeInterface
This is the Home interface class


remoteInterface

protected java.lang.Class remoteInterface
This is the Remote interface class


localHomeInterface

protected java.lang.Class localHomeInterface
The local home interface class


localInterface

protected java.lang.Class localInterface
The local inteface class


tm

protected TransactionManager (src)  tm
This is the TransactionManager


sm

protected AuthenticationManager (src)  sm
This is the SecurityManager


rm

protected RealmMapping (src)  rm
This is the realm mapping


securityProxy

protected java.lang.Object securityProxy
The custom security proxy used by the SecurityInterceptor


lockManager

protected BeanLockManager (src)  lockManager
This is the bean lock manager that is to be used


localProxyFactory

protected LocalProxyFactory (src)  localProxyFactory
???


marshalledInvocationMapping

protected java.util.Map marshalledInvocationMapping
Maps for MarshalledInvocation mapping


proxyFactories

protected java.util.HashMap proxyFactories
HashMap for the invoker bindings


proxyFactoryTL

protected java.lang.ThreadLocal proxyFactoryTL
The Proxy factory is set in the Invocation. This TL is used for methods that do not have access to the Invocation.


createCount

protected long createCount
The number of create invocations that have been made


removeCount

protected long removeCount
The number of create invocations that have been made


invokeStats

protected InvocationStatistics (src)  invokeStats
Time statistics for the invoke(Invocation) methods


jaccContextID

protected java.lang.String jaccContextID
The JACC context id for the container

Constructor Detail

Container

public Container()
Method Detail

getLocalClass

public java.lang.Class getLocalClass()

getLocalHomeClass

public java.lang.Class getLocalHomeClass()

getRemoteClass

public java.lang.Class getRemoteClass()

getHomeClass

public java.lang.Class getHomeClass()
this actually should be called remotehome, but for interface compliance purposes we keep it like that


isCallByValue

public boolean isCallByValue()
Whether the bean is call by value

Returns:
true for call by value

setTransactionManager

public void setTransactionManager(TransactionManager (src)  tm)
Sets a transaction manager for this container.

Parameters:
tm -
See Also:
TransactionManager (src)

getTransactionManager

public TransactionManager (src)  getTransactionManager()
Returns this container's transaction manager.

Returns:
A concrete instance of javax.transaction.TransactionManager

setSecurityManager

public void setSecurityManager(AuthenticationManager (src)  sm)

getSecurityManager

public AuthenticationManager (src)  getSecurityManager()

getLockManager

public BeanLockManager (src)  getLockManager()

setLockManager

public void setLockManager(BeanLockManager (src)  lockManager)

addProxyFactory

public void addProxyFactory(java.lang.String invokerBinding,
                            EJBProxyFactory (src)  factory)

setRealmMapping

public void setRealmMapping(RealmMapping (src)  rm)

getRealmMapping

public RealmMapping (src)  getRealmMapping()

setSecurityProxy

public void setSecurityProxy(java.lang.Object proxy)

getSecurityProxy

public java.lang.Object getSecurityProxy()

getProxyFactory

public EJBProxyFactory (src)  getProxyFactory()

setProxyFactory

public void setProxyFactory(java.lang.Object factory)

lookupProxyFactory

public EJBProxyFactory (src)  lookupProxyFactory(java.lang.String binding)

getDeploymentInfo

public final DeploymentInfo (src)  getDeploymentInfo()
Gets the DeploymentInfo for this Container

Returns:
The DeploymentInfo for this Container

setDeploymentInfo

public final void setDeploymentInfo(DeploymentInfo (src)  di)
Sets the DeploymentInfo of this Container

Parameters:
di - The new DeploymentInfo to be used

setEjbModule

public void setEjbModule(EjbModule (src)  app)
Sets the application deployment unit for this container. All the bean containers within the same application unit share the same instance.

Parameters:
app - application for this container

getJaccContextID

public java.lang.String getJaccContextID()

setJaccContextID

public void setJaccContextID(java.lang.String id)

getEjbModule

public EjbModule (src)  getEjbModule()
Gets the application deployment unit for this container. All the bean containers within the same application unit share the same instance.


getCreateCount

public long getCreateCount()
Gets the number of create invocations that have been made


getRemoveCount

public long getRemoveCount()
Gets the number of remove invocations that have been made


getInvokeStats

public InvocationStatistics (src)  getInvokeStats()
Gets the invocation statistics collection


setLocalClassLoader

public void setLocalClassLoader(java.lang.ClassLoader cl)
Sets the local class loader for this container. Used for loading resources from the local jar file for this container. NOT for loading classes!

Parameters:
cl -

getLocalClassLoader

public java.lang.ClassLoader getLocalClassLoader()
Returns the local classloader for this container.

Returns:
The local classloader for this container.

setClassLoader

public void setClassLoader(java.lang.ClassLoader cl)
Sets the class loader for this container. All the classes and resources used by the bean in this container will use this classloader.

Parameters:
cl -

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the classloader for this container.

Returns:

getWebClassLoader

public java.lang.ClassLoader getWebClassLoader()
Get the class loader for dynamic class loading via http.


setWebClassLoader

public void setWebClassLoader(java.lang.ClassLoader webClassLoader)
Set the class loader for dynamic class loading via http.


setBeanMetaData

public void setBeanMetaData(BeanMetaData (src)  metaData)
Sets the meta data for this container. The meta data consists of the properties found in the XML descriptors.

Parameters:
metaData -

getEnvContext

public javax.naming.Context getEnvContext()
                                   throws javax.naming.NamingException
Get the components environment context

Returns:
Environment Context
Throws:
javax.naming.NamingException

getBeanMetaData

public BeanMetaData (src)  getBeanMetaData()
Returns the metadata of this container.

Returns:
metaData;

getMethodPermissions

public java.util.Set getMethodPermissions(java.lang.reflect.Method m,
                                          InvocationType (src)  iface)
Returns the permissions for a method. (a set of roles)

Returns:
assemblyDescriptor;

getBeanClass

public java.lang.Class getBeanClass()
Returns the bean class instance of this container.

Returns:
instance of the Enterprise bean class.

createBeanClassInstance

public java.lang.Object createBeanClassInstance()
                                         throws java.lang.Exception
Returns a new instance of the bean class or a subclass of the bean class. This factory style method is speciffically used by a container to supply an implementation of the abstract accessors in EJB2.0, but could be usefull in other situations. This method should ALWAYS be used instead of getBeanClass().newInstance();

Returns:
the new instance
Throws:
java.lang.Exception
See Also:
Class.newInstance()

getJmxName

public ObjectName (src)  getJmxName()
Build a JMX name using the pattern jboss.j2ee:service=EJB,jndiName=[jndiName] where the [jndiName] is either the bean remote home JNDI binding, or the local home JNDI binding if the bean has no remote interfaces.


getTimerService

public TimerService (src)  getTimerService(java.lang.Object pKey)
                             throws java.lang.IllegalStateException
Creates the single Timer Servic for this container if not already created

Parameters:
pKey - Bean id
Returns:
Container Timer Service
Throws:
java.lang.IllegalStateException - If the type of EJB is not allowed to use the timer service
See Also:
EJBContext.getTimerService()

removeTimerService

public void removeTimerService(java.lang.Object pKey)
                        throws java.lang.IllegalStateException
Removes Timer Servic for this container

Parameters:
pKey - Bean id
Throws:
java.lang.IllegalStateException - If the type of EJB is not allowed to use the timer service

createService

protected void createService()
                      throws java.lang.Exception
The EJBDeployer calls this method. The EJBDeployer has set all the plugins and interceptors that this bean requires and now proceeds to initialize the chain. The method looks for the standard classes in the URL, sets up the naming environment of the bean. The concrete container classes should override this method to introduce implementation specific initialization behaviour.

Overrides:
createService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception - if loading the bean class failed (ClassNotFoundException) or setting up "java:" naming environment failed (DeploymentException)

startService

protected void startService()
                     throws java.lang.Exception
A default implementation of starting the container service. The container registers it's dynamic MBean interface in the JMX base. The concrete container classes should override this method to introduce implementation specific start behaviour. todo implement the service lifecycle methods in an xmbean interceptor so non lifecycle managed ops are blocked when mbean is not started.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception - An exception that occured during start

stopService

protected void stopService()
                    throws java.lang.Exception
A default implementation of stopping the container service (no-op). The concrete container classes should override this method to introduce implementation specific stop behaviour.

Overrides:
stopService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

destroyService

protected void destroyService()
                       throws java.lang.Exception
A default implementation of destroying the container service (no-op). The concrete container classes should override this method to introduce implementation specific destroy behaviour.

Overrides:
destroyService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

internalInvokeHome

public abstract java.lang.Object internalInvokeHome(Invocation (src)  mi)
                                             throws java.lang.Exception
This method is called when a method call comes in on the Home object. The Container forwards this call to the interceptor chain for further processing.

Parameters:
mi - the object holding all info about this invocation
Returns:
the result of the home invocation
Throws:
java.lang.Exception

internalInvoke

public abstract java.lang.Object internalInvoke(Invocation (src)  mi)
                                         throws java.lang.Exception
This method is called when a method call comes in on an EJBObject. The Container forwards this call to the interceptor chain for further processing.

Throws:
java.lang.Exception

addInterceptor

public abstract void addInterceptor(Interceptor (src)  in)

invoke

public java.lang.Object invoke(Invocation (src)  mi)
                        throws java.lang.Exception
The detached invoker operation.

Parameters:
mi - - the method invocation context
Returns:
the value of the ejb invocation
Throws:
java.lang.Exception - on error

getMessageDestination

public MessageDestinationMetaData (src)  getMessageDestination(java.lang.String link)