xdoclet.ejb.tags
Class EjbTagsHandler

java.lang.Object
  |
  +--xdoclet.template.TemplateTagHandler
        |
        +--xdoclet.XDocletTagSupport
              |
              +--xdoclet.ejb.tags.EjbTagsHandler
Direct Known Subclasses:
DaoTagsHandler, DataObjectTagsHandler, EjbRefTagsHandler, EntityTagsHandler, HomeTagsHandler, InterfaceTagsHandler, MdbTagsHandler, PkTagsHandler, RelationTagsHandler, SecurityTagsHandler, SessionTagsHandler, StrutsFormTagsHandler, UtilTagsHandler, ValueObjectTagsHandler

public class EjbTagsHandler
extends XDocletTagSupport

Version:
$Revision: 1.31 $
Author:
Ara Abrahamian (ara_e@email.com)

Field Summary
protected static java.lang.String LOCAL_SUFFIX
           
 
Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
EjbTagsHandler()
           
 
Method Summary
 java.lang.String beanType()
          Returns Bean type : "Entity", "Session" or "Message Driven".
protected static java.lang.String choosePackage(java.lang.String packageName, java.lang.String package_pattern, java.lang.String for_subtask)
          Returns modified package name for a package name.
 java.lang.String concreteFullClassName()
          Returns the full-qualified name of the current class's concrete class.
 java.lang.String ejbExternalRefName()
          Returns the name of EJB ref.
 java.lang.String ejbName(java.util.Properties attributes)
          Returns the name of current EJB bean.
 java.lang.String ejbRefName()
          Returns the name of EJB ref.
protected  java.lang.String extendsFromFor(com.sun.javadoc.ClassDoc clazz, java.lang.String tag_name, java.lang.String type, java.lang.String extends_param_name, java.lang.String default_base_class_name)
          Returns the name of the class pk/etc class extends.
 void forAllBeans(java.lang.String template)
          Evaluates the body block for each EJBean derived from one of the three EJB types: EntityBean, SessionBean or MessageDrivenBean.
protected  java.lang.String getDependentClassFor(com.sun.javadoc.ClassDoc clazz, java.lang.String type)
          sub-classes which deal with patternized class names return a reasonable value
protected  java.lang.String getDependentClassTagName()
           
static java.lang.String getEjbIdFor(com.sun.javadoc.ClassDoc clazz)
           
static java.lang.String getEjbNameFor(com.sun.javadoc.ClassDoc clazz)
          Returns the EJB name of the clazz by seaching for ejb:bean's name parameter.
static java.lang.String getEjbSpec()
          Returns the EJB specification version used.
static java.lang.String getShortEjbNameFor(com.sun.javadoc.ClassDoc clazz)
          Returns short version of the EJB name of the clazz.
protected  boolean hasPermission(com.sun.javadoc.Doc doc)
          Returns true if class/method denoted by doc has ejb:permission tag, false otherwise.
protected  boolean hasTransaction(com.sun.javadoc.Doc doc)
          Returns true if class/method denoted by doc has ejb:transaction tag, false otherwise.
 java.lang.String id()
          Returns unique id for current ejb.
 void ifIsAConcreteEJBean(java.lang.String template, java.util.Properties attributes)
          Evaluates the body block if current bean is a concrete bean meaning the generate parameter of ejb:bean is either not specified or equals to "true", otherwise the bean is just an abstract base class bean not meant to be used as a EJBean but serve as the base for other EJBeans.
 void ifLocalEjb(java.lang.String template)
           
 void ifNotLocalEjb(java.lang.String template)
           
 void ifNotRemoteEjb(java.lang.String template)
           
 void ifRemoteEjb(java.lang.String template)
           
static boolean isAConcreteEJBean(com.sun.javadoc.ClassDoc clazz)
           
protected  boolean isEjb(com.sun.javadoc.ClassDoc clazz)
          Returns true of clazz is an EJB (derived from an EJB type), false otherwise.
static boolean isLocalEjb(com.sun.javadoc.ClassDoc clazz)
           
static boolean isOnlyLocalEjb(com.sun.javadoc.ClassDoc clazz)
          Returns true if clazz is only a local EJB by looking at ejb:bean's view-type parameter.
static boolean isOnlyRemoteEjb(com.sun.javadoc.ClassDoc clazz)
          Returns true if clazz is only a remote EJB by looking at ejb:bean's view-type parameter.
static boolean isRemoteEjb(com.sun.javadoc.ClassDoc clazz)
           
protected  java.lang.String prefixWithEjbSlash(java.lang.String ejb_name)
           
 java.lang.String shortEjbName()
          Returns short version of ejbName().
protected  boolean shouldTraverseSuperclassForDependentClass(com.sun.javadoc.ClassDoc clazz, java.lang.String tag_name)
           
 java.lang.String symbolicClassName()
          Returns the symbolic name of the current class.
 
Methods inherited from class xdoclet.XDocletTagSupport
getClassTagValue, getClassTagValue, getConstructorTagValue, getCurrentClass, getCurrentConstructor, getCurrentField, getCurrentMethod, getCurrentPackage, getCurrentTag, getDocletContext, getFieldTagValue, getFieldTagValue, getMethodTagValue, getMethodTagValue, getParameterValue, getParameterValue, getTagValue, getTagValue, getTagValue, invalidParamValueFound, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, parsePropertyString, popCurrentClass, pushCurrentClass, replaceProperties, setCurrentClass, setCurrentConstructor, setCurrentField, setCurrentMethod, setCurrentPackage, setCurrentTag, tokenizeValue
 
Methods inherited from class xdoclet.template.TemplateTagHandler
generate, getContext, getEngine, getParser, setContext, setEngine, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCAL_SUFFIX

protected static final java.lang.String LOCAL_SUFFIX
Constructor Detail

EjbTagsHandler

public EjbTagsHandler()
Method Detail

isAConcreteEJBean

public static boolean isAConcreteEJBean(com.sun.javadoc.ClassDoc clazz)
                                 throws XDocletException

getEjbNameFor

public static java.lang.String getEjbNameFor(com.sun.javadoc.ClassDoc clazz)
                                      throws XDocletException
Returns the EJB name of the clazz by seaching for ejb:bean's name parameter. If that is not found, it uses the class' name minus any suffix from the list in the 'ejbClassNameSuffix' config parameter ("Bean,EJB,Ejb" by default).
Parameters:
clazz - The EJB bean class for which we want the EJB name
Returns:
The EjbName value
Throws:
XDocletException - Description of Exception
See Also:
ejbName(java.util.Properties)

getShortEjbNameFor

public static java.lang.String getShortEjbNameFor(com.sun.javadoc.ClassDoc clazz)
                                           throws XDocletException
Returns short version of the EJB name of the clazz.
Parameters:
clazz - the class we want its short EJB name
Returns:
The shortEjbName value
Throws:
XDocletException - Description of Exception
See Also:
shortEjbName()

getEjbIdFor

public static java.lang.String getEjbIdFor(com.sun.javadoc.ClassDoc clazz)
                                    throws XDocletException
Parameters:
clazz - Description of Parameter
Returns:
a unique id for clazz
Throws:
XDocletException - Description of Exception

getEjbSpec

public static java.lang.String getEjbSpec()
Returns the EJB specification version used. The generated files will be compatible with the version specified.
Returns:
The Ejbspec value

isLocalEjb

public static boolean isLocalEjb(com.sun.javadoc.ClassDoc clazz)
                          throws XDocletException

isRemoteEjb

public static boolean isRemoteEjb(com.sun.javadoc.ClassDoc clazz)
                           throws XDocletException

isOnlyLocalEjb

public static boolean isOnlyLocalEjb(com.sun.javadoc.ClassDoc clazz)
                              throws XDocletException
Returns true if clazz is only a local EJB by looking at ejb:bean's view-type parameter.
Parameters:
clazz - Description of Parameter
Returns:
The OnlyLocalEjb value
Throws:
XDocletException - Description of Exception

isOnlyRemoteEjb

public static boolean isOnlyRemoteEjb(com.sun.javadoc.ClassDoc clazz)
                               throws XDocletException
Returns true if clazz is only a remote EJB by looking at ejb:bean's view-type parameter.
Parameters:
clazz - Description of Parameter
Returns:
The OnlyRemoteEjb value
Throws:
XDocletException - Description of Exception

choosePackage

protected static java.lang.String choosePackage(java.lang.String packageName,
                                                java.lang.String package_pattern,
                                                java.lang.String for_subtask)
                                         throws XDocletException
Returns modified package name for a package name. If package name ends with one of the toReplace Strings, then it's substituted by the replaceWith String. If package_pattern not null then it's roughly used.
Parameters:
packageName - The name of the package name the new package name will be derived from
package_pattern - The package pattern to use. Can be null
for_subtask -  
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

ejbName

public java.lang.String ejbName(java.util.Properties attributes)
                         throws XDocletException
Returns the name of current EJB bean.
Parameters:
attributes - The attributes of the template tag
Returns:
The name of current EJB bean.
Throws:
XDocletException - Description of Exception
See Also:
getEjbNameFor(com.sun.javadoc.ClassDoc)

ejbRefName

public java.lang.String ejbRefName()
                            throws XDocletException
Returns the name of EJB ref.
Returns:
The name of current EJB bean.
Throws:
XDocletException - Description of Exception

ejbExternalRefName

public java.lang.String ejbExternalRefName()
                                    throws XDocletException
Returns the name of EJB ref.
Returns:
The name of current EJB bean.
Throws:
XDocletException - Description of Exception

symbolicClassName

public java.lang.String symbolicClassName()
                                   throws XDocletException
Returns the symbolic name of the current class. For an EJBean it's the value of ejb:bean's name parameter.
Returns:
The symbolic name of the current class
Throws:
XDocletException - Description of Exception
See Also:
shortEjbName()

shortEjbName

public java.lang.String shortEjbName()
                              throws XDocletException
Returns short version of ejbName(). Example: "foo.bar.MyBean" ->"MyBean", "foo/bar/MyBean" ->"MyBean"
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception
See Also:
getShortEjbNameFor(com.sun.javadoc.ClassDoc)

forAllBeans

public void forAllBeans(java.lang.String template)
                 throws XDocletException
Evaluates the body block for each EJBean derived from one of the three EJB types: EntityBean, SessionBean or MessageDrivenBean.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
EntityTagsHandler.isEntity(com.sun.javadoc.ClassDoc), SessionTagsHandler.isSession(com.sun.javadoc.ClassDoc), MdbTagsHandler.isMessageDriven(com.sun.javadoc.ClassDoc)

ifIsAConcreteEJBean

public void ifIsAConcreteEJBean(java.lang.String template,
                                java.util.Properties attributes)
                         throws XDocletException
Evaluates the body block if current bean is a concrete bean meaning the generate parameter of ejb:bean is either not specified or equals to "true", otherwise the bean is just an abstract base class bean not meant to be used as a EJBean but serve as the base for other EJBeans.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

beanType

public java.lang.String beanType()
                          throws XDocletException
Returns Bean type : "Entity", "Session" or "Message Driven".
Returns:
"Entity", "Session" or "Message Driven".
Throws:
XDocletException - Description of Exception
See Also:
EntityTagsHandler.isEntity(com.sun.javadoc.ClassDoc), SessionTagsHandler.isSession(com.sun.javadoc.ClassDoc), MdbTagsHandler.isMessageDriven(com.sun.javadoc.ClassDoc)

concreteFullClassName

public java.lang.String concreteFullClassName()
                                       throws XDocletException
Returns the full-qualified name of the current class's concrete class. This is the class that is generated and is derived from current class.
Returns:
The full-qualified name of the current class's concrete class
Throws:
XDocletException - Description of Exception
See Also:
SessionTagsHandler.sessionClass(), BmpTagsHandler.entityBmpClass(), CmpTagsHandler.entityCmpClass(), MdbTagsHandler.messageDrivenClass()

id

public java.lang.String id()
                    throws XDocletException
Returns unique id for current ejb.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

ifLocalEjb

public void ifLocalEjb(java.lang.String template)
                throws XDocletException
Parameters:
template - Description of Parameter
Throws:
XDocletException - Description of Exception

ifRemoteEjb

public void ifRemoteEjb(java.lang.String template)
                 throws XDocletException
Parameters:
template - Description of Parameter
Throws:
XDocletException - Description of Exception

ifNotLocalEjb

public void ifNotLocalEjb(java.lang.String template)
                   throws XDocletException
Parameters:
template -  
Throws:
XDocletException -  

ifNotRemoteEjb

public void ifNotRemoteEjb(java.lang.String template)
                    throws XDocletException
Parameters:
template -  
Throws:
XDocletException -  

isEjb

protected boolean isEjb(com.sun.javadoc.ClassDoc clazz)
                 throws XDocletException
Returns true of clazz is an EJB (derived from an EJB type), false otherwise.
Parameters:
clazz - Description of Parameter
Returns:
The Ejb value
Throws:
XDocletException - Description of Exception

getDependentClassFor

protected java.lang.String getDependentClassFor(com.sun.javadoc.ClassDoc clazz,
                                                java.lang.String type)
                                         throws XDocletException
sub-classes which deal with patternized class names return a reasonable value
Parameters:
clazz - the class
type - type value used for view-type of remote/local
Returns:
dependent class name for the class and type
Throws:
XDocletException -  

getDependentClassTagName

protected java.lang.String getDependentClassTagName()

prefixWithEjbSlash

protected java.lang.String prefixWithEjbSlash(java.lang.String ejb_name)

hasPermission

protected boolean hasPermission(com.sun.javadoc.Doc doc)
                         throws XDocletException
Returns true if class/method denoted by doc has ejb:permission tag, false otherwise.
Parameters:
doc - Description of Parameter
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

hasTransaction

protected boolean hasTransaction(com.sun.javadoc.Doc doc)
                          throws XDocletException
Returns true if class/method denoted by doc has ejb:transaction tag, false otherwise.
Parameters:
doc - Description of Parameter
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

extendsFromFor

protected java.lang.String extendsFromFor(com.sun.javadoc.ClassDoc clazz,
                                          java.lang.String tag_name,
                                          java.lang.String type,
                                          java.lang.String extends_param_name,
                                          java.lang.String default_base_class_name)
                                   throws XDocletException
Returns the name of the class pk/etc class extends.
Parameters:
clazz - the class
tag_name - name of the tag (ejb:bean for example, used for getting generate parameter)
type - type value used for view type of remote/local
extends_param_name - extends parameter name (is "extends" for ejb:bean but is "local-extends" for local)
default_base_class_name - default base class name, returned when not deriving from another base class
Returns:
correct value for the extends statement of a generated class
Throws:
XDocletException -  

shouldTraverseSuperclassForDependentClass

protected boolean shouldTraverseSuperclassForDependentClass(com.sun.javadoc.ClassDoc clazz,
                                                            java.lang.String tag_name)
                                                     throws XDocletException