java.lang.Object
org.enhydra.tool.codegen.TemplateDrivenGenerator
- All Implemented Interfaces:
- Constants, java.util.EventListener, Generator, org.enhydra.tool.common.event.TemplateListener
- Direct Known Subclasses:
- AppGenerator
- public abstract class TemplateDrivenGenerator
- extends java.lang.Object
- implements Generator, org.enhydra.tool.common.event.TemplateListener, Constants
A partial implementation of the Generator interface that works with
template files. The predefined generators are based on this class.
| Fields inherited from interface org.enhydra.tool.codegen.Constants |
CLIENT_SUFFIX, CONTENT_HTML, CONTENT_WML, DIR_AT_PACKAGE_DIR_AT, DIR_INPUT, DIR_LIB, DIR_MEDIA, DIR_OUTPUT, DIR_PRESENTATION, DIR_RESOURCES, DIR_SRC, DIR_TEMPLATE, DIR_TOOL, FILE_BOOTSTRAP4_CONF, FILE_ENHYDRA_JAR, FILE_JAVA_POLICY, FILE_JNDI_PROPERTIES, FILE_MAKEFILE, FILE_README_HTML, FILE_START4_IN, FILE_WEB_DTD, FILE_WKMBEANS_XML, SYS_JAVA_VENDOR, SYS_JAVA_VERSION, SYS_USER_HOME, TAB4, TYPE_CONF, TYPE_HTML, TYPE_IN, TYPE_JAVA, TYPE_MK, TYPE_TEMPLATE, TYPE_WML, XMLC_DEFAULT, XMLC_SUFFIX |
res
public static java.util.ResourceBundle res
properties
private java.util.Properties properties
rootDir
private java.io.File rootDir
fileVector
private java.util.Vector fileVector
replacementSet
private org.enhydra.tool.common.ReplacementSet replacementSet
optionSet
private OptionSet optionSet
overwrite
private boolean overwrite
echo
private boolean echo
swing
private boolean swing
TemplateDrivenGenerator
public TemplateDrivenGenerator()
preprocessTemplates
public abstract org.enhydra.tool.common.Template[] preprocessTemplates(org.enhydra.tool.common.Template[] templates)
preprocessCopyList
public abstract org.enhydra.tool.common.Template[] preprocessCopyList(org.enhydra.tool.common.Template[] templates)
getTemplateFilter
public abstract org.enhydra.tool.common.TemplateFilter getTemplateFilter()
getCopyFilter
public abstract org.enhydra.tool.common.TemplateFilter getCopyFilter()
getDestinationPath
public abstract java.lang.String getDestinationPath()
throws GeneratorException
initReplacementSet
public abstract void initReplacementSet()
throws GeneratorException
createReplacementsForDirectory
public abstract org.enhydra.tool.common.Replacement[] createReplacementsForDirectory(org.enhydra.tool.common.PathHandle path)
throws GeneratorException
toString
public java.lang.String toString()
- Use the display name for the string representation of this class
so that a list model can map directly into generators.
getProperties
public java.util.Properties getProperties()
- Get properties used to customize CodeGen. This may contain
information on the template directory location and
persisted generation options.
- Specified by:
getProperties in interface Generator
setProperties
public void setProperties(java.util.Properties p)
throws GeneratorException
- Set CodeGen customization properties. The CodeGen
class calls this method after it instantiates a
generator class.
- Specified by:
setProperties in interface Generator
getTemplateRoot
public org.enhydra.tool.common.Template getTemplateRoot()
- Get the location of the template files.
isOverwrite
public boolean isOverwrite()
setOverwrite
public void setOverwrite(boolean b)
isEcho
public boolean isEcho()
- Specified by:
isEcho in interface Generator
setEcho
public void setEcho(boolean b)
- Specified by:
setEcho in interface Generator
isSwing
public boolean isSwing()
- Specified by:
isSwing in interface Generator
setSwing
public void setSwing(boolean b)
- Specified by:
setSwing in interface Generator
getReplacementSet
public org.enhydra.tool.common.ReplacementSet getReplacementSet()
- Get the replacement operations to run against the templates. If this is
null or has a zero length, no replacements are performed during generate().
setReplacementSet
public void setReplacementSet(org.enhydra.tool.common.ReplacementSet replacementSet)
- Set the replacement operations to run against the templates. If this is
not called, called prior to generate(), no replacements are performed.
getOptionSet
public OptionSet getOptionSet()
- Get generator option set
- Specified by:
getOptionSet in interface Generator
setOptionSet
public void setOptionSet(OptionSet set)
generate
public java.io.File[] generate()
throws GeneratorException
- Generate application files from a set of templates. This implementation of
the generate method uses the replacements array to perform a search and
replace on generated file names as well as there contents.
- Specified by:
generate in interface Generator
storeProperties
public void storeProperties()
- Method declaration
recurseFolders
private void recurseFolders(org.enhydra.tool.common.Template source,
java.io.File dest)
throws org.enhydra.tool.common.ToolException,
GeneratorException
- Method declaration