xdoclet.modules.ejb

Class EjbTagsHandler

Known Direct Subclasses:
DaoTagsHandler, DataObjectTagsHandler, EjbRefTagsHandler, EntityTagsHandler, HomeTagsHandler, LookupUtilTagsHandler, MdbTagsHandler, PkTagsHandler, RelationTagsHandler, SecurityTagsHandler, SessionTagsHandler, StrutsFormTagsHandler, ValueObjectTagsHandler

public class EjbTagsHandler
extends xdoclet.XDocletTagSupport

Version:
$Revision: 1.30 $
Authors:
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

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(XTag tag, XClass clazz)
Returns the name of EJB ref.
protected String
extendsFromFor(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(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 XClass
getEjb(String name)
Returns the class with the specified ejb name
static String
getEjbIdFor(XClass clazz)
static String
getEjbNameFor(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(XClass clazz)
Returns short version of the EJB name of the clazz.
protected boolean
hasTransaction(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(XClass clazz)
Gets the AConcreteEJBean attribute of the EjbTagsHandler class
static boolean
isEjb(XClass clazz)
Returns true of clazz is an EJB (derived from an EJB type), false otherwise.
static boolean
isLocalEjb(XClass clazz)
static boolean
isOnlyLocalEjb(XClass clazz)
Returns true if clazz is only a local EJB by looking at ejb:bean's view-type parameter.
static boolean
isOnlyRemoteEjb(XClass clazz)
Returns true if clazz is only a remote EJB by looking at ejb:bean's view-type parameter.
static boolean
isOnlyServiceEndpointEjb(XClass clazz)
Returns true if clazz is only a service endpoint EJB by looking at ejb:bean's view-type parameter.
static boolean
isRemoteEjb(XClass clazz)
static boolean
isServiceEndpointEjb(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(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

Field Details

ALL

public static final String ALL

LOCAL_SUFFIX

protected static final String LOCAL_SUFFIX

SERVICE_ENDPOINT

public static final String SERVICE_ENDPOINT

SERVICE_ENDPOINT_SUFFIX

public static final String SERVICE_ENDPOINT_SUFFIX

Method Details

beanType

public String beanType()
            throws xdoclet.XDocletException
Returns Bean type : "Entity", "Session" or "Message Driven".
Returns:
"Entity", "Session" or "Message Driven".
Throws:
xdoclet.XDocletException -
See Also:
xdoclet.modules.ejb.entity.EntityTagsHandler.isEntity(xjavadoc.XClass), xdoclet.modules.ejb.session.SessionTagsHandler.isSession(xjavadoc.XClass), xdoclet.modules.ejb.mdb.MdbTagsHandler.isMessageDriven(xjavadoc.XClass)
doc.tag
type = "content"

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

concreteFullClassName

public String concreteFullClassName()
            throws xdoclet.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:
xdoclet.XDocletException -
doc.tag
type = "content"

ejbExternalRefName

public String ejbExternalRefName()
            throws xdoclet.XDocletException
Returns the name of EJB ref.
Returns:
The name of current EJB bean.
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"

ejbName

public String ejbName(Properties attributes)
            throws xdoclet.XDocletException
Returns the name of current EJB bean.
Parameters:
attributes - The attributes of the template tag
Returns:
The name of current EJB bean.
Throws:
xdoclet.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."

ejbRefName

public static String ejbRefName()
            throws xdoclet.XDocletException
Returns the name of EJB ref.
Returns:
The name of current EJB bean.
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"

ejbRefName

public static String ejbRefName(XTag tag,
                                XClass clazz)
            throws xdoclet.XDocletException
Returns the name of EJB ref.
Parameters:
tag -
clazz -
Returns:
The name of current EJB bean.
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"

extendsFromFor

protected String extendsFromFor(XClass clazz,
                                String tagName,
                                String type,
                                String extendsParamName,
                                String defaultBaseClassName)
            throws xdoclet.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:
xdoclet.XDocletException -

forAllBeans

public void forAllBeans(String template)
            throws xdoclet.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:
xdoclet.XDocletException -
See Also:
xdoclet.modules.ejb.entity.EntityTagsHandler.isEntity(xjavadoc.XClass), xdoclet.modules.ejb.session.SessionTagsHandler.isSession(xjavadoc.XClass), xdoclet.modules.ejb.mdb.MdbTagsHandler.isMessageDriven(xjavadoc.XClass)
doc.tag
type = "block"

getDependentClassFor

protected String getDependentClassFor(XClass clazz,
                                      String type)
            throws xdoclet.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:
xdoclet.XDocletException -

getDependentClassTagName

protected String getDependentClassTagName()
Gets the DependentClassTagName attribute of the EjbTagsHandler object
Returns:
The DependentClassTagName value

getEjb

public static XClass getEjb(String name)
            throws xdoclet.XDocletException
Returns the class with the specified ejb name
Parameters:
name -
Returns:
Throws:
xdoclet.XDocletException -

getEjbIdFor

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

getEjbNameFor

public static String getEjbNameFor(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)

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

getShortEjbNameFor

public static String getShortEjbNameFor(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

hasTransaction

protected boolean hasTransaction(XDoc doc)
            throws xdoclet.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:
xdoclet.XDocletException -

id

public String id()
            throws xdoclet.XDocletException
Returns unique id for current ejb.
Returns:
Description of the Returned Value
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"

ifIsAConcreteEJBean

public void ifIsAConcreteEJBean(String template,
                                Properties attributes)
            throws xdoclet.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:
xdoclet.XDocletException -
doc.tag
type = "block"

ifLocalEjb

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

ifNotLocalEjb

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

ifNotRemoteEjb

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

ifNotServiceEndpointEjb

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

ifRemoteEjb

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

ifServiceEndpointEjb

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

isAConcreteEJBean

public static boolean isAConcreteEJBean(XClass clazz)
            throws xdoclet.XDocletException
Gets the AConcreteEJBean attribute of the EjbTagsHandler class
Parameters:
clazz - Describe what the parameter does
Returns:
The AConcreteEJBean value
Throws:
xdoclet.XDocletException -

isEjb

public static boolean isEjb(XClass clazz)
            throws xdoclet.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:
xdoclet.XDocletException -

isLocalEjb

public static boolean isLocalEjb(XClass clazz)
            throws xdoclet.XDocletException

isOnlyLocalEjb

public static boolean isOnlyLocalEjb(XClass clazz)
            throws xdoclet.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:
xdoclet.XDocletException -

isOnlyRemoteEjb

public static boolean isOnlyRemoteEjb(XClass clazz)
            throws xdoclet.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:
xdoclet.XDocletException -

isOnlyServiceEndpointEjb

public static boolean isOnlyServiceEndpointEjb(XClass clazz)
            throws xdoclet.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:
xdoclet.XDocletException -

isRemoteEjb

public static boolean isRemoteEjb(XClass clazz)
            throws xdoclet.XDocletException

isServiceEndpointEjb

public static boolean isServiceEndpointEjb(XClass clazz)
            throws xdoclet.XDocletException

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

shortEjbName

public String shortEjbName()
            throws xdoclet.XDocletException
Returns short version of ejbName(). Example: "foo.bar.MyBean" ->"MyBean", "foo/bar/MyBean" ->"MyBean"
Returns:
Description of the Returned Value
Throws:
xdoclet.XDocletException -
See Also:
getShortEjbNameFor(xjavadoc.XClass)
doc.tag
type = "content"

shouldTraverseSuperclassForDependentClass

protected boolean shouldTraverseSuperclassForDependentClass(XClass clazz,
                                                            String tagName)
            throws xdoclet.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:
xdoclet.XDocletException -

symbolicClassName

public String symbolicClassName()
            throws xdoclet.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:
xdoclet.XDocletException -
doc.tag
type = "content"