I've patched the build-torque.xml so that you can just keep Torque in the jar and not have to extract it. Everything is configured via properties (see the attached project.properties for the new properties I added), so normally you'd put in the build-torque.xml in a dir, set the properties in the build.properties and call "ant -f build-torque.xml".
As long as Torque is in your classpath, it should work great. So you'd
accomplish this with maven but adding it to your dependencies in
project.xml, as you said you were interested in doing.
Also, since you're using Maven, you can setup the Torque settings in
your project.properties, then in your build.xml, add:
<property name="maven.core.callback.pre-compile.buildFile"
value="${basedir}/build-torque.xml"/>
<property name="maven.core.callback.pre-compile.buildTarget"
value="main-classpath"/>
This plugs Torque into the Maven callback architecture, so now Torque
will automatically run everytime you run ant.
If this isn't desirable (eventually I'll get around to making it smart
enough to only run when it needs to), you can also add delegates to your
build.xml file (see the bottom of attached build.xml file), and then
just run "ant torque:main" when you've changed your schema.
This setup has been working well for me and I'd like to see it included
in Torque (or at least the functionality of it, if not necessarily my
patch of it). So if you like how these files work, let the devs know so
they'll accept my patch or work on their own. :-)
Also, let me know if you run into problems/bugs in this approach and
I'll try and patch them up.
Thanks,
Stephen
> -----Original Message-----
> From: Christian Willy Asmussen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 29, 2002 10:38 AM
> To: [EMAIL PROTECTED]
> Subject: What happend to build-torque.xml
>
> In the torque site, the documentation refers to a file named
> build-torque.xml. I cannot find it anywhere.
>
> Also, I am using maven on my project. Is it possible to use torque
simply
> by declaring it as a dependency, or do I have to get the .tar.gz and
do all
> that stuff?
>
>
> --
> There is no limit to what you can do
> if you don't care who gets the credit.
> - Keynote
>
> --
> To unsubscribe, e-mail: <mailto:turbine-torque-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:turbine-torque-user-
> [EMAIL PROTECTED]>
<?xml version="1.0"?>
<project name="maven" default="war" basedir=".">
<property file="${user.home}/build.properties"/>
<property file="build.properties"/>
<property file="project.properties"/>
<!-- Tie Torque into Maven -->
<property name="maven.core.callback.pre-compile.buildFile" value="${basedir}/build-torque.xml"/>
<property name="maven.core.callback.pre-compile.buildTarget" value="main-classpath"/>
<!-- property name="maven.core.callback.pre-clean.buildFile" value="build-torque.xml"/ -->
<!-- property name="maven.core.callback.pre-clean.buildTarget" value="clean"/ -->
<!-- Use the cool exportAll-enabled Ant task -->
<taskdef name="maven-ant" classname="org.apache.maven.ant.Ant">
<classpath>
<pathelement location="${lib.repo}/maven.jar"/>
</classpath>
</taskdef>
<!-- Make sure we copy the gdss-pipeline.xml file over to the destination dir. -->
<property name="maven.core.callback.post-compile.buildFile" value="${basedir}/build.xml"/>
<property name="maven.core.callback.post-compile.buildTarget" value="copy-pipeline"/>
<target name="copy-pipeline">
<copy file="src/conf/gdss-pipeline.xml" todir="target/classes/com/mobiledecisions/gdss"/>
<!-- jar destfile="target/${maven.j2ee.war.name}" update="true"></jar -->
</target>
<target name="war">
<delete dir="target/webapp"/>
<ant target="maven:war"/>
<unjar src="target/upgdss.war" dest="target/webapp"/>
<echo message="${maven.src.dir}"/>
</target>
<!-- maven:start -->
<target name="maven:iutest">
<ant antfile="${maven.home}/plugins/iutest/build.xml" target="iutest"/>
</target>
<target name="maven:update-jars">
<ant antfile="${maven.home}/plugins/core/build.xml" target="update-jars"/>
</target>
<target name="maven:docs">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="docs"/>
</target>
<target name="maven:cvs-change-log">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="cvs-change-log"/>
</target>
<target name="maven:compile">
<ant antfile="${maven.home}/plugins/core/build.xml" target="compile"/>
</target>
<target name="maven:pdf">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="pdf"/>
</target>
<target name="maven:validate-war">
<ant antfile="${maven.home}/plugins/j2ee/build.xml" target="validate-war"/>
</target>
<target name="maven:env">
<ant antfile="${maven.home}/plugins/core/build.xml" target="env"/>
</target>
<target name="maven:deploy-site">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="deploy-site"/>
</target>
<target name="maven:gump-descriptor">
<ant antfile="${maven.home}/plugins/core/build.xml" target="gump-descriptor"/>
</target>
<target name="maven:announce">
<ant antfile="${maven.home}/plugins/core/build.xml" target="announce"/>
</target>
<target name="maven:install-jar">
<ant antfile="${maven.home}/plugins/core/build.xml" target="install-jar"/>
</target>
<target name="maven:war">
<ant antfile="${maven.home}/plugins/j2ee/build.xml" target="war"/>
</target>
<target name="maven:dist">
<ant antfile="${maven.home}/plugins/core/build.xml" target="dist"/>
</target>
<target name="maven:task-list">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="task-list"/>
</target>
<target name="maven:javadocs">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="javadocs"/>
</target>
<target name="maven:run-singletest">
<ant antfile="${maven.home}/plugins/test/build.xml" target="run-singletest"/>
</target>
<target name="maven:jar">
<ant antfile="${maven.home}/plugins/core/build.xml" target="jar"/>
</target>
<target name="maven:docs-quick">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="docs-quick"/>
</target>
<target name="maven:validate-pom">
<ant antfile="${maven.home}/plugins/core/build.xml" target="validate-pom"/>
</target>
<target name="maven:ear">
<ant antfile="${maven.home}/plugins/j2ee/build.xml" target="ear"/>
</target>
<target name="maven:test">
<ant antfile="${maven.home}/plugins/test/build.xml" target="test"/>
</target>
<target name="maven:deploy-dist">
<ant antfile="${maven.home}/plugins/core/build.xml" target="deploy-dist"/>
</target>
<target name="maven:maven-update">
<ant antfile="${maven.home}/plugins/core/build.xml" target="maven-update"/>
</target>
<target name="maven:generate-reactor">
<ant antfile="${maven.home}/plugins/reactor/build.xml" target="generate-reactor"/>
</target>
<target name="maven:fo">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="fo"/>
</target>
<target name="maven:clean">
<ant antfile="${maven.home}/plugins/core/build.xml" target="clean"/>
</target>
<target name="maven:site">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="site"/>
</target>
<target name="maven:dist-build">
<ant antfile="${maven.home}/plugins/core/build.xml" target="dist-build"/>
</target>
<target name="maven:cross-ref">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="cross-ref"/>
</target>
<target name="maven:activity-log">
<ant antfile="${maven.home}/plugins/docs/build.xml" target="activity-log"/>
</target>
<target name="maven:verify-project">
<ant antfile="${maven.home}/plugins/core/build.xml" target="verify-project"/>
</target>
<target name="maven:metrics">
<ant antfile="${maven.home}/plugins/metrics/build.xml" target="metrics"/>
</target>
<target name="maven:check-source">
<ant antfile="${maven.home}/plugins/core/build.xml" target="check-source"/>
</target>
<!-- maven:end -->
<!-- torque:start -->
<target name="torque:main">
<ant antfile="build-torque.xml" target="main-classpath"/>
</target>
<target name="torque:sql">
<ant antfile="build-torque.xml" target="project-sql-classpath"/>
</target>
<target name="torque:doc">
<ant antfile="build-torque.xml" target="project-doc-classpath"/>
</target>
<target name="torque:create-db">
<ant antfile="build-torque.xml" target="project-create-db-classpath"/>
</target>
<target name="torque:insert-sql">
<ant antfile="build-torque.xml" target="project-insert-sql-classpath"/>
</target>
<target name="torque:jdbc">
<ant antfile="build-torque.xml" target="project-jdbc-classpath"/>
</target>
<target name="torque:datasql">
<ant antfile="build-torque.xml" target="project-datasql-classpath"/>
</target>
<target name="torque:id-table-init-sql">
<ant antfile="build-torque.xml" target="project-id-table-init-sql-classpath"/>
</target>
<target name="torque:datadump">
<ant antfile="build-torque.xml" target="project-datadump-classpath"/>
</target>
<target name="torque:datadtd">
<ant antfile="build-torque.xml" target="project-datadtd-classpath"/>
</target>
<target name="torque:om">
<ant antfile="build-torque.xml" target="project-om-classpath"/>
</target>
<target name="torque:sql2xml">
<ant antfile="build-torque.xml" target="project-sql2xml-classpath"/>
</target>
<target name="torque:ojb-repository">
<ant antfile="build-torque.xml" target="project-ojb-repository-classpath"/>
</target>
<target name="torque:ojb-model">
<ant antfile="build-torque.xml" target="project-ojb-model-classpath"/>
</target>
<target name="torque:clean">
<!-- ant antfile="build-torque.xml" target="project-clean"/-->
</target>
<!-- torque:end -->
</project>
<project name="Torque" default="main" basedir=".">
<property file="${user.home}/build.properties"/>
<property name="torque.build.properties" value="build.properties"/>
<property file="${torque.build.properties}"/>
<!--
The torque.home property can be over-ridden to point to a single
Torque installation. Drop this build-torque.xml into each project's
src tree, but then set torque.home = c:\\Java\\Apache\\torque-3.0-b2.
Perhaps if torque.home="." we can detect whether to use classpath
based on if a certain file is around (e.g. templates/om/Control.vm)
and set a property instead of having separate targets.
-->
<property name="torque.home" value="."/>
<property name="torque.project" value="${project}"/>
<property name="torque.database" value="${database}"/>
<property name="torque.outputDirectory" value="${torque.home}/${outputDirectory}"/>
<property name="torque.schemaDirectory" value="${torque.home}/${schemaDirectory}"/>
<property name="torque.target.java.dir" value="${torque.outputDirectory}/java"/>
<property name="torque.target.sql.dir" value="${torque.outputDirectory}/sql"/>
<property name="torque.target.doc.dir" value="${torque.outputDirectory}/doc"/>
<property name="torque.target.javadoc.dir" value="${torque.outputDirectory}/javadoc"/>
<property name="torque.target.ojb.dir" value="${torque.outputDirectory}/ojb"/>
<property name="torque.target.build.dir" value="${torque.home}/bin/classes"/>
<property name="torque.templatePath" value="${torque.home}/templates"/>
<property name="torque.documentationFormat" value="${documentationFormat}"/>
<property name="torque.lib.dir" value="lib"/>
<property name="idTableXMLFile" value=""/>
<!-- Build classpath -->
<path id="torque-classpath">
<pathelement location="${torque.lib.dir}/commons-collections.jar"/>
<pathelement location="${torque.lib.dir}/commons-configuration-1.0-dev.jar"/>
<pathelement location="${torque.lib.dir}/commons-lang-0.1-dev.jar"/>
<pathelement location="${torque.lib.dir}/commons-pool.jar"/>
<pathelement location="${torque.lib.dir}/jcs-1.0-dev.jar"/>
<pathelement location="${torque.lib.dir}/jdbc2_0-stdext.jar"/>
<pathelement location="${torque.lib.dir}/log4j-1.1.3.jar"/>
<pathelement location="${torque.lib.dir}/stratum-1.0-b2-dev.jar"/>
<pathelement location="${torque.lib.dir}/torque-3.0-b2.jar"/>
<pathelement location="${torque.lib.dir}/velocity-1.3-rc1.jar"/>
<pathelement location="${torque.lib.dir}/village-1.5.3.jar"/>
<pathelement location="${torque.lib.dir}/xercesImpl-2.0.0.jar"/>
<pathelement location="${torque.lib.dir}/xmlParserAPIs-2.0.0.jar"/>
</path>
<!-- ================================================================ -->
<!-- M A I N T A R G E T -->
<!-- ================================================================ -->
<!-- This default target will run all the targets that generate -->
<!-- source. You will probably only run this target once then -->
<!-- call individual targets as necessary to update your sources -->
<!-- when you change your XML schema. -->
<!-- ================================================================ -->
<target
name="main"
description="==> generates sql + om classes">
<antcall target="project-sql"/>
<antcall target="project-om"/>
</target>
<target
name="main-classpath"
description="==> generates sql + om classes">
<antcall target="project-sql-classpath"/>
<antcall target="project-om-classpath"/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T S Q L -->
<!-- ================================================================ -->
<!-- Generate the SQL for your project, these are in addition -->
<!-- to the base Turbine tables! The tables you require for your -->
<!-- project should be specified in project-schema.xml. -->
<!-- ================================================================ -->
<target
name="project-sql"
description="==> generates the SQL for your project">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL for YOUR Turbine project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="torque-sql"
classname="org.apache.torque.task.TorqueSQLTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-sql
contextProperties="${torque.build.properties}"
controlTemplate="${SQLControlTemplate}"
outputDirectory="${torque.target.sql.dir}"
templatePath="${torque.templatePath}"
basePathToDbProps="sql/base/"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputFile="report.${torque.project}.sql.generation"
targetDatabase="${torque.database}"
idTableXMLFile="${idTableXMLFile}">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-sql>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E D O C S -->
<!-- ================================================================ -->
<target
name="project-doc"
description="==> generates documentation for your datamodel">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating docs for YOUR datamodel! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="torque-doc"
classname="org.apache.torque.task.TorqueDocumentationTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-doc
contextProperties="${torque.build.properties}"
controlTemplate="${DocControlTemplate}"
outputDirectory="${torque.target.doc.dir}"
outputFormat="${torque.documentationFormat}"
templatePath="${torque.templatePath}"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputFile="report.${torque.project}.doc.generation">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-doc>
</target>
<!-- ================================================================ -->
<!-- C R E A T E T A R G E T D A T A B A S E -->
<!-- ================================================================ -->
<!-- Create the target database by executing a generated script -->
<!-- that is capable of performing the task. -->
<!-- ================================================================ -->
<target
name="project-create-db"
unless="database.manual.creation"
description="==> generates the target database">
<taskdef
name="torque-create-db"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-create-db
controlTemplate="sql/db-init/Control.vm"
outputDirectory="${torque.target.sql.dir}"
targetDatabase="${torque.database}"
templatePath="${torque.templatePath}"
outputFile="create-db.sql">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-create-db>
<echo>
Executing the create-db.sql script ...
</echo>
<sql
driver="${databaseDriver}"
url="${createDatabaseUrl}"
userid="${databaseUser}"
password="${databasePassword}"
src="${torque.target.sql.dir}/create-db.sql"
autocommit="true"
onerror="continue">
<classpath refid="torque-classpath"/>
</sql>
</target>
<!-- ================================================================ -->
<!-- I N S E R T S I N G L E S Q L F I L E S -->
<!-- ================================================================ -->
<target
name="project-insert-sql">
<taskdef
name="torque-insert-sql"
classname="org.apache.torque.task.TorqueSQLExec">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-insert-sql
driver="${databaseDriver}"
url="${buildDatabaseUrl}"
userid="${databaseUser}"
password="${databasePassword}"
autocommit="true"
onerror="continue"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
srcDir="${torque.target.sql.dir}">
<classpath refid="torque-classpath"/>
</torque-insert-sql>
</target>
<!-- ================================================================ -->
<!-- J D B C TO X M L -->
<!-- ================================================================ -->
<target
name="project-jdbc"
description="==> jdbc to xml">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating XML from JDBC connection ! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${torque.build.properties}"/>
<taskdef
name="torque-jdbc"
classname="org.apache.torque.task.TorqueJDBCTransformTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-jdbc
dbUrl="${databaseUrl}"
dbDriver="${databaseDriver}"
dbUser="${databaseUser}"
dbPassword="${databasePassword}"
dbSchema="${databaseSchema}"
outputFile="${torque.outputDirectory}/schema.xml"
sameJavaName="${sameJavaName}"
/>
</target>
<!-- ================================================================ -->
<!-- Generate SQL from XML data file -->
<!-- ================================================================ -->
<target
name="project-datasql"
description="==> generates sql from data xml">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL from data XML ! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${torque.build.properties}"/>
<taskdef
name="torque-datasql"
classname="org.apache.torque.task.TorqueDataSQLTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-datasql
contextProperties="${torque.build.properties}"
controlTemplate="${DataSQLControlTemplate}"
outputDirectory="${torque.outputDirectory}"
templatePath="${torque.templatePath}"
outputFile="${torque.project}-data.sql"
xmlFile="${torque.schemaDirectory}/${torque.project}-schema.xml"
dataXmlFile="${torque.schemaDirectory}/${torque.project}-data.xml"
dataDTD="${torque.schemaDirectory}/${torque.project}-data.dtd"
targetDatabase="${torque.database}"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E I D B R O K E R I N I T S Q L -->
<!-- ================================================================ -->
<target
name="id-table-init-sql">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating initialization SQL |"/>
<echo message="| for ID Broker system! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="torque-sql"
classname="org.apache.torque.task.TorqueSQLTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-sql
contextProperties="${torque.templatePath}/sql/id-table/project.props"
controlTemplate="${idTableControlTemplate}"
templatePath="${torque.templatePath}"
suffix="-idtable-init"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputDirectory="${torque.target.sql.dir}"
outputFile="${torque.database}-id-table-init.sql"
targetDatabase="${torque.database}">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
</torque-sql>
</target>
<!-- ================================================================ -->
<!-- Dump data from database into xml file -->
<!-- ================================================================ -->
<target
name="project-datadump"
description="==> dump data from database into xml file">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Dumping the data from database into XML |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${torque.build.properties}"/>
<taskdef
name="torque-datadump"
classname="org.apache.torque.task.TorqueDataDumpTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-datadump
contextProperties="${torque.build.properties}"
controlTemplate="${DataDumpControlTemplate}"
outputDirectory="${torque.outputDirectory}"
templatePath="${torque.templatePath}"
outputFile="report.${torque.project}.datadump.generation"
xmlFile="${torque.schemaDirectory}/${torque.project}-schema.xml"
databaseDriver="${databaseDriver}"
databaseUrl="${databaseUrl}"
databaseUser="${databaseUser}"
databasePassword="${databasePassword}"
databaseName="${databaseName}"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T D A T A D T D -->
<!-- ================================================================ -->
<!-- Generate the DATA DTD for your project -->
<!-- ================================================================ -->
<target
name="project-datadtd"
description="==> generates the DATA DTD for your project">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Data DTD for YOUR Turbine project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<taskdef
name="torque-datadtd"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-datadtd
contextProperties="${torque.build.properties}"
controlTemplate="${DataDTDControlTemplate}"
outputDirectory="${torque.outputDirectory}"
templatePath="${torque.templatePath}"
outputFile="report.${torque.project}.datadtd.generation"
xmlFile="${torque.schemaDirectory}/${torque.project}-schema.xml"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T P E E R B A S E D O M -->
<!-- ================================================================ -->
<!-- Generate the Peer-based object model for your project. -->
<!-- These are in addition to the base Turbine OM! -->
<!-- ================================================================ -->
<target
name="project-om"
description="==> generates the Peer-based object model for your project">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Peer-based Object Model for |"/>
<echo message="| YOUR Turbine project! Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="torque-om"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-om
contextProperties="${torque.build.properties}"
controlTemplate="${OMControlTemplate}"
outputDirectory="${torque.target.java.dir}"
templatePath="${torque.templatePath}"
outputFile="report.${torque.project}.om.generation"
targetPackage="${targetPackage}.om"
targetDatabase="${torque.database}">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
</torque-om>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T S Q L -->
<!-- ================================================================ -->
<!-- Generate the SQL for your project, these are in addition -->
<!-- to the base Turbine tables! The tables you require for your -->
<!-- project should be specified in project-schema.xml. -->
<!-- ================================================================ -->
<target
name="project-sql-classpath"
description="==> generates the SQL for your project">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL for YOUR Turbine project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="torque-sql"
classname="org.apache.torque.task.TorqueSQLTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-sql
contextProperties="${torque.build.properties}"
controlTemplate="${SQLControlTemplate}"
outputDirectory="${torque.target.sql.dir}"
useClasspath="true"
basePathToDbProps="sql/base/"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputFile="report.${torque.project}.sql.generation"
targetDatabase="${torque.database}"
idTableXMLFile="${idTableXMLFile}">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-sql>
</target>
<!-- ================================================================ -->
<!-- Generate SQL from XML data file -->
<!-- ================================================================ -->
<target
name="project-datasql-classpath"
description="==> generates sql from data xml">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL from data XML ! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${torque.build.properties}"/>
<taskdef
name="torque-datasql"
classname="org.apache.torque.task.TorqueDataSQLTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-datasql
contextProperties="${torque.build.properties}"
controlTemplate="${DataSQLControlTemplate}"
outputDirectory="${torque.outputDirectory}"
useClasspath="true"
outputFile="${torque.project}-data.sql"
xmlFile="${torque.schemaDirectory}/${torque.project}-schema.xml"
dataXmlFile="${torque.schemaDirectory}/${torque.project}-data.xml"
dataDTD="${torque.schemaDirectory}/${torque.project}-data.dtd"
targetDatabase="${torque.database}"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T D A T A D T D -->
<!-- ================================================================ -->
<!-- Generate the DATA DTD for your project -->
<!-- ================================================================ -->
<target
name="project-datadtd-classpath"
description="==> generates the DATA DTD for your project">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Data DTD for YOUR Turbine project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<taskdef
name="torque-datadtd"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-datadtd
contextProperties="${torque.build.properties}"
controlTemplate="${DataDTDControlTemplate}"
outputDirectory="${torque.outputDirectory}"
useClasspath="true"
outputFile="report.${torque.project}.datadtd.generation"
xmlFile="${torque.schemaDirectory}/${torque.project}-schema.xml"
/>
</target>
<!-- ================================================================ -->
<!-- Dump data from database into xml file -->
<!-- ================================================================ -->
<target
name="project-datadump-classpath"
description="==> dump data from database into xml file">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Dumping the data from database into XML |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${torque.build.properties}"/>
<taskdef
name="torque-datadump"
classname="org.apache.torque.task.TorqueDataDumpTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-datadump
contextProperties="${torque.build.properties}"
controlTemplate="${DataDumpControlTemplate}"
outputDirectory="${torque.outputDirectory}"
useClasspath="true"
outputFile="report.${torque.project}.datadump.generation"
xmlFile="${torque.schemaDirectory}/${torque.project}-schema.xml"
databaseDriver="${databaseDriver}"
databaseUrl="${databaseUrl}"
databaseUser="${databaseUser}"
databasePassword="${databasePassword}"
databaseName="${databaseName}"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T P E E R B A S E D O M -->
<!-- ================================================================ -->
<!-- Generate the Peer-based object model for your project. -->
<!-- These are in addition to the base Turbine OM! -->
<!-- ================================================================ -->
<target
name="project-om-classpath"
description="==> generates the Peer-based object model for your project">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Peer-based Object Model for |"/>
<echo message="| YOUR Turbine project! Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="torque-om"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-om
contextProperties="${torque.build.properties}"
controlTemplate="${OMControlTemplate}"
outputDirectory="${torque.target.java.dir}"
useClasspath="true"
outputFile="report.${torque.project}.om.generation"
targetPackage="${targetPackage}.om"
targetDatabase="${torque.database}">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
</torque-om>
</target>
<!-- ================================================================ -->
<!-- C R E A T E T A R G E T D A T A B A S E -->
<!-- ================================================================ -->
<!-- Create the target database by executing a generated script -->
<!-- that is capable of performing the task. -->
<!-- ================================================================ -->
<target
name="project-create-db-classpath"
unless="database.manual.creation"
description="==> generates the target database">
<taskdef
name="torque-create-db"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<echo>
driver="${databaseDriver}"
url="${createDatabaseUrl}"
userid="${databaseUser}"
password="${databasePassword}"
</echo>
<torque-create-db
controlTemplate="sql/db-init/Control.vm"
outputDirectory="${torque.target.sql.dir}"
targetDatabase="${torque.database}"
useClasspath="true"
outputFile="create-db.sql">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-create-db>
<sql
driver="${databaseDriver}"
url="${createDatabaseUrl}"
userid="${databaseUser}"
password="${databasePassword}"
src="${torque.target.sql.dir}/create-db.sql"
autocommit="true"
onerror="continue">
<classpath refid="torque-classpath"/>
</sql>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E I D B R O K E R I N I T S Q L -->
<!-- ================================================================ -->
<target
name="id-table-init-sql-classpath">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating initialization SQL |"/>
<echo message="| for ID Broker system! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="torque-sql"
classname="org.apache.torque.task.TorqueSQLTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-sql
contextProperties="sql/id-table/project.props"
controlTemplate="${idTableControlTemplate}"
useClasspath="true"
suffix="-idtable-init"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputDirectory="${torque.target.sql.dir}"
outputFile="${torque.database}-id-table-init.sql"
targetDatabase="${torque.database}">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
</torque-sql>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E D O C S -->
<!-- ================================================================ -->
<target
name="project-doc-classpath"
description="==> generates documentation for your datamodel">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating docs for YOUR datamodel! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="torque-doc"
classname="org.apache.torque.task.TorqueDocumentationTask">
<classpath refid="torque-classpath"/>
</taskdef>
<torque-doc
contextProperties="${torque.build.properties}"
controlTemplate="${DocControlTemplate}"
outputDirectory="${torque.target.doc.dir}"
outputFormat="${torque.documentationFormat}"
useClasspath="true"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputFile="report.${torque.project}.doc.generation">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-doc>
</target>
<!-- =================================================================== -->
<!-- C O M P I L E O M -->
<!-- =================================================================== -->
<target
name="compile"
description="==> compiles the OM classes">
<!--
This should be moved to the top of the file, and
the values should come from the build.properties file.
-->
<property name="src.dir" value="${torque.target.java.dir}"/>
<property name="build.dest" value="${torque.target.build.dir}"/>
<property name="debug" value="on"/>
<property name="deprecation" value="off"/>
<property name="optimize" value="off"/>
<mkdir dir="${build.dest}"/>
<javac srcdir="${src.dir}"
destdir="${build.dest}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}">
<classpath refid="torque-classpath"/>
</javac>
</target>
<!-- =================================================================== -->
<!-- S Q L T O X M L -->
<!-- =================================================================== -->
<!-- Create an xml schema from an sql schema. -->
<!-- -->
<!-- inputFile: The input sql file. This must be valid sql file but -->
<!-- it not not be in any specific format. -->
<!-- outputFile: The file where the xml schema will be written -->
<!-- =================================================================== -->
<target
name="project-sql2xml"
description="==> creates an xml schema from an sql schema">
<taskdef
name="sql-xml"
classname="org.apache.torque.task.TorqueSQLTransformTask">
<classpath refid="torque-classpath"/>
</taskdef>
<sql-xml
inputFile="schema/schema.sql"
outputFile="schema/schema.xml"
/>
</target>
<!-- ================================================================== -->
<!-- J A V A D O C -->
<!-- ================================================================== -->
<target
name="javadocs"
description="==> generates the API documentation">
<mkdir dir="${torque.target.javadoc.dir}"/>
<javadoc
sourcepath="${torque.target.java.dir}"
packagenames="${targetPackage}.*"
destdir="${torque.target.javadoc.dir}"
author="true"
private="true"
version="true"
use="true">
<classpath refid="torque-classpath"/>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- =================================================================== -->
<!-- O J B S T U F F -->
<!-- =================================================================== -->
<!-- =================================================================== -->
<target
name="project-ojb-repository">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating OJB repository |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="ojb-repository"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<ojb-repository
contextProperties="${torque.build.properties}"
controlTemplate="ojb/repository/Control.vm"
targetPackage="${targetPackage}.om"
targetDatabase="${torque.database}"
outputDirectory="${torque.target.ojb.dir}"
templatePath="${torque.templatePath}"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputFile="report.${torque.project}.ojb.generation">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</ojb-repository>
</target>
<target
name="project-ojb-repository-classpath">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating OJB repository |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="ojb-repository"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<ojb-repository
contextProperties="${torque.build.properties}"
controlTemplate="ojb/repository/Control.vm"
targetPackage="${targetPackage}.om"
targetDatabase="${torque.database}"
outputDirectory="${torque.home}/${outputDirectory}/ojb"
useClasspath="true"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputFile="report.${torque.project}.ojb.generation">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</ojb-repository>
</target>
<target
name="project-ojb-model">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating OJB model |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="ojb-model"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<ojb-model
contextProperties="${torque.build.properties}"
controlTemplate="ojb/model/Control.vm"
targetPackage="${targetPackage}.om"
targetDatabase="${torque.database}"
outputDirectory="${torque.home}/${outputDirectory}/ojb"
templatePath="${torque.templatePath}"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputFile="report.${torque.project}.ojb.generation">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</ojb-model>
</target>
<target
name="project-ojb-model-classpath">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating OJB model |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<taskdef
name="ojb-model"
classname="org.apache.torque.task.TorqueDataModelTask">
<classpath refid="torque-classpath"/>
</taskdef>
<ojb-model
contextProperties="${torque.build.properties}"
controlTemplate="ojb/model/Control.vm"
targetPackage="${targetPackage}.om"
targetDatabase="${torque.database}"
outputDirectory="${torque.home}/${outputDirectory}/ojb"
useClasspath="true"
sqldbmap="${torque.target.sql.dir}/sqldb.map"
outputFile="report.${torque.project}.ojb.generation">
<fileset dir="${torque.schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</ojb-model>
</target>
</project>
project.properties
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
