|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object 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.
Field Summary | |
---|---|
protected Context |
context
Velocity context which exposes our objects in the templates. |
protected Hashtable<String,String> |
databaseNames
Hashtable containing the names of all the databases in our collection of schemas. |
protected Hashtable<String,String> |
dataModelDbMap
Map of data model name to database name. |
protected List<Database> |
dataModels
Data models that we collect. |
protected List<org.apache.tools.ant.types.FileSet> |
filesets
Fileset of XML schemas which represent our data models. |
protected String |
sqldbmap
Name of the properties file that maps an SQL file to a particular database. |
private String |
targetDatabase
The target database(s) we are generating SQL for. |
private String |
targetPackage
Target Java package to place the generated files in. |
protected String |
xmlFile
XML that describes the database model, this is transformed into the application model object. |
Constructor Summary | |
---|---|
TorqueDataModelTask()
|
Method Summary | |
---|---|
void |
addFileset(org.apache.tools.ant.types.FileSet set)
Adds a set of xml schema files (nested fileset attribute). |
protected DatabaseParser |
getDatabaseParser()
Return a SAX parser that implements the DatabaseParser interface |
protected Database |
getDataModel(File file)
Parse a schema XML File into a Database object |
Hashtable<String,String> |
getDataModelDbMap()
Return the data model to database name map. |
protected List<File> |
getDataModelFiles()
Get the list of schema XML files from our filesets |
List<Database> |
getDataModels()
Return the data models that have been processed. |
List<org.apache.tools.ant.types.FileSet> |
getFilesets()
|
protected List<Database> |
getPopulatedDataModels()
Parse schema XML files into Database objects |
String |
getSqlDbMap()
Get the sqldbmap. |
String |
getTargetDatabase()
Get the current target database. |
String |
getTargetPackage()
Get the current target package. |
String |
getXmlFile()
Get the xml schema describing the application model. |
private String |
grokName(String xmlFile)
Gets a name to use for the application's data model. |
Context |
initControlContext()
Set up the initial context for generating SQL |
protected void |
populateInitialContext(Context context)
Change type of "now" to java.util.Date |
void |
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. |
void |
setFilesets(List<org.apache.tools.ant.types.FileSet> filesets)
|
void |
setSqlDbMap(String sqldbmap)
Set the sqldbmap. |
void |
setTargetDatabase(String targetDatabase)
Set the current target database. |
void |
setTargetPackage(String targetPackage)
Set the current target package. |
void |
setXmlFile(String xmlFile)
Set the xml schema describing the application model. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String xmlFile
protected List<org.apache.tools.ant.types.FileSet> filesets
protected List<Database> dataModels
protected Context context
protected Hashtable<String,String> dataModelDbMap
protected Hashtable<String,String> databaseNames
protected String sqldbmap
private String targetDatabase
private String targetPackage
Constructor Detail |
---|
public TorqueDataModelTask()
Method Detail |
---|
public void setSqlDbMap(String sqldbmap)
sqldbmap
- th db mappublic String getSqlDbMap()
public List<Database> getDataModels()
public Hashtable<String,String> getDataModelDbMap()
public String getXmlFile()
public void setXmlFile(String xmlFile)
xmlFile
- The new XmlFile valuepublic void addFileset(org.apache.tools.ant.types.FileSet set)
set
- a Set of xml schema filespublic String getTargetDatabase()
public void setTargetDatabase(String targetDatabase)
public String getTargetPackage()
public void setTargetPackage(String targetPackage)
protected DatabaseParser getDatabaseParser()
protected Database getDataModel(File file) throws EngineException
EngineException
protected List<File> getDataModelFiles()
protected List<Database> getPopulatedDataModels() throws EngineException
EngineException
public Context initControlContext() throws Exception
Exception
protected void populateInitialContext(Context context) throws Exception
Exception
org.apache.velocity.texen.ant.TexenTask#populateInitialContext(org.apache.velocity.context.Context)
private String grokName(String xmlFile)
xmlFile
- The path to the XML file housing the data model.
AppData
.public void setContextProperties(String file)
Also, move xxx.yyy properties to xxxYyy as Velocity doesn't like the xxx.yyy syntax.
file
- the file to read the properties frompublic List<org.apache.tools.ant.types.FileSet> getFilesets()
public void setFilesets(List<org.apache.tools.ant.types.FileSet> filesets)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |