xdoclet.tags
Class MergeTagsHandler

java.lang.Object
  |
  +--xdoclet.template.TemplateTagHandler
        |
        +--xdoclet.XDocletTagSupport
              |
              +--xdoclet.tags.MergeTagsHandler

public class MergeTagsHandler
extends XDocletTagSupport

Version:
$Revision: 1.13 $
Author:
Ara Abrahamian (ara_e@email.com)

Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
MergeTagsHandler()
           
 
Method Summary
protected  void generateFileUsingTemplate(java.lang.String dest_file, java.lang.String template_file_name)
          A utility method used for generating the dest_file based on template_file template file.
protected  void generateUsingMergedFile(java.lang.String merge_file, java.lang.String contents)
          Processes the file specified in merge_file_pattern that has the text content contents.
protected  java.lang.String getMergeFileContents(java.lang.String merge_file_pattern)
          A utility method used for merging a file used by tag.
 void merge(java.lang.String template, java.util.Properties attributes)
          Merge contents of the file designated by the file parameter and evaluates the body if the file is not found.
 
Methods inherited from class xdoclet.XDocletTagSupport
getClassTagValue, getClassTagValue, getConstructorTagValue, getCurrentClass, getCurrentConstructor, getCurrentField, getCurrentMethod, getCurrentPackage, getCurrentTag, getDocletContext, getFieldTagValue, getFieldTagValue, getMethodTagValue, getMethodTagValue, getParameterValue, getParameterValue, getTagValue, getTagValue, getTagValue, invalidParamValueFound, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, parsePropertyString, popCurrentClass, pushCurrentClass, replaceProperties, setCurrentClass, setCurrentConstructor, setCurrentField, setCurrentMethod, setCurrentPackage, setCurrentTag, tokenizeValue
 
Methods inherited from class xdoclet.template.TemplateTagHandler
generate, getContext, getEngine, getParser, setContext, setEngine, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergeTagsHandler

public MergeTagsHandler()
Method Detail

merge

public void merge(java.lang.String template,
                  java.util.Properties attributes)
           throws XDocletException
Merge contents of the file designated by the file parameter and evaluates the body if the file is not found. It searches for the file in the directory specified by mergeDir configuration parameter.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - XDocletException if something goes wrong

getMergeFileContents

protected java.lang.String getMergeFileContents(java.lang.String merge_file_pattern)
A utility method used for merging a file used by tag. If the merge_file_pattern parameter has a {0} in it then the {0} is replaced with the sybolic class name of the current class, and the package structure of the class is prefixed to it. If not search is done for the exact file with the name specified in merge_file_pattern. Both of these two searches search for the file in root directory designated of mergeDir config parameter. It uses xdoclet.util.FileManager to load the file. FileManager caches the content so that subsequent tries to load the file are served from memory, without reloading the file again and again.
Parameters:
merge_file_pattern - The exact file name or a string that has a {0} in it. {0} is substituted by symbolic class name of current class.
Returns:
The content of the text file.
See Also:
merge(java.lang.String,java.util.Properties), PackageTagsHandler.packageNameAsPathFor(com.sun.javadoc.PackageDoc), ClassTagsHandler.symbolicClassName(), FileManager

generateUsingMergedFile

protected void generateUsingMergedFile(java.lang.String merge_file,
                                       java.lang.String contents)
                                throws XDocletException
Processes the file specified in merge_file_pattern that has the text content contents. It resets currentLineNum to 0 upon calling generate() and restores it back to its previous value. It also sets and restores templateFile.
Parameters:
merge_file - The file to be merged
contents - Description of Parameter
Throws:
XDocletException - Description of Exception
See Also:
TemplateEngine.setTemplateURL(java.net.URL)

generateFileUsingTemplate

protected void generateFileUsingTemplate(java.lang.String dest_file,
                                         java.lang.String template_file_name)
                                  throws XDocletException
A utility method used for generating the dest_file based on template_file template file.
Parameters:
dest_file - the path to the destination file prepended by value of the destDir configuration parameter.
template_file_name - the template file name
Throws:
XDocletException - Description of Exception