com.interface21.ejb.support
Class AbstractMessageDrivenBean

java.lang.Object
  |
  +--com.interface21.ejb.support.AbstractEnterpriseBean
        |
        +--com.interface21.ejb.support.AbstractMessageDrivenBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, javax.ejb.MessageDrivenBean, java.io.Serializable
Direct Known Subclasses:
AbstractJmsMessageDrivenBean

public abstract class AbstractMessageDrivenBean
extends AbstractEnterpriseBean
implements javax.ejb.MessageDrivenBean

Convenient superclass for MDBs. Doesn't require JMS, as EJB 2.1 MDBs are no longer JMS-specific: see the AbstractJmsMessageDrivenBean subclass.
This class ensures that subclasses have access to the MessageDrivenContext provided by the EJB container, and implement a no argument ejbCreate() method as required by the EJB specification, but not the javax.ejb.MessageDrivenBean interface.
NB: we cannot use final methods to implement EJB API methods, as this violates the EJB specification.

Author:
Rod Johnson
See Also:
Serialized Form

Fields inherited from class com.interface21.ejb.support.AbstractEnterpriseBean
logger
 
Constructor Summary
AbstractMessageDrivenBean()
           
 
Method Summary
abstract  void ejbCreate()
          Lifecycle method required by the EJB specification but not the MessageDrivenBean interface.
 void ejbRemove()
          This method is required by the EJB Specification.
protected  javax.ejb.MessageDrivenContext getMessageDrivenContext()
          Convenience method for subclasses to use
 void setMessageDrivenContext(javax.ejb.MessageDrivenContext messageDrivenContext)
          Required lifecycle method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMessageDrivenBean

public AbstractMessageDrivenBean()
Method Detail

getMessageDrivenContext

protected final javax.ejb.MessageDrivenContext getMessageDrivenContext()
Convenience method for subclasses to use
Returns:
the MessageDrivenContext passed to this EJB by the EJB container

setMessageDrivenContext

public void setMessageDrivenContext(javax.ejb.MessageDrivenContext messageDrivenContext)
Required lifecycle method. Sets the MessageDriven context.
Specified by:
setMessageDrivenContext in interface javax.ejb.MessageDrivenBean
Parameters:
messageDrivenContext - MessageDrivenContext

ejbCreate

public abstract void ejbCreate()
Lifecycle method required by the EJB specification but not the MessageDrivenBean interface. We implement this as an abstract method to force subclasses to implement it. Can use BeanFactory here for initialization if required.

ejbRemove

public void ejbRemove()
This method is required by the EJB Specification.
Specified by:
ejbRemove in interface javax.ejb.MessageDrivenBean


Rod Johnson and Spring contributors 2001-2003.