org.ow2.jonas.deployment.ejb
Class BeanDesc

java.lang.Object
  extended by org.ow2.jonas.deployment.common.DescriptionGroupDesc
      extended by org.ow2.jonas.deployment.common.JndiEnvRefsGroupDesc
          extended by org.ow2.jonas.deployment.ejb.BeanDesc
All Implemented Interfaces:
IDescriptionGroupDesc, IJNDIEnvRefsGroupDesc
Direct Known Subclasses:
EntityDesc, MessageDrivenDesc, SessionDesc

public abstract class BeanDesc
extends JndiEnvRefsGroupDesc

Class to hold meta-information related to any enterprise-beans

Author:
Christophe Ney [cney@batisseurs.com] : Initial developer, Helene Joanin, Jeff Mesnil, Philippe Coq, Florent Benoit & Ludovic Bert : ejb_link

Field Summary
protected static int BEAN_TRANSACTION_TYPE
          Bean transaction type
protected  String beanIdentification
          bean identification string
protected  int cacheMax
          Maximum Bean Cache size
protected  boolean clusterReplicated
          Cluster - true if the bean has to be replicated
protected static int CONTAINER_TRANSACTION_TYPE
          Container transaction type
protected  DeploymentDesc deploymentDesc
          DeploymentDesc parent of this BeanDesc
protected  String derivedBeanName
          Bean classname
protected  Properties ejb10EnvProps
          EJB 1.0 Environment as Properties
protected  Class ejbClass
          Bean Class
protected  String ejbName
          name of the Bean
protected  String ejbTimeoutSignature
           
protected  String fullDerivedBeanName
          Bean fully qualified classname
static String GENERATED_PREFIX
          Package prefix for generated files
protected  Class home
          Home Class
protected  String jndiLocalName
          JNDI local name of the Bean
protected  String jndiName
          JNDI name of the Bean
protected  Class local
          Local Class
protected  Class localhome
          LocalHome Class
protected  int poolMin
          Minimum Bean Pool size
protected  Class remote
          Remote Class
protected  List securityRoleRefDescList
          List of SecurityRoleRefDesc for JACC
protected  int timerTxAttribute
           
protected static String[] TRANS
           
 
Fields inherited from class org.ow2.jonas.deployment.common.JndiEnvRefsGroupDesc
logger
 
Fields inherited from class org.ow2.jonas.deployment.common.DescriptionGroupDesc
description, displayName, largeIcon, smallIcon
 
Constructor Summary
BeanDesc(ClassLoader classLoader, CommonEjb ejb, JonasCommonEjb jonasEjb, AssemblyDescriptor asd, JLinkedList jMDRList, String fileName)
          Constructor to be used by parent node
 
Method Summary
protected  int addEJBMethodDesc(int len)
          Permit Methods addition from subtypes Protected method that need to be overridden in subclasses
protected  MethodDesc addMethodDesc(Method meth, Class classDef)
          Add a new method descriptor to the bean
 void check()
          Check that the bean descriptor is valid
 void checkRemoteException(Method m, boolean shouldThrow)
          Check if method throws RemoteException (or not).
 void checkRunAsMapping()
          Check that the runAs role mapping is correct
protected abstract  void checkTxAttribute(MethodDesc md)
          Check that trans-attribute is valid for a bean's method.
 void checkValidTypesForRmi(Method m)
          Check if argument and return types are valid types for RMI-IIOP.
 int getCacheMax()
           
 Object getCluster()
           
 DeploymentDesc getDeploymentDesc()
           
 String getDerivedBeanName()
           
 Properties getEjb10Environment()
          Get bean's EJB 1.0 environment properties.
 Class getEjbClass()
          Get bean's class.
 String getEjbName()
          Get the enterprise bean's name.
 String getEjbTimeoutSignature()
           
 String getFullDerivedBeanName()
           
 String getFullWrpHandleName()
           
 String getFullWrpHomeName()
           
 String getFullWrpLocalHomeName()
           
 String getFullWrpLocalName()
           
 String getFullWrpRemoteName()
           
protected  String getHashCodeForIdentifier()
          Gets an hashcode for this bean Return hashcode for jndiname + jndi localname
 Class getHomeClass()
          Get bean's home interface.
 String getIdentifier()
          Build a valid java identifier for the bean.
 String getJndiLocalName()
          Get the name to associate with the enterprise Bean in the JNDI name space for local access (inside the same JOnAS Server)
 String getJndiName()
          Get the name to associate with the enterprise Bean in the JNDI name space.
 Class getLocalClass()
          Get bean's local interface.
 Class getLocalHomeClass()
          Get bean's local home interface.
 MethodDesc getMethodDesc(int index)
          get a MethodDesc from its index.
 MethodDesc getMethodDesc(Method method)
          Get descriptor attached to a given method.
 Iterator getMethodDescIterator()
          get an iterator for all MethodDesc of the bean.
protected  Class getParentClass(String intfType)
          Returns the parent Class for a method given an interface type.
 int getPoolMin()
           
 Class getRemoteClass()
          Get bean's remote interface.
 String getRunAsPrincipalName()
           
 String getRunAsRole()
           
 org.ow2.carol.util.csiv2.SasComponent getSasComponent()
           
 List getSecurityRoleRefDescList()
          Gets the security-role-ref of the beans can access to the EJBRoleRefPermission and role-link.
 int getTimerTxAttribute()
           
 String getWrpHandleName()
           
 String getWrpHomeName()
           
 String getWrpLocalHomeName()
           
 String getWrpLocalName()
           
 String getWrpRemoteName()
           
 boolean hasDefinedLocalInterface()
           
 boolean isClusterReplicated()
           
protected  void loadExtraClasses(CommonEjb ce, ClassLoader loader)
          Permit classes loading from subtypes.
protected  MethodDesc newMethodDescInstance(Method meth, Class classDef, int index)
          MethodDesc constructor factory method to ovewrite
 void setCluster(Object cluster)
           
 void setClusterReplicated(boolean replicated)
          Set the cluster replicated attribute
 void setDeploymentDesc(DeploymentDesc deploymentDesc)
          Set the parent deployment descriptor
 void setJndiLocalName(String jndiLocalName)
          Set the name to associate with the enterprise Bean in the JNDI name space for local access (inside the same JOnAS Server)
 void setJndiName(String jndiName)
          Set the name to associate with the enterprise Bean in the JNDI name space.
 void setSasComponent(org.ow2.carol.util.csiv2.SasComponent sasComponent)
           
 String toString()
          String representation of the object for test purpose
protected  void verifyRoleName(AssemblyDescriptor asd)
          Check that there are always corresponding role-name element in security-role and method-permission elements.
 
Methods inherited from class org.ow2.jonas.deployment.common.JndiEnvRefsGroupDesc
getEjbLocalRefDesc, getEjbRefDesc, getENCBindingHolder, getEnvEntryDesc, getMessageDestinationRefDesc, getPersistenceUnitRefs, getResourceEnvRefDesc, getResourceRefDesc, getServiceRefDesc, setENCBindingHolder
 
Methods inherited from class org.ow2.jonas.deployment.common.DescriptionGroupDesc
getDescription, getDisplayName, getLargeIcon, getSAXMsg, getSmallIcon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BEAN_TRANSACTION_TYPE

protected static final int BEAN_TRANSACTION_TYPE
Bean transaction type

See Also:
Constant Field Values

CONTAINER_TRANSACTION_TYPE

protected static final int CONTAINER_TRANSACTION_TYPE
Container transaction type

See Also:
Constant Field Values

TRANS

protected static final String[] TRANS

GENERATED_PREFIX

public static final String GENERATED_PREFIX
Package prefix for generated files

See Also:
Constant Field Values

ejbName

protected String ejbName
name of the Bean


jndiName

protected String jndiName
JNDI name of the Bean


jndiLocalName

protected String jndiLocalName
JNDI local name of the Bean


home

protected Class home
Home Class


remote

protected Class remote
Remote Class


localhome

protected Class localhome
LocalHome Class


local

protected Class local
Local Class


ejbClass

protected Class ejbClass
Bean Class


beanIdentification

protected String beanIdentification
bean identification string


ejb10EnvProps

protected Properties ejb10EnvProps
EJB 1.0 Environment as Properties


securityRoleRefDescList

protected List securityRoleRefDescList
List of SecurityRoleRefDesc for JACC


deploymentDesc

protected DeploymentDesc deploymentDesc
DeploymentDesc parent of this BeanDesc


fullDerivedBeanName

protected String fullDerivedBeanName
Bean fully qualified classname


derivedBeanName

protected String derivedBeanName
Bean classname


poolMin

protected int poolMin
Minimum Bean Pool size


cacheMax

protected int cacheMax
Maximum Bean Cache size


timerTxAttribute

protected int timerTxAttribute

ejbTimeoutSignature

protected String ejbTimeoutSignature

clusterReplicated

protected boolean clusterReplicated
Cluster - true if the bean has to be replicated

Constructor Detail

BeanDesc

public BeanDesc(ClassLoader classLoader,
                CommonEjb ejb,
                JonasCommonEjb jonasEjb,
                AssemblyDescriptor asd,
                JLinkedList jMDRList,
                String fileName)
         throws DeploymentDescException
Constructor to be used by parent node

Parameters:
classLoader - ClassLoader used to load Bean's classes
ejb - XML Element from standard Deployment Descriptor
jonasEjb - XML Element from jonas specific Deployment Descriptor
asd - XML Element for the AssemblyDescriptor
fileName - jar filename
Throws:
DeploymentDescException - when BeanDesc cannot be instanciated (class loading problem, ...)
Method Detail

loadExtraClasses

protected void loadExtraClasses(CommonEjb ce,
                                ClassLoader loader)
                         throws DeploymentDescException
Permit classes loading from subtypes. (needed for Stateless Session Beans with service-endpoints). Needs to be overridden in subtypes.

Parameters:
ce - XML Element representing EJB Descriptor
loader - ClassLoader used to load classes
Throws:
DeploymentDescException - when a class cannot be loaded

addEJBMethodDesc

protected int addEJBMethodDesc(int len)
                        throws DeploymentDescException
Permit Methods addition from subtypes Protected method that need to be overridden in subclasses

Parameters:
len - method array length
Returns:
new len value
Throws:
DeploymentDescException - when java reflection cannot be used on classes

getParentClass

protected Class getParentClass(String intfType)
                        throws DeploymentDescException
Returns the parent Class for a method given an interface type.

Parameters:
intfType - type of the interface (Home/Remote/LocalHome/Local or ServiceEndpoint)
Returns:
the parent class for a method given an interface type
Throws:
DeploymentDescException - when intfType is unknown

getHashCodeForIdentifier

protected String getHashCodeForIdentifier()
Gets an hashcode for this bean Return hashcode for jndiname + jndi localname

Returns:
a string for hashcode for jndiname + jndi localname

getIdentifier

public String getIdentifier()
Build a valid java identifier for the bean.

Returns:
Returns a valid java identifier from the bean.

checkRemoteException

public void checkRemoteException(Method m,
                                 boolean shouldThrow)
                          throws DeploymentDescException
Check if method throws RemoteException (or not).

Parameters:
m - the method to examine
shouldThrow - boolean value indicating if the method should or shouldn't throw RemoteException
Throws:
DeploymentDescException - thrown for non-valid method

checkValidTypesForRmi

public void checkValidTypesForRmi(Method m)
Check if argument and return types are valid types for RMI-IIOP. (Primitive types, remote objects, or non-remote objects that implement the java.io.Serializable interface) Only a warning is logging if it's not the case.

Parameters:
m - the methode to examine

check

public void check()
           throws DeploymentDescException
Check that the bean descriptor is valid

Throws:
DeploymentDescException - thrown for non-valid bean

checkRunAsMapping

public void checkRunAsMapping()
                       throws DeploymentDescException
Check that the runAs role mapping is correct

Throws:
DeploymentDescException - if role mapping is incorrect

checkTxAttribute

protected abstract void checkTxAttribute(MethodDesc md)
                                  throws DeploymentDescException
Check that trans-attribute is valid for a bean's method.

Parameters:
md - MethodDesc to check
Throws:
DeploymentDescException - When MethodDesc is not valid

verifyRoleName

protected void verifyRoleName(AssemblyDescriptor asd)
                       throws DeploymentDescException
Check that there are always corresponding role-name element in security-role and method-permission elements.

Parameters:
asd - the AssemblyDescriptor used to check bean's role names
Throws:
DeploymentDescException - When verification fails

getEjbName

public String getEjbName()
Get the enterprise bean's name.

Returns:
Name of the bean

getJndiName

public String getJndiName()
Get the name to associate with the enterprise Bean in the JNDI name space. Invoking this method is disallowed for message driven bean. (This information is JOnAS specific). Used by Server

Returns:
Jndi name of the bean

setJndiName

public void setJndiName(String jndiName)
Set the name to associate with the enterprise Bean in the JNDI name space. Invoking this method is disallowed for message driven bean. (This information is JOnAS specific). Used by Server

Parameters:
jndiName - Jndi name of the bean

getJndiLocalName

public String getJndiLocalName()
Get the name to associate with the enterprise Bean in the JNDI name space for local access (inside the same JOnAS Server)

Returns:
Jndi local name of the bean

setJndiLocalName

public void setJndiLocalName(String jndiLocalName)
Set the name to associate with the enterprise Bean in the JNDI name space for local access (inside the same JOnAS Server)

Parameters:
jndiLocalName - Jndi local name of the bean

getHomeClass

public Class getHomeClass()
Get bean's home interface. Invoking this method is disallowed for message driven bean. Used by GenIC and Server

Returns:
Class for the home interface or null

getRemoteClass

public Class getRemoteClass()
Get bean's remote interface. Invoking this method is disallowed for message driven bean. Used by GenIC and Server

Returns:
Class for the remote interface or null

getLocalHomeClass

public Class getLocalHomeClass()
Get bean's local home interface. Invoking this method is disallowed for message driven bean. Used by GenIC and Server

Returns:
Class for the home interface or null

getLocalClass

public Class getLocalClass()
Get bean's local interface. Invoking this method is disallowed for message driven bean. Used by GenIC and Server

Returns:
Class for the Local interface or null

getEjbClass

public Class getEjbClass()
Get bean's class. Used by GenIC and Server

Returns:
Class for the bean

getEjb10Environment

public Properties getEjb10Environment()
Get bean's EJB 1.0 environment properties.

Returns:
Returns the bean's EJB 1.0 environment properties

getMethodDesc

public MethodDesc getMethodDesc(Method method)
Get descriptor attached to a given method. Used by GenIC and JMdbEndpointFactory

Parameters:
method - Method from the Home/Remote/MessageListener interface
Returns:
The method descriptor (never returns null)

getMethodDescIterator

public Iterator getMethodDescIterator()
get an iterator for all MethodDesc of the bean.

Returns:
Returns an iterator for all MethodDesc of the bean

getMethodDesc

public MethodDesc getMethodDesc(int index)
get a MethodDesc from its index.

Parameters:
index - MethodDesc index
Returns:
Returns a MethodDesc from its index

getSecurityRoleRefDescList

public List getSecurityRoleRefDescList()
Gets the security-role-ref of the beans can access to the EJBRoleRefPermission and role-link.

Returns:
the security-role-ref of the beans

getPoolMin

public int getPoolMin()
Returns:
min size of the pool

getCacheMax

public int getCacheMax()
Returns:
max size of the cache

getRunAsRole

public String getRunAsRole()
Returns:
the run-as role name

getTimerTxAttribute

public int getTimerTxAttribute()
Returns:
the transaction attribute for the ejbTimeout method

getEjbTimeoutSignature

public String getEjbTimeoutSignature()
Returns:
the security signature for the ejbTimeout method

toString

public String toString()
String representation of the object for test purpose

Specified by:
toString in interface IDescriptionGroupDesc
Specified by:
toString in class DescriptionGroupDesc
Returns:
String representation of this object

newMethodDescInstance

protected MethodDesc newMethodDescInstance(Method meth,
                                           Class classDef,
                                           int index)
MethodDesc constructor factory method to ovewrite

Parameters:
meth - the method to be wrapped into a MethodDesc instance
index - index of the method inside the MethodDesc List
Returns:
Returns a new MethodDesc (or subclass)

addMethodDesc

protected MethodDesc addMethodDesc(Method meth,
                                   Class classDef)
Add a new method descriptor to the bean

Parameters:
meth - method to add inside MethodDescs list
Returns:
the constructed MethodDesc

getFullWrpRemoteName

public String getFullWrpRemoteName()
Returns:
Returns the full name of the wrapper class for the bean

getFullWrpLocalName

public String getFullWrpLocalName()
Returns:
Returns the full name of the wrapper class for the bean

getWrpRemoteName

public String getWrpRemoteName()
Returns:
Returns the name of the wrapper class for the bean

getWrpLocalName

public String getWrpLocalName()
Returns:
Returns the name of the wrapper class for the bean

getFullWrpHandleName

public String getFullWrpHandleName()
Returns:
Returns the full name of the Handle class for the bean

getWrpHandleName

public String getWrpHandleName()
Returns:
Returns the name of the Handle class for the bean

getFullWrpHomeName

public String getFullWrpHomeName()
Returns:
Returns the full name of the wrapper home class for the bean

getFullWrpLocalHomeName

public String getFullWrpLocalHomeName()
Returns:
Returns the full name of the wrapper local home class for the bean

getWrpHomeName

public String getWrpHomeName()
Returns:
Returns the name of the wrapper home class for the bean

getWrpLocalHomeName

public String getWrpLocalHomeName()
Returns:
Returns the name of the wrapper local home class for the bean

getFullDerivedBeanName

public String getFullDerivedBeanName()
Returns:
Returns the full name of the derived class of the bean

getDerivedBeanName

public String getDerivedBeanName()
Returns:
Returns the name of the derived class of the bean

getDeploymentDesc

public DeploymentDesc getDeploymentDesc()
Returns:
Returns the parent deployment descriptor

setDeploymentDesc

public void setDeploymentDesc(DeploymentDesc deploymentDesc)
Set the parent deployment descriptor

Parameters:
deploymentDesc - parent DeploymentDesc

getRunAsPrincipalName

public String getRunAsPrincipalName()
Returns:
the runAs principal name.

hasDefinedLocalInterface

public boolean hasDefinedLocalInterface()
Returns:
true if local interface has been defined in the DD

getSasComponent

public org.ow2.carol.util.csiv2.SasComponent getSasComponent()
Returns:
the sasComponent.

setSasComponent

public void setSasComponent(org.ow2.carol.util.csiv2.SasComponent sasComponent)
Parameters:
sasComponent - The sasComponent to set.

isClusterReplicated

public boolean isClusterReplicated()
Returns:
true if the bean has to be replicated over the cluster

setClusterReplicated

public void setClusterReplicated(boolean replicated)
Set the cluster replicated attribute

Parameters:
replicated - true if the replicated mode is enabled

getCluster

public Object getCluster()
Returns:
the cluster

setCluster

public void setCluster(Object cluster)
Parameters:
cluster - the cluster to set


Copyright © 2010 OW2 Consortium. All Rights Reserved.