The Spring Framework

org.springframework.ejb.support
Class AbstractJmsMessageDrivenBean

java.lang.Object
  extended by org.springframework.ejb.support.AbstractMessageDrivenBean
      extended by org.springframework.ejb.support.AbstractJmsMessageDrivenBean
All Implemented Interfaces:
Serializable, EnterpriseBean, MessageDrivenBean, MessageListener

public abstract class AbstractJmsMessageDrivenBean
extends AbstractMessageDrivenBean
implements MessageListener

Convenient superclass for JMS MDBs. Requires subclasses to implement the JMS interface javax.jms.MessageListener.

Author:
Rod Johnson
See Also:
Serialized Form

Field Summary
static String BEAN_FACTORY_PATH_ENVIRONMENT_KEY
           
 
Fields inherited from class org.springframework.ejb.support.AbstractMessageDrivenBean
logger
 
Constructor Summary
AbstractJmsMessageDrivenBean()
           
 
Method Summary
 void ejbRemove()
          EJB lifecycle method, implemented to invoke onEjbRemote and unload the BeanFactory afterwards.
protected  BeanFactory getBeanFactory()
          May be called after ejbCreate().
protected  void onEjbRemove()
          Subclasses must implement this method to do any initialization they would otherwise have done in an ejbRemove() method.
 void setBeanFactoryLocator(BeanFactoryLocator beanFactoryLocator)
          Set the BeanFactoryLocator to use for this EJB.
 void setBeanFactoryLocatorKey(String factoryKey)
          Set the bean factory locator key.
 
Methods inherited from class org.springframework.ejb.support.AbstractMessageDrivenBean
ejbCreate, getMessageDrivenContext, onEjbCreate, setMessageDrivenContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.MessageListener
onMessage
 
Methods inherited from interface javax.ejb.MessageDrivenBean
ejbRemove
 

Field Detail

BEAN_FACTORY_PATH_ENVIRONMENT_KEY

public static final String BEAN_FACTORY_PATH_ENVIRONMENT_KEY
See Also:
Constant Field Values
Constructor Detail

AbstractJmsMessageDrivenBean

public AbstractJmsMessageDrivenBean()
Method Detail

setBeanFactoryLocator

public void setBeanFactoryLocator(BeanFactoryLocator beanFactoryLocator)
Set the BeanFactoryLocator to use for this EJB. Default is a ContextJndiBeanFactoryLocator.

Can be invoked before loadBeanFactory, for example in constructor or setSessionContext if you want to override the default locator.

Note that the BeanFactory is automatically loaded by the ejbCreate implementations of AbstractStatelessSessionBean and AbstractMessageDriverBean but needs to be explicitly loaded in custom AbstractStatefulSessionBean ejbCreate methods.

See Also:
AbstractStatelessSessionBean.ejbCreate(), AbstractMessageDrivenBean.ejbCreate(), AbstractStatefulSessionBean.loadBeanFactory(), ContextJndiBeanFactoryLocator

setBeanFactoryLocatorKey

public void setBeanFactoryLocatorKey(String factoryKey)
Set the bean factory locator key.

In case of the default BeanFactoryLocator implementation, ContextJndiBeanFactoryLocator, this is the JNDI path. The default value of this property is "java:comp/env/ejb/BeanFactoryPath".

Can be invoked before loadBeanFactory, for example in constructor or setSessionContext if you want to override the default locator key.

See Also:
BEAN_FACTORY_PATH_ENVIRONMENT_KEY

getBeanFactory

protected BeanFactory getBeanFactory()
May be called after ejbCreate().

Returns:
the bean factory

ejbRemove

public void ejbRemove()
EJB lifecycle method, implemented to invoke onEjbRemote and unload the BeanFactory afterwards.

Don't override it (although it can't be made final): code your shutdown in onEjbRemove.

See Also:
onEjbRemove()

onEjbRemove

protected void onEjbRemove()
Subclasses must implement this method to do any initialization they would otherwise have done in an ejbRemove() method. The BeanFactory will be unloaded afterwards.

This implementation is empty, to be overridden in subclasses. The same restrictions apply to the work of this method as to an ejbRemove() method.


The Spring Framework

Copyright © 2002-2007 The Spring Framework.