org.jboss.ejb
Class SessionContainer

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

public abstract class SessionContainer
extends Container

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
Version:
$Revision: 1.11 $
Author:
Christoph G. Jung

Nested Class Summary
 
Nested classes inherited from class org.jboss.ejb.Container
Container.AbstractContainerInterceptor
 
Field Summary
protected  Map beanMapping
          These are the mappings between the remote interface methods and the bean methods.
protected  Map homeMapping
          These are the mappings between the home interface methods and the container methods.
protected  InstancePool instancePool
          This is the instancepool that is to be used
protected  Interceptor interceptor
          This is the first interceptor in the chain.
protected  Class serviceEndpoint
          this is the service endpoint class
 
Fields inherited from class org.jboss.ejb.Container
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
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags
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
 
Constructor Summary
SessionContainer()
           
 
Method Summary
 void addInterceptor(Interceptor 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  Map getBeanMapping()
          needed for sub-inner-class access (old jdk compiler bug)
 javax.ejb.EJBHome getEJBHome(Invocation mi)
           
 javax.ejb.EJBLocalHome getEJBLocalHome(Invocation mi)
           
 javax.ejb.EJBMetaData getEJBMetaDataHome()
           
 javax.ejb.EJBMetaData getEJBMetaDataHome(Invocation mi)
           
 javax.ejb.Handle getHandle(Invocation 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
 javax.ejb.HomeHandle getHomeHandleHome()
           
 javax.ejb.HomeHandle getHomeHandleHome(Invocation mi)
           
protected  Map getHomeMapping()
          needed for sub-inner-class access (old jdk compiler bug)
 InstancePool getInstancePool()
          return instance pool
 Interceptor getInterceptor()
          return first interceptor
 LocalProxyFactory getLocalProxyFactory()
          return local proxy factory
 Object getPrimaryKey()
           
 Object getPrimaryKey(Invocation mi)
           
 Class getServiceEndpoint()
          return service endpoint
 Object internalInvoke(Invocation 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
 Object internalInvokeHome(Invocation mi)
          This method is called when a method call comes in on the Home object.
 boolean isIdentical(Invocation mi)
           
 void setInstancePool(InstancePool ip)
          set the instance pool
protected  void setupBeanMapping()
          build bean mappings for application logic
protected  void setUpBeanMappingImpl(Map map, Method[] methods, 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
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
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
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

homeMapping

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


beanMapping

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


interceptor

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


serviceEndpoint

protected Class serviceEndpoint
this is the service endpoint class


instancePool

protected InstancePool instancePool
This is the instancepool that is to be used

Constructor Detail

SessionContainer

public SessionContainer()
Method Detail

setInstancePool

public void setInstancePool(InstancePool ip)
set the instance pool


getInstancePool

public InstancePool getInstancePool()
return instance pool


getLocalProxyFactory

public LocalProxyFactory getLocalProxyFactory()
return local proxy factory


addInterceptor

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

Specified by:
addInterceptor in class Container

getInterceptor

public Interceptor getInterceptor()
return first interceptor


getServiceEndpoint

public Class getServiceEndpoint()
return service endpoint


createService

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

setupHomeMapping

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

Throws:
Exception

setUpBeanMappingImpl

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

Throws:
NoSuchMethodException

setupBeanMapping

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

Throws:
NoSuchMethodException

setupMarshalledInvocationMapping

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

Throws:
Exception

checkCoherency

protected void checkCoherency()
                       throws Exception
Throws:
Exception

createInstancePool

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

Throws:
Exception

createInstanceCache

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

Throws:
Exception

createInvokers

protected void createInvokers()
                       throws Exception
creates the invokers

Throws:
Exception

createInterceptors

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

Throws:
Exception

createPersistenceManager

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

Throws:
Exception

startService

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

startPersistenceManager

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

Throws:
Exception

startInstanceCache

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

Throws:
Exception

startInvokers

protected void startInvokers()
                      throws Exception
Start container invokers

Throws:
Exception

startInstancePool

protected void startInstancePool()
                          throws Exception
Start pool

Throws:
Exception

startInterceptors

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

Throws:
Exception

stopService

protected void stopService()
                    throws Exception
Description copied from class: Container
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
Throws:
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 Exception
Description copied from class: Container
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
Throws:
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 Object internalInvokeHome(Invocation mi)
                          throws Exception
Description copied from class: Container
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
Parameters:
mi - the object holding all info about this invocation
Returns:
the result of the home invocation
Throws:
Exception

internalInvoke

public Object internalInvoke(Invocation mi)
                      throws 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
Throws:
Exception

getHandle

public javax.ejb.Handle getHandle(Invocation mi)
                           throws 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:
RemoteException

getPrimaryKey

public Object getPrimaryKey(Invocation mi)
                     throws RemoteException
Throws:
RemoteException

getPrimaryKey

public Object getPrimaryKey()
                     throws RemoteException
Throws:
RemoteException

getEJBHome

public javax.ejb.EJBHome getEJBHome(Invocation mi)
                             throws RemoteException
Throws:
RemoteException

isIdentical

public boolean isIdentical(Invocation mi)
                    throws RemoteException
Returns:
Always false
Throws:
RemoteException

getEJBMetaDataHome

public javax.ejb.EJBMetaData getEJBMetaDataHome(Invocation mi)
                                         throws RemoteException
Throws:
RemoteException

getEJBMetaDataHome

public javax.ejb.EJBMetaData getEJBMetaDataHome()
                                         throws RemoteException
Throws:
RemoteException

getHomeHandleHome

public javax.ejb.HomeHandle getHomeHandleHome(Invocation mi)
                                       throws RemoteException
Throws:
RemoteException

getHomeHandleHome

public javax.ejb.HomeHandle getHomeHandleHome()
                                       throws RemoteException
Throws:
RemoteException

getEJBLocalHome

public javax.ejb.EJBLocalHome getEJBLocalHome(Invocation mi)

getHomeMapping

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

Returns:

getBeanMapping

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

Returns:


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.