Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.torque.task
Class TorqueDataModelTask  view TorqueDataModelTask download TorqueDataModelTask.java

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.apache.velocity.texen.ant.TexenTask
              extended byorg.apache.torque.task.TorqueDataModelTask
Direct Known Subclasses:
TorqueDataDumpTask, TorqueDataSQLTask, TorqueDocumentationTask, TorqueSQLTask

public class TorqueDataModelTask
extends org.apache.velocity.texen.ant.TexenTask

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.

Version:
$Id: TorqueDataModelTask.java,v 1.2.2.2 2004/05/20 04:35:14 seade Exp $

Field Summary
private  java.lang.String basePathToDbProps
          The path to properties file containing db idiosyncrasies is constructed by appending the "getTargetDatabase()/db.props to this path.
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.
private  java.lang.String targetDatabase
          The target database(s) we are generating SQL for.
private  java.lang.String targetPackage
          Target Java package to place the generated files in.
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.velocity.texen.ant.TexenTask
contextProperties, controlTemplate, inputEncoding, outputDirectory, outputEncoding, outputFile, templatePath, useClasspath
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
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).
 java.lang.String getBasePathToDbProps()
          The path to properties file containing db idiosyncrasies is constructed by appending the "getTargetDatabase()/db.props to this path.
 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.
private  java.lang.String grokName(java.lang.String xmlFile)
          Gets a name to use for the application's data model.
 org.apache.velocity.context.Context initControlContext()
          Set up the initial context for generating the SQL from the XML schema.
 void setBasePathToDbProps(java.lang.String v)
          The path to properties file containing db idiosyncrasies is constructed by appending the "getTargetDatabase()/db.props to this path.
 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.velocity.texen.ant.TexenTask
cleanup, execute, getContextProperties, getControlTemplate, getOutputDirectory, getOutputFile, getTemplatePath, populateInitialContext, setControlTemplate, setInputEncoding, setOutputDirectory, setOutputEncoding, setOutputFile, setTemplatePath, setUseClasspath
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlFile

protected java.lang.String xmlFile
XML that describes the database model, this is transformed into the application model object.


filesets

protected java.util.List filesets
Fileset of XML schemas which represent our data models.


dataModels

protected java.util.List dataModels
Data models that we collect. One from each XML schema file.


context

protected org.apache.velocity.context.Context context
Velocity context which exposes our objects in the templates.


dataModelDbMap

protected java.util.Hashtable dataModelDbMap
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.


databaseNames

protected java.util.Hashtable databaseNames
Hashtable containing the names of all the databases in our collection of schemas.


sqldbmap

protected java.lang.String sqldbmap
Name of the properties file that maps an SQL file to a particular database.


basePathToDbProps

private java.lang.String basePathToDbProps
The path to properties file containing db idiosyncrasies is constructed by appending the "getTargetDatabase()/db.props to this path.


targetDatabase

private java.lang.String targetDatabase
The target database(s) we are generating SQL for. Right now we can only deal with a single target, but we will support multiple targets soon.


targetPackage

private java.lang.String targetPackage
Target Java package to place the generated files in.

Constructor Detail

TorqueDataModelTask

public TorqueDataModelTask()
Method Detail

setSqlDbMap

public void setSqlDbMap(java.lang.String sqldbmap)
Set the sqldbmap.


getSqlDbMap

public java.lang.String getSqlDbMap()
Get the sqldbmap.


getDataModels

public java.util.List getDataModels()
Return the data models that have been processed.


getDataModelDbMap

public java.util.Hashtable getDataModelDbMap()
Return the data model to database name map.


getXmlFile

public java.lang.String getXmlFile()
Get the xml schema describing the application model.


setXmlFile

public void setXmlFile(java.lang.String xmlFile)
Set the xml schema describing the application model.


addFileset

public void addFileset(org.apache.tools.ant.types.FileSet set)
Adds a set of xml schema files (nested fileset attribute).


getTargetDatabase

public java.lang.String getTargetDatabase()
Get the current target database.


setTargetDatabase

public void setTargetDatabase(java.lang.String v)
Set the current target database. (e.g. mysql, oracle, ..)


getTargetPackage

public java.lang.String getTargetPackage()
Get the current target package.


setTargetPackage

public void setTargetPackage(java.lang.String v)
Set the current target package. This is where generated java classes will live.


getBasePathToDbProps

public java.lang.String getBasePathToDbProps()
The path to properties file containing db idiosyncrasies is constructed by appending the "getTargetDatabase()/db.props to this path.


setBasePathToDbProps

public void setBasePathToDbProps(java.lang.String v)
The path to properties file containing db idiosyncrasies is constructed by appending the "getTargetDatabase()/db.props to this path.


initControlContext

public org.apache.velocity.context.Context initControlContext()
                                                       throws java.lang.Exception
Set up the initial context for generating the SQL from the XML schema.


grokName

private java.lang.String grokName(java.lang.String xmlFile)
Gets a name to use for the application's data model.


setContextProperties

public 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.

Also, move xxx.yyy properties to xxxYyy as Velocity doesn't like the xxx.yyy syntax.