org.jboss.ejb3.session
Class SessionContainer

java.lang.Object
  extended by org.jboss.ejb3.EJBContainer
      extended by org.jboss.ejb3.session.SessionContainer
All Implemented Interfaces:
Container, 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, ExtendedInjectionContainer, InjectionContainer
Direct Known Subclasses:
ServiceContainer, SessionSpecContainer

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

Comment

Version:
$Revision: 87604 $
Author:
Bill Burke

Field Summary
protected  ProxyDeployer proxyDeployer
           
 
Fields inherited from class org.jboss.ejb3.EJBContainer
assembly, beanClassName, classloader, defaultConstructorIndex, ejbName, enc, encFactory, encInjections, encInjectors, ENTITY_MANAGER_FACTORY, initialContextProperties, injectors, invokeStats, MANAGED_ENTITY_MANAGER_FACTORY, objectName, pool, reinitialize, xml
 
Fields inherited from interface org.jboss.ejb3.Container
ENC_CTX_NAME
 
Constructor Summary
SessionContainer(ClassLoader cl, String beanClassName, String ejbName, org.jboss.aop.Domain domain, Hashtable ctxProperties, Ejb3Deployment deployment, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData beanMetaData)
           
 
Method Summary
protected  Throwable constructProperNoSuchEjbException(javax.ejb.NoSuchEJBException original, 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.
 Serializable createSession()
           
abstract  Serializable createSession(Class<?>[] initParameterTypes, Object[] initParameterValues)
          Create session to an EJB bean.
protected  void destroySession(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
 Map<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).
protected  org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase getJndiRegistrar()
          Obtains the JndiSessionRegistrarBase from MC, null if not found
protected abstract  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(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.
 List<Method> getVirtualMethods()
          Do not call, used by BeanContainer.
 boolean hasJNDIBinding(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.
 Object invoke(org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory factory, Object id, Method method, Object[] args)
          Deprecated. Use "invoke" as defined by InvokableContext
protected  Object invokeEJBObjectMethod(Object id, org.jboss.aop.MethodInfo info, Object[] args)
           
 boolean isSessionAware()
          Designates that this Container is not session-aware.
abstract  Object localHomeInvoke(Method method, Object[] args)
           
abstract  Object localInvoke(Object id, Method method, Object[] args)
           
protected  void lockedStart()
           
protected  void lockedStop()
           
static org.jboss.aop.joinpoint.InvocationResponse marshallException(org.jboss.aop.joinpoint.Invocation invocation, Throwable exception, Map responseContext)
           
static org.jboss.aop.joinpoint.InvocationResponse marshallResponse(org.jboss.aop.joinpoint.Invocation invocation, Object rtn, 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  List<Class<?>> resolveBusinessInterfaces()
           
 void setJndiRegistrar(org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase jndiRegistrar)
           
 
Methods inherited from class org.jboss.ejb3.EJBContainer
checkForDuplicateLocalAndRemoteInterfaces, construct, create, createBeanContext, createInterceptor, createObjectName, createObjectName, destroy, destroyBeanContext, findPartitionName, getAdvisor, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotations, getAssemblyDescriptor, getBeanClass, getBeanClassName, getBeanContainer, getBusinessInterfaces, getBusinessObject, getCachedConnectionManager, getClassloader, getClazz, getDependencyPolicy, getDeployment, getDeploymentDescriptorType, getDeploymentPropertyListString, getDeploymentQualifiedName, getDeploymentUnit, getEJBContainer, getEjbJndiName, getEjbJndiName, getEjbName, getEnc, getEncInjections, getEncInjectors, getEnvironmentRefGroup, getHandledCallbacks, getIdentifier, getInitialContext, getInitialContextProperties, getInjectors, getInterceptorRepository, getInvocationLock, getInvokedBusinessInterface, getInvokedInterface, getInvokeStats, getJaccContextId, getMethodInfo, getModule, getName, getNonBridgeMethod, getObjectName, getPartitionName, getPool, getRootFile, getSecurityManager, getTimeoutCallback, getXml, initializePool, injectBeanContext, invokeCallback, invokeInit, invokePostActivate, invokePostConstruct, invokePostConstruct, invokePreDestroy, invokePrePassivate, isAnnotationPresent, isBusinessMethod, isClustered, peekContext, popContext, popEnc, processMetadata, pushContext, pushEnc, reinitialize, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveEjbContainer, resolveEjbContainer, resolveInjectors, resolveMessageDestination, resolvePersistenceUnitSupplier, setAssemblyDescriptor, setCachedConnectionManager, setDirectContainer, setJaccContextId, 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.Container
getMBean, getTimerService, getTimerService
 

Field Detail

proxyDeployer

protected ProxyDeployer proxyDeployer
Constructor Detail

SessionContainer

public SessionContainer(ClassLoader cl,
                        String beanClassName,
                        String ejbName,
                        org.jboss.aop.Domain domain,
                        Hashtable ctxProperties,
                        Ejb3Deployment deployment,
                        org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData beanMetaData)
                 throws ClassNotFoundException
Throws:
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(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 Throwable
Entry point for remoting-based invocations via InvokableContextClassProxyHack

Specified by:
dynamicInvoke in interface org.jboss.ejb3.proxy.spi.container.InvokableContext
Throws:
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 List<Class<?>> resolveBusinessInterfaces()
Specified by:
resolveBusinessInterfaces in class EJBContainer

lockedStart

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

registerWithAopDispatcher

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


getClusterFamilies

public Map<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 Exception
Overrides:
lockedStop in class EJBContainer
Throws:
Exception

getVirtualMethods

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

Overrides:
getVirtualMethods in class EJBContainer
Returns:

getJndiRegistrarBindName

protected abstract 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,
                                                                           Throwable exception,
                                                                           Map responseContext)
                                                                    throws Throwable
Throws:
Throwable

marshallResponse

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

invoke

@Deprecated
public Object invoke(org.jboss.ejb3.proxy.impl.factory.session.SessionProxyFactory factory,
                                Object id,
                                Method method,
                                Object[] args)
              throws 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:
Throwable

createSession

public abstract Serializable createSession(Class<?>[] initParameterTypes,
                                           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 Object localInvoke(Object id,
                                   Method method,
                                   Object[] args)
                            throws Throwable
Throws:
Throwable

localHomeInvoke

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

createSession

public Serializable createSession()

destroySession

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

Parameters:
id - the identifier of the session

hasJNDIBinding

public boolean hasJNDIBinding(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 Object invokeEJBObjectMethod(Object id,
                                       org.jboss.aop.MethodInfo info,
                                       Object[] args)
                                throws Exception
Throws:
Exception

constructProperNoSuchEjbException

protected Throwable constructProperNoSuchEjbException(javax.ejb.NoSuchEJBException original,
                                                      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 Exception
Throws:
Exception

getSessionFactory

public org.jboss.ejb3.endpoint.SessionFactory getSessionFactory()
                                                         throws 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:
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()


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.