org.ow2.jonas.deployment.ejb
Class MethodDesc

java.lang.Object
  extended by org.ow2.jonas.deployment.ejb.MethodDesc
Direct Known Subclasses:
MethodCmp2Desc, MethodJdbcCmp1Desc

public class MethodDesc
extends Object

Class to hold meta-information related to bean and home methods.

Author:
Christophe Ney [cney@batisseurs.com] : Initial developer, Helene Joanin: fix a bug about select method select method is a bean's method which name begins with ejbSelect, (and not home interface method as finder method).

Field Summary
protected static String[] APPLY_TO
           
static int APPLY_TO_BEAN
           
static int APPLY_TO_BEAN_METHOD
           
static int APPLY_TO_BEAN_METHOD_NAME
           
static int APPLY_TO_CLASS
           
static int APPLY_TO_CLASS_METHOD
           
static int APPLY_TO_CLASS_METHOD_NAME
           
static int APPLY_TO_NOTHING
           
protected  BeanDesc beanDesc
           
static int TX_MANDATORY
           
static int TX_NEVER
           
static int TX_NOT_SET
           
static int TX_NOT_SUPPORTED
           
static int TX_NULL
          Set of constants for method transaction attribute
static int TX_REQUIRED
           
static int TX_REQUIRES_NEW
           
protected static String TX_STR_DEFAULT_VALUE
          default value for undefined transaction attribute for sessions and entities
protected static String TX_STR_DEFAULT_VALUE_4_MDB
          default value for undefined transaction attribute for message driven beans
static int TX_SUPPORTS
           
 
Constructor Summary
MethodDesc(BeanDesc beanDesc, Method meth, Class clDef, int index)
          constructor to be used by parent node
 
Method Summary
 BeanDesc getBeanDesc()
          get the parent node
 int getIndex()
          get a unique index of the method for the bean
 Method getMethod()
          return the method to which the meta-information applies
 String[] getRoleName()
          String representation of the roles which can execute the method
 int getTxAttribute()
          Get the container transaction attribute that match the method
 String getTxAttributeName()
          String representation of the transactionnal attribute
static String getTxAttributeName(int value)
          String representation of the transactionnal attribute
 int getTxAttributeStatus()
          Get the container transaction attribute that match the method
 boolean isEjbSelect()
          access if the method is a select
static boolean isEjbSelect(Method meth)
          access if a method is a select
 boolean isExcluded()
           
 boolean isFindByPrimaryKey()
          access if the method is findByPrimaryKey
static boolean isFindByPrimaryKey(Method meth)
          access if a method is findByPrimaryKey
 boolean isFinder()
          access if the method is a finder
static boolean isFinder(Method meth)
          access if a method is a finder
 int matchPattern(Class pclass, String mName, MethodParams patternMethodParams)
          Evaluate method pattern maching as defined in the EJB specifications
static int matchPattern(Method meth, Class classMeth, Class pclass, String mName, MethodParams patternMethodParams)
          Get the status of applicability for a given pattern to a method
static String methodElementToString(Method m)
          String representation of the given element
protected static String methodElementToString(String intf, String name, MethodParams params)
          get a String representation of a method from it's XML representation
 void setExcluded(boolean excluded)
          Sets the excluded attribute.
 void setIndex(int idx)
           
 String toString()
          String representation of the object for test purpose
static String toString(Method m)
          get a String representation of a method from the reflection object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TX_NULL

public static final int TX_NULL
Set of constants for method transaction attribute

See Also:
Constant Field Values

TX_NOT_SET

public static final int TX_NOT_SET
See Also:
Constant Field Values

TX_NOT_SUPPORTED

public static final int TX_NOT_SUPPORTED
See Also:
Constant Field Values

TX_REQUIRED

public static final int TX_REQUIRED
See Also:
Constant Field Values

TX_SUPPORTS

public static final int TX_SUPPORTS
See Also:
Constant Field Values

TX_REQUIRES_NEW

public static final int TX_REQUIRES_NEW
See Also:
Constant Field Values

TX_MANDATORY

public static final int TX_MANDATORY
See Also:
Constant Field Values

TX_NEVER

public static final int TX_NEVER
See Also:
Constant Field Values

TX_STR_DEFAULT_VALUE

protected static final String TX_STR_DEFAULT_VALUE
default value for undefined transaction attribute for sessions and entities

See Also:
Constant Field Values

TX_STR_DEFAULT_VALUE_4_MDB

protected static final String TX_STR_DEFAULT_VALUE_4_MDB
default value for undefined transaction attribute for message driven beans

See Also:
Constant Field Values

APPLY_TO_NOTHING

public static final int APPLY_TO_NOTHING
See Also:
Constant Field Values

APPLY_TO_BEAN

public static final int APPLY_TO_BEAN
See Also:
Constant Field Values

APPLY_TO_CLASS

public static final int APPLY_TO_CLASS
See Also:
Constant Field Values

APPLY_TO_BEAN_METHOD_NAME

public static final int APPLY_TO_BEAN_METHOD_NAME
See Also:
Constant Field Values

APPLY_TO_CLASS_METHOD_NAME

public static final int APPLY_TO_CLASS_METHOD_NAME
See Also:
Constant Field Values

APPLY_TO_BEAN_METHOD

public static final int APPLY_TO_BEAN_METHOD
See Also:
Constant Field Values

APPLY_TO_CLASS_METHOD

public static final int APPLY_TO_CLASS_METHOD
See Also:
Constant Field Values

APPLY_TO

protected static final String[] APPLY_TO

beanDesc

protected BeanDesc beanDesc
Constructor Detail

MethodDesc

public MethodDesc(BeanDesc beanDesc,
                  Method meth,
                  Class clDef,
                  int index)
constructor to be used by parent node

Method Detail

getIndex

public int getIndex()
get a unique index of the method for the bean


setIndex

public void setIndex(int idx)

isFinder

public boolean isFinder()
access if the method is a finder

Returns:
true for finder methods

isFindByPrimaryKey

public boolean isFindByPrimaryKey()
access if the method is findByPrimaryKey

Returns:
true for the findByPrimaryKey method

isEjbSelect

public boolean isEjbSelect()
access if the method is a select

Returns:
true for select methods

matchPattern

public int matchPattern(Class pclass,
                        String mName,
                        MethodParams patternMethodParams)
Evaluate method pattern maching as defined in the EJB specifications

Returns:
one of the APPLY_TO_* values.

matchPattern

public static int matchPattern(Method meth,
                               Class classMeth,
                               Class pclass,
                               String mName,
                               MethodParams patternMethodParams)
Get the status of applicability for a given pattern to a method

Returns:
status of applicability APPLY_TO_NOTHING,APPLY_TO_BEAN,APPLY_TO_CLASS,APPLY_TO_METHOD_NAME,APPLY_TO_METHOD

getTxAttribute

public int getTxAttribute()
Get the container transaction attribute that match the method

Returns:
Constant value within list : TX_NOT_SUPPORTED,TX_REQUIRED,TX_SUPPORTS,TX_REQUIRES_NEW,TX_MANDATORY,TX_NEVER,TX_NOT_SET

getTxAttributeStatus

public int getTxAttributeStatus()
Get the container transaction attribute that match the method

Returns:
Constant value within list : APPLY_TO_NOTHING, APPLY_TO_BEAN, APPLY_TO_CLASS, APPLY_TO_BEAN_METHOD_NAME, APPLY_TO_CLASS_METHOD_NAME, APPLY_TO_BEAN_METHOD, APPLY_TO_CLASS_METHOD

getTxAttributeName

public static String getTxAttributeName(int value)
String representation of the transactionnal attribute

Returns:
String representation of this transactionnal attribute

getTxAttributeName

public String getTxAttributeName()
String representation of the transactionnal attribute

Returns:
String representation of this transactionnal attribute

getRoleName

public String[] getRoleName()
String representation of the roles which can execute the method

Returns:
Array of String representing the roles which can execute the method

methodElementToString

public static String methodElementToString(Method m)
String representation of the given element

Parameters:
m - an element
Returns:
String representation of the given element method

methodElementToString

protected static String methodElementToString(String intf,
                                              String name,
                                              MethodParams params)
get a String representation of a method from it's XML representation


toString

public static String toString(Method m)
get a String representation of a method from the reflection object


getMethod

public Method getMethod()
return the method to which the meta-information applies


getBeanDesc

public BeanDesc getBeanDesc()
get the parent node


isFinder

public static boolean isFinder(Method meth)
access if a method is a finder


isFindByPrimaryKey

public static boolean isFindByPrimaryKey(Method meth)
access if a method is findByPrimaryKey


isEjbSelect

public static boolean isEjbSelect(Method meth)
access if a method is a select


toString

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

Overrides:
toString in class Object
Returns:
String representation of this object

isExcluded

public boolean isExcluded()
Returns:
true if this method is excluded (in DD), else false

setExcluded

public void setExcluded(boolean excluded)
Sets the excluded attribute.

Parameters:
excluded - true of false


Copyright © 2010 OW2 Consortium. All Rights Reserved.