Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
Task
org.apache.velocity.texen.ant.TexenTask
public class TexenTask
extends Task
Field Summary | |
private static String |
|
protected ExtendedProperties |
|
protected String |
|
private String |
|
protected String |
|
protected String |
|
protected String |
|
protected String |
|
protected String |
|
protected boolean |
|
Method Summary | |
protected void | |
void |
|
ExtendedProperties |
|
String |
|
String |
|
String |
|
String |
|
Context |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
private static final String ERR_MSG_FRAGMENT
This message fragment (telling users to consult the log or invoke ant with the -debug flag) is appended to rethrown exception messages.
protected ExtendedProperties contextProperties
These are properties that are fed into the initial context from a properties file. This is simply a convenient way to set some values that you wish to make available in the context. These values are not critical, like the template path or output path, but allow a convenient way to set a value that may be specific to a particular generation task. For example, if you are generating scripts to allow user to automatically create a database, then you might want the$databaseName
to be placed in the initial context so that it is available in a script that might look something like the following:The value of
#!bin/sh echo y | mysqladmin create $databaseName$databaseName
isn't critical to output, and you obviously don't want to change the ant task to simply take a database name. So initial context values can be set with properties file.
protected String controlTemplate
This is the control template that governs the output. It may or may not invoke the services of worker templates.
private String fileSeparator
Path separator.
protected String inputEncoding
This is the encoding for the input file(s) (templates).
protected String outputDirectory
This is where texen will place all the output that is a product of the generation process.
protected String outputEncoding
This is the encoding for the output file(s).
protected String outputFile
This is the file where the generated text will be placed.
protected String templatePath
This is where Velocity will look for templates using the file template loader.
protected boolean useClasspath
Property which controls whether the classpath will be used when trying to locate templates.
protected void cleanup() throws Exception
A hook method called at the end ofexecute()
which can be overridden to perform any necessary cleanup activities (such as the release of database connections, etc.). By default, does nothing.
public void execute() throws BuildException
Execute the input script with Velocity
public ExtendedProperties getContextProperties()
Get the context properties that will be fed into the initial context be the generating process starts.
public String getControlTemplate()
Get the control template for the generating process.
public String getOutputDirectory()
Get the output directory.
public String getOutputFile()
Get the output file for the generation process.
public String getTemplatePath()
Get the path where Velocity will look for templates using the file template loader.
public Context initControlContext() throws Exception
Creates a VelocityContext.
- Returns:
- new Context
protected void populateInitialContext(Context context) throws Exception
Place useful objects into the initial context. TexenTask placesDate().toString()
into the context as$now
. Subclasses who want to vary the objects in the context should override this method.$generator
is not put into the context in this method.
- Parameters:
context
- The context to populate, as retrieved frominitControlContext()
.
public void setContextProperties(String file)
Set the context properties that will be fed into the initial context be the generating process starts.
public void setControlTemplate(String controlTemplate)
[REQUIRED] Set the control template for the generating process.
public void setInputEncoding(String inputEncoding)
Set the input (template) encoding.
public void setOutputDirectory(File outputDirectory)
[REQUIRED] Set the output directory. It will be created if it doesn't exist.
public void setOutputEncoding(String outputEncoding)
Set the output encoding.
public void setOutputFile(String outputFile)
[REQUIRED] Set the output file for the generation process.
public void setTemplatePath(String templatePath) throws Exception
[REQUIRED] Set the path where Velocity will look for templates using the file template loader.
public void setUseClasspath(boolean useClasspath)
Set the use of the classpath in locating templates
- Parameters: