com.caucho.ejb.cfg
Class EjbBean<X>

java.lang.Object
  extended by com.caucho.config.types.DescriptionGroupConfig
      extended by com.caucho.ejb.cfg.EjbBean<X>
All Implemented Interfaces:
DependencyBean, EnvironmentBean
Direct Known Subclasses:
EjbMessageBean, EjbSessionBean

public class EjbBean<X>
extends DescriptionGroupConfig
implements EnvironmentBean, DependencyBean

Configuration for an ejb bean.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.caucho.config.types.DescriptionGroupConfig
DescriptionGroupConfig.Icon
 
Field Summary
protected  java.util.ArrayList<EjbMethodPattern<X>> _beanMethodList
           
protected  boolean _isContainerTransaction
           
protected  java.lang.ClassLoader _jClassLoader
           
protected  java.util.ArrayList<AnnotatedType<? super X>> _localList
           
protected  java.util.ArrayList<EjbMethodPattern<X>> _methodList
           
protected  java.util.ArrayList<AnnotatedType<? super X>> _remoteList
           
 
Constructor Summary
EjbBean(EjbConfig ejbConfig, AnnotatedType<X> rawAnnType, AnnotatedType<X> annType, java.lang.String ejbModuleName)
          Creates a new entity bean configuration.
EjbBean(EjbConfig ejbConfig, java.lang.String ejbModuleName)
          Creates a new entity bean configuration.
 
Method Summary
 void addAfterBeginMethod(AfterBeginMethod<X> method)
           
 void addAsyncMethod(AsyncConfig async)
           
 void addBeanDependency(java.lang.String ejbName)
          Add a bean dependency.
 void addBeforeCompletionMethod(BeforeCompletionMethod<X> method)
           
 void addBuilderProgram(ConfigProgram init)
          Adds an undefined value, e.g.
 void addBusinessLocal(java.lang.Class<?> localApi)
           
 void addBusinessRemote(java.lang.Class<?> remoteApi)
           
 void addConcurrentMethod(ConcurrentMethod<X> concurrentMethod)
          Adds a new concurrent-method
 void addDepend(Path path)
          Add a dependency.
 void addDependency(java.lang.Class<?> cl)
          Add a dependency.
 void addDependency(PersistentDependency depend)
          Add a dependency.
 void addDependencyList(java.util.ArrayList<PersistentDependency> dependList)
          Adds a list of dependencies.
 void addInitProgram(ConfigProgram init)
          Adds an init program.
 void addInterceptor(Interceptor interceptor, boolean isDefault)
          Adds a new interceptor.
 void addLocal(java.lang.Class<?> local)
          Sets the ejb local interface
protected  void addLocalType(BaseType local)
           
 void addLocalWrapper(AnnotatedType<? super X> local)
          Sets the local interface class.
 void addMethod(EjbMethodPattern<X> method)
          Adds a method.
 void addPostConstruct(PostConstructType<X> postConstruct)
           
<T> void
addRemote(java.lang.Class<T> remote)
           
<T> void
addRemoteType(BaseType remote)
          Sets the ejb remote interface
 void addRemoteWrapper(AnnotatedType<? super X> remote)
          Sets the remote interface class.
 void addRemoveMethod(RemoveMethod<X> removeMethod)
          Adds a new remove-method
 boolean classHasMethod(AnnotatedType<?> cl, AnnotatedMethod<?> method)
          Tests is a method is declared in a class.
protected  BeanGenerator<X> createBeanGenerator()
          Creates the BeanGenerator generator instance
 DataSourceRef createDataSource()
           
 EjbLocalRef createEjbLocalRef()
           
 EjbRef createEjbRef()
           
 EnvEntry createEnvEntry()
           
 MessageDestinationRef createMessageDestinationRef()
           
 EjbMethodPattern<X> createMethod(MethodSignature sig)
          Adds a method.
 ResourceEnvRef createResourceEnvRef()
           
 ResourceRef createResourceRef()
           
 AbstractEjbBeanManager<X> deployServer(EjbManager ejbContainer, EjbLazyGenerator<X> lazyGenerator)
          Deploys the bean.
 java.lang.RuntimeException error(java.lang.Exception e)
          Returns an error.
 ConfigException error(java.lang.String msg)
          Returns an error.
protected
<T> AnnotatedMethod<? super T>
findFirstCreateMethod(AnnotatedType<T> cl)
           
static
<Y> AnnotatedMethod<? super Y>
findMethod(MethodSignature sig, AnnotatedType<Y> cl, java.lang.String intf)
          Finds the method in the class.
 AnnotatedTypeImpl<X> getAnnotatedType()
           
 java.util.ArrayList<java.lang.String> getBeanDependList()
          Gets the bean depend list.
protected  java.lang.String getBeanType()
           
 InjectManager getCdiManager()
           
 java.lang.ClassLoader getClassLoader()
          Returns the class loader.
static java.lang.String getClassName(java.lang.Class<?> cl)
          Returns a printable version of a class.
 EjbConfig getConfig()
           
 java.util.ArrayList<PersistentDependency> getDependList()
          Gets the depend list.
 java.lang.Class<X> getEJBClass()
          Gets the ejb implementation class.
 java.lang.String getEJBClassName()
          Gets the ejb implementation class.
 EjbManager getEjbContainer()
           
 java.lang.String getEJBFullClassName()
          Gets the ejb implementation class.
 java.lang.String getEJBKind()
          Returns the kind of bean.
 java.lang.String getEJBModuleName()
           
 java.lang.String getEJBName()
          Gets the ejbName
 java.lang.String getFilename()
          Gets the file name
 java.lang.String getFullImplName()
          Gets the implementation class name.
static java.lang.String getFullMethodName(AnnotatedMethod<?> method)
          Returns a full method name with arguments.
static java.lang.String getFullMethodName(java.lang.String methodName, java.lang.Class<?>[] params)
          Returns a full method name with arguments.
 ContainerProgram getInitProgram()
          Gets the init program.
 InjectionTarget<X> getInjectionTarget()
           
 EjbJar getJar()
           
 int getLine()
          Gets the line
 AnnotatedType<X> getLocalBean()
           
 java.util.ArrayList<AnnotatedType<? super X>> getLocalList()
          Gets the local interface class.
 java.lang.String getLocation()
          Gets the location
 java.lang.String getMappedName()
          The mapped-name is the published name used by IIOP, Hessian, and jndi-remote-prefix, jndi-local-prefix.
static
<X,T> AnnotatedMethod<? super X>
getMethod(AnnotatedType<X> cl, AnnotatedMethod<? extends T> sourceMethod)
          Finds the method in the class.
static
<X> AnnotatedMethod<? super X>
getMethod(AnnotatedType<X> cl, java.lang.String name, java.lang.Class<?>[] param)
          Finds the method in the class.
protected  AnnotatedMethod<? super X> getMethod(java.lang.String methodName, java.lang.Class<?>[] paramTypes)
          Finds the method in the class.
 java.util.ArrayList<EjbMethodPattern<X>> getMethodList()
          returns the method list.
 EjbMethodPattern<X> getMethodPattern(AnnotatedMethod<?> method, java.lang.String intf)
          Gets the best method.
 java.lang.String getModuleName()
           
 AnnotatedType<X> getRawAnnotatedType()
           
 java.util.ArrayList<AnnotatedType<? super X>> getRemoteList()
          Gets the remote interface class.
 java.util.ArrayList<ResourceGroupConfig> getResourceList()
           
 ContainerProgram getServerProgram()
          Gets the server program.
static java.lang.String getShortClassName(java.lang.Class<?> cl)
          Returns a printable version of a class.
 java.lang.String getSkeletonName()
           
 java.lang.String getTimeoutMethodName()
          Returns the timeout method name.
 long getTransactionTimeout()
          Gets the transaction timeout.
 void init()
          Configure initialization.
 void initIntrospect()
          Configure initialization.
protected  void introspect()
           
protected  void introspectBean(AnnotatedType<X> type, java.lang.String defaultName)
           
 boolean isAllowPOJO()
          Return true if POJO are allowed.
 boolean isCMP()
           
 boolean isCMP1()
           
 boolean isContainerTransaction()
          Returns true if the transaction type is container.
 boolean isMatch(AnnotatedMethod<?> method)
           
protected  java.lang.Class<?> loadClass(java.lang.String className)
           
 void setAllowPOJO(boolean allowPOJO)
          Sets true if POJO are allowed.
 void setAroundInvoke(AroundInvokeConfig aroundInvoke)
           
 void setConcurrencyManagementType(java.lang.String type)
           
 void setConfigLocation(java.lang.String filename, int line)
          Sets the location
 void setContainerTransaction(boolean isContainerTransaction)
          Returns true if the transaction type is container.
 void setEJBClass(java.lang.Class<X> ejbClass)
          Sets the ejb implementation class.
 void setEJBClassWrapper(AnnotatedType<X> ejbClass)
          Sets the ejb implementation class.
 void setEJBName(java.lang.String ejbName)
          Sets the ejbName
 void setInit(ContainerProgram init)
           
 void setInjectionTarget(InjectionTarget<X> injectTarget)
           
 void setJar(EjbJar jar)
           
 void setLocalBean(boolean isLocal)
           
 void setLocation(java.lang.String location)
          Sets the location
 void setMappedName(java.lang.String mappedName)
          The mapped-name is the remote published name used by IIOP, Hessian, and jndi-remote-prefix, jndi-local-prefix.
 void setSecurityIdentity(EjbSecurityIdentity securityIdentity)
          Sets the security identity
 void setStatefulTimeout(EjbTimeout timeout)
           
 void setTransactionTimeout(Period timeout)
          Sets the transaction timeout.
 java.lang.String toString()
           
 void validateException(AnnotatedMethod<?> method, java.lang.Class<?> e)
           
 void validateExceptions(AnnotatedMethod<?> caller, AnnotatedMethod<? super X> callee)
           
 void validateExceptions(AnnotatedMethod<?> method, java.lang.Class<?>[] exn)
          Check that the method throws the expected exceptions.
protected
<T> void
validateLocal(AnnotatedType<T> objectType)
          Validates the local interface.
protected
<T> void
validateRemote(AnnotatedType<T> objectType)
          Validates the remote interface.
 
Methods inherited from class com.caucho.config.types.DescriptionGroupConfig
createIcon, getDisplayName, setDescription, setDisplayName, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_jClassLoader

protected java.lang.ClassLoader _jClassLoader

_remoteList

protected java.util.ArrayList<AnnotatedType<? super X>> _remoteList

_localList

protected java.util.ArrayList<AnnotatedType<? super X>> _localList

_isContainerTransaction

protected boolean _isContainerTransaction

_methodList

protected java.util.ArrayList<EjbMethodPattern<X>> _methodList

_beanMethodList

protected java.util.ArrayList<EjbMethodPattern<X>> _beanMethodList
Constructor Detail

EjbBean

public EjbBean(EjbConfig ejbConfig,
               java.lang.String ejbModuleName)
Creates a new entity bean configuration.


EjbBean

public EjbBean(EjbConfig ejbConfig,
               AnnotatedType<X> rawAnnType,
               AnnotatedType<X> annType,
               java.lang.String ejbModuleName)
Creates a new entity bean configuration.

Method Detail

getConfig

public EjbConfig getConfig()

getEjbContainer

public EjbManager getEjbContainer()

getCdiManager

public InjectManager getCdiManager()

getModuleName

public java.lang.String getModuleName()

getJar

public EjbJar getJar()

setJar

public void setJar(EjbJar jar)

setAroundInvoke

public void setAroundInvoke(AroundInvokeConfig aroundInvoke)

addAsyncMethod

public void addAsyncMethod(AsyncConfig async)

setInjectionTarget

public void setInjectionTarget(InjectionTarget<X> injectTarget)

getInjectionTarget

public InjectionTarget<X> getInjectionTarget()

getTimeoutMethodName

public java.lang.String getTimeoutMethodName()
Returns the timeout method name.


addRemoveMethod

@Configurable
public void addRemoveMethod(RemoveMethod<X> removeMethod)
Adds a new remove-method


addConcurrentMethod

@Configurable
public void addConcurrentMethod(ConcurrentMethod<X> concurrentMethod)
Adds a new concurrent-method


addAfterBeginMethod

public void addAfterBeginMethod(AfterBeginMethod<X> method)

addBeforeCompletionMethod

public void addBeforeCompletionMethod(BeforeCompletionMethod<X> method)

addInterceptor

public void addInterceptor(Interceptor interceptor,
                           boolean isDefault)
Adds a new interceptor.


getEJBModuleName

public java.lang.String getEJBModuleName()

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the class loader.

Specified by:
getClassLoader in interface EnvironmentBean

loadClass

protected java.lang.Class<?> loadClass(java.lang.String className)

setConfigLocation

public void setConfigLocation(java.lang.String filename,
                              int line)
Sets the location


setLocation

public void setLocation(java.lang.String location)
Sets the location


getLocation

public java.lang.String getLocation()
Gets the location


getFilename

public java.lang.String getFilename()
Gets the file name


getLine

public int getLine()
Gets the line


setAllowPOJO

public void setAllowPOJO(boolean allowPOJO)
Sets true if POJO are allowed.


isAllowPOJO

public boolean isAllowPOJO()
Return true if POJO are allowed.


setEJBName

public void setEJBName(java.lang.String ejbName)
Sets the ejbName


getEJBName

public java.lang.String getEJBName()
Gets the ejbName


setMappedName

public void setMappedName(java.lang.String mappedName)
The mapped-name is the remote published name used by IIOP, Hessian, and jndi-remote-prefix, jndi-local-prefix. The default is the EJBName.


getMappedName

public java.lang.String getMappedName()
The mapped-name is the published name used by IIOP, Hessian, and jndi-remote-prefix, jndi-local-prefix.


getEJBKind

public java.lang.String getEJBKind()
Returns the kind of bean.


setEJBClass

public void setEJBClass(java.lang.Class<X> ejbClass)
                 throws ConfigException
Sets the ejb implementation class.

Throws:
ConfigException

setEJBClassWrapper

public void setEJBClassWrapper(AnnotatedType<X> ejbClass)
                        throws ConfigException
Sets the ejb implementation class.

Throws:
ConfigException

getEJBClass

public java.lang.Class<X> getEJBClass()
Gets the ejb implementation class.


getRawAnnotatedType

public AnnotatedType<X> getRawAnnotatedType()

getAnnotatedType

public AnnotatedTypeImpl<X> getAnnotatedType()

getEJBFullClassName

public java.lang.String getEJBFullClassName()
Gets the ejb implementation class.


getEJBClassName

public java.lang.String getEJBClassName()
Gets the ejb implementation class.


getFullImplName

public java.lang.String getFullImplName()
Gets the implementation class name.


addRemote

public <T> void addRemote(java.lang.Class<T> remote)
               throws ConfigException
Throws:
ConfigException

addRemoteType

public <T> void addRemoteType(BaseType remote)
                   throws ConfigException
Sets the ejb remote interface

Throws:
ConfigException

addRemoteWrapper

public void addRemoteWrapper(AnnotatedType<? super X> remote)
                      throws ConfigException
Sets the remote interface class.

Throws:
ConfigException

getRemoteList

public java.util.ArrayList<AnnotatedType<? super X>> getRemoteList()
Gets the remote interface class.


addLocal

public void addLocal(java.lang.Class<?> local)
              throws ConfigException
Sets the ejb local interface

Throws:
ConfigException

addLocalType

protected void addLocalType(BaseType local)

addLocalWrapper

public void addLocalWrapper(AnnotatedType<? super X> local)
                     throws ConfigException
Sets the local interface class.

Throws:
ConfigException

getLocalList

public java.util.ArrayList<AnnotatedType<? super X>> getLocalList()
Gets the local interface class.


getLocalBean

public AnnotatedType<X> getLocalBean()

isContainerTransaction

public boolean isContainerTransaction()
Returns true if the transaction type is container.


setContainerTransaction

public void setContainerTransaction(boolean isContainerTransaction)
Returns true if the transaction type is container.


setConcurrencyManagementType

public void setConcurrencyManagementType(java.lang.String type)

setStatefulTimeout

public void setStatefulTimeout(EjbTimeout timeout)

createMethod

public EjbMethodPattern<X> createMethod(MethodSignature sig)
Adds a method.


addMethod

public void addMethod(EjbMethodPattern<X> method)
Adds a method.


isMatch

public boolean isMatch(AnnotatedMethod<?> method)

getMethodPattern

public EjbMethodPattern<X> getMethodPattern(AnnotatedMethod<?> method,
                                            java.lang.String intf)
Gets the best method.


getMethodList

public java.util.ArrayList<EjbMethodPattern<X>> getMethodList()
returns the method list.


setTransactionTimeout

public void setTransactionTimeout(Period timeout)
Sets the transaction timeout.


addBusinessLocal

public void addBusinessLocal(java.lang.Class<?> localApi)

addBusinessRemote

public void addBusinessRemote(java.lang.Class<?> remoteApi)

setLocalBean

public void setLocalBean(boolean isLocal)

getTransactionTimeout

public long getTransactionTimeout()
Gets the transaction timeout.


createMessageDestinationRef

public MessageDestinationRef createMessageDestinationRef()

setSecurityIdentity

public void setSecurityIdentity(EjbSecurityIdentity securityIdentity)
Sets the security identity


addDependencyList

public void addDependencyList(java.util.ArrayList<PersistentDependency> dependList)
Adds a list of dependencies.


addDepend

public void addDepend(Path path)
Add a dependency.


addDependency

public void addDependency(PersistentDependency depend)
Add a dependency.

Specified by:
addDependency in interface DependencyBean

addDependency

public void addDependency(java.lang.Class<?> cl)
Add a dependency.


getDependList

public java.util.ArrayList<PersistentDependency> getDependList()
Gets the depend list.


addBeanDependency

public void addBeanDependency(java.lang.String ejbName)
Add a bean dependency.


getBeanDependList

public java.util.ArrayList<java.lang.String> getBeanDependList()
Gets the bean depend list.


addInitProgram

public void addInitProgram(ConfigProgram init)
Adds an init program.


addBuilderProgram

public void addBuilderProgram(ConfigProgram init)
Adds an undefined value, e.g. env-entry


createDataSource

public DataSourceRef createDataSource()

createEnvEntry

public EnvEntry createEnvEntry()

createEjbRef

public EjbRef createEjbRef()

createEjbLocalRef

public EjbLocalRef createEjbLocalRef()

createResourceRef

public ResourceRef createResourceRef()

createResourceEnvRef

public ResourceEnvRef createResourceEnvRef()

getResourceList

public java.util.ArrayList<ResourceGroupConfig> getResourceList()

setInit

public void setInit(ContainerProgram init)

addPostConstruct

public void addPostConstruct(PostConstructType<X> postConstruct)

getInitProgram

public ContainerProgram getInitProgram()
Gets the init program.


getServerProgram

public ContainerProgram getServerProgram()
Gets the server program.


init

@PostConstruct
public void init()
          throws ConfigException
Configure initialization.

Throws:
ConfigException

introspect

protected void introspect()

createBeanGenerator

protected BeanGenerator<X> createBeanGenerator()
Creates the BeanGenerator generator instance


initIntrospect

public void initIntrospect()
                    throws ConfigException
Configure initialization.

Throws:
ConfigException

deployServer

public AbstractEjbBeanManager<X> deployServer(EjbManager ejbContainer,
                                              EjbLazyGenerator<X> lazyGenerator)
                                       throws java.lang.ClassNotFoundException,
                                              ConfigException
Deploys the bean.

Throws:
java.lang.ClassNotFoundException
ConfigException

validateLocal

protected <T> void validateLocal(AnnotatedType<T> objectType)
                      throws ConfigException
Validates the local interface.

Throws:
ConfigException

validateRemote

protected <T> void validateRemote(AnnotatedType<T> objectType)
                       throws ConfigException
Validates the remote interface.

Throws:
ConfigException

getSkeletonName

public java.lang.String getSkeletonName()

getBeanType

protected java.lang.String getBeanType()
Returns:
Type of bean (Stateful, Stateless, etc.)

getMethod

protected AnnotatedMethod<? super X> getMethod(java.lang.String methodName,
                                               java.lang.Class<?>[] paramTypes)
Finds the method in the class.

Parameters:
cl - owning class
method - source method
Returns:
the matching method or null if non matches.

getMethod

public static <X,T> AnnotatedMethod<? super X> getMethod(AnnotatedType<X> cl,
                                                         AnnotatedMethod<? extends T> sourceMethod)
Finds the method in the class.

Parameters:
cl - owning class
method - source method
Returns:
the matching method or null if non matches.

getMethod

public static <X> AnnotatedMethod<? super X> getMethod(AnnotatedType<X> cl,
                                                       java.lang.String name,
                                                       java.lang.Class<?>[] param)
Finds the method in the class.

Parameters:
cl - owning class
name - method name to match
params - method parameters to match
Returns:
the matching method or null if non matches.

isCMP

public boolean isCMP()

isCMP1

public boolean isCMP1()

findMethod

public static <Y> AnnotatedMethod<? super Y> findMethod(MethodSignature sig,
                                                        AnnotatedType<Y> cl,
                                                        java.lang.String intf)
Finds the method in the class.

Parameters:
cl - owning class
name - method name to match
params - method parameters to match
Returns:
the matching method or null if non matches.

getClassName

public static java.lang.String getClassName(java.lang.Class<?> cl)
Returns a printable version of a class.


getShortClassName

public static java.lang.String getShortClassName(java.lang.Class<?> cl)
Returns a printable version of a class.


classHasMethod

public boolean classHasMethod(AnnotatedType<?> cl,
                              AnnotatedMethod<?> method)
Tests is a method is declared in a class.


validateException

public void validateException(AnnotatedMethod<?> method,
                              java.lang.Class<?> e)
                       throws ConfigException
Throws:
ConfigException

validateExceptions

public void validateExceptions(AnnotatedMethod<?> method,
                               java.lang.Class<?>[] exn)
                        throws ConfigException
Check that the method throws the expected exceptions.

Parameters:
method - the method to test
exn - the expected exceptions
Throws:
ConfigException

validateExceptions

public void validateExceptions(AnnotatedMethod<?> caller,
                               AnnotatedMethod<? super X> callee)
                        throws ConfigException
Throws:
ConfigException

findFirstCreateMethod

protected <T> AnnotatedMethod<? super T> findFirstCreateMethod(AnnotatedType<T> cl)

introspectBean

protected void introspectBean(AnnotatedType<X> type,
                              java.lang.String defaultName)
                       throws ConfigException
Throws:
ConfigException

getFullMethodName

public static java.lang.String getFullMethodName(AnnotatedMethod<?> method)
Returns a full method name with arguments.


getFullMethodName

public static java.lang.String getFullMethodName(java.lang.String methodName,
                                                 java.lang.Class<?>[] params)
Returns a full method name with arguments.


error

public ConfigException error(java.lang.String msg)
Returns an error.


error

public java.lang.RuntimeException error(java.lang.Exception e)
Returns an error.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object