xdoclet.modules.ejb.home

Class HomeTagsHandler

public class HomeTagsHandler extends EjbTagsHandler

Version: $Revision: 1.37 $

Author: Ara Abrahamian (ara_e@email.com)

UNKNOWN: Oct 15, 2001 namespace = "EjbHome"

Method Summary
StringcompName(Properties attributes)
StringcurrentExceptions()
Return exceptions for current home method.
StringcurrentMethod()
Return name of current home method.
StringcurrentPermission()
Return permission for current home method.
StringcurrentSignature()
Return signature of current home method.
StringcurrentType()
Return type of current home method.
StringejbPostCreateSignature(Properties attributes)
Returns the appropriate ejbPostCreate method name for the current ejbCreate method.
StringextendsFrom(Properties attributes)
Returns the name of the class home interface extends.
StringfinderClass()
generates name for finder utility class backing current finder
static StringfinderSignatureFunger(String s, XClass clazz, String type)
Describe what the method does
static XMethodfindFirstCreateMethodFor(XClass clazz)
Describe what the method does
voidforAllHomeMethods(String template, Properties attributes)
Iterates over all home methods of specified type (finder or create method) defined in a class and super classes.
static StringfullPackageChange(String s)
Convert various collection types within a string to their fully qualified forms.
static StringgetCompNameFor(XClass clazz, String type)
Returns a suitable component name (which could be used, for example, in JNDI lookups) for a class.
protected StringgetDependentClassFor(XClass clazz, String type)
Gets the DependentClassFor attribute of the HomeTagsHandler object
protected static StringgetHomeClassPattern()
Gets the HomeClassPattern attribute of the HomeTagsHandler class.
static StringgetHomeDefinition(XClass clazz, XMethod method, String tagType, String type)
Gets the HomeDefinition attribute of the HomeTagsHandler class
static StringgetHomeInterface(String type, XClass clazz)
Similar to {@link xdoclet.modules.ejb.intf.InterfaceTagsHandler#getComponentInterface}.
static StringgetJndiNameOfTypeFor(String type, XClass clazz)
protected static StringgetLocalHomeClassPattern()
Gets the LocalHomeClassPattern attribute of the HomeTagsHandler class.
StringhomeInterface(Properties attributes)
Returns the full qualified local or remote home interface name for the bean, depending on the value of type parameter.
voidifDoesntHavePostCreateMethod(String template, Properties attributes)
Evaluates the body block if current create method's ejbPostCreate method does not exist.
voidifIsCollectionType(String template, Properties param)
Whether current finder return collection.
voidifIsCreateMethod(String template, Properties attributes)
Evaluates the body block if current method is a create method.
voidifIsEnumerationType(String template, Properties param)
Whether current finder return enumeration.
voidifIsFinderMethod(String template, Properties attributes)
Evaluates the body block if current method is a ejbFind method.
voidifIsHomeMethod(String template, Properties attributes)
Evaluates the body block if current method is a home method.
voidifIsInterfaceType(String template, Properties param)
Whether current finder return interface.
voidifNotRemoveMethod(String template)
Evaluates the body block if current method is not an ejbRemove method.
static booleanisCreateMethod(XMethod method)
Returns true if method is a create method marked with a \@ejb.create-method tag, false otherwise.
static booleanisFinderMethod(XMethod method)
Returns true if method is an ejbFind method, false otherwise.
static booleanisHomeMethod(XMethod method)
Returns true if method is a home method marked with a \@ejb.home-method tag, false otherwise.
static booleanisRemoveMethod(XMethod method)
Returns true if method is an ejbRemove method, false otherwise.
StringjndiName(Properties attributes)
protected booleanmatchesViewType(XTag tag, String type)
Returns true if an XTag has a view-type compatible with the specified type.
protected booleanmatchesViewType(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.
StringparameterList()
Return parameter list (names only) for current home method.
StringparameterListDefinition()
Return parameter list definition (types and names) for current home method.
protected voidsetCurrentExceptions(String es)
Sets the CurrentExceptions attribute of the HomeTagsHandler object.
voidsetCurrentPermission(String permission)
protected voidsetCurrentSignature(String cs)
Sets the CurrentSignature attribute of the HomeTagsHandler object.
protected booleanshouldTraverseSuperclassForDependentClass(XClass clazz, String tag_name)
Describe what the method does
static StringtoCreateMethod(String methodName)
Converts ejbCreateblabla to createblabla , the one that should appear in home interface.
static StringtoFinderMethod(String methodName)
Converts ejbFindblabla to findblabla , the one that should appear in home interface.
static StringtoHomeMethod(String methodName)
Converts ejbHomeblabla to homeblabla , the one that should appear in home interface.

Method Detail

compName

public String compName(Properties attributes)

Parameters: attributes The attributes of the template tag

Returns: Description of the Returned Value

Throws: XDocletException

UNKNOWN: type = "content" 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()
Return exceptions for current home method.

Returns: exceptions

Throws: XDocletException

UNKNOWN: type = "content"

currentMethod

public String currentMethod()
Return name of current home method.

Returns: method name

Throws: XDocletException

UNKNOWN: type = "content" i18n

currentPermission

public String currentPermission()
Return permission for current home method.

Returns:

Throws: XDocletException

UNKNOWN: type = "content"

currentSignature

public String currentSignature()
Return signature of current home method.

Returns: Describe the return value

Throws: XDocletException

currentType

public String currentType()
Return type of current home method.

Returns:

Throws: XDocletException

UNKNOWN: type = "content" 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

UNKNOWN: type = "content"

extendsFrom

public String extendsFrom(Properties attributes)
Returns the name of the class home interface extends.

Parameters: attributes

Returns: The name of generated PK class.

Throws: XDocletException

UNKNOWN: type = "content"

finderClass

public String finderClass()
generates name for finder utility class backing current finder

Returns:

Throws: XDocletException

UNKNOWN: type = "content" i18n

finderSignatureFunger

public static String finderSignatureFunger(String s, XClass clazz, String type)
Describe what the method does

Parameters: s Describe what the parameter does clazz type

Returns: Describe the return value

Throws: XDocletException

findFirstCreateMethodFor

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

Parameters: clazz Describe what the parameter does

Returns: Describe the return value

forAllHomeMethods

public 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.

Parameters: template The body of the block tag attributes The attributes of the template tag

Throws: XDocletException

UNKNOWN: type = "block" 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)
Gets the DependentClassFor attribute of the HomeTagsHandler object

Parameters: clazz Describe what the parameter does type Describe what the parameter does

Returns: The DependentClassFor value

Throws: 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)
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

getHomeInterface

public static String getHomeInterface(String type, XClass clazz)
Similar to {@link xdoclet.modules.ejb.intf.InterfaceTagsHandler#getComponentInterface}. 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

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)
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

UNKNOWN: type = "content" name = "type" optional = "false" values = "remote,local" description = "Specifies the type * of component home interface."

ifDoesntHavePostCreateMethod

public void ifDoesntHavePostCreateMethod(String template, Properties attributes)
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

UNKNOWN: type = "block"

ifIsCollectionType

public void ifIsCollectionType(String template, Properties param)
Whether current finder return collection.

Parameters: template param

Throws: XDocletException

UNKNOWN: type = "block"

ifIsCreateMethod

public void ifIsCreateMethod(String template, Properties attributes)
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: HomeTagsHandler

UNKNOWN: type = "block" 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)
Whether current finder return enumeration.

Parameters: template param

Throws: XDocletException

UNKNOWN: type = "block"

ifIsFinderMethod

public void ifIsFinderMethod(String template, Properties attributes)
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: HomeTagsHandler

UNKNOWN: type = "block" 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)
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: HomeTagsHandler

UNKNOWN: type = "block" 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)
Whether current finder return interface.

Parameters: template param

Throws: XDocletException

UNKNOWN: type = "block"

ifNotRemoveMethod

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

Parameters: template The body of the block tag

Throws: XDocletException

See Also: HomeTagsHandler

UNKNOWN: 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)

Parameters: attributes

Returns: Description of the Returned Value

Throws: XDocletException

UNKNOWN: type = "content" 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(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

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

parameterList

public String parameterList()
Return parameter list (names only) for current home method.

Returns: comma-separated parameter list

Throws: XDocletException

UNKNOWN: type = "content"

parameterListDefinition

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

Returns: comma-separated parameter list

Throws: XDocletException

UNKNOWN: type = "content" 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)
Describe what the method does

Parameters: clazz Describe what the parameter does tag_name Describe what the parameter does

Returns: Describe the return value

Throws: 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.