| java.lang.Object org.apache.velocity.texen.Generator
Constructor Summary | |
public | Generator(String propFile) Create a new generator object with properties loaded from
a file. | public | Generator(Properties props) Create a new Generator object with a given property
set. |
Method Summary | |
protected void | fillContextDefaults(Context context) | protected void | fillContextHash(Context context, 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(Hashtable objs) Create a new context and fill it with the elements of the
objs Hashtable. | public static Generator | getInstance() Create a new generator object with default properties. | public String | getOutputPath() Get the output path for the generated
output. | public Template | getTemplate(String templateName, String encoding) Returns a template, based on encoding and path. | public String | getTemplatePath() Get the template path. | public Writer | getWriter(String path, String encoding) Returns a writer, based on encoding and path. | public String | parse(String inputTemplate, String outputFile) Parse an input and write the output to an output file. | public String | parse(String inputTemplate, String outputFile, String objectID, Object object) Parse an input and write the output to an output file. | public String | parse(String inputTemplate, String inputEncoding, String outputFile, String outputEncoding, String objectID, Object object) Parse an input and write the output to an output file. | public String | parse(String controlTemplate, Context controlContext) Parse the control template and merge it with the control
context. | protected void | setDefaultProps() Set default properties. | public void | setInputEncoding(String inputEncoding) Set the input (template) encoding. | public void | setOutputEncoding(String outputEncoding) Set the output encoding. | public void | setOutputPath(String outputPath) Set the output path for the generated
output. | public void | setTemplatePath(String templatePath) Set the template path, where Texen will look
for Velocity templates. | public void | setVelocityEngine(VelocityEngine ve) Set the velocity engine. | 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. |
OUTPUT_PATH | final public static String OUTPUT_PATH(Code) | | Where the texen output will placed.
|
TEMPLATE_PATH | final public static String TEMPLATE_PATH(Code) | | Where the velocity templates live.
|
inputEncoding | protected String inputEncoding(Code) | | This is the encoding for the input file(s)
(templates).
|
outputEncoding | protected String outputEncoding(Code) | | This is the encoding for the output file(s).
|
Generator | public Generator(String propFile)(Code) | | Create a new generator object with properties loaded from
a file. If the file does not exist or any other exception
occurs during the reading operation the default properties
are used.
Parameters: propFile - properties used to help populate the control context. |
Generator | public Generator(Properties props)(Code) | | Create a new Generator object with a given property
set. The property set will be duplicated.
Parameters: props - properties object to help populate the control context. |
fillContextDefaults | protected void fillContextDefaults(Context context)(Code) | | Add properties that will aways be in the context by default
Parameters: context - control context to fill with default values. |
fillContextHash | protected void fillContextHash(Context context, Hashtable objs)(Code) | | Add all the contents of a Hashtable to the context.
Parameters: context - context to fill with objects Parameters: objs - source of objects |
fillContextProperties | protected void fillContextProperties(Context context)(Code) | | Add objects to the context from the current properties.
Parameters: context - control context to fill with objectsthat are specified in the default.propertiesfile |
getContext | protected Context getContext(Hashtable objs)(Code) | | 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.
Parameters: objs - objects to place in the control context Context context filled with objects |
getInstance | public static Generator getInstance()(Code) | | Create a new generator object with default properties.
Generator generator used in the control context. |
getOutputPath | public String getOutputPath()(Code) | | Get the output path for the generated
output.
String output path for texen output. |
getTemplate | public Template getTemplate(String templateName, String encoding) throws Exception(Code) | | Returns a template, based on encoding and path.
Parameters: templateName - name of the template Parameters: encoding - template encoding A Template. throws: Exception - |
getTemplatePath | public String getTemplatePath()(Code) | | Get the template path.
String template path for velocity templates. |
getWriter | public Writer getWriter(String path, String encoding) throws Exception(Code) | | Returns a writer, based on encoding and path.
Parameters: path - path to the output file Parameters: encoding - output encoding A Writer for this generator. throws: Exception - |
parse | public String parse(String inputTemplate, String outputFile) throws Exception(Code) | | 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.
Parameters: inputTemplate - input template Parameters: outputFile - output file The parsed file. throws: Exception - |
parse | public String parse(String inputTemplate, String outputFile, String objectID, Object object) throws Exception(Code) | | 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.
Parameters: inputTemplate - input template Parameters: outputFile - output file Parameters: objectID - id for object to be placed in the control context Parameters: object - object to be placed in the context String generated output from velocity throws: Exception - |
parse | public String parse(String inputTemplate, String inputEncoding, String outputFile, String outputEncoding, String objectID, Object object) throws Exception(Code) | | 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.
Parameters: inputTemplate - input template Parameters: inputEncoding - template encoding Parameters: outputFile - output file Parameters: outputEncoding - outputEncoding encoding of output file Parameters: objectID - id for object to be placed in the control context Parameters: object - object to be placed in the context String generated output from velocity throws: Exception - |
parse | public String parse(String controlTemplate, Context controlContext) throws Exception(Code) | | Parse the control template and merge it with the control
context. This is the starting point in texen.
Parameters: controlTemplate - control template Parameters: controlContext - control context String generated output throws: Exception - |
setDefaultProps | protected void setDefaultProps()(Code) | | Set default properties.
|
setInputEncoding | public void setInputEncoding(String inputEncoding)(Code) | | Set the input (template) encoding.
Parameters: inputEncoding - |
setOutputEncoding | public void setOutputEncoding(String outputEncoding)(Code) | | Set the output encoding.
Parameters: outputEncoding - |
setOutputPath | public void setOutputPath(String outputPath)(Code) | | Set the output path for the generated
output.
Parameters: outputPath - |
setTemplatePath | public void setTemplatePath(String templatePath)(Code) | | Set the template path, where Texen will look
for Velocity templates.
Parameters: templatePath - template path for velocity templates. |
setVelocityEngine | public void setVelocityEngine(VelocityEngine ve)(Code) | | Set the velocity engine.
Parameters: ve - |
shutdown | public void shutdown()(Code) | | Properly shut down the generator, right now
this is simply flushing and closing the file
writers that we have been holding on to.
|
|
|