xdoclet.modules.ejb
Class EjbTagsHandler

java.lang.Object
  extended byxdoclet.template.TemplateTagHandler
      extended byxdoclet.XDocletTagSupport
          extended byxdoclet.modules.ejb.EjbTagsHandler
Direct Known Subclasses:
DaoTagsHandler, DataObjectTagsHandler, EjbRefTagsHandler, EntityTagsHandler, HomeTagsHandler, InterfaceTagsHandler, LookupUtilTagsHandler, MdbTagsHandler, PkTagsHandler, RelationTagsHandler, SecurityTagsHandler, SessionTagsHandler, StrutsFormTagsHandler, ValueObjectTagsHandler

public class EjbTagsHandler
extends XDocletTagSupport

Version:
$Revision: 1.30 $
Author:
Ara Abrahamian (ara_e@email.com), Christoph G. Jung (christoph.jung@infor.de)
xdoclet.taghandler
namespace="Ejb"
created
Oct 15, 2001

Field Summary
static String ALL
           
protected static String LOCAL_SUFFIX
           
static String SERVICE_ENDPOINT
           
static String SERVICE_ENDPOINT_SUFFIX
           
 
Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
EjbTagsHandler()
           
 
Method Summary
 String beanType()
          Returns Bean type : "Entity", "Session" or "Message Driven".
static String choosePackage(String packageName, String packagePattern, String subtask)
          Returns modified package name for a package name.
 String concreteFullClassName()
          Returns the full-qualified name of the current class's concrete class.
 String ejbExternalRefName()
          Returns the name of EJB ref.
 String ejbName(Properties attributes)
          Returns the name of current EJB bean.
static String ejbRefName()
          Returns the name of EJB ref.
static String ejbRefName(xjavadoc.XTag tag, xjavadoc.XClass clazz)
          Returns the name of EJB ref.
protected  String extendsFromFor(xjavadoc.XClass clazz, String tagName, String type, String extendsParamName, String defaultBaseClassName)
          Returns the name of the class pk/etc class extends.
 void forAllBeans(String template)
          Evaluates the body block for each EJBean derived from one of the three EJB types: EntityBean, SessionBean or MessageDrivenBean.
protected  String getDependentClassFor(xjavadoc.XClass clazz, String type)
          sub-classes which deal with patternized class names return a reasonable value
protected  String getDependentClassTagName()
          Gets the DependentClassTagName attribute of the EjbTagsHandler object
static xjavadoc.XClass getEjb(String name)
          Returns the class with the specified ejb name
static String getEjbIdFor(xjavadoc.XClass clazz)
           
static String getEjbNameFor(xjavadoc.XClass clazz)
          Returns the EJB name of the clazz by seaching for ejb:bean's name parameter.
static String getEjbSpec()
          Returns the EJB specification version used.
static String getShortEjbNameFor(xjavadoc.XClass clazz)
          Returns short version of the EJB name of the clazz.
protected  boolean hasTransaction(xjavadoc.XDoc doc)
          Returns true if class/method denoted by doc has ejb:transaction tag, false otherwise.
 String id()
          Returns unique id for current ejb.
 void ifIsAConcreteEJBean(String template, 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(String template)
           
 void ifNotLocalEjb(String template)
           
 void ifNotRemoteEjb(String template)
           
 void ifNotServiceEndpointEjb(String template)
           
 void ifRemoteEjb(String template)
           
 void ifServiceEndpointEjb(String template)
           
static boolean isAConcreteEJBean(xjavadoc.XClass clazz)
          Gets the AConcreteEJBean attribute of the EjbTagsHandler class
static boolean isEjb(xjavadoc.XClass clazz)
          Returns true of clazz is an EJB (derived from an EJB type), false otherwise.
static boolean isLocalEjb(xjavadoc.XClass clazz)
           
static boolean isOnlyLocalEjb(xjavadoc.XClass clazz)
          Returns true if clazz is only a local EJB by looking at ejb:bean's view-type parameter.
static boolean isOnlyRemoteEjb(xjavadoc.XClass clazz)
          Returns true if clazz is only a remote EJB by looking at ejb:bean's view-type parameter.
static boolean isOnlyServiceEndpointEjb(xjavadoc.XClass clazz)
          Returns true if clazz is only a service endpoint EJB by looking at ejb:bean's view-type parameter.
static boolean isRemoteEjb(xjavadoc.XClass clazz)
           
static boolean isServiceEndpointEjb(xjavadoc.XClass clazz)
           
protected static String prefixWithEjbSlash(String ejbName)
          Replace "." by "/" and add "ejb/" to the parameter.
 String shortEjbName()
          Returns short version of ejbName().
protected  boolean shouldTraverseSuperclassForDependentClass(xjavadoc.XClass clazz, String tagName)
          Describe what the method does
 String symbolicClassName()
          Returns the symbolic name of the current class.
 
Methods inherited from class xdoclet.XDocletTagSupport
delimit, expandClassName, generate, getCurrentClass, getCurrentClassTag, getCurrentConstructor, getCurrentField, getCurrentFieldTag, getCurrentMethod, getCurrentMethodTag, getCurrentPackage, getDocletContext, getEngine, getExpandedDelimitedTagValue, getTagValue, getTagValue, getTagValue, hasHavingClassTag, hasTag, isTagValueEqual, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, modifiers, popCurrentClass, pushCurrentClass, setCurrentClass, setCurrentClassTag, setCurrentConstructor, setCurrentField, setCurrentFieldTag, setCurrentMethod, setCurrentMethodTag, setCurrentPackage
 
Methods inherited from class xdoclet.template.TemplateTagHandler
getXJavaDoc, setXJavaDoc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_ENDPOINT

public static final String SERVICE_ENDPOINT
See Also:
Constant Field Values

ALL

public static final String ALL
See Also:
Constant Field Values

SERVICE_ENDPOINT_SUFFIX

public static final String SERVICE_ENDPOINT_SUFFIX
See Also:
Constant Field Values

LOCAL_SUFFIX

protected static final String LOCAL_SUFFIX
See Also:
Constant Field Values
Constructor Detail

EjbTagsHandler

public EjbTagsHandler()
Method Detail

isAConcreteEJBean

public static boolean isAConcreteEJBean(xjavadoc.XClass clazz)
                                 throws XDocletException
Gets the AConcreteEJBean attribute of the EjbTagsHandler class

Parameters:
clazz - Describe what the parameter does
Returns:
The AConcreteEJBean value
Throws:
XDocletException

getEjbNameFor

public static String getEjbNameFor(xjavadoc.XClass clazz)
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
See Also:
ejbName(java.util.Properties)

getShortEjbNameFor

public static String getShortEjbNameFor(xjavadoc.XClass clazz)
Returns short version of the EJB name of the clazz.

Parameters:
clazz - the class we want its short EJB name
Returns:
The shortEjbName value
See Also:
shortEjbName()

getEjbIdFor

public static String getEjbIdFor(xjavadoc.XClass clazz)
Parameters:
clazz - Description of Parameter
Returns:
a unique id for clazz

getEjbSpec

public static 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(xjavadoc.XClass clazz)
                          throws XDocletException
Throws:
XDocletException

isRemoteEjb

public static boolean isRemoteEjb(xjavadoc.XClass clazz)
                           throws XDocletException
Throws:
XDocletException

isServiceEndpointEjb

public static boolean isServiceEndpointEjb(xjavadoc.XClass clazz)
                                    throws XDocletException
Throws:
XDocletException

isOnlyLocalEjb

public static boolean isOnlyLocalEjb(xjavadoc.XClass 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

isOnlyRemoteEjb

public static boolean isOnlyRemoteEjb(xjavadoc.XClass 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

isOnlyServiceEndpointEjb

public static boolean isOnlyServiceEndpointEjb(xjavadoc.XClass clazz)
                                        throws XDocletException
Returns true if clazz is only a service endpoint EJB by looking at ejb:bean's view-type parameter.

Parameters:
clazz - Description of Parameter
Returns:
The OnlyRemoteEjb value
Throws:
XDocletException

getEjb

public static xjavadoc.XClass getEjb(String name)
                              throws XDocletException
Returns the class with the specified ejb name

Parameters:
name -
Returns:
Throws:
XDocletException

isEjb

public static boolean isEjb(xjavadoc.XClass 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

choosePackage

public static String choosePackage(String packageName,
                                   String packagePattern,
                                   String subtask)
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 packagePattern not null then it's roughly used.

Parameters:
packageName - The name of the package name the new package name will be derived from
packagePattern - The package pattern to use. Can be null
subtask -
Returns:
Description of the Returned Value
To do:
this method is really an utility method that should be deprecated here and moved to PackageTagsHandler or even somewhere else

ejbRefName

public static String ejbRefName()
                         throws XDocletException
Returns the name of EJB ref.

Returns:
The name of current EJB bean.
Throws:
XDocletException
doc.tag
type="content"

ejbRefName

public static String ejbRefName(xjavadoc.XTag tag,
                                xjavadoc.XClass clazz)
                         throws XDocletException
Returns the name of EJB ref.

Parameters:
tag -
clazz -
Returns:
The name of current EJB bean.
Throws:
XDocletException
doc.tag
type="content"

prefixWithEjbSlash

protected static String prefixWithEjbSlash(String ejbName)
Replace "." by "/" and add "ejb/" to the parameter.

Parameters:
ejbName - The string to parse
Returns:
The parsed String

ejbName

public String ejbName(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
See Also:
getEjbNameFor(xjavadoc.XClass)
doc.tag
type="content"
doc.param
name="prefixWithEjbSlash" optional="true" values="true,false" description="Specifies whether to prefix it with ejb/ or not. False by default."

ejbExternalRefName

public String ejbExternalRefName()
                          throws XDocletException
Returns the name of EJB ref.

Returns:
The name of current EJB bean.
Throws:
XDocletException
doc.tag
type="content"

symbolicClassName

public 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
See Also:
shortEjbName()
doc.tag
type="content"

shortEjbName

public 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
See Also:
getShortEjbNameFor(xjavadoc.XClass)
doc.tag
type="content"

forAllBeans

public void forAllBeans(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
See Also:
EntityTagsHandler.isEntity(xjavadoc.XClass), SessionTagsHandler.isSession(xjavadoc.XClass), MdbTagsHandler.isMessageDriven(xjavadoc.XClass)
doc.tag
type="block"

ifIsAConcreteEJBean

public void ifIsAConcreteEJBean(String template,
                                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
doc.tag
type="block"

beanType

public String beanType()
                throws XDocletException
Returns Bean type : "Entity", "Session" or "Message Driven".

Returns:
"Entity", "Session" or "Message Driven".
Throws:
XDocletException
See Also:
EntityTagsHandler.isEntity(xjavadoc.XClass), SessionTagsHandler.isSession(xjavadoc.XClass), MdbTagsHandler.isMessageDriven(xjavadoc.XClass)
doc.tag
type="content"

concreteFullClassName

public 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
See Also:
SessionTagsHandler.sessionClass(), BmpTagsHandler.entityBmpClass(), CmpTagsHandler.entityCmpClass(), MdbTagsHandler.messageDrivenClass()
doc.tag
type="content"

id

public String id()
          throws XDocletException
Returns unique id for current ejb.

Returns:
Description of the Returned Value
Throws:
XDocletException
doc.tag
type="content"

ifLocalEjb

public void ifLocalEjb(String template)
                throws XDocletException
Parameters:
template - Description of Parameter
Throws:
XDocletException
doc.tag
type="block"

ifRemoteEjb

public void ifRemoteEjb(String template)
                 throws XDocletException
Parameters:
template - Description of Parameter
Throws:
XDocletException
doc.tag
type="block"

ifServiceEndpointEjb

public void ifServiceEndpointEjb(String template)
                          throws XDocletException
Parameters:
template - Description of Parameter
Throws:
XDocletException
doc.tag
type="block"

ifNotLocalEjb

public void ifNotLocalEjb(String template)
                   throws XDocletException
Parameters:
template -
Throws:
XDocletException
doc.tag
type="block"

ifNotRemoteEjb

public void ifNotRemoteEjb(String template)
                    throws XDocletException
Parameters:
template -
Throws:
XDocletException
doc.tag
type="block"

ifNotServiceEndpointEjb

public void ifNotServiceEndpointEjb(String template)
                             throws XDocletException
Parameters:
template -
Throws:
XDocletException
doc.tag
type="block"

getDependentClassFor

protected String getDependentClassFor(xjavadoc.XClass clazz,
                                      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 String getDependentClassTagName()
Gets the DependentClassTagName attribute of the EjbTagsHandler object

Returns:
The DependentClassTagName value

hasTransaction

protected boolean hasTransaction(xjavadoc.XDoc 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

extendsFromFor

protected String extendsFromFor(xjavadoc.XClass clazz,
                                String tagName,
                                String type,
                                String extendsParamName,
                                String defaultBaseClassName)
                         throws XDocletException
Returns the name of the class pk/etc class extends.

Parameters:
clazz - the class
tagName - name of the tag (ejb:bean for example, used for getting generate parameter)
type - type value used for view type of remote/local
extendsParamName - extends parameter name (is "extends" for ejb:bean but is "local-extends" for local)
defaultBaseClassName - 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(xjavadoc.XClass clazz,
                                                            String tagName)
                                                     throws XDocletException
Describe what the method does

Parameters:
clazz - Describe what the parameter does
tagName - Describe what the parameter does
Returns:
Describe the return value
Throws:
XDocletException

http://xdoclet.sourceforge.net/