org.apache.webbeans.ejb.common.component
Class BaseEjbBean<T>

java.lang.Object
  extended by org.apache.webbeans.component.AbstractOwbBean<T>
      extended by org.apache.webbeans.component.AbstractInjectionTargetBean<T>
          extended by org.apache.webbeans.ejb.common.component.BaseEjbBean<T>
All Implemented Interfaces:
javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.Bean<T>, EnterpriseBeanMarker, InjectionTargetBean<T>, InterceptedMarker, OwbBean<T>

public abstract class BaseEjbBean<T>
extends AbstractInjectionTargetBean<T>
implements EnterpriseBeanMarker

Defines bean contract for the session beans.

Version:
$Rev$ $Date$

Field Summary
protected  javax.enterprise.inject.spi.SessionBeanType ejbType
          Session bean type
static Object[] OBJECT_EMPTY
           
 
Fields inherited from class org.apache.webbeans.component.AbstractInjectionTargetBean
decorators, inheritedMetaData, interceptorStack
 
Fields inherited from class org.apache.webbeans.component.AbstractOwbBean
apiTypes, enabled, implQualifiers, implScopeType, injectionPoints, name, nullable, passivatingId, returnType, scopeClass, serializable, specializedBean, stereoTypeClasses, stereoTypes, webBeansType
 
Constructor Summary
BaseEjbBean(Class<T> ejbClassType, javax.enterprise.inject.spi.SessionBeanType type, WebBeansContext webBeansContext)
          Creates a new instance of the session bean.
 
Method Summary
 void addDependentSFSB(Object dependentSFSB, Object proxy)
          Keep track of which proxies have gotten EJB objects out of a context
protected  T createComponentInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          
protected  void destroyComponentInstance(T instance, javax.enterprise.context.spi.CreationalContext<T> creational)
          
protected  void destroyStatefulSessionBeanInstance(T proxyInstance, Object ejbInstance)
          Called when we must ask the container to remove a specific
 List<Class<?>> getBusinessLocalInterfaces()
          Subclasses must override this to return local interfaces.
 Object getDependentSFSBForProxy(Object proxy)
           
 String getEjbName()
          Subclasses must override this to return ejb name
 javax.enterprise.inject.spi.SessionBeanType getEjbType()
          Gets ejb session type.
protected abstract  T getInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Sublclasses must return instance.
 List<Method> getRemoveMethods()
          Subclasses can override this.
 void injectFieldInInterceptor(Object instance, javax.enterprise.context.spi.CreationalContext<?> creationalContext)
          Inject session bean injected fields.
 boolean isPassivationCapable()
           
 boolean needsBeanLocalViewAddedToTypes()
           
 void removeDependentSFSB(Object proxy)
          Call after observing an @Remove method on an EJB instance
 
Methods inherited from class org.apache.webbeans.component.AbstractInjectionTargetBean
addInjectedField, addInjectedFieldToSuper, addInjectedMethod, addInjectedMethodToSuper, addObservableMethod, afterConstructor, beforeConstructor, createDefaultInstance, createInstance, destroyInstance, getAnnotatedType, getDecoratorStack, getInheritedMetaData, getInjectedFields, getInjectedFromSuperFields, getInjectedFromSuperMethods, getInjectedMethods, getInjectionPoints, getInterceptorStack, getObservableMethods, injectFields, injectMethods, injectResources, injectSuperFields, injectSuperMethods, postConstruct, postConstructDefault, preDestroy, preDestroyDefault, setAnnotatedType, setInheritedMetaData, validatePassivationDependencies
 
Methods inherited from class org.apache.webbeans.component.AbstractOwbBean
addApiType, addInjectionPoint, addQualifier, addStereoType, create, createNewInstance, destroy, destroyCreatedInstance, equals, getBeanClass, getId, getImplQualifiers, getImplScopeType, getInjectionPoint, getLogger, getManager, getName, getOwbStereotypes, getQualifiers, getReturnType, getScope, getStereotypes, getTypes, getWebBeansContext, getWebBeansType, hashCode, isAlternative, isDependent, isEnabled, isNullable, isSerializable, isSpecializedBean, setEnabled, setImplScopeType, setName, setNullable, setSerializable, setSpecializedBean, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.webbeans.component.OwbBean
addApiType, addInjectionPoint, addQualifier, addStereoType, createNewInstance, destroyCreatedInstance, getId, getImplQualifiers, getImplScopeType, getInjectionPoint, getOwbStereotypes, getReturnType, getWebBeansContext, getWebBeansType, isDependent, isEnabled, isSerializable, isSpecializedBean, setEnabled, setImplScopeType, setName, setNullable, setSerializable, setSpecializedBean
 
Methods inherited from interface javax.enterprise.inject.spi.Bean
getBeanClass, getName, getQualifiers, getScope, getStereotypes, getTypes, isAlternative, isNullable
 
Methods inherited from interface javax.enterprise.context.spi.Contextual
create, destroy
 

Field Detail

OBJECT_EMPTY

public static final Object[] OBJECT_EMPTY

ejbType

protected final javax.enterprise.inject.spi.SessionBeanType ejbType
Session bean type

Constructor Detail

BaseEjbBean

public BaseEjbBean(Class<T> ejbClassType,
                   javax.enterprise.inject.spi.SessionBeanType type,
                   WebBeansContext webBeansContext)
Creates a new instance of the session bean.

Parameters:
webBeansContext -
ejbClassType - ebj class type
Method Detail

isPassivationCapable

public boolean isPassivationCapable()
Specified by:
isPassivationCapable in interface EnterpriseBeanMarker
Specified by:
isPassivationCapable in interface OwbBean<T>
Overrides:
isPassivationCapable in class AbstractOwbBean<T>

injectFieldInInterceptor

public void injectFieldInInterceptor(Object instance,
                                     javax.enterprise.context.spi.CreationalContext<?> creationalContext)
Inject session bean injected fields. It is called from interceptor.

Parameters:
instance - bean instance
creationalContext - creational context instance

createComponentInstance

protected T createComponentInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)

Overrides:
createComponentInstance in class AbstractInjectionTargetBean<T>

getInstance

protected abstract T getInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Sublclasses must return instance.

Parameters:
creationalContext - creational context
Returns:
instance

destroyComponentInstance

protected void destroyComponentInstance(T instance,
                                        javax.enterprise.context.spi.CreationalContext<T> creational)

Overrides:
destroyComponentInstance in class AbstractInjectionTargetBean<T>

destroyStatefulSessionBeanInstance

protected void destroyStatefulSessionBeanInstance(T proxyInstance,
                                                  Object ejbInstance)
Called when we must ask the container to remove a specific

Parameters:
proxyInstance - The contextual reference
ejbInstance - The underlying EJB instance to be removed

getRemoveMethods

public List<Method> getRemoveMethods()
Subclasses can override this.

Returns:
remove methods

getBusinessLocalInterfaces

public List<Class<?>> getBusinessLocalInterfaces()
Subclasses must override this to return local interfaces.

Returns:
local business interfaces.

getEjbName

public String getEjbName()
Subclasses must override this to return ejb name

Returns:
ejb name

getEjbType

public javax.enterprise.inject.spi.SessionBeanType getEjbType()
Gets ejb session type.

Returns:
type of the ejb

addDependentSFSB

public void addDependentSFSB(Object dependentSFSB,
                             Object proxy)
Keep track of which proxies have gotten EJB objects out of a context

Parameters:
dependentSFSB - The dependent SFSB acquired from the EJB container
proxy - The OWB proxy instance whose method handler acquired the dependnet SFSB

removeDependentSFSB

public void removeDependentSFSB(Object proxy)
Call after observing an @Remove method on an EJB instance

Parameters:
proxy - the proxy instance the dependent SFSB is associated with

getDependentSFSBForProxy

public Object getDependentSFSBForProxy(Object proxy)
Parameters:
proxy - an instance of our own proxy
Returns:
the underlying EJB instance associated with the proxy

needsBeanLocalViewAddedToTypes

public boolean needsBeanLocalViewAddedToTypes()
Returns:
true if the bean supports a no-interface (bean-class) local view but the container does not return it in the list of business local interfaces.


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.