org.jboss.ejb3.session
Class SessionContainer

java.lang.Object
  extended by org.jboss.ejb3.EJBContainer
      extended by org.jboss.ejb3.TimerServiceContainer
          extended by org.jboss.ejb3.session.SessionContainer
All Implemented Interfaces:
Container, org.jboss.ejb3.context.spi.BeanManager, org.jboss.ejb3.context.spi.SessionBeanManager, org.jboss.ejb3.endpoint.Endpoint, org.jboss.ejb3.interceptors.direct.IndirectContainer<EJBContainer,org.jboss.ejb3.interceptors.direct.DirectContainer<EJBContainer>>, JavaEEComponent, org.jboss.ejb3.proxy.spi.container.InvokableContext, EJBInjectionContainer, ExtendedInjectionContainer, InjectionContainer
Direct Known Subclasses:
ServiceContainer, SessionSpecContainer

public abstract class SessionContainer
extends TimerServiceContainer
implements org.jboss.ejb3.proxy.spi.container.InvokableContext, org.jboss.ejb3.endpoint.Endpoint, org.jboss.ejb3.context.spi.SessionBeanManager

Comment


Field Summary
protected  ProxyDeployer proxyDeployer
           
 
Fields inherited from class org.jboss.ejb3.TimerServiceContainer
timerService
 
Fields inherited from class org.jboss.ejb3.EJBContainer
assembly, beanClassName, classloader, ejbName, enc, encFactory, encInjections, encInjectors, ENTITY_MANAGER_FACTORY, initialContextProperties, injectors, invokeStats, MANAGED_ENTITY_MANAGER_FACTORY, metadataBasedAnnotationRepo, objectName, pool, reinitialize, xml
 
Fields inherited from interface org.jboss.ejb3.Container
ENC_CTX_NAME
 
Constructor Summary
SessionContainer(java.lang.ClassLoader cl, java.lang.String beanClassName, java.lang.String ejbName, org.jboss.aop.Domain domain, java.util.Hashtable ctxProperties, Ejb3Deployment deployment, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData beanMetaData)
           
SessionContainer(java.lang.ClassLoader cl, java.lang.String beanClassName, java.lang.String ejbName, org.jboss.aop.Domain domain, java.util.Hashtable ctxProperties, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData beanMetaData)
           
 
Method Summary
protected  java.lang.Throwable constructProperNoSuchEjbException(javax.ejb.NoSuchEJBException original, java.lang.String invokingClassName)
          Obtains the proper Exception to return to the caller in the event a "remove" call is made on a bean that doesn't exist.
 java.io.Serializable createSession()
           
abstract  java.io.Serializable createSession(java.lang.Class<?>[] initParameterTypes, java.lang.Object[] initParameterValues)
          Create session to an EJB bean.
protected  void destroySession(java.lang.Object id)
          Destroy a created session.
abstract  org.jboss.aop.joinpoint.InvocationResponse dynamicInvoke(org.jboss.aop.joinpoint.Invocation invocation)
          Entry point for remoting-based invocations via InvokableContextClassProxyHack
<T> T
getBusinessObject(org.jboss.ejb3.context.spi.SessionContext ctx, java.lang.Class<T> businessInterface)
          
 java.util.Map<java.lang.String,org.jboss.ha.framework.server.HATarget> getClusterFamilies()
          This gets called by replicants manager interceptor factory during the initialization of the bean container (during construction of EJBContainer).
 javax.ejb.EJBLocalObject getEJBLocalObject(org.jboss.ejb3.context.spi.SessionContext ctx)
          
 javax.ejb.EJBObject getEJBObject(org.jboss.ejb3.context.spi.SessionContext ctx)
          
protected  org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase getJndiRegistrar()
          Obtains the JndiSessionRegistrarBase from MC, null if not found
protected abstract  java.lang.String getJndiRegistrarBindName()
          Returns the name under which the JNDI Registrar for this container is bound
 org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData getMetaData()
           
protected  org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory getProxyFactory(org.jboss.ejb3.annotation.LocalBinding binding)
           
protected  org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory getProxyFactory(org.jboss.ejb3.annotation.RemoteBinding binding)
           
protected  org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory getProxyFactory(java.lang.String proxyFactoryRegistryBindName)
          Obtains the proxy factory bound at the specified registry name
protected  org.jboss.ejb3.annotation.RemoteBinding getRemoteBinding()
          Deprecated. Non-deterministic, more than one binding may be specified for this container
 org.jboss.ejb3.endpoint.SessionFactory getSessionFactory()
          Base implementation, assumes that this Container is not session-aware.
 java.util.List<java.lang.reflect.Method> getVirtualMethods()
          Do not call, used by BeanContainer.
 boolean hasJNDIBinding(java.lang.String jndiName)
          Checks if this session bean binds to the given JNDI name.
 void instantiated()
          After XML processing has been done this allows the container to further initialize the meta data.
 java.lang.Object invoke(org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory factory, java.lang.Object id, java.lang.reflect.Method method, java.lang.Object[] args)
          Deprecated. Use "invoke" as defined by InvokableContext
protected  java.lang.Object invokeEJBObjectMethod(java.lang.Object id, org.jboss.aop.MethodInfo info, java.lang.Object[] args)
           
protected  void invokeSetSessionContext(BeanContext beanCtx)
          EJB3 spec states that if a session bean implements the SessionBean interface then the container should invoke SessionBean.setSessionContext(javax.ejb.SessionContext) to associate a session context with the bean instance.
 boolean isSessionAware()
          Designates that this Container is not session-aware.
abstract  java.lang.Object localHomeInvoke(java.lang.reflect.Method method, java.lang.Object[] args)
           
abstract  java.lang.Object localInvoke(java.lang.Object id, java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  void lockedStart()
           
protected  void lockedStop()
          Suspends the TimerService associated with this container.
static org.jboss.aop.joinpoint.InvocationResponse marshallException(org.jboss.aop.joinpoint.Invocation invocation, java.lang.Throwable exception, java.util.Map responseContext)
           
static org.jboss.aop.joinpoint.InvocationResponse marshallResponse(org.jboss.aop.joinpoint.Invocation invocation, java.lang.Object rtn, java.util.Map responseContext)
           
protected  StatefulContainerInvocation populateInvocation(StatefulContainerInvocation invocation)
          Allow a container sub class to supplement an invocation.
protected  void registerWithAopDispatcher()
          Registers this Container with Remoting / AOP Dispatcher
protected abstract  void removeHandle(javax.ejb.Handle handle)
           
protected  java.util.List<java.lang.Class<?>> resolveBusinessInterfaces()
           
 void setJndiRegistrar(org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase jndiRegistrar)
           
 
Methods inherited from class org.jboss.ejb3.TimerServiceContainer
afterStart, create, getTimedObjectInvoker, getTimerService, getTimerService, setTimerServiceFactory
 
Methods inherited from class org.jboss.ejb3.EJBContainer
canResolveEJB, checkForDuplicateLocalAndRemoteInterfaces, construct, createBeanContext, createInterceptor, createObjectName, createObjectName, destroy, destroyBeanContext, findPartitionName, getAdvisor, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotations, getApplicationException, getAssemblyDescriptor, getBeanClass, getBeanClassName, getBeanContainer, getBeanInstantiator, getBusinessAndComponentInterfaces, getBusinessObject, getCachedConnectionManager, getClassloader, getClazz, getDependencyPolicy, getDeployment, getDeploymentDescriptorType, getDeploymentPropertyListString, getDeploymentQualifiedName, getDeploymentUnit, getEffigy, getEJBContainer, getEJBHome, getEjbJndiName, getEjbJndiName, getEJBLocalHome, getEjbName, getEnc, getEncInjections, getEncInjectors, getEnvironmentRefGroup, getHandledCallbacks, getIdentifier, getInitialContext, getInitialContextProperties, getInjectionHandlers, getInjectors, getInterceptorClasses, getInterceptorInjectors, getInterceptorRepository, getInterceptors, getInvocationLock, getInvokedBusinessInterface, getInvokedInterface, getInvokeStats, getJaccContextId, getMetaDataBasedAnnotationRepository, getMethodInfo, getModule, getName, getNonBridgeMethod, getObjectName, getPartitionName, getPool, getRollbackOnly, getRootFile, getSecurityManager, getTimeoutCallback, getUserTransaction, getXml, initializePool, initMetaDataBasedAnnotationRepository, injectBeanContext, invokeCallback, invokePostActivate, invokePostConstruct, invokePostConstruct, invokePreDestroy, invokePrePassivate, isAnnotationPresent, isBusinessMethod, isCallerInRole, isClustered, lookup, peekContext, popContext, popEnc, processMetadata, pushContext, pushEnc, reinitialize, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveEJB, resolveEjbContainer, resolveEjbContainer, resolveInjectors, resolveMessageDestination, resolvePersistenceUnitSupplier, setAssemblyDescriptor, setBeanInstantiator, setCachedConnectionManager, setDirectContainer, setEjbEncFactory, setInjectionManager, setJaccContextId, setRollbackOnly, setTransactionManager, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.ejb3.proxy.spi.container.InvokableContext
invoke
 
Methods inherited from interface org.jboss.ejb3.endpoint.Endpoint
invoke
 
Methods inherited from interface org.jboss.ejb3.context.spi.BeanManager
getEJBHome, getEJBLocalHome, getRollbackOnly, getTimerService, getUserTransaction, isCallerInRole, lookup, setRollbackOnly
 
Methods inherited from interface org.jboss.ejb3.Container
getMBean
 

Field Detail

proxyDeployer

protected ProxyDeployer proxyDeployer
Constructor Detail

SessionContainer

public SessionContainer(java.lang.ClassLoader cl,
                        java.lang.String beanClassName,
                        java.lang.String ejbName,
                        org.jboss.aop.Domain domain,
                        java.util.Hashtable ctxProperties,
                        Ejb3Deployment deployment,
                        org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData beanMetaData)
                 throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

SessionContainer

public SessionContainer(java.lang.ClassLoader cl,
                        java.lang.String beanClassName,
                        java.lang.String ejbName,
                        org.jboss.aop.Domain domain,
                        java.util.Hashtable ctxProperties,
                        org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData beanMetaData)
                 throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException
Method Detail

getRemoteBinding

@Deprecated
protected org.jboss.ejb3.annotation.RemoteBinding getRemoteBinding()
Deprecated. Non-deterministic, more than one binding may be specified for this container

Returns a remote binding for this container

Returns:

getProxyFactory

protected org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory getProxyFactory(org.jboss.ejb3.annotation.LocalBinding binding)

getProxyFactory

protected org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory getProxyFactory(org.jboss.ejb3.annotation.RemoteBinding binding)

getProxyFactory

protected org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory getProxyFactory(java.lang.String proxyFactoryRegistryBindName)
Obtains the proxy factory bound at the specified registry name

Parameters:
proxyFactoryRegistryBindName -
Returns:

dynamicInvoke

public abstract org.jboss.aop.joinpoint.InvocationResponse dynamicInvoke(org.jboss.aop.joinpoint.Invocation invocation)
                                                                  throws java.lang.Throwable
Entry point for remoting-based invocations via InvokableContextClassProxyHack

Specified by:
dynamicInvoke in interface org.jboss.ejb3.proxy.spi.container.InvokableContext
Throws:
java.lang.Throwable

getMetaData

public org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData getMetaData()

instantiated

public void instantiated()
Description copied from class: EJBContainer
After XML processing has been done this allows the container to further initialize the meta data.

Overrides:
instantiated in class EJBContainer

resolveBusinessInterfaces

protected java.util.List<java.lang.Class<?>> resolveBusinessInterfaces()
Specified by:
resolveBusinessInterfaces in class EJBContainer

lockedStart

protected void lockedStart()
                    throws java.lang.Exception
Overrides:
lockedStart in class EJBContainer
Throws:
java.lang.Exception

registerWithAopDispatcher

protected void registerWithAopDispatcher()
Registers this Container with Remoting / AOP Dispatcher


getClusterFamilies

public java.util.Map<java.lang.String,org.jboss.ha.framework.server.HATarget> getClusterFamilies()
This gets called by replicants manager interceptor factory during the initialization of the bean container (during construction of EJBContainer). So we have detached construction here.

Returns:
the cluster families, never null

lockedStop

protected void lockedStop()
                   throws java.lang.Exception
Description copied from class: TimerServiceContainer
Suspends the TimerService associated with this container.

This method skips timerservice suspension of stateful session beans

Overrides:
lockedStop in class TimerServiceContainer
Throws:
java.lang.Exception
See Also:
EJBContainer.lockedStop()

getVirtualMethods

public java.util.List<java.lang.reflect.Method> getVirtualMethods()
Description copied from class: EJBContainer
Do not call, used by BeanContainer.

Overrides:
getVirtualMethods in class EJBContainer
Returns:

getJndiRegistrarBindName

protected abstract java.lang.String getJndiRegistrarBindName()
Returns the name under which the JNDI Registrar for this container is bound

Returns:

getJndiRegistrar

protected org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase getJndiRegistrar()
Obtains the JndiSessionRegistrarBase from MC, null if not found

Returns:

setJndiRegistrar

public void setJndiRegistrar(org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase jndiRegistrar)

marshallException

public static org.jboss.aop.joinpoint.InvocationResponse marshallException(org.jboss.aop.joinpoint.Invocation invocation,
                                                                           java.lang.Throwable exception,
                                                                           java.util.Map responseContext)
                                                                    throws java.lang.Throwable
Throws:
java.lang.Throwable

marshallResponse

public static org.jboss.aop.joinpoint.InvocationResponse marshallResponse(org.jboss.aop.joinpoint.Invocation invocation,
                                                                          java.lang.Object rtn,
                                                                          java.util.Map responseContext)
                                                                   throws java.io.IOException
Throws:
java.io.IOException

invoke

@Deprecated
public java.lang.Object invoke(org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory factory,
                                          java.lang.Object id,
                                          java.lang.reflect.Method method,
                                          java.lang.Object[] args)
                        throws java.lang.Throwable
Deprecated. Use "invoke" as defined by InvokableContext

Invoke a method on the virtual EJB bean. The method must be one of the methods defined in one of the business interfaces (or home interface) of the bean. TODO: work in progress

Parameters:
factory - the originating end point
id - unique identifier (primary key), can be null for stateless
method - the business or home method to invoke
args - the arguments for the method
provider - for asynchronous usage
Throws:
java.lang.Throwable

createSession

public abstract java.io.Serializable createSession(java.lang.Class<?>[] initParameterTypes,
                                                   java.lang.Object[] initParameterValues)
Create session to an EJB bean.

Parameters:
initParameterTypes - the parameter types used by the home's create method
initParameterValues - the arguments for the home's create method
Returns:
the identifier of the session

localInvoke

public abstract java.lang.Object localInvoke(java.lang.Object id,
                                             java.lang.reflect.Method method,
                                             java.lang.Object[] args)
                                      throws java.lang.Throwable
Throws:
java.lang.Throwable

localHomeInvoke

public abstract java.lang.Object localHomeInvoke(java.lang.reflect.Method method,
                                                 java.lang.Object[] args)
                                          throws java.lang.Throwable
Throws:
java.lang.Throwable

createSession

public java.io.Serializable createSession()

destroySession

protected void destroySession(java.lang.Object id)
Destroy a created session.

Parameters:
id - the identifier of the session

hasJNDIBinding

public boolean hasJNDIBinding(java.lang.String jndiName)
Checks if this session bean binds to the given JNDI name.

Specified by:
hasJNDIBinding in interface InjectionContainer
Specified by:
hasJNDIBinding in class EJBContainer

invokeEJBObjectMethod

protected java.lang.Object invokeEJBObjectMethod(java.lang.Object id,
                                                 org.jboss.aop.MethodInfo info,
                                                 java.lang.Object[] args)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

constructProperNoSuchEjbException

protected java.lang.Throwable constructProperNoSuchEjbException(javax.ejb.NoSuchEJBException original,
                                                                java.lang.String invokingClassName)
Obtains the proper Exception to return to the caller in the event a "remove" call is made on a bean that doesn't exist. Implements EJB 3.0 Core Specification 14.3.9

Parameters:
original -
invokingClassName -
Returns:

populateInvocation

protected StatefulContainerInvocation populateInvocation(StatefulContainerInvocation invocation)
Allow a container sub class to supplement an invocation. Per default nothing to supplement.

Parameters:
invocation -
Returns:

removeHandle

protected abstract void removeHandle(javax.ejb.Handle handle)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getSessionFactory

public org.jboss.ejb3.endpoint.SessionFactory getSessionFactory()
                                                         throws java.lang.IllegalStateException
Base implementation, assumes that this Container is not session-aware. May be overridden at lower levels to support this feature.

Specified by:
getSessionFactory in interface org.jboss.ejb3.endpoint.Endpoint
Throws:
java.lang.IllegalStateException - If this Container is not session-aware
See Also:
Endpoint.getSessionFactory()

isSessionAware

public boolean isSessionAware()
Designates that this Container is not session-aware. May be overridden at lower levels to support this feature.

Specified by:
isSessionAware in interface org.jboss.ejb3.endpoint.Endpoint
See Also:
Endpoint.isSessionAware()

getBusinessObject

public <T> T getBusinessObject(org.jboss.ejb3.context.spi.SessionContext ctx,
                               java.lang.Class<T> businessInterface)
                    throws java.lang.IllegalStateException

Specified by:
getBusinessObject in interface org.jboss.ejb3.context.spi.SessionBeanManager
Throws:
java.lang.IllegalStateException

getEJBLocalObject

public javax.ejb.EJBLocalObject getEJBLocalObject(org.jboss.ejb3.context.spi.SessionContext ctx)
                                           throws java.lang.IllegalStateException

Specified by:
getEJBLocalObject in interface org.jboss.ejb3.context.spi.SessionBeanManager
Throws:
java.lang.IllegalStateException

getEJBObject

public javax.ejb.EJBObject getEJBObject(org.jboss.ejb3.context.spi.SessionContext ctx)
                                 throws java.lang.IllegalStateException

Specified by:
getEJBObject in interface org.jboss.ejb3.context.spi.SessionBeanManager
Throws:
java.lang.IllegalStateException

invokeSetSessionContext

protected void invokeSetSessionContext(BeanContext beanCtx)
                                throws javax.ejb.EJBException,
                                       java.rmi.RemoteException
EJB3 spec states that if a session bean implements the SessionBean interface then the container should invoke SessionBean.setSessionContext(javax.ejb.SessionContext) to associate a session context with the bean instance. The container calls this invokeSetSessionContext(BeanContext) method when a new BeanContext is created (typically via EJBContainer.createBeanContext()).

Parameters:
beanCtx - The BeanContext
Throws:
javax.ejb.EJBException
java.rmi.RemoteException