|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tools.ant.ProjectComponent org.apache.tools.ant.Task org.apache.texen.ant.TexenTask org.apache.torque.task.TorqueDataModelTask
public class TorqueDataModelTask
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.
Nested Class Summary | |
---|---|
static class |
TorqueDataModelTask.TorqueClasspathResourceLoader
A custom classpath resource loader which filters tabs and removes spaces from lines with velocity commands. |
static class |
TorqueDataModelTask.TorqueFileResourceLoader
A custom file resource loader which filters tabs and removes spaces from lines with velocity commands. |
Field Summary | |
---|---|
protected org.apache.velocity.context.Context |
context
Velocity context which exposes our objects in the templates. |
protected java.util.Hashtable |
databaseNames
Hashtable containing the names of all the databases in our collection of schemas. |
protected java.util.Hashtable |
dataModelDbMap
Map of data model name to database name. |
protected java.util.List |
dataModels
Data models that we collect. |
protected java.util.List |
filesets
Fileset of XML schemas which represent our data models. |
protected java.lang.String |
sqldbmap
Name of the properties file that maps an SQL file to a particular database. |
protected java.lang.String |
xmlFile
XML that describes the database model, this is transformed into the application model object. |
Fields inherited from class org.apache.texen.ant.TexenTask |
---|
contextProperties, controlTemplate, inputEncoding, logFile, outputDirectory, outputEncoding, outputFile, resourceLoaderModificationCheckInterval, templatePath, useClasspath, useResourceLoaderCache |
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
TorqueDataModelTask()
|
Method Summary | |
---|---|
void |
addFileset(org.apache.tools.ant.types.FileSet set)
Adds a set of xml schema files (nested fileset attribute). |
void |
execute()
This method creates an VelocityEngine instance, parses every template and creates the corresponding output. |
protected java.io.InputStream |
filter(java.io.InputStream resource)
This method filters the template and replaces some unwanted characters. |
java.util.Hashtable |
getDataModelDbMap()
Return the data model to database name map. |
java.util.List |
getDataModels()
Return the data models that have been processed. |
java.lang.String |
getSqlDbMap()
Get the sqldbmap. |
java.lang.String |
getTargetDatabase()
Get the current target database. |
java.lang.String |
getTargetPackage()
Get the current target package. |
java.lang.String |
getXmlFile()
Get the xml schema describing the application model. |
org.apache.velocity.context.Context |
initControlContext()
Set up the initial context for generating the SQL from the XML schema. |
protected void |
populateInitialContext(org.apache.velocity.context.Context context)
Change type of "now" to java.util.Date |
void |
setContextProperties(java.lang.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. |
void |
setSqlDbMap(java.lang.String sqldbmap)
Set the sqldbmap. |
void |
setTargetDatabase(java.lang.String v)
Set the current target database. |
void |
setTargetPackage(java.lang.String v)
Set the current target package. |
void |
setXmlFile(java.lang.String xmlFile)
Set the xml schema describing the application model. |
Methods inherited from class org.apache.texen.ant.TexenTask |
---|
cleanup, getContextProperties, getControlTemplate, getLogFile, getOutputDirectory, getOutputFile, getTemplatePath, setControlTemplate, setInputEncoding, setLogFile, setOutputDirectory, setOutputEncoding, setOutputFile, setResourceLoaderModificationCheckInterval, setTemplatePath, setUseClasspath, setUseResourceLoaderCache |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String xmlFile
protected java.util.List filesets
protected java.util.List dataModels
protected org.apache.velocity.context.Context context
protected java.util.Hashtable dataModelDbMap
protected java.util.Hashtable databaseNames
protected java.lang.String sqldbmap
Constructor Detail |
---|
public TorqueDataModelTask()
Method Detail |
---|
public void setSqlDbMap(java.lang.String sqldbmap)
sqldbmap
- th db mappublic java.lang.String getSqlDbMap()
public java.util.List getDataModels()
public java.util.Hashtable getDataModelDbMap()
public java.lang.String getXmlFile()
public void setXmlFile(java.lang.String xmlFile)
xmlFile
- The new XmlFile valuepublic void addFileset(org.apache.tools.ant.types.FileSet set)
set
- a Set of xml schema filespublic java.lang.String getTargetDatabase()
public void setTargetDatabase(java.lang.String v)
v
- target database(s)public java.lang.String getTargetPackage()
public void setTargetPackage(java.lang.String v)
v
- target java package.public org.apache.velocity.context.Context initControlContext() throws java.lang.Exception
initControlContext
in class org.apache.texen.ant.TexenTask
java.lang.Exception
protected void populateInitialContext(org.apache.velocity.context.Context context) throws java.lang.Exception
populateInitialContext
in class org.apache.texen.ant.TexenTask
java.lang.Exception
TexenTask.populateInitialContext(org.apache.velocity.context.Context)
public void setContextProperties(java.lang.String file)
Also, move xxx.yyy properties to xxxYyy as Velocity doesn't like the xxx.yyy syntax.
setContextProperties
in class org.apache.texen.ant.TexenTask
file
- the file to read the properties frompublic void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.texen.ant.TexenTask
org.apache.tools.ant.BuildException
TexenTask.execute()
protected java.io.InputStream filter(java.io.InputStream resource) throws java.io.IOException
resource
- the input stream to filter
java.io.IOException
- if creating, reading or writing to a stream fails.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |