| java.lang.Object org.springframework.ejb.support.AbstractEnterpriseBean
All known Subclasses: org.springframework.ejb.support.AbstractSessionBean, org.springframework.ejb.support.AbstractMessageDrivenBean,
AbstractEnterpriseBean | abstract class AbstractEnterpriseBean implements EnterpriseBean(Code) | | 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 class path (based on a JNDI name specified). For a
different locator strategy, setBeanFactoryLocator may be called
(before your EJB's ejbCreate method is invoked, for example,
in setSessionContext ). For use of a shared ApplicationContext between
multiple EJBs, where the container class loader setup supports this visibility,
you may instead use a ContextSingletonBeanFactoryLocator. Alternately,
setBeanFactoryLocator may be called with a completely custom
implementation of the BeanFactoryLocator interface.
Note that we cannot use final for our implementation of EJB lifecycle methods,
as this violates the EJB specification.
author: Rod Johnson author: Colin Sampaleanu See Also: AbstractEnterpriseBean.setBeanFactoryLocator See Also: org.springframework.context.access.ContextJndiBeanFactoryLocator See Also: org.springframework.context.access.ContextSingletonBeanFactoryLocator |
Method Summary | |
public void | ejbRemove() EJB lifecycle method, implemented to invoke onEjbRemote and unload the
BeanFactory afterwards. | protected BeanFactory | getBeanFactory() May be called after ejbCreate(). | 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. | public void | setBeanFactoryLocator(BeanFactoryLocator beanFactoryLocator) Set the BeanFactoryLocator to use for this EJB. | public void | setBeanFactoryLocatorKey(String factoryKey) Set the bean factory locator key.
In case of the default BeanFactoryLocator implementation,
ContextJndiBeanFactoryLocator, this is the JNDI path. | void | unloadBeanFactory() Unload the Spring BeanFactory instance. |
BEAN_FACTORY_PATH_ENVIRONMENT_KEY | final public static String BEAN_FACTORY_PATH_ENVIRONMENT_KEY(Code) | | |
ejbRemove | public void ejbRemove()(Code) | | 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: AbstractEnterpriseBean.onEjbRemove |
getBeanFactory | protected BeanFactory getBeanFactory()(Code) | | May be called after ejbCreate().
the bean factory |
onEjbRemove | protected void onEjbRemove()(Code) | | 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.
|
setBeanFactoryLocatorKey | public void setBeanFactoryLocatorKey(String factoryKey)(Code) | | 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: AbstractEnterpriseBean.BEAN_FACTORY_PATH_ENVIRONMENT_KEY |
unloadBeanFactory | void unloadBeanFactory() throws FatalBeanException(Code) | | Unload the Spring BeanFactory instance. The default
AbstractEnterpriseBean.ejbRemove() method invokes this method, but subclasses which override ejbRemove
must invoke this method themselves.
Package-visible as it shouldn't be called directly by user-created
subclasses.
|
|
|