|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.ejb.support.AbstractEnterpriseBean
Superclass for all EJBs. Package-visible: not intended for direct subclassing. Provides a standard way of loading a BeanFactory. Subclasses act as a facade, with the business logic deferred to beans in the BeanFactory.
Default is to use a ContextJndiBeanFactoryLocator, which will initialize an XML ApplicationContext from the classpath (based on a JNDI name specified). For a lighter weight implementation when ApplicationContext usage is not required, setBeanFactoryLocator may be called (before your EJB's ejbCreate method is invoked, for example, in setSessionContext) with a JndiBeanFactoryLocator, which will load an XML BeanFactory from the classpath. Alternately, setBeanFactoryLocator may be called with a completely custom implementation of BeanFactoryLocator.
Note that we cannot use final for our implementation of EJB lifecycle methods, as this violates the EJB specification.
setBeanFactoryLocator(org.springframework.beans.factory.access.BeanFactoryLocator)
,
ContextJndiBeanFactoryLocator
,
JndiBeanFactoryLocator
Field Summary | |
static String |
BEAN_FACTORY_PATH_ENVIRONMENT_KEY
|
Constructor Summary | |
(package private) |
AbstractEnterpriseBean()
|
Method Summary | |
void |
ejbRemove()
EJB lifecycle method, implemented to invoke onEjbRemote and unload the BeanFactory afterwards. |
protected BeanFactory |
getBeanFactory()
May be called after ejbCreate(). |
(package private) void |
loadBeanFactory()
Load a Spring BeanFactory namespace. |
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. |
(package private) void |
unloadBeanFactory()
Unload the Spring BeanFactory instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String BEAN_FACTORY_PATH_ENVIRONMENT_KEY
Constructor Detail |
AbstractEnterpriseBean()
Method Detail |
public void setBeanFactoryLocator(BeanFactoryLocator beanFactoryLocator)
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.
AbstractStatelessSessionBean.ejbCreate()
,
AbstractMessageDrivenBean.ejbCreate()
,
AbstractStatefulSessionBean.loadBeanFactory()
,
ContextJndiBeanFactoryLocator
,
JndiBeanFactoryLocator
public void setBeanFactoryLocatorKey(String factoryKey)
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.
BEAN_FACTORY_PATH_ENVIRONMENT_KEY
void loadBeanFactory() throws BeansException
Package-visible as it shouldn't be called directly by user-created subclasses.
BeansException
AbstractStatelessSessionBean.ejbCreate()
void unloadBeanFactory() throws FatalBeanException
Package-visible as it shouldn't be called directly by user-created subclasses.
FatalBeanException
protected BeanFactory getBeanFactory()
public void ejbRemove()
Don't override it (although it can't be made final): code your shutdown in onEjbRemove.
onEjbRemove()
protected void onEjbRemove()
This implementation is empty, to be overridden in subclasses. The same restrictions apply to the work of this method as to an ejbRemove() method.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |