当前页面:
在线文档首页 >
Spring Framework 1.2.9 API 文档英文版
AbstractStatelessSessionBean (Spring Framework) - Spring Framework 1.2.9 API 文档英文版
org.springframework.ejb.support
Class AbstractStatelessSessionBean
java.lang.Object
org.springframework.ejb.support.AbstractEnterpriseBean
org.springframework.ejb.support.AbstractSessionBean
org.springframework.ejb.support.AbstractStatelessSessionBean
- All Implemented Interfaces:
- Serializable, EnterpriseBean, SessionBean, SmartSessionBean
public abstract class AbstractStatelessSessionBean
- extends AbstractSessionBean
Convenient superclass for stateless session beans (SLSBs), minimizing
the work involved in implementing an SLSB and preventing common errors.
Note that SLSBs are the most useful kind of EJB.
As the ejbActivate() and ejbPassivate() methods cannot be invoked
on SLSBs, these methods are implemented to throw an exception and should
not be overriden by subclasses. (Unfortunately the EJB specification
forbids enforcing this by making EJB lifecycle methods final.)
There should be no need to override the setSessionContext() or
ejbCreate() lifecycle methods.
Subclasses are left to implement the onEjbCreate() method to do
whatever initialization they wish to do after their BeanFactory has
already been loaded, and is available from the getBeanFactory() method.
This class provides the no-argument ejbCreate() method required
by the EJB specification, but not the SessionBean interface,
eliminating a common cause of EJB deployment failure.
- Author:
- Rod Johnson
- See Also:
- Serialized Form
Method Summary |
void |
ejbActivate()
|
void |
ejbCreate()
This implementation loads the BeanFactory. |
void |
ejbPassivate()
|
protected abstract void |
onEjbCreate()
Subclasses must implement this method to do any initialization
they would otherwise have done in an ejbCreate() method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final Log logger
AbstractStatelessSessionBean
public AbstractStatelessSessionBean()
ejbCreate
public void ejbCreate()
throws CreateException
- This implementation loads the BeanFactory. A BeansException thrown by
loadBeanFactory will simply get propagated, as it is a runtime exception.
Don't override it (although it can't be made final): code your own
initialization in onEjbCreate(), which is called when the BeanFactory
is available.
Unfortunately we can't load the BeanFactory in setSessionContext(),
as resource manager access isn't permitted there - but the BeanFactory
may require it.
- Throws:
CreateException
onEjbCreate
protected abstract void onEjbCreate()
throws CreateException
- Subclasses must implement this method to do any initialization
they would otherwise have done in an ejbCreate() method. In contrast
to ejbCreate, the BeanFactory will have been loaded here.
The same restrictions apply to the work of this method as
to an ejbCreate() method.
- Throws:
CreateException
ejbActivate
public void ejbActivate()
throws EJBException
- Throws:
EJBException
- See Also:
This method always throws an exception, as
it should not be invoked by the EJB container.
ejbPassivate
public void ejbPassivate()
throws EJBException
- Throws:
EJBException
- See Also:
This method always throws an exception, as
it should not be invoked by the EJB container.
Copyright (c) 2002-2007 The Spring Framework Project.