xdoclet.tagshandler

Class MergeTagsHandler

public class MergeTagsHandler extends XDocletTagSupport

Version: $Revision: 1.13 $

Author: Ara Abrahamian (ara_e@email.com)

UNKNOWN: Oct 15, 2001 namespace = "Merge"

Method Summary
protected voidgenerateFileUsingTemplate(String dest_file, String templateFileName)
A utility method used for generating the dest_file based on template_file template file.
protected voidgenerateUsingMergedFile(String mergeFile, String contents)
Processes the file specified in merge_file_pattern that has the text content contents.
protected StringgetMergeFileContents(String mergeFilePattern)
A utility method used for merging a file used by tag.
voidifMergeFileExists(String template, Properties attributes)
Evaluates the body if the file exists specified by the "file" attribute.
voidmerge(String template, Properties attributes)
Merge contents of the file designated by the file parameter and evaluates the body if the file is not found.

Method Detail

generateFileUsingTemplate

protected void generateFileUsingTemplate(String dest_file, String templateFileName)
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. templateFileName the template file name

Throws: XDocletException Description of Exception

generateUsingMergedFile

protected void generateUsingMergedFile(String mergeFile, String contents)
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: mergeFile The file to be merged contents Description of Parameter

Throws: XDocletException Description of Exception

See Also: setTemplateURL

getMergeFileContents

protected String getMergeFileContents(String mergeFilePattern)
A utility method used for merging a file used by tag. If the mergeFilePattern 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 mergeFilePattern. 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: mergeFilePattern 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: MergeTagsHandler PackageTagsHandler symbolicClassName FileManager

ifMergeFileExists

public void ifMergeFileExists(String template, Properties attributes)
Evaluates the body if the file exists specified by the "file" attribute.

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

Throws: XDocletException

UNKNOWN: type = "block" name = "file" optional = "false" description = "The path to the file to be merged. The * value of this parameter can have {0} in it, if so {0} is replaced with the current class name and system * searches for the file in in mergeDir+packageName directory. {0} is for cases where you want to define and * merge a file per each class."

merge

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

UNKNOWN: type = "block" name = "file" optional = "false" description = "The path to the file to be merged. The * value of this parameter can have {0} in it, if so {0} is replaced with the current class name and system * searches for the file in in mergeDir+packageName directory. {0} is for cases where you want to define and * merge a file per each class." name = "generateMergedFile" values = "true,false" description = "If true then process the * merged file also, otherwise only merge it and do not process it. True if the default."