org.springframework.ejb.support
Class AbstractEnterpriseBean

Direct Known Subclasses:
AbstractMessageDrivenBean, AbstractSessionBean

abstract class AbstractEnterpriseBean
implements EnterpriseBean

Superclass for all EJBs. Package-visible: not intended for direct subclassing. Provides a logger and 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 an XmlApplicationContextBeanFactoryLoader, which will initialize an XmlApplicationContext from the classpath (based on a JNDI name specified). For a lighter weight implementation when ApplicationContext usage is not required, setBeanFactoryLoader() may be called (before your EJB's ejbCreate() method is invoked, for example, in setSessionContext()) with a value of XmlBeanFactoryLoader, which will load an XML bean factory from the classpath. Alternately, setBeanFactoryLoader() may be called with a completely custom implementation of the BeanFactoryLoader.

Note that we cannot use final for our implementation of EJB lifecycle methods, as this violates the EJB specification.

Author:
Rod Johnson
Version: $Id: AbstractEnterpriseBean.java,v 1.8 2004/02/04 18:01:24 jhoeller Exp $

Field Summary
 final static StringBEAN_FACTORY_PATH_ENVIRONMENT_KEY
           

Method Summary
 voidejbRemove()
          Useful EJB lifecycle method.
 (package private) voidloadBeanFactory()
          Load a Spring BeanFactory namespace.
 voidsetBeanFactoryLocator(BeanFactoryLocator beanFactoryLocator)
          Can be invoked before loadBeanFactory.
 voidsetBeanFactoryLocatorKey(String factoryKey)
          Can be invoked before loadBeanFactory.
 (package private) voidunloadBeanFactory()
          Unload the Spring BeanFactory instance.

Field Detail

BEAN_FACTORY_PATH_ENVIRONMENT_KEY

public final static String BEAN_FACTORY_PATH_ENVIRONMENT_KEY
Method Detail

ejbRemove

public void ejbRemove()
Useful EJB lifecycle method. Override if necessary.

loadBeanFactory

void loadBeanFactory()
throws org.springframework.beans.factory.access.BootstrapException
Load a Spring BeanFactory namespace. Subclasses must invoke this method. Package-visible as it shouldn't be called directly by user-created subclasses.
See Also:
AbstractStatelessSessionBean.ejbCreate()

setBeanFactoryLocator

public void setBeanFactoryLocator(BeanFactoryLocator beanFactoryLocator)
Can be invoked before loadBeanFactory. Invoke in constructor or setXXXXContext() if you want to override the default bean factory loader.

setBeanFactoryLocatorKey

public void setBeanFactoryLocatorKey(String factoryKey)
Can be invoked before loadBeanFactory. Invoke in constructor or setXXXXContext() if you want to override the default bean factory factory key. If the default BeanFactoryLocator implementation, JndiBeanFactoryLocator, this is the JNDI path. The default value of this property is BEAN_FACTORY_PATH_ENVIRONMENT_KEY

unloadBeanFactory

void unloadBeanFactory()
throws org.springframework.beans.FatalBeanException
Unload the Spring BeanFactory instance. The default 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.

Association Links

to Class java.lang.String

to Class org.springframework.beans.factory.access.BeanFactoryLocator

Helper strategy that knows how to load Spring BeanFactory (or ApplicationContext subclass).

to Class java.lang.String

FactoryKey to be used with BeanFactoryLocator

to Class org.springframework.beans.factory.access.BeanFactoryReference

Spring BeanFactory that provides the namespace for this EJB