org.jboss.ejb
Class SessionContainer

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

public abstract class SessionContainer
extends Container (src)

Container dedicated to session beans. Contains factored out redundancies between stateless and stateful treatments, because (extending the spec) we would like to also support stateful web services.

Since:
30.10.2003

Nested Class Summary
 
Nested classes inherited from class org.jboss.ejb.Container (src)
Container.AbstractContainerInterceptor (src)
 
Field Summary
protected  java.util.Map beanMapping
          These are the mappings between the remote interface methods and the bean methods.
protected  java.util.Map homeMapping
          These are the mappings between the home interface methods and the container methods.
protected  InstancePool (src) instancePool
          This is the instancepool that is to be used
protected  Interceptor (src) interceptor
          This is the first interceptor in the chain.
protected  java.lang.Class serviceEndpoint
          this is the service endpoint class
 
Fields inherited from class org.jboss.ejb.Container (src)
BASE_EJB_CONTAINER_NAME, beanClass, classLoader, createCount, EJB_CONTAINER_QUERY_NAME, EJB_TIMEOUT, ejbModule, EJBOBJECT_REMOVE, homeInterface, invokeStats, jaccContextID, localClassLoader, localHomeInterface, localInterface, localProxyFactory, lockManager, marshalledInvocationMapping, metaData, ORB_NAME, proxyFactories, proxyFactoryTL, remoteInterface, removeCount, rm, securityProxy, sm, tm, webClassLoader
 
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
SessionContainer()
           
 
Method Summary
 void addInterceptor(Interceptor (src)  in)
          add an additional interceptor to the chain
protected  void checkCoherency()
           
protected  void createInstanceCache()
          no instance cache per default
protected  void createInstancePool()
          creates a new instance pool
protected  void createInterceptors()
          Initialize the interceptors by calling the chain
protected  void createInvokers()
          creates the invokers
protected  void createPersistenceManager()
          no persistence manager per default
protected  void createService()
          The EJBDeployer calls this method.
protected  void destroyInstanceCache()
           
protected  void destroyInstancePool()
           
protected  void destroyInterceptors()
           
protected  void destroyInvokers()
           
protected  void destroyMarshalledInvocationMapping()
           
protected  void destroyPersistenceManager()
           
protected  void destroyService()
          A default implementation of destroying the container service (no-op).
protected  java.util.Map getBeanMapping()
          needed for sub-inner-class access (old jdk compiler bug)
 EJBHome (src) getEJBHome(Invocation (src)  mi)
           
 EJBLocalHome (src) getEJBLocalHome(Invocation (src)  mi)
           
 EJBMetaData (src) getEJBMetaDataHome()
           
 EJBMetaData (src) getEJBMetaDataHome(Invocation (src)  mi)
           
 Handle (src) getHandle(Invocation (src)  mi)
          While the following methods are implemented in the client in the case of JRMP we would need to implement them to fully support other transport protocols
 HomeHandle (src) getHomeHandleHome()
           
 HomeHandle (src) getHomeHandleHome(Invocation (src)  mi)
           
protected  java.util.Map getHomeMapping()
          needed for sub-inner-class access (old jdk compiler bug)
 InstancePool (src) getInstancePool()
          return instance pool
 Interceptor (src) getInterceptor()
          return first interceptor
 LocalProxyFactory (src) getLocalProxyFactory()
          return local proxy factory
 java.lang.Object getPrimaryKey()
           
 java.lang.Object getPrimaryKey(Invocation (src)  mi)
           
 java.lang.Class getServiceEndpoint()
          return service endpoint
 java.lang.Object internalInvoke(Invocation (src)  mi)
          This method does invocation interpositioning of tx and security, retrieves the instance from an object table, and invokes the method on the particular instance
 java.lang.Object internalInvokeHome(Invocation (src)  mi)
          This method is called when a method call comes in on the Home object.
 boolean isIdentical(Invocation (src)  mi)
           
 void setInstancePool(InstancePool (src)  ip)
          set the instance pool
protected  void setupBeanMapping()
          build bean mappings for application logic
protected  void setUpBeanMappingImpl(java.util.Map map, java.lang.reflect.Method[] methods, java.lang.String declaringClass)
          loop through methods and setup mapping
protected abstract  void setupHomeMapping()
          how home methods are treated by container
protected  void setupMarshalledInvocationMapping()
          sets up marshalled invocation mappings
protected  void startInstanceCache()
          no instance cache per default
protected  void startInstancePool()
          Start pool
protected  void startInterceptors()
          Start all interceptors in the chain
protected  void startInvokers()
          Start container invokers
protected  void startPersistenceManager()
          no persistence manager per default
protected  void startService()
          A default implementation of starting the container service.
protected  void stopInstanceCache()
          no instance cache
protected  void stopInstancePool()
          Stop pool
protected  void stopInterceptors()
          Stop all interceptors in the chain
protected  void stopInvokers()
          Stop container invoker
protected  void stopPersistenceManager()
          no persistence
protected  void stopService()
          A default implementation of stopping the container service (no-op).
 
Methods inherited from class org.jboss.ejb.Container (src)
addProxyFactory, createBeanClassInstance, getBeanClass, getBeanMetaData, getClassLoader, getCreateCount, getDeploymentInfo, getEjbModule, getEnvContext, getHomeClass, getInvokeStats, getJaccContextID, getJmxName, getLocalClass, getLocalClassLoader, getLocalHomeClass, getLockManager, getMessageDestination, getMethodPermissions, getProxyFactory, getRealmMapping, getRemoteClass, getRemoveCount, getSecurityManager, getSecurityProxy, getTimerService, getTransactionManager, getWebClassLoader, invoke, isCallByValue, lookupProxyFactory, removeTimerService, setBeanMetaData, setClassLoader, setDeploymentInfo, setEjbModule, setJaccContextID, setLocalClassLoader, setLockManager, setProxyFactory, setRealmMapping, setSecurityManager, setSecurityProxy, setTransactionManager, setWebClassLoader
 
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

homeMapping

protected java.util.Map homeMapping
These are the mappings between the home interface methods and the container methods.


beanMapping

protected java.util.Map beanMapping
These are the mappings between the remote interface methods and the bean methods.


interceptor

protected Interceptor (src)  interceptor
This is the first interceptor in the chain. The last interceptor must be provided by the container itself


serviceEndpoint

protected java.lang.Class serviceEndpoint
this is the service endpoint class


instancePool

protected InstancePool (src)  instancePool
This is the instancepool that is to be used

Constructor Detail

SessionContainer

public SessionContainer()
Method Detail

setInstancePool

public void setInstancePool(InstancePool (src)  ip)
set the instance pool


getInstancePool

public InstancePool (src)  getInstancePool()
return instance pool


getLocalProxyFactory

public LocalProxyFactory (src)  getLocalProxyFactory()
return local proxy factory


addInterceptor

public void addInterceptor(Interceptor (src)  in)
add an additional interceptor to the chain

Specified by:
addInterceptor in class Container (src)

getInterceptor

public Interceptor (src)  getInterceptor()
return first interceptor


getServiceEndpoint

public java.lang.Class getServiceEndpoint()
return service endpoint


createService

protected void createService()
                      throws java.lang.Exception
Description copied from class: Container (src)
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 Container (src)
Throws:
java.lang.Exception - if loading the bean class failed (ClassNotFoundException) or setting up "java:" naming environment failed (DeploymentException)

setupHomeMapping

protected abstract void setupHomeMapping()
                                  throws java.lang.Exception
how home methods are treated by container

Throws:
java.lang.Exception

setUpBeanMappingImpl

protected void setUpBeanMappingImpl(java.util.Map map,
                                    java.lang.reflect.Method[] methods,
                                    java.lang.String declaringClass)
                             throws java.lang.NoSuchMethodException
loop through methods and setup mapping

Throws:
java.lang.NoSuchMethodException

setupBeanMapping

protected void setupBeanMapping()
                         throws java.lang.NoSuchMethodException
build bean mappings for application logic

Throws:
java.lang.NoSuchMethodException

setupMarshalledInvocationMapping

protected void setupMarshalledInvocationMapping()
                                         throws java.lang.Exception
sets up marshalled invocation mappings

Throws:
java.lang.Exception

checkCoherency

protected void checkCoherency()
                       throws java.lang.Exception
Throws:
java.lang.Exception

createInstancePool

protected void createInstancePool()
                           throws java.lang.Exception
creates a new instance pool

Throws:
java.lang.Exception

createInstanceCache

protected void createInstanceCache()
                            throws java.lang.Exception
no instance cache per default

Throws:
java.lang.Exception

createInvokers

protected void createInvokers()
                       throws java.lang.Exception
creates the invokers

Throws:
java.lang.Exception

createInterceptors

protected void createInterceptors()
                           throws java.lang.Exception
Initialize the interceptors by calling the chain

Throws:
java.lang.Exception

createPersistenceManager

protected void createPersistenceManager()
                                 throws java.lang.Exception
no persistence manager per default

Throws:
java.lang.Exception

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: Container (src)
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 Container (src)
Throws:
java.lang.Exception - An exception that occured during start

startPersistenceManager

protected void startPersistenceManager()
                                throws java.lang.Exception
no persistence manager per default

Throws:
java.lang.Exception

startInstanceCache

protected void startInstanceCache()
                           throws java.lang.Exception
no instance cache per default

Throws:
java.lang.Exception

startInvokers

protected void startInvokers()
                      throws java.lang.Exception
Start container invokers

Throws:
java.lang.Exception

startInstancePool

protected void startInstancePool()
                          throws java.lang.Exception
Start pool

Throws:
java.lang.Exception

startInterceptors

protected void startInterceptors()
                          throws java.lang.Exception
Start all interceptors in the chain

Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Description copied from class: Container (src)
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 Container (src)
Throws:
java.lang.Exception

stopInterceptors

protected void stopInterceptors()
Stop all interceptors in the chain


stopPersistenceManager

protected void stopPersistenceManager()
no persistence


stopInstancePool

protected void stopInstancePool()
Stop pool


stopInstanceCache

protected void stopInstanceCache()
no instance cache


stopInvokers

protected void stopInvokers()
Stop container invoker


destroyService

protected void destroyService()
                       throws java.lang.Exception
Description copied from class: Container (src)
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 Container (src)
Throws:
java.lang.Exception

destroyMarshalledInvocationMapping

protected void destroyMarshalledInvocationMapping()

destroyInterceptors

protected void destroyInterceptors()

destroyPersistenceManager

protected void destroyPersistenceManager()

destroyInstancePool

protected void destroyInstancePool()

destroyInstanceCache

protected void destroyInstanceCache()

destroyInvokers

protected void destroyInvokers()

internalInvokeHome

public java.lang.Object internalInvokeHome(Invocation (src)  mi)
                                    throws java.lang.Exception
Description copied from class: Container (src)
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.

Specified by:
internalInvokeHome in class Container (src)
Parameters:
mi - the object holding all info about this invocation
Returns:
the result of the home invocation
Throws:
java.lang.Exception

internalInvoke

public java.lang.Object internalInvoke(Invocation (src)  mi)
                                throws java.lang.Exception
This method does invocation interpositioning of tx and security, retrieves the instance from an object table, and invokes the method on the particular instance

Specified by:
internalInvoke in class Container (src)
Throws:
java.lang.Exception

getHandle

public Handle (src)  getHandle(Invocation (src)  mi)
                 throws java.rmi.RemoteException
While the following methods are implemented in the client in the case of JRMP we would need to implement them to fully support other transport protocols

Returns:
Always null
Throws:
java.rmi.RemoteException

getPrimaryKey

public java.lang.Object getPrimaryKey(Invocation (src)  mi)
                               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getPrimaryKey

public java.lang.Object getPrimaryKey()
                               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getEJBHome

public EJBHome (src)  getEJBHome(Invocation (src)  mi)
                   throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

isIdentical

public boolean isIdentical(Invocation (src)  mi)
                    throws java.rmi.RemoteException
Returns:
Always false
Throws:
java.rmi.RemoteException

getEJBMetaDataHome

public EJBMetaData (src)  getEJBMetaDataHome(Invocation (src)  mi)
                               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getEJBMetaDataHome

public EJBMetaData (src)  getEJBMetaDataHome()
                               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getHomeHandleHome

public HomeHandle (src)  getHomeHandleHome(Invocation (src)  mi)
                             throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getHomeHandleHome

public HomeHandle (src)  getHomeHandleHome()
                             throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getEJBLocalHome

public EJBLocalHome (src)  getEJBLocalHome(Invocation (src)  mi)

getHomeMapping

protected java.util.Map getHomeMapping()
needed for sub-inner-class access (old jdk compiler bug)

Returns:

getBeanMapping

protected java.util.Map getBeanMapping()
needed for sub-inner-class access (old jdk compiler bug)

Returns: