|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.velocity.texen.Generator
A text/code generator class
Field Summary | |
private Context |
controlContext
Context used for generating the texen output. |
private static java.lang.String |
DEFAULT_TEXEN_PROPERTIES
Default properties file used for controlling the tools placed in the context. |
private java.util.Hashtable |
fileWriters
Keep track of the file writers used for outputting to files. |
private static Generator |
instance
The generator tools used for creating additional output withing the control template. |
static java.lang.String |
OUTPUT_PATH
Where the texen output will placed. |
private java.util.Properties |
props
Default properties used by texen. |
static java.lang.String |
TEMPLATE_PATH
Where the velocity templates live. |
Constructor Summary | |
private |
Generator()
Default constructor. |
|
Generator(java.util.Properties props)
Create a new Generator object with a given property set. |
|
Generator(java.lang.String propFile)
Create a new generator object with properties loaded from a file. |
Method Summary | |
protected void |
fillContextDefaults(Context context)
Add properties that will aways be in the context by default |
protected void |
fillContextHash(Context context,
java.util.Hashtable objs)
Add all the contents of a Hashtable to the context. |
protected void |
fillContextProperties(Context context)
Add objects to the context from the current properties. |
protected Context |
getContext(java.util.Hashtable objs)
Create a new context and fill it with the elements of the objs Hashtable. |
static Generator |
getInstance()
Create a new generator object with default properties. |
java.lang.String |
getOutputPath()
Get the output path for the generated output. |
java.lang.String |
getTemplatePath()
Get the template path. |
java.lang.String |
parse(java.lang.String controlTemplate,
Context controlContext)
Parse the control template and merge it with the control context. |
java.lang.String |
parse(java.lang.String inputTemplate,
java.lang.String outputFile)
Parse an input and write the output to an output file. |
java.lang.String |
parse(java.lang.String inputTemplate,
java.lang.String outputFile,
java.lang.String objectID,
java.lang.Object object)
Parse an input and write the output to an output file. |
protected void |
setDefaultProps()
Set default properties. |
void |
setOutputPath(java.lang.String outputPath)
Set the output path for the generated output. |
void |
setTemplatePath(java.lang.String templatePath)
Set the template path, where Texen will look for Velocity templates. |
void |
shutdown()
Properly shut down the generator, right now this is simply flushing and closing the file writers that we have been holding on to. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final java.lang.String OUTPUT_PATH
public static final java.lang.String TEMPLATE_PATH
private static final java.lang.String DEFAULT_TEXEN_PROPERTIES
private java.util.Properties props
private Context controlContext
private java.util.Hashtable fileWriters
private static Generator instance
Constructor Detail |
private Generator()
public Generator(java.lang.String propFile)
String
- properties used to help populate the control context.public Generator(java.util.Properties props)
Properties
- properties object to help populate the control context.Method Detail |
public static Generator getInstance()
protected void setDefaultProps()
public void setTemplatePath(java.lang.String templatePath)
String
- template path for velocity templates.public java.lang.String getTemplatePath()
public void setOutputPath(java.lang.String outputPath)
public java.lang.String getOutputPath()
public java.lang.String parse(java.lang.String inputTemplate, java.lang.String outputFile) throws java.lang.Exception
String
- input templateString
- output filepublic java.lang.String parse(java.lang.String inputTemplate, java.lang.String outputFile, java.lang.String objectID, java.lang.Object object) throws java.lang.Exception
String
- input templateString
- output fileString
- id for object to be placed in the control contextString
- object to be placed in the contextpublic java.lang.String parse(java.lang.String controlTemplate, Context controlContext) throws java.lang.Exception
String
- control templateContext
- control contextprotected Context getContext(java.util.Hashtable objs)
Hashtable
- objects to place in the control contextprotected void fillContextHash(Context context, java.util.Hashtable objs)
Context
- context to fill with objectsHashtable
- source of objectsprotected void fillContextDefaults(Context context)
Context
- control context to fill with default values.protected void fillContextProperties(Context context)
Context
- control context to fill with objects
that are specified in the default.properties
filepublic void shutdown()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |