xdoclet.modules.ejb.home

Class HomeTagsHandler


public class HomeTagsHandler
extends EjbTagsHandler

Version:
$Revision: 1.37 $
Author:
Ara Abrahamian (ara_e@email.com)
xdoclet.taghandler
namespace = "EjbHome"
created
Oct 15, 2001

Field Summary

Fields inherited from class xdoclet.modules.ejb.EjbTagsHandler

ALL, LOCAL_SUFFIX, SERVICE_ENDPOINT, SERVICE_ENDPOINT_SUFFIX

Fields inherited from class xdoclet.XDocletTagSupport

FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER

Method Summary

String
compName(Properties attributes)
String
currentExceptions()
Return exceptions for current home method.
String
currentMethod()
Return name of current home method.
String
currentPermission()
Return permission for current home method.
String
currentSignature()
Return signature of current home method.
String
currentType()
Return type of current home method.
String
ejbPostCreateSignature(Properties attributes)
Returns the appropriate ejbPostCreate method name for the current ejbCreate method.
String
extendsFrom(Properties attributes)
Returns the name of the class home interface extends.
static XMethod
findFirstCreateMethodFor(XClass clazz)
Describe what the method does
String
finderClass()
generates name for finder utility class backing current finder
static String
finderSignatureFunger(String s, XClass clazz, String type)
Describe what the method does
void
forAllHomeMethods(String template, Properties attributes)
Iterates over all home methods of specified type (finder or create method) defined in a class and super classes.
static String
fullPackageChange(String s)
Convert various collection types within a string to their fully qualified forms.
static String
getCompNameFor(XClass clazz, String type)
Returns a suitable component name (which could be used, for example, in JNDI lookups) for a class.
protected String
getDependentClassFor(XClass clazz, String type)
Gets the DependentClassFor attribute of the HomeTagsHandler object
protected static String
getHomeClassPattern()
Gets the HomeClassPattern attribute of the HomeTagsHandler class.
static String
getHomeDefinition(XClass clazz, XMethod method, String tagType, String type)
Gets the HomeDefinition attribute of the HomeTagsHandler class
static String
getHomeInterface(String type, XClass clazz)
Similar to InterfaceTagsHandler.getComponentInterface(String,XClass).
static String
getJndiNameOfTypeFor(String type, XClass clazz)
protected static String
getLocalHomeClassPattern()
Gets the LocalHomeClassPattern attribute of the HomeTagsHandler class.
String
homeInterface(Properties attributes)
Returns the full qualified local or remote home interface name for the bean, depending on the value of type parameter.
void
ifDoesntHavePostCreateMethod(String template, Properties attributes)
Evaluates the body block if current create method's ejbPostCreate method does not exist.
void
ifIsCollectionType(String template, Properties param)
Whether current finder return collection.
void
ifIsCreateMethod(String template, Properties attributes)
Evaluates the body block if current method is a create method.
void
ifIsEnumerationType(String template, Properties param)
Whether current finder return enumeration.
void
ifIsFinderMethod(String template, Properties attributes)
Evaluates the body block if current method is a ejbFind method.
void
ifIsHomeMethod(String template, Properties attributes)
Evaluates the body block if current method is a home method.
void
ifIsInterfaceType(String template, Properties param)
Whether current finder return interface.
void
ifNotRemoveMethod(String template)
Evaluates the body block if current method is not an ejbRemove method.
static boolean
isCreateMethod(XMethod method)
Returns true if method is a create method marked with a \@ejb.create-method tag, false otherwise.
static boolean
isFinderMethod(XMethod method)
Returns true if method is an ejbFind method, false otherwise.
static boolean
isHomeMethod(XMethod method)
Returns true if method is a home method marked with a \@ejb.home-method tag, false otherwise.
static boolean
isRemoveMethod(XMethod method)
Returns true if method is an ejbRemove method, false otherwise.
String
jndiName(Properties attributes)
protected boolean
matchesViewType(Collection tags, String type)
Check every XTag in a collection and return true if they all have a view-type compatible with the specified type.
protected boolean
matchesViewType(XTag tag, String type)
Returns true if an XTag has a view-type compatible with the specified type.
String
parameterList()
Return parameter list (names only) for current home method.
String
parameterListDefinition()
Return parameter list definition (types and names) for current home method.
protected void
setCurrentExceptions(String es)
Sets the CurrentExceptions attribute of the HomeTagsHandler object.
void
setCurrentPermission(String permission)
protected void
setCurrentSignature(String cs)
Sets the CurrentSignature attribute of the HomeTagsHandler object.
protected boolean
shouldTraverseSuperclassForDependentClass(XClass clazz, String tag_name)
Describe what the method does
static String
toCreateMethod(String methodName)
Converts ejbCreateblabla to createblabla , the one that should appear in home interface.
static String
toFinderMethod(String methodName)
Converts ejbFindblabla to findblabla , the one that should appear in home interface.
static String
toHomeMethod(String methodName)
Converts ejbHomeblabla to homeblabla , the one that should appear in home interface.

Methods inherited from class xdoclet.modules.ejb.EjbTagsHandler

beanType, choosePackage, concreteFullClassName, ejbExternalRefName, ejbName, ejbRefName, ejbRefName, extendsFromFor, forAllBeans, getDependentClassFor, getDependentClassTagName, getEjb, getEjbIdFor, getEjbNameFor, getEjbSpec, getShortEjbNameFor, hasTransaction, id, ifIsAConcreteEJBean, ifLocalEjb, ifNotLocalEjb, ifNotRemoteEjb, ifNotServiceEndpointEjb, ifRemoteEjb, ifServiceEndpointEjb, isAConcreteEJBean, isEjb, isLocalEjb, isOnlyLocalEjb, isOnlyRemoteEjb, isOnlyServiceEndpointEjb, isRemoteEjb, isServiceEndpointEjb, prefixWithEjbSlash, shortEjbName, shouldTraverseSuperclassForDependentClass, symbolicClassName

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

Method Details

compName

public String compName(Properties attributes)
            throws xdoclet.XDocletException
Parameters:
attributes - The attributes of the template tag
Returns:
Description of the Returned Value
Throws:
xdoclet.XDocletException -
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."
name = "type" optional = "false" values = "remote,local" description = "Specifies if we want the jndi name value for local or remote lookup."

currentExceptions

public String currentExceptions()
            throws xdoclet.XDocletException
Return exceptions for current home method.
Returns:
exceptions
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"

currentMethod

public String currentMethod()
            throws xdoclet.XDocletException
Return name of current home method.
Returns:
method name
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"
To do:
i18n

currentPermission

public String currentPermission()
            throws xdoclet.XDocletException
Return permission for current home method.
Returns:
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"

currentSignature

public String currentSignature()
            throws xdoclet.XDocletException
Return signature of current home method.
Returns:
Describe the return value
Throws:
xdoclet.XDocletException -

currentType

public String currentType()
            throws xdoclet.XDocletException
Return type of current home method.
Returns:
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"
To do:
i18n

ejbPostCreateSignature

public String ejbPostCreateSignature(Properties attributes)
Returns the appropriate ejbPostCreate method name for the current ejbCreate method.
Parameters:
attributes - The attributes of the template tag
Returns:
Equivalent ejbPostCreate method name
doc.tag
type = "content"

extendsFrom

public String extendsFrom(Properties attributes)
            throws xdoclet.XDocletException
Returns the name of the class home interface extends.
Parameters:
attributes -
Returns:
The name of generated PK class.
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"

findFirstCreateMethodFor

public static XMethod findFirstCreateMethodFor(XClass clazz)
Describe what the method does
Parameters:
clazz - Describe what the parameter does
Returns:
Describe the return value

finderClass

public String finderClass()
            throws xdoclet.XDocletException
generates name for finder utility class backing current finder
Returns:
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"
To do:
i18n

finderSignatureFunger

public static String finderSignatureFunger(String s,
                                           XClass clazz,
                                           String type)
            throws xdoclet.XDocletException
Describe what the method does
Parameters:
s - Describe what the parameter does
clazz -
type -
Returns:
Describe the return value
Throws:
xdoclet.XDocletException -

forAllHomeMethods

public void forAllHomeMethods(String template,
                              Properties attributes)
            throws xdoclet.XDocletException
Iterates over all home methods of specified type (finder or create method) defined in a class and super classes.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
xdoclet.XDocletException -
doc.tag
type = "block"
doc.param
name = "tagName" optional = "false" description = "The tag name for the method type to iterate over." values = "ejb:finder,ejb:create-method"
name = "superclasses" values = "true,false" description = "If true then traverse superclasses also, otherwise look up the tag in current concrete class only."
name = "tagKey" description = "A tag property that will be used as a unique key. This is used to avoid duplicate code due to similar tags in superclasses."

fullPackageChange

public static String fullPackageChange(String s)
Convert various collection types within a string to their fully qualified forms.
Parameters:
s - String to be converted.
Returns:
String with fully qualified collection types.

getCompNameFor

public static String getCompNameFor(XClass clazz,
                                    String type)
Returns a suitable component name (which could be used, for example, in JNDI lookups) for a class.
Parameters:
clazz - the class
type - interface view type, \"local\" or \"remote\"
Returns:
compname

getDependentClassFor

protected String getDependentClassFor(XClass clazz,
                                      String type)
            throws xdoclet.XDocletException
Gets the DependentClassFor attribute of the HomeTagsHandler object
Overrides:
getDependentClassFor in interface EjbTagsHandler
Parameters:
clazz - Describe what the parameter does
type - Describe what the parameter does
Returns:
The DependentClassFor value
Throws:
xdoclet.XDocletException -

getHomeClassPattern

protected static String getHomeClassPattern()
Gets the HomeClassPattern attribute of the HomeTagsHandler class.
Returns:
The HomeClassPattern value

getHomeDefinition

public static String getHomeDefinition(XClass clazz,
                                       XMethod method,
                                       String tagType,
                                       String type)
            throws xdoclet.XDocletException
Gets the HomeDefinition attribute of the HomeTagsHandler class
Parameters:
clazz - Describe what the parameter does
method - Describe what the parameter does
tagType - Describe what the parameter does
type - Describe what the parameter does
Returns:
The HomeDefinition value
Throws:
xdoclet.XDocletException -

getHomeInterface

public static String getHomeInterface(String type,
                                      XClass clazz)
            throws xdoclet.XDocletException
Similar to InterfaceTagsHandler.getComponentInterface(String,XClass). Relies on the ejb:home tag, which has the following relevant properties:
  • remote-class: The fully qualified name of the remote class - overrides all set patterns
  • local-class: The fully qualified name of the local class - overrides all set patterns
  • remote-pattern: The pattern to be used to determine the unqualified name of the remote class
  • local-pattern: The pattern to be used to determine the unqualified name of the local class
  • pattern: The pattern to be used in determining the unqualified remote and/or local home interface name - used where remote- or local- pattern are not specified.
  • remote-package: The package the remote home interface is to be placed in
  • local-package: The package the local home interface is to be placed in
  • package: The package the remote and/or local home interface is to be placed in - used where remote- or local- package are not specified.
Parameters:
type - The type of home interface - can be remote or local.
clazz - Description of Parameter
Returns:
The HomeInterface value
Throws:
xdoclet.XDocletException -

getJndiNameOfTypeFor

public static String getJndiNameOfTypeFor(String type,
                                          XClass clazz)

getLocalHomeClassPattern

protected static String getLocalHomeClassPattern()
Gets the LocalHomeClassPattern attribute of the HomeTagsHandler class.
Returns:
The LocalHomeClassPattern value

homeInterface

public String homeInterface(Properties attributes)
            throws xdoclet.XDocletException
Returns the full qualified local or remote home interface name for the bean, depending on the value of type parameter.
Parameters:
attributes - The attributes of the template tag
Returns:
Description of the Returned Value
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"
doc.param
name = "type" optional = "false" values = "remote,local" description = "Specifies the type of component home interface."

ifDoesntHavePostCreateMethod

public void ifDoesntHavePostCreateMethod(String template,
                                         Properties attributes)
            throws xdoclet.XDocletException
Evaluates the body block if current create method's ejbPostCreate method does not exist.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
xdoclet.XDocletException -
doc.tag
type = "block"

ifIsCollectionType

public void ifIsCollectionType(String template,
                               Properties param)
            throws xdoclet.XDocletException
Whether current finder return collection.
Parameters:
template -
param -
Throws:
xdoclet.XDocletException -
doc.tag
type = "block"

ifIsCreateMethod

public void ifIsCreateMethod(String template,
                             Properties attributes)
            throws xdoclet.XDocletException
Evaluates the body block if current method is a create method. Create methods should have ejb:create-method defined.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
xdoclet.XDocletException -
See Also:
isCreateMethod(xjavadoc.XMethod)
doc.tag
type = "block"
doc.param
name = "superclasses" optional = "true" description = "Traverse superclasses too. With false value used in remote/local home interface templates. Default is False."

ifIsEnumerationType

public void ifIsEnumerationType(String template,
                                Properties param)
            throws xdoclet.XDocletException
Whether current finder return enumeration.
Parameters:
template -
param -
Throws:
xdoclet.XDocletException -
doc.tag
type = "block"

ifIsFinderMethod

public void ifIsFinderMethod(String template,
                             Properties attributes)
            throws xdoclet.XDocletException
Evaluates the body block if current method is a ejbFind method.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
xdoclet.XDocletException - Description of Exception
See Also:
isFinderMethod(xjavadoc.XMethod)
doc.tag
type = "block"
doc.param
name = "superclasses" optional = "true" description = "Traverse superclasses too. With false value used in remote/local home interface templates. Default is False."

ifIsHomeMethod

public void ifIsHomeMethod(String template,
                           Properties attributes)
            throws xdoclet.XDocletException
Evaluates the body block if current method is a home method. Home methods should have ejb:home-method defined.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
xdoclet.XDocletException -
See Also:
isHomeMethod(xjavadoc.XMethod)
doc.tag
type = "block"
doc.param
name = "superclasses" optional = "true" description = "Traverse superclasses too. With false value used in remote/local home interface templates. Default is False."

ifIsInterfaceType

public void ifIsInterfaceType(String template,
                              Properties param)
            throws xdoclet.XDocletException
Whether current finder return interface.
Parameters:
template -
param -
Throws:
xdoclet.XDocletException -
doc.tag
type = "block"

ifNotRemoveMethod

public void ifNotRemoveMethod(String template)
            throws xdoclet.XDocletException
Evaluates the body block if current method is not an ejbRemove method.
Parameters:
template - The body of the block tag
Throws:
xdoclet.XDocletException -
See Also:
isRemoveMethod(xjavadoc.XMethod)
doc.tag
type = "block"

isCreateMethod

public static boolean isCreateMethod(XMethod method)
Returns true if method is a create method marked with a \@ejb.create-method tag, false otherwise.
Parameters:
method - The method to test
Returns:
true if ejb.create-method tag found

isFinderMethod

public static boolean isFinderMethod(XMethod method)
Returns true if method is an ejbFind method, false otherwise.
Parameters:
method - The method to test
Returns:
true if name starts with ejbFind

isHomeMethod

public static boolean isHomeMethod(XMethod method)
Returns true if method is a home method marked with a \@ejb.home-method tag, false otherwise.
Parameters:
method - The method to test
Returns:
true if ejb.home-method tag found

isRemoveMethod

public static boolean isRemoveMethod(XMethod method)
Returns true if method is an ejbRemove method, false otherwise.
Parameters:
method - The method to test
Returns:
true if named ejbRemove

jndiName

public String jndiName(Properties attributes)
            throws xdoclet.XDocletException
Parameters:
attributes -
Returns:
Description of the Returned Value
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"
doc.param
name = "type" optional = "false" values = "remote,local" description = "Specifies if we want the jndi name value for local or remote lookup."

matchesViewType

protected boolean matchesViewType(Collection tags,
                                  String type)
Check every XTag in a collection and return true if they all have a view-type compatible with the specified type. A view-type is compatible if it is the same as type or \"both\". A missing or empty view-type is assumed to be compatible.
Parameters:
tags - Collection of XTag to be checked.
type - The desired view-type
Returns:
true if all tags' view-type parameters are compatible

matchesViewType

protected boolean matchesViewType(XTag tag,
                                  String type)
Returns true if an XTag has a view-type compatible with the specified type. A view-type is compatible if it is the same as type or \"both\". A missing or empty view-type is assumed to be compatible.
Parameters:
tag - The XTag to check
type - The desired view-type
Returns:
true if the tag's view-type is compatible

parameterList

public String parameterList()
            throws xdoclet.XDocletException
Return parameter list (names only) for current home method.
Returns:
comma-separated parameter list
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"

parameterListDefinition

public String parameterListDefinition()
            throws xdoclet.XDocletException
Return parameter list definition (types and names) for current home method.
Returns:
comma-separated parameter list
Throws:
xdoclet.XDocletException -
doc.tag
type = "content"
To do:
i18n

setCurrentExceptions

protected void setCurrentExceptions(String es)
Sets the CurrentExceptions attribute of the HomeTagsHandler object.
Parameters:
es - The new CurrentExceptions value

setCurrentPermission

public void setCurrentPermission(String permission)

setCurrentSignature

protected void setCurrentSignature(String cs)
Sets the CurrentSignature attribute of the HomeTagsHandler object.
Parameters:
cs - The new CurrentSignature value

shouldTraverseSuperclassForDependentClass

protected boolean shouldTraverseSuperclassForDependentClass(XClass clazz,
                                                            String tag_name)
            throws xdoclet.XDocletException
Describe what the method does
Overrides:
shouldTraverseSuperclassForDependentClass in interface EjbTagsHandler
Parameters:
clazz - Describe what the parameter does
tag_name - Describe what the parameter does
Returns:
Describe the return value
Throws:
xdoclet.XDocletException -

toCreateMethod

public static String toCreateMethod(String methodName)
Converts ejbCreateblabla to createblabla , the one that should appear in home interface.
Parameters:
methodName - Method name to be converted.
Returns:
Equivalent home interface method name.

toFinderMethod

public static String toFinderMethod(String methodName)
Converts ejbFindblabla to findblabla , the one that should appear in home interface.
Parameters:
methodName - Method name to be converted.
Returns:
Equivalent home interface method name.

toHomeMethod

public static String toHomeMethod(String methodName)
Converts ejbHomeblabla to homeblabla , the one that should appear in home interface.
Parameters:
methodName - Method name to be converted.
Returns:
Equivalent home interface method name.