xdoclet.modules.ejb.home
Class HomeTagsHandler

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

Constructor Detail

HomeTagsHandler

public HomeTagsHandler()
Method Detail

getHomeInterface

public static java.lang.String getHomeInterface(java.lang.String type,
                                                xjavadoc.XClass clazz)
                                         throws XDocletException
Similar to InterfaceTagsHandler.getComponentInterface(java.lang.String, xjavadoc.XClass). Relies on the ejb:home tag, which has the following relevant properties:

Parameters:
type - The type of home interface - can be remote or local.
clazz - Description of Parameter
Returns:
The HomeInterface value
Throws:
XDocletException

isRemoveMethod

public static boolean isRemoveMethod(xjavadoc.XMethod method)
Returns true if method is an ejbRemove method, false otherwise.

Parameters:
method - The method to test
Returns:
true if named ejbRemove

isCreateMethod

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

isHomeMethod

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

getCompNameFor

public static java.lang.String getCompNameFor(xjavadoc.XClass clazz,
                                              java.lang.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

isFinderMethod

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

getHomeDefinition

public static java.lang.String getHomeDefinition(xjavadoc.XClass clazz,
                                                 xjavadoc.XMethod method,
                                                 java.lang.String tagType,
                                                 java.lang.String type)
                                          throws 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:
XDocletException

getJndiNameOfTypeFor

public static java.lang.String getJndiNameOfTypeFor(java.lang.String type,
                                                    xjavadoc.XClass clazz)

toHomeMethod

public static java.lang.String toHomeMethod(java.lang.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.

toCreateMethod

public static java.lang.String toCreateMethod(java.lang.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.

findFirstCreateMethodFor

public static xjavadoc.XMethod findFirstCreateMethodFor(xjavadoc.XClass clazz)
Describe what the method does

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

toFinderMethod

public static java.lang.String toFinderMethod(java.lang.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.

fullPackageChange

public static java.lang.String fullPackageChange(java.lang.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.

finderSignatureFunger

public static java.lang.String finderSignatureFunger(java.lang.String s,
                                                     xjavadoc.XClass clazz,
                                                     java.lang.String type)
                                              throws XDocletException
Describe what the method does

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

getLocalHomeClassPattern

protected static java.lang.String getLocalHomeClassPattern()
Gets the LocalHomeClassPattern attribute of the HomeTagsHandler class.

Returns:
The LocalHomeClassPattern value

getHomeClassPattern

protected static java.lang.String getHomeClassPattern()
Gets the HomeClassPattern attribute of the HomeTagsHandler class.

Returns:
The HomeClassPattern value

setCurrentPermission

public void setCurrentPermission(java.lang.String permission)

homeInterface

public java.lang.String homeInterface(java.util.Properties attributes)
                               throws 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:
XDocletException
doc.tag
type = "content"
doc.param
name = "type" optional = "false" values = "remote,local" description = "Specifies the type * of component home interface."

ifIsCreateMethod

public void ifIsCreateMethod(java.lang.String template,
                             java.util.Properties attributes)
                      throws 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:
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."

ifDoesntHavePostCreateMethod

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

ejbPostCreateSignature

public java.lang.String ejbPostCreateSignature(java.util.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"

ifIsHomeMethod

public void ifIsHomeMethod(java.lang.String template,
                           java.util.Properties attributes)
                    throws 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:
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."

ifNotRemoveMethod

public void ifNotRemoveMethod(java.lang.String template)
                       throws XDocletException
Evaluates the body block if current method is not an ejbRemove method.

Parameters:
template - The body of the block tag
Throws:
XDocletException
See Also:
isRemoveMethod(xjavadoc.XMethod)
doc.tag
type = "block"

ifIsFinderMethod

public void ifIsFinderMethod(java.lang.String template,
                             java.util.Properties attributes)
                      throws 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:
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."

compName

public java.lang.String compName(java.util.Properties attributes)
                          throws XDocletException
Parameters:
attributes - The attributes of the template tag
Returns:
Description of the Returned Value
Throws:
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."

jndiName

public java.lang.String jndiName(java.util.Properties attributes)
                          throws XDocletException
Parameters:
attributes -
Returns:
Description of the Returned Value
Throws:
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."

extendsFrom

public java.lang.String extendsFrom(java.util.Properties attributes)
                             throws XDocletException
Returns the name of the class home interface extends.

Parameters:
attributes -
Returns:
The name of generated PK class.
Throws:
XDocletException
doc.tag
type = "content"

forAllHomeMethods

public void forAllHomeMethods(java.lang.String template,
                              java.util.Properties attributes)
                       throws 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:
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."

currentSignature

public java.lang.String currentSignature()
                                  throws XDocletException
Return signature of current home method.

Returns:
Describe the return value
Throws:
XDocletException

currentPermission

public java.lang.String currentPermission()
                                   throws XDocletException
Return permission for current home method.

Returns:
Throws:
XDocletException
doc.tag
type = "content"

currentType

public java.lang.String currentType()
                             throws XDocletException
Return type of current home method.

Returns:
Throws:
XDocletException
doc.tag
type = "content"
To do:
i18n

finderClass

public java.lang.String finderClass()
                             throws XDocletException
generates name for finder utility class backing current finder

Returns:
Throws:
XDocletException
doc.tag
type = "content"
To do:
i18n

ifIsCollectionType

public void ifIsCollectionType(java.lang.String template,
                               java.util.Properties param)
                        throws XDocletException
Whether current finder return collection.

Parameters:
template -
param -
Throws:
XDocletException
doc.tag
type = "block"

ifIsEnumerationType

public void ifIsEnumerationType(java.lang.String template,
                                java.util.Properties param)
                         throws XDocletException
Whether current finder return enumeration.

Parameters:
template -
param -
Throws:
XDocletException
doc.tag
type = "block"

ifIsInterfaceType

public void ifIsInterfaceType(java.lang.String template,
                              java.util.Properties param)
                       throws XDocletException
Whether current finder return interface.

Parameters:
template -
param -
Throws:
XDocletException
doc.tag
type = "block"

currentMethod

public java.lang.String currentMethod()
                               throws XDocletException
Return name of current home method.

Returns:
method name
Throws:
XDocletException
doc.tag
type = "content"
To do:
i18n

parameterListDefinition

public java.lang.String parameterListDefinition()
                                         throws XDocletException
Return parameter list definition (types and names) for current home method.

Returns:
comma-separated parameter list
Throws:
XDocletException
doc.tag
type = "content"
To do:
i18n

parameterList

public java.lang.String parameterList()
                               throws XDocletException
Return parameter list (names only) for current home method.

Returns:
comma-separated parameter list
Throws:
XDocletException
doc.tag
type = "content"

currentExceptions

public java.lang.String currentExceptions()
                                   throws XDocletException
Return exceptions for current home method.

Returns:
exceptions
Throws:
XDocletException
doc.tag
type = "content"

getDependentClassFor

protected java.lang.String getDependentClassFor(xjavadoc.XClass clazz,
                                                java.lang.String type)
                                         throws XDocletException
Gets the DependentClassFor attribute of the HomeTagsHandler object

Overrides:
getDependentClassFor in class EjbTagsHandler
Parameters:
clazz - Describe what the parameter does
type - Describe what the parameter does
Returns:
The DependentClassFor value
Throws:
XDocletException

setCurrentSignature

protected void setCurrentSignature(java.lang.String cs)
Sets the CurrentSignature attribute of the HomeTagsHandler object.

Parameters:
cs - The new CurrentSignature value

setCurrentExceptions

protected void setCurrentExceptions(java.lang.String es)
Sets the CurrentExceptions attribute of the HomeTagsHandler object.

Parameters:
es - The new CurrentExceptions value

shouldTraverseSuperclassForDependentClass

protected boolean shouldTraverseSuperclassForDependentClass(xjavadoc.XClass clazz,
                                                            java.lang.String tag_name)
                                                     throws XDocletException
Describe what the method does

Overrides:
shouldTraverseSuperclassForDependentClass in class EjbTagsHandler
Parameters:
clazz - Describe what the parameter does
tag_name - Describe what the parameter does
Returns:
Describe the return value
Throws:
XDocletException

matchesViewType

protected boolean matchesViewType(xjavadoc.XTag tag,
                                  java.lang.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

matchesViewType

protected boolean matchesViewType(java.util.Collection tags,
                                  java.lang.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

http://xdoclet.sourceforge.net/