|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.texen.Generator
A text/code generator class
| Field Summary | |
protected String |
inputEncoding
This is the encoding for the input file(s) (templates). |
static String |
OUTPUT_PATH
Where the texen output will placed. |
protected String |
outputEncoding
This is the encoding for the output file(s). |
static String |
TEMPLATE_PATH
Where the velocity templates live. |
protected org.apache.velocity.app.VelocityEngine |
ve
Velocity engine. |
| Constructor Summary | |
Generator(Properties props)
Create a new Generator object with a given property set. |
|
Generator(String propFile)
Create a new generator object with properties loaded from a file. |
|
| Method Summary | |
protected void |
fillContextDefaults(org.apache.velocity.context.Context context)
Add properties that will aways be in the context by default |
protected void |
fillContextHash(org.apache.velocity.context.Context context,
Hashtable objs)
Add all the contents of a Hashtable to the context. |
protected void |
fillContextProperties(org.apache.velocity.context.Context context)
Add objects to the context from the current properties. |
protected org.apache.velocity.context.Context |
getContext(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. |
String |
getOutputPath()
Get the output path for the generated output. |
org.apache.velocity.Template |
getTemplate(String templateName,
String encoding)
Returns a template, based on encoding and path. |
String |
getTemplatePath()
Get the template path. |
Writer |
getWriter(String path,
String encoding)
Returns a writer, based on encoding and path. |
String |
parse(String controlTemplate,
org.apache.velocity.context.Context controlContext)
Parse the control template and merge it with the control context. |
String |
parse(String inputTemplate,
String outputFile)
Parse an input and write the output to an output file. |
String |
parse(String inputTemplate,
String outputFile,
String objectID,
Object object)
Parse an input and write the output to an output file. |
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. |
protected void |
setDefaultProps()
Set default properties. |
void |
setInputEncoding(String inputEncoding)
Set the input (template) encoding. |
void |
setOutputEncoding(String outputEncoding)
Set the output encoding. |
void |
setOutputPath(String outputPath)
Set the output path for the generated output. |
void |
setTemplatePath(String templatePath)
Set the template path, where Texen will look for Velocity templates. |
void |
setVelocityEngine(org.apache.velocity.app.VelocityEngine ve)
Set the velocity engine. |
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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String OUTPUT_PATH
public static final String TEMPLATE_PATH
protected String outputEncoding
protected String inputEncoding
protected org.apache.velocity.app.VelocityEngine ve
| Constructor Detail |
public Generator(String propFile)
propFile - properties used to help populate the control context.public Generator(Properties props)
props - properties object to help populate the control context.| Method Detail |
public static Generator getInstance()
public void setVelocityEngine(org.apache.velocity.app.VelocityEngine ve)
ve - protected void setDefaultProps()
public void setTemplatePath(String templatePath)
templatePath - template path for velocity templates.public String getTemplatePath()
public void setOutputPath(String outputPath)
outputPath - public String getOutputPath()
public void setOutputEncoding(String outputEncoding)
outputEncoding - public void setInputEncoding(String inputEncoding)
inputEncoding -
public Writer getWriter(String path,
String encoding)
throws Exception
path - path to the output fileencoding - output encoding
Exception
public org.apache.velocity.Template getTemplate(String templateName,
String encoding)
throws Exception
templateName - name of the templateencoding - template encoding
Exception
public String parse(String inputTemplate,
String outputFile)
throws Exception
inputTemplate - input templateoutputFile - output file
Exception
public String parse(String inputTemplate,
String outputFile,
String objectID,
Object object)
throws Exception
inputTemplate - input templateoutputFile - output fileobjectID - id for object to be placed in the control contextobject - object to be placed in the context
Exception
public String parse(String inputTemplate,
String inputEncoding,
String outputFile,
String outputEncoding,
String objectID,
Object object)
throws Exception
inputTemplate - input templateinputEncoding - template encodingoutputFile - output fileoutputEncoding - outputEncoding encoding of output fileobjectID - id for object to be placed in the control contextobject - object to be placed in the context
Exception
public String parse(String controlTemplate,
org.apache.velocity.context.Context controlContext)
throws Exception
controlTemplate - control templatecontrolContext - control context
Exceptionprotected org.apache.velocity.context.Context getContext(Hashtable objs)
objs - objects to place in the control context
protected void fillContextHash(org.apache.velocity.context.Context context,
Hashtable objs)
context - context to fill with objectsobjs - source of objectsprotected void fillContextDefaults(org.apache.velocity.context.Context context)
context - control context to fill with default values.protected void fillContextProperties(org.apache.velocity.context.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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||