public class TorqueDataModelTask extends TexenTask (Code)
A base torque task that uses either a single XML schema
representing a data model, or a <fileset> of XML schemas.
We are making the assumption that an XML schema representing
a data model contains tables for a single
database.
author: Jason van Zyl author: Daniel Rall
Inner Class :public static class TorqueClasspathResourceLoader extends ClasspathResourceLoader
Inner Class :public static class TorqueFileResourceLoader extends FileResourceLoader
Field Summary
protected Context
context Velocity context which exposes our objects in the templates.
xmlFile XML that describes the database model, this is transformed
into the application model object.
Method Summary
public void
addFileset(FileSet set) Adds a set of xml schema files (nested fileset attribute).
public void
execute() This method creates an VelocityEngine instance, parses
every template and creates the corresponding output.
Unfortunately the TextenTask.execute() method makes
everything for us but we just want to set our own
VelocityTemplateLoader.
setContextProperties(String file) Override Texen's context properties to map the
torque.xxx properties (including defaults set by the
org/apache/torque/defaults.properties) to just xxx.
Map of data model name to database name.
Should probably stick to the convention of them being the same but
I know right now in a lot of cases they won't be.
This method creates an VelocityEngine instance, parses
every template and creates the corresponding output.
Unfortunately the TextenTask.execute() method makes
everything for us but we just want to set our own
VelocityTemplateLoader.
TODO: change once TEXEN-14 is resolved and out.
See Also: org.apache.texen.ant.TexenTask.execute
This method filters the template and replaces some
unwanted characters. For example it removes leading
spaces in front of velocity commands and replaces
tabs with spaces to prevent bounces in different
code editors with different tab-width-setting.
Parameters: resource - the input stream to filter the filtered input stream. throws: IOException - if creating, reading or writing to a stream fails.
Change type of "now" to java.util.Date
See Also: org.apache.texen.ant.TexenTask.populateInitialContext(org.apache.velocity.context.Context)
setContextProperties
public void setContextProperties(String file)(Code)
Override Texen's context properties to map the
torque.xxx properties (including defaults set by the
org/apache/torque/defaults.properties) to just xxx.
Also, move xxx.yyy properties to xxxYyy as Velocity
doesn't like the xxx.yyy syntax.
Parameters: file - the file to read the properties from