DEFAULT_TEXEN_PROPERTIES
private static final String DEFAULT_TEXEN_PROPERTIES
Default properties file used for controlling the
tools placed in the context.
OUTPUT_PATH
public static final String OUTPUT_PATH
Where the texen output will placed.
TEMPLATE_PATH
public static final String TEMPLATE_PATH
Where the velocity templates live.
controlContext
private Context controlContext
Context used for generating the texen output.
inputEncoding
protected String inputEncoding
This is the encoding for the input file(s)
(templates).
instance
private static Generator instance
The generator tools used for creating additional
output withing the control template. This could
use some cleaning up.
outputEncoding
protected String outputEncoding
This is the encoding for the output file(s).
props
private Properties props
Default properties used by texen.
writers
private Hashtable writers
Keep track of the file writers used for outputting
to files. If we come across a file writer more
then once then the additional output will be
appended to the file instead of overwritting
the contents.
fillContextDefaults
protected void fillContextDefaults(Context context)
Add properties that will aways be in the context by default
fillContextHash
protected void fillContextHash(Context context,
Hashtable objs)
Add all the contents of a Hashtable to the context.
fillContextProperties
protected void fillContextProperties(Context context)
Add objects to the context from the current properties.
getContext
protected Context getContext(Hashtable objs)
Create a new context and fill it with the elements of the
objs Hashtable. Default objects and objects that comes from
the properties of this Generator object is also added.
- Context context filled with objects
getInstance
public static Generator getInstance()
Create a new generator object with default properties.
- Generator generator used in the control context.
getOutputPath
public String getOutputPath()
Get the output path for the generated
output.
- String output path for texen output.
getTemplate
public Template getTemplate(String templateName,
String encoding)
throws Exception
Returns a template, based on encoding and path.
templateName
- name of the templateencoding
- template encoding
getTemplatePath
public String getTemplatePath()
Get the template path.
- String template path for velocity templates.
getWriter
public Writer getWriter(String path,
String encoding)
throws Exception
Returns a writer, based on encoding and path.
path
- path to the output fileencoding
- output encoding
parse
public String parse(String inputTemplate,
String outputFile)
throws Exception
Parse an input and write the output to an output file. If the
output file parameter is null or an empty string the result is
returned as a string object. Otherwise an empty string is returned.
parse
public String parse(String inputTemplate,
String outputFile,
String objectID,
Object object)
throws Exception
Parse an input and write the output to an output file. If the
output file parameter is null or an empty string the result is
returned as a string object. Otherwise an empty string is returned.
You can add objects to the context with the objs Hashtable.
- String generated output from velocity
parse
public String parse(String inputTemplate,
String intputEncoding,
String outputFile,
String outputEncoding,
String objectID,
Object object)
throws Exception
Parse an input and write the output to an output file. If the
output file parameter is null or an empty string the result is
returned as a string object. Otherwise an empty string is returned.
You can add objects to the context with the objs Hashtable.
- String generated output from velocity
parse
public String parse(String controlTemplate,
Context controlContext)
throws Exception
Parse the control template and merge it with the control
context. This is the starting point in texen.
- String generated output
setDefaultProps
protected void setDefaultProps()
Set default properties.
setInputEncoding
public void setInputEncoding(String inputEncoding)
Set the input (template) encoding.
setOutputEncoding
public void setOutputEncoding(String outputEncoding)
Set the output encoding.
setOutputPath
public void setOutputPath(String outputPath)
Set the output path for the generated
output.
setTemplatePath
public void setTemplatePath(String templatePath)
Set the template path, where Texen will look
for Velocity templates.
shutdown
public 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.