xdoclet.modules.hibernate
Class HibernateTagsHandler

java.lang.Object
  extended byxdoclet.template.TemplateTagHandler
      extended byxdoclet.XDocletTagSupport
          extended byxdoclet.modules.hibernate.HibernateTagsHandler

public class HibernateTagsHandler
extends XDocletTagSupport

Specific tags handler to make the template easy.

Version:
$Revision: 1.38 $
Author:
Sébastien Guimont (sebastieng@sympatico.ca)
xdoclet.taghandler
namespace="Hibernate"
created
August 9th, 2002

Field Summary
 
Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
HibernateTagsHandler()
           
 
Method Summary
 String computeColumnName(Properties attributes)
          The column name for a component is prefix + basename
 String dataSource()
          Data source JNDI Name extractor.
 String dialect()
          SQL dialect extractor.
 String driver()
          Driver Name extractor.
 String factoryClass()
          classname extractor.
 void forAllJndiProperties(String template, Properties attributes)
          Iterates over all jndiProperties specified.
 void forAllOtherMappings(String template, Properties attributes)
          Iterates over all otherMappings specified.
 void forAllOtherProperties(String template, Properties attributes)
          Iterates over all otherProperties specified.
 void forAllPersistentClasses(String template, Properties attributes)
          Iterates over all classes marked as persistent.
 void forAllSubclasses(String template, Properties attributes)
          Iterates over all classes loaded by javadoc that are direct subclasses of the current class and evaluates the body of the tag for each class.
 String getCurrentMappingElement(Properties attributes)
           
 String getCurrentTag(Properties attributes)
           
 FactoryClassSubTask getFactoryClassSubTask()
           
 String getFileName()
          Returns full path of hibernate file for the current class.
 xdoclet.modules.hibernate.HibernateProperties getHibernateProperties()
           
 xjavadoc.XMethod getIdMethod()
          find id property of current class.
 JBossServiceSubTask getJBossServiceSubTask()
           
 void ifCurrentMappingElementIsnt(String template, Properties attributes)
          Render template if the current mapping element is not the one specified.
 void ifGeneratePropertyCache(String template, Properties attributes)
          Render template if all of the properties needed are valid.
 void ifHasCompositeId(String template, Properties attributes)
          Render template if ID is composite.
 void ifHasJndiName(String template, Properties attributes)
          Render template if jndiName of JBossServiceSubtask is valid.
 void ifHasPrimitiveId(String template, Properties attributes)
          Render template if id is primitive.
 void ifNotHasJndiName(String template, Properties attributes)
          Render template if jndiName of JBossServiceSubtask is not valid.
 void ifNotUseJndiFactory(String template, Properties attributes)
          Render template if jndiName of JBossServiceSubtask is valid.
 void ifUseJndiFactory(String template, Properties attributes)
          Render template if jndiName of JBossServiceSubtask is valid.
 String jdbcUrl()
          JDBC URL extractor.
 String jndiName()
          Configured JNDI name.
 String jndiParameterName()
           
 String jndiParameterValue()
           
 void logMapping(Properties attributes)
          Print the name of the current class to the console.
 String mappingList()
          Comma separated list of hibernate mappings.
 String otherMappingName()
           
 String otherMappingValue()
           
 String otherParameterName()
           
 String otherParameterValue()
           
 String password()
          password extractor.
 String poolSize()
          poolSize extractor.
 String roleAttribute(Properties attributes)
          Get the attribute used for collection property names in this version of Hibernate (ie.
 String serviceClassName(Properties attributes)
          Get the name of the class the implements the SessionFactory as a MBean is this version of Hibernate.
 String serviceName()
          Return configured service name.
 void setColumnPrefix(String template, Properties attributes)
          Set the prefix for the \@hibernate.component, as there may be more than one component in a class that refer to the same target class.
 void setCurrentTag(String template, Properties attributes)
           
 String userName()
          username extractor.
 
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

HibernateTagsHandler

public HibernateTagsHandler()
Method Detail

getFileName

public String getFileName()
                   throws XDocletException
Returns full path of hibernate file for the current class.

Returns:
The full file path of the current class.
Throws:
XDocletException
doc.tag
type="content"

getJBossServiceSubTask

public JBossServiceSubTask getJBossServiceSubTask()

getFactoryClassSubTask

public FactoryClassSubTask getFactoryClassSubTask()

getHibernateProperties

public xdoclet.modules.hibernate.HibernateProperties getHibernateProperties()
                                                                     throws XDocletException
Throws:
XDocletException

getIdMethod

public xjavadoc.XMethod getIdMethod()
                             throws XDocletException
find id property of current class.

Returns:
Throws:
XDocletException

getCurrentTag

public String getCurrentTag(Properties attributes)

getCurrentMappingElement

public String getCurrentMappingElement(Properties attributes)

setCurrentTag

public void setCurrentTag(String template,
                          Properties attributes)
                   throws XDocletException
Throws:
XDocletException

setColumnPrefix

public void setColumnPrefix(String template,
                            Properties attributes)
                     throws XDocletException
Set the prefix for the \@hibernate.component, as there may be more than one component in a class that refer to the same target class.

Parameters:
template -
attributes -
Throws:
XDocletException

roleAttribute

public String roleAttribute(Properties attributes)
Get the attribute used for collection property names in this version of Hibernate (ie. "role" or "name").

Parameters:
attributes -
Returns:

serviceClassName

public String serviceClassName(Properties attributes)
Get the name of the class the implements the SessionFactory as a MBean is this version of Hibernate.

Parameters:
attributes -
Returns:

ifCurrentMappingElementIsnt

public void ifCurrentMappingElementIsnt(String template,
                                        Properties attributes)
                                 throws XDocletException
Render template if the current mapping element is not the one specified.

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

ifHasCompositeId

public void ifHasCompositeId(String template,
                             Properties attributes)
                      throws XDocletException
Render template if ID is composite.

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

ifHasPrimitiveId

public void ifHasPrimitiveId(String template,
                             Properties attributes)
                      throws XDocletException
Render template if id is primitive.

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

serviceName

public String serviceName()
                   throws XDocletException
Return configured service name.

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

jndiName

public String jndiName()
                throws XDocletException
Configured JNDI name.

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

ifUseJndiFactory

public void ifUseJndiFactory(String template,
                             Properties attributes)
                      throws XDocletException
Render template if jndiName of JBossServiceSubtask is valid. This is a required parameter, but the user might not be using that subtask.

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

ifNotUseJndiFactory

public void ifNotUseJndiFactory(String template,
                                Properties attributes)
                         throws XDocletException
Render template if jndiName of JBossServiceSubtask is valid. This is a required parameter, but the user might not be using that subtask.

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

ifHasJndiName

public void ifHasJndiName(String template,
                          Properties attributes)
                   throws XDocletException
Render template if jndiName of JBossServiceSubtask is valid. This is a required parameter, but the user might not be using that subtask.

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

ifGeneratePropertyCache

public void ifGeneratePropertyCache(String template,
                                    Properties attributes)
                             throws XDocletException
Render template if all of the properties needed are valid.

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

ifNotHasJndiName

public void ifNotHasJndiName(String template,
                             Properties attributes)
                      throws XDocletException
Render template if jndiName of JBossServiceSubtask is not valid.

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

dialect

public String dialect()
               throws XDocletException
SQL dialect extractor.

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

dataSource

public String dataSource()
                  throws XDocletException
Data source JNDI Name extractor.

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

driver

public String driver()
              throws XDocletException
Driver Name extractor.

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

jdbcUrl

public String jdbcUrl()
               throws XDocletException
JDBC URL extractor.

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

userName

public String userName()
                throws XDocletException
username extractor.

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

password

public String password()
                throws XDocletException
password extractor.

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

poolSize

public String poolSize()
                throws XDocletException
poolSize extractor.

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

factoryClass

public String factoryClass()
                    throws XDocletException
classname extractor.

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

mappingList

public String mappingList()
                   throws XDocletException
Comma separated list of hibernate mappings.

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

logMapping

public void logMapping(Properties attributes)
                throws XDocletException
Print the name of the current class to the console.

Parameters:
attributes -
Throws:
XDocletException
doc.tag
type="content"

forAllPersistentClasses

public void forAllPersistentClasses(String template,
                                    Properties attributes)
                             throws XDocletException
Iterates over all classes marked as persistent.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
doc.tag
type="block"

forAllJndiProperties

public void forAllJndiProperties(String template,
                                 Properties attributes)
                          throws XDocletException
Iterates over all jndiProperties specified.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
doc.tag
type="block"

forAllOtherProperties

public void forAllOtherProperties(String template,
                                  Properties attributes)
                           throws XDocletException
Iterates over all otherProperties specified.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
doc.tag
type="block"

forAllOtherMappings

public void forAllOtherMappings(String template,
                                Properties attributes)
                         throws XDocletException
Iterates over all otherMappings specified.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
doc.tag
type="block"

jndiParameterName

public String jndiParameterName()

jndiParameterValue

public String jndiParameterValue()

otherParameterName

public String otherParameterName()

otherParameterValue

public String otherParameterValue()

otherMappingName

public String otherMappingName()

otherMappingValue

public String otherMappingValue()

forAllSubclasses

public void forAllSubclasses(String template,
                             Properties attributes)
                      throws XDocletException
Iterates over all classes loaded by javadoc that are direct subclasses of the current class and evaluates the body of the tag for each class. It discards classes that have an xdoclet-generated class tag defined.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
doc.tag
type="block"

computeColumnName

public String computeColumnName(Properties attributes)
The column name for a component is prefix + basename

Parameters:
attributes -
Returns:

http://xdoclet.sourceforge.net/