org.jboss.ejb3.mdb
Class MessagingContainer

java.lang.Object
  extended by org.jboss.ejb3.EJBContainer
      extended by org.jboss.ejb3.TimerServiceContainer
          extended by org.jboss.ejb3.mdb.MessagingContainer
All Implemented Interfaces:
Container, org.jboss.ejb3.context.spi.BeanManager, org.jboss.ejb3.context.spi.MessageDrivenBeanManager, org.jboss.ejb3.interceptors.direct.IndirectContainer<EJBContainer,org.jboss.ejb3.interceptors.direct.DirectContainer<EJBContainer>>, JavaEEComponent, org.jboss.ejb3.timerservice.spi.MultiTimeoutMethodTimedObjectInvoker, org.jboss.ejb3.timerservice.spi.TimedObjectInvoker, EJBInjectionContainer, ExtendedInjectionContainer, InjectionContainer
Direct Known Subclasses:
ConsumerContainer, MDB

public abstract class MessagingContainer
extends TimerServiceContainer
implements org.jboss.ejb3.timerservice.spi.MultiTimeoutMethodTimedObjectInvoker, org.jboss.ejb3.context.spi.MessageDrivenBeanManager


Field Summary
protected  ActivationSpec activationSpec
           
protected static java.lang.String DEFAULT_DESTINATION_TYPE
          Default destination type.
protected static java.lang.String DESTINATION
           
protected static java.lang.String DESTINATION_TYPE
           
protected static java.lang.String JMS_ADAPTOR
           
protected static java.lang.String MAX_SESSION
           
protected  JBossMessageEndpointFactory messageEndpointFactory
           
protected static java.lang.String PROVIDER_ADAPTER_JNDI
           
 
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
MessagingContainer(java.lang.String ejbName, org.jboss.aop.Domain domain, java.lang.ClassLoader cl, java.lang.String beanClassName, java.util.Hashtable ctxProperties, Ejb3Deployment deployment, org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData beanMetaData)
           
 
Method Summary
protected  void addActivationSpecProperty(java.util.Map<java.lang.String,org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData> result, javax.ejb.ActivationConfigProperty property)
           
 void callTimeout(javax.ejb.Timer timer)
           
 void callTimeout(javax.ejb.Timer timer, java.lang.reflect.Method tMethod)
          Invokes the passed timeout method for the passed Timer, on a bean instance.
 BeanContext<?> createBeanContext()
          Create a bean context for use in a pool.
abstract  java.util.Map<java.lang.String,org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData> getActivationConfigProperties()
           
protected  java.lang.String getDestination()
           
protected  java.lang.String getDestinationType()
           
protected  java.lang.String getDestinationType(javax.naming.Context ctx, java.lang.String destinationJNDI)
          Try to get a destination type by looking up the destination JNDI, or provide a default if there is not destinationJNDI or if it is not possible to lookup.
protected  org.jboss.jms.jndi.JMSProviderAdapter getJMSProviderAdapter()
          Return the JMSProviderAdapter that should be used.
 javax.management.ObjectName getJmxName()
           
 int getKeepAliveMillis()
           
 int getMaxMessages()
           
 int getMaxPoolSize()
           
protected  java.lang.String getMaxSession()
           
 java.lang.Object getMBean()
           
abstract  java.lang.Class getMessagingType()
           
protected  org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData getMetaData()
           
 org.jboss.aop.MethodInfo getMethodInfo(java.lang.reflect.Method method)
          Deprecated. 
 int getMinPoolSize()
           
protected  java.lang.String getProviderAdapterJNDI()
           
 java.lang.String getResourceAdaptorName()
           
 java.lang.String getTimedObjectId()
           
protected  org.jboss.ejb3.timerservice.spi.TimedObjectInvoker getTimedObjectInvoker()
          Returns the TimedObjectInvoker which will be used by the timer implementations to invoke the timeout method (annotated with Timeout or specified in deployment descriptor) on the bean.
protected abstract  org.jboss.metadata.ejb.spec.NamedMethodMetaData getTimeoutMethodMetaData()
           
 boolean hasJNDIBinding(java.lang.String jndiName)
          A messaging container is bound to a message destination and thus has no JNDI binding of it's own.
protected  void initializePool()
           
protected  void innerCreateQueue(javax.naming.Context context)
           
protected  void innerCreateTopic(javax.naming.Context context)
           
protected  void innerStart()
           
protected  void invokeSetMessageDrivenContext(BeanContext beanCtx)
          EJB3 spec states that if a message driven bean implements the MessageDrivenBean interface then the container should invoke MessageDrivenBean.setMessageDrivenContext(javax.ejb.MessageDrivenContext) to associate the MessageDrivenContext context with the bean instance.
protected  boolean isDeliveryActive()
           
 java.lang.Object localInvoke(org.jboss.aop.MethodInfo info, java.lang.Object[] args)
           
 java.lang.Object localInvoke(java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  void lockedStart()
          Initialize the container invoker.
protected  void lockedStop()
          Suspends the TimerService associated with this container.
protected  java.lang.String parseJndiSuffix(java.lang.String jndiname, java.lang.String defautSuffix)
          Parse the JNDI suffix from the given JNDI name.
protected abstract  void populateActivationSpec()
           
 void setMessageEndpointFactory(JBossMessageEndpointFactory messageEndpointFactory)
           
protected  void startDelivery()
           
protected  void startProxies()
           
protected  void stopDelivery()
           
protected  void stopProxies()
           
 
Methods inherited from class org.jboss.ejb3.TimerServiceContainer
afterStart, create, getTimerService, getTimerService, setTimerServiceFactory
 
Methods inherited from class org.jboss.ejb3.EJBContainer
canResolveEJB, checkForDuplicateLocalAndRemoteInterfaces, construct, 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, getModule, getName, getNonBridgeMethod, getObjectName, getPartitionName, getPool, getRollbackOnly, getRootFile, getSecurityManager, getTimeoutCallback, getUserTransaction, getVirtualMethods, getXml, initMetaDataBasedAnnotationRepository, injectBeanContext, instantiated, invokeCallback, invokePostActivate, invokePostConstruct, invokePostConstruct, invokePreDestroy, invokePrePassivate, isAnnotationPresent, isBusinessMethod, isCallerInRole, isClustered, lookup, peekContext, popContext, popEnc, processMetadata, pushContext, pushEnc, reinitialize, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveBusinessInterfaces, 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.context.spi.BeanManager
getEJBHome, getEJBLocalHome, getRollbackOnly, getTimerService, getUserTransaction, isCallerInRole, lookup, setRollbackOnly
 

Field Detail

activationSpec

protected ActivationSpec activationSpec

messageEndpointFactory

protected JBossMessageEndpointFactory messageEndpointFactory

DEFAULT_DESTINATION_TYPE

protected static final java.lang.String DEFAULT_DESTINATION_TYPE
Default destination type. Used when no message-driven-destination is given in ejb-jar, and a lookup of destinationJNDI from jboss.xml is not successfull. Default value: javax.jms.Topic.

See Also:
Constant Field Values

JMS_ADAPTOR

protected static final java.lang.String JMS_ADAPTOR
See Also:
Constant Field Values

DESTINATION

protected static final java.lang.String DESTINATION
See Also:
Constant Field Values

DESTINATION_TYPE

protected static final java.lang.String DESTINATION_TYPE
See Also:
Constant Field Values

PROVIDER_ADAPTER_JNDI

protected static final java.lang.String PROVIDER_ADAPTER_JNDI
See Also:
Constant Field Values

MAX_SESSION

protected static final java.lang.String MAX_SESSION
See Also:
Constant Field Values
Constructor Detail

MessagingContainer

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

createBeanContext

public BeanContext<?> createBeanContext()
Description copied from interface: Container
Create a bean context for use in a pool.

Specified by:
createBeanContext in interface Container
Specified by:
createBeanContext in class EJBContainer
Returns:
a ready to use bean context

getMBean

public java.lang.Object getMBean()
Specified by:
getMBean in interface Container

getMetaData

protected org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData getMetaData()

getTimeoutMethodMetaData

protected abstract org.jboss.metadata.ejb.spec.NamedMethodMetaData getTimeoutMethodMetaData()

getMessagingType

public abstract java.lang.Class getMessagingType()

getActivationConfigProperties

public abstract java.util.Map<java.lang.String,org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData> getActivationConfigProperties()

populateActivationSpec

protected abstract void populateActivationSpec()

getMethodInfo

@Deprecated
public org.jboss.aop.MethodInfo getMethodInfo(java.lang.reflect.Method method)
Deprecated. 

Overrides:
getMethodInfo in class EJBContainer

setMessageEndpointFactory

public void setMessageEndpointFactory(JBossMessageEndpointFactory messageEndpointFactory)

getResourceAdaptorName

public java.lang.String getResourceAdaptorName()

addActivationSpecProperty

protected void addActivationSpecProperty(java.util.Map<java.lang.String,org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData> result,
                                         javax.ejb.ActivationConfigProperty property)

lockedStart

protected void lockedStart()
                    throws java.lang.Exception
Initialize the container invoker. Sets up a connection, a server session pool and a connection consumer for the configured destination.

Any JMSExceptions produced while initializing will be assumed to be caused due to JMS Provider failure.

Overrides:
lockedStart in class EJBContainer
Throws:
java.lang.Exception - Failed to initalize.

startDelivery

protected void startDelivery()

innerStart

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

isDeliveryActive

protected boolean isDeliveryActive()

getJmxName

public javax.management.ObjectName getJmxName()

startProxies

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

parseJndiSuffix

protected java.lang.String parseJndiSuffix(java.lang.String jndiname,
                                           java.lang.String defautSuffix)
Parse the JNDI suffix from the given JNDI name.

Parameters:
jndiname - The JNDI name used to lookup the destination.
defautSuffix - Description of Parameter
Returns:
The parsed suffix or the defaultSuffix

localInvoke

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

localInvoke

public java.lang.Object localInvoke(org.jboss.aop.MethodInfo info,
                                    java.lang.Object[] args)
                             throws java.lang.Throwable
Throws:
java.lang.Throwable

callTimeout

public void callTimeout(javax.ejb.Timer timer)
                 throws java.lang.Exception
Specified by:
callTimeout in interface org.jboss.ejb3.timerservice.spi.TimedObjectInvoker
Throws:
java.lang.Exception

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()

stopDelivery

protected void stopDelivery()

stopProxies

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

initializePool

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

getProviderAdapterJNDI

protected java.lang.String getProviderAdapterJNDI()

getMaxSession

protected java.lang.String getMaxSession()

getDestination

protected java.lang.String getDestination()

getDestinationType

protected java.lang.String getDestinationType()

innerCreateQueue

protected void innerCreateQueue(javax.naming.Context context)
                         throws java.lang.Exception
Throws:
java.lang.Exception

innerCreateTopic

protected void innerCreateTopic(javax.naming.Context context)
                         throws java.lang.Exception
Throws:
java.lang.Exception

getJMSProviderAdapter

protected org.jboss.jms.jndi.JMSProviderAdapter getJMSProviderAdapter()
                                                               throws javax.naming.NamingException
Return the JMSProviderAdapter that should be used.

Returns:
The JMSProviderAdapter to use.
Throws:
javax.naming.NamingException

getDestinationType

protected java.lang.String getDestinationType(javax.naming.Context ctx,
                                              java.lang.String destinationJNDI)
Try to get a destination type by looking up the destination JNDI, or provide a default if there is not destinationJNDI or if it is not possible to lookup.

Parameters:
ctx - The naming context to lookup destinations from.
destinationJNDI - The name to use when looking up destinations.
Returns:
The destination type, either derived from destinationJDNI or DEFAULT_DESTINATION_TYPE

hasJNDIBinding

public boolean hasJNDIBinding(java.lang.String jndiName)
A messaging container is bound to a message destination and thus has no JNDI binding of it's own.

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

getMinPoolSize

public int getMinPoolSize()

getMaxPoolSize

public int getMaxPoolSize()

getMaxMessages

public int getMaxMessages()

getKeepAliveMillis

public int getKeepAliveMillis()

getTimedObjectId

public java.lang.String getTimedObjectId()
Specified by:
getTimedObjectId in interface org.jboss.ejb3.timerservice.spi.TimedObjectInvoker
See Also:
TimedObjectInvoker.getTimedObjectId()

getTimedObjectInvoker

protected org.jboss.ejb3.timerservice.spi.TimedObjectInvoker getTimedObjectInvoker()
Description copied from class: TimerServiceContainer
Returns the TimedObjectInvoker which will be used by the timer implementations to invoke the timeout method (annotated with Timeout or specified in deployment descriptor) on the bean.

Specified by:
getTimedObjectInvoker in class TimerServiceContainer
Returns:

callTimeout

public void callTimeout(javax.ejb.Timer timer,
                        java.lang.reflect.Method tMethod)
                 throws java.lang.Exception
Invokes the passed timeout method for the passed Timer, on a bean instance.

Specified by:
callTimeout in interface org.jboss.ejb3.timerservice.spi.MultiTimeoutMethodTimedObjectInvoker
Parameters:
timer - The Timer for which the timeout has occurred
tMethod - The timeout method
Throws:
java.lang.Exception - If any exception occurs during invocation of timeout method on the target bean
{@link - NullPointerException} If the passed tMethod is null

invokeSetMessageDrivenContext

protected void invokeSetMessageDrivenContext(BeanContext beanCtx)
                                      throws javax.ejb.EJBException,
                                             java.rmi.RemoteException
EJB3 spec states that if a message driven bean implements the MessageDrivenBean interface then the container should invoke MessageDrivenBean.setMessageDrivenContext(javax.ejb.MessageDrivenContext) to associate the MessageDrivenContext context with the bean instance. The container calls this invokeSetMessageDrivenContext(BeanContext) method when a new BeanContext is created (typically via createBeanContext())

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