Yeah, yeah, this one works, trust me. Again. :-)
It passes the test bed with complete backwards compatibility. I've got a
new src/conf/default.properties being copied to
org/apache/torque/default.properties (had to modify the build.xml and
add a maven callback to get it into classes) that handles defining the
old default properties and then mapping to the new ones (besides
backwards compatibility, it also favors the idea that you'll only have
to declare the properties you don't want as default).
The high light is that you can set:
- torque.schema.dir to be where your schema dir is.
- torque.java.dir to be where you want the java files to show up.
- torque.sql.dir to be where you want the sql files to show up.
- torque.useClasspath = true
- torque.lib.dir to somewhere it can find torque-3.0-b3-dev and it's
libraries (e.g. lib.repo)
and it will work without having torque unpacked and hanging all over the
place.
I've got a few todos left...
- I'd like to move all of the template variables (e.g. addSaveMethod) to
torque.context.addSaveMethod to distinguish them from the other build
variables, but then instead of modifying the templates, override Texen's
initContextProperties (or something like that), and instead of reading
in all of the build.properties/torque.contextProperties into Velocity's
contextProperties, screen for only those beginning with torque.context.
I don't like not knowing which variables are used by the templates via
contextProperties and what aren't.
- The separate sql-template/sql-classpath targets are still there.
Hopefully they'll be going away with a patched PropertiesUtil in
velocity 1.4.
- A doc for the new properties and how to use Torque both unpacked in
your source tree and also off in the class path. I'm holding off on
these until the patch gets approved as I don't want to spend time on
them for nothing.
- Auto-detecting if the schema has changed and hence only generating the
OM/sql code on a need basis. This would make Torque includable in every
build run. Scarab does this well and I had it implemented at one time,
but I want to get this in first and make sure I do it right.
Let me know if I did anything horribly wrong (e.g. renaming the
XxxControlTemplate to torque.template.Xxx...that was more a spur of the
moment thing) as I probably put more changes than was needed into this.
(Overall, as you can tell, the patch heavily favors naming things via
torque.xxx, but I think this is the right direction to go, as I see it,
as then Torque wouldn't need it's own config file, but could operate
nicely in, say, project.properties).
Thanks,
Stephen
Index: build-torque.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/conf/build-torque.xml,v
retrieving revision 1.37
diff -u -r1.37 build-torque.xml
--- build-torque.xml 11 Jul 2002 18:09:25 -0000 1.37
+++ build-torque.xml 15 Jul 2002 06:56:32 -0000
@@ -1,19 +1,67 @@
<project name="Torque" default="main" basedir=".">
+ <!--
+ Note - You should not have to edit this file.
+
+ Instead, if calling build-torque.xml directly, edit the build.properties
+ that is in the same directory. If calling build-torque.xml via another
+ build file, you can also use the build.properties in the same directory,
+ or set the property torque.contextProperties to the file
+ to use in place of build.properties (e.g. project.properties).
+ -->
- <property name="torque.home" value="."/>
+ <!--
+ For us to load the default.properties from the classpath, we need to bootstrap.
+ To know the right lib.dir for the torque-classpath, we need to manually
+ figure out torque.lib.dir, but to do that, we need to manually figure
+ out torque.contextProperties and load that so that any old configurations
+ still work propertly. Then we can go on and do the rest of the mappings via
+ old.properties.
+ -->
<property name="build.properties" value="build.properties"/>
- <property file="${build.properties}"/>
+ <property name="torque.contextProperties" value="${build.properties}"/>
+ <property file="${torque.contextProperties}"/>
<property name="lib.dir" value="lib"/>
- <property name="idTableXMLFile" value=""/>
+ <property name="torque.lib.dir" value="${lib.dir}"/>
- <!-- Build classpath -->
+ <!--
+ Build the classpath. Specifically point to each file we're including to avoid
+ version conflicts in the case of the torque.lib.dir being something like lib.repo.
+ However, we still need to pull in the user's database driver and since we don't
+ know which jar that will be, after we've got all of our specific, version-safe
+jars,
+ do a general inclusion of the torque.lib.dir to catch any drivers.
+ -->
<path id="torque-classpath">
- <fileset dir="${lib.dir}">
+ <pathelement location="${torque.lib.dir}/commons-beansutils-1.2.jar"/>
+ <pathelement location="${torque.lib.dir}/commons-collections-2.0.jar"/>
+ <pathelement location="${torque.lib.dir}/commons-configuration-1.0-dev.jar"/>
+ <pathelement location="${torque.lib.dir}/commons-jdbc2pool-1.0-dev.jar"/>
+ <pathelement location="${torque.lib.dir}/commons-lang-1.0-dev.jar"/>
+ <pathelement location="${torque.lib.dir}/commons-pool-1.0.jar"/>
+ <pathelement location="${torque.lib.dir}/jcs-1.0-dev.jar"/>
+ <pathelement location="${torque.lib.dir}/jdbc-2.0.jar"/>
+ <pathelement location="${torque.lib.dir}/jndi-1.2.1.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}/tomcat-naming-1.0.jar"/>
+ <pathelement location="${torque.lib.dir}/torque-3.0-b3-dev.jar"/>
+ <pathelement location="${torque.lib.dir}/velocity-1.3.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"/>
+ <fileset dir="${torque.lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!--
+ The default.properties file will map old properties to the new ones along
+ with setting the corret defaults.
+ -->
+ <property
+ classpathref="torque-classpath"
+ resource="org/apache/torque/default.properties"/>
+
+ <!--
Do forward declarations of all of our tasks to
centralize them and clean up the targets.
-->
@@ -67,21 +115,36 @@
<antcall target="om"/>
</target>
+
+ <!-- ================================================================ -->
+ <!-- C H E C K U S E C L A S S P A T H -->
+ <!-- ================================================================ -->
+ <!-- Temporary hack around the propertiesUtil bug. Should -->
+ <!-- be fixed soon. -->
+ <!-- ================================================================ -->
+
+ <target name="check-use-classpath">
+ <condition property="torque.internal.useClasspath">
+ <equals arg1="${torque.useClasspath}" arg2="true"/>
+ </condition>
+ </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 -->
+ <!-- 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="sql"
+ depends="check-use-classpath"
description="==> generates the SQL for your project">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
- <echo message="| Generating SQL for YOUR Turbine project! |"/>
+ <echo message="| Generating SQL for YOUR Torque project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
@@ -90,45 +153,35 @@
<antcall target="sql-template"/>
</target>
- <target
- name="sql-classpath"
- if="useClasspath">
-
- <echo message="using classpath"/>
-
+ <target name="sql-classpath" if="torque.internal.useClasspath">
<torque-sql
- contextProperties="${build.properties}"
- controlTemplate="${SQLControlTemplate}"
- outputDirectory="${torque.home}/${outputDirectory}/sql"
- useClasspath="${useClasspath}"
basePathToDbProps="sql/base/"
- sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
- outputFile="report.${project}.sql.generation"
- targetDatabase="${database}"
- idTableXMLFile="${idTableXMLFile}">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.sql}"
+ idTableXMLFile="${torque.idTableXMLFile}"
+ outputDirectory="${torque.sql.dir}"
+ outputFile="report.${torque.project}.sql.generation"
+ sqldbmap="${torque.sql.dir}/sqldb.map"
+ targetDatabase="${torque.database}"
+ useClasspath="${torque.useClasspath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
</fileset>
</torque-sql>
</target>
- <target
- name="sql-template"
- unless="useClasspath">
-
- <echo message="using template path ${templatePath}"/>
-
+ <target name="sql-template" unless="torque.internal.useClasspath">
<torque-sql
- contextProperties="${build.properties}"
- controlTemplate="${SQLControlTemplate}"
- outputDirectory="${torque.home}/${outputDirectory}/sql"
- templatePath="${templatePath}"
basePathToDbProps="sql/base/"
- sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
- outputFile="report.${project}.sql.generation"
- targetDatabase="${database}"
- idTableXMLFile="${idTableXMLFile}">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.sql}"
+ idTableXMLFile="${torque.idTableXMLFile}"
+ outputDirectory="${torque.sql.dir}"
+ outputFile="report.${torque.project}.sql.generation"
+ sqldbmap="${torque.sql.dir}/sqldb.map"
+ targetDatabase="${torque.database}"
+ templatePath="${torque.templatePath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
</fileset>
</torque-sql>
@@ -137,6 +190,10 @@
<!-- ================================================================ -->
<!-- G E N E R A T E D O C S -->
<!-- ================================================================ -->
+ <!-- Generates documentation to -->
+ <!-- ${torque.doc.dir}/project-schema.html -->
+ <!-- ================================================================ -->
+
<target
name="doc"
@@ -150,15 +207,15 @@
<echo message="+------------------------------------------+"/>
<torque-doc
- contextProperties="${build.properties}"
- controlTemplate="${DocControlTemplate}"
- outputDirectory="${torque.home}/${outputDirectory}/doc"
- useClasspath="${useClasspath}"
- outputFormat="${documentationFormat}"
- templatePath="${templatePath}"
- sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
- outputFile="report.${project}.doc.generation">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.doc}"
+ outputDirectory="${torque.doc.dir}"
+ outputFile="report.${torque.project}.doc.generation"
+ outputFormat="${torque.doc.format}"
+ sqldbmap="${torque.sql.dir}/sqldb.map"
+ templatePath="${torque.templatePath}"
+ useClasspath="${torque.useClasspath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
</fileset>
</torque-doc>
@@ -177,13 +234,13 @@
description="==> generates the target database">
<torque-data-model
- controlTemplate="sql/db-init/Control.vm"
- outputDirectory="${torque.home}/${outputDirectory}/sql"
- useClasspath="${useClasspath}"
- targetDatabase="${database}"
- templatePath="${templatePath}"
- outputFile="create-db.sql">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ controlTemplate="${torque.template.sqlDbInit}"
+ outputDirectory="${torque.sql.dir}"
+ outputFile="create-db.sql"
+ targetDatabase="${torque.database}"
+ templatePath="${torque.templatePath}"
+ useClasspath="${torque.useClasspath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
</fileset>
</torque-data-model>
@@ -193,13 +250,13 @@
</echo>
<sql
- driver="${databaseDriver}"
- url="${createDatabaseUrl}"
- userid="${databaseUser}"
- password="${databasePassword}"
- src="${torque.home}/${outputDirectory}/sql/create-db.sql"
autocommit="true"
- onerror="continue">
+ driver="${torque.database.driver}"
+ onerror="continue"
+ password="${torque.database.password}"
+ src="${torque.sql.dir}/create-db.sql"
+ url="${torque.database.createUrl}"
+ userid="${torque.database.user}">
<classpath refid="torque-classpath"/>
</sql>
</target>
@@ -212,14 +269,14 @@
name="insert-sql">
<torque-sql-exec
- driver="${databaseDriver}"
- url="${buildDatabaseUrl}"
- userid="${databaseUser}"
- password="${databasePassword}"
autocommit="true"
+ driver="${torque.database.driver}"
onerror="continue"
- sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
- srcDir="${torque.home}/${outputDirectory}/sql">
+ password="${torque.database.password}"
+ sqldbmap="${torque.sql.dir}/sqldb.map"
+ srcDir="${torque.sql.dir}"
+ url="${buildDatabaseUrl}"
+ userid="${torque.database.user}">
<classpath refid="torque-classpath"/>
</torque-sql-exec>
</target>
@@ -238,15 +295,14 @@
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
- <echo message=" taking build.properties from: ${build.properties}"/>
<torque-jdbc-transform
- dbUrl="${databaseUrl}"
- dbDriver="${databaseDriver}"
- dbUser="${databaseUser}"
- dbPassword="${databasePassword}"
+ dbDriver="${torque.database.driver}"
+ dbPassword="${torque.database.password}"
dbSchema="${databaseSchema}"
- outputFile="${torque.home}/${outputDirectory}/schema.xml"
+ dbUrl="${torque.database.url}"
+ dbUser="${torque.database.user}"
+ outputFile="${torque.schema.dir}/schema.xml"
sameJavaName="${sameJavaName}"
/>
</target>
@@ -265,20 +321,19 @@
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
- <echo message=" taking build.properties from: ${build.properties}"/>
<torque-data-sql
- contextProperties="${build.properties}"
- controlTemplate="${DataSQLControlTemplate}"
- outputDirectory="${torque.home}/${outputDirectory}"
- useClasspath="${useClasspath}"
- templatePath="${templatePath}"
- outputFile="${project}-data.sql"
- xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
- dataXmlFile="${torque.home}/${schemaDirectory}/${project}-data.xml"
- dataDTD="${torque.home}/${schemaDirectory}/${project}-data.dtd"
- targetDatabase="${database}"
- sqldbmap="${basedir}/${outputDirectory}/sql/sqldb.map"
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.dataSql}"
+ dataDTD="${torque.schema.dir}/${torque.project}-data.dtd"
+ dataXmlFile="${torque.schema.dir}/${torque.project}-data.xml"
+ outputDirectory="${torque.output.dir}"
+ outputFile="${torque.project}-data.sql"
+ sqldbmap="${torque.sql.dir}/sqldb.map"
+ targetDatabase="${torque.database}"
+ templatePath="${torque.templatePath}"
+ useClasspath="${torque.useClasspath}"
+ xmlFile="${torque.schema.dir}/${torque.project}-schema.xml"
/>
</target>
@@ -297,16 +352,16 @@
<echo message="+------------------------------------------+"/>
<torque-sql
- contextProperties="${build.properties}"
- controlTemplate="${idTableControlTemplate}"
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.idTable}"
+ outputDirectory="${torque.sql.dir}"
+ outputFile="${torque.database}-id-table-init.sql"
+ sqldbmap="${torque.sql.dir}/sqldb.map"
suffix="-idtable-init"
- sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
- outputDirectory="${torque.home}/${outputDirectory}/sql"
- useClasspath="${useClasspath}"
- templatePath="${templatePath}"
- outputFile="${database}-id-table-init.sql"
- targetDatabase="${database}">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ targetDatabase="${torque.database}"
+ templatePath="${torque.templatePath}"
+ useClasspath="${torque.useClasspath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
@@ -327,21 +382,20 @@
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
- <echo message=" taking build.properties from: ${build.properties}"/>
<torque-data-dump
- contextProperties="${build.properties}"
- controlTemplate="${DataDumpControlTemplate}"
- outputDirectory="${torque.home}/${outputDirectory}"
- useClasspath="${useClasspath}"
- templatePath="${templatePath}"
- outputFile="report.${project}.datadump.generation"
- xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
- databaseDriver="${databaseDriver}"
- databaseUrl="${databaseUrl}"
- databaseUser="${databaseUser}"
- databasePassword="${databasePassword}"
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.dataDump}"
+ databaseDriver="${torque.database.driver}"
databaseName="${databaseName}"
+ databaseUrl="${torque.database.url}"
+ databaseUser="${torque.database.user}"
+ databasePassword="${torque.database.password}"
+ outputDirectory="${torque.output.dir}"
+ outputFile="report.${torque.project}.datadump.generation"
+ templatePath="${torque.templatePath}"
+ useClasspath="${torque.useClasspath}"
+ xmlFile="${torque.schema.dir}/${torque.project}-schema.xml"
/>
</target>
@@ -363,13 +417,13 @@
<echo message="+-----------------------------------------------+"/>
<torque-data-model
- contextProperties="${build.properties}"
- controlTemplate="${DataDTDControlTemplate}"
- outputDirectory="${torque.home}/${outputDirectory}"
- useClasspath="${useClasspath}"
- templatePath="${templatePath}"
- outputFile="report.${project}.datadtd.generation"
- xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.dataDtd}"
+ outputDirectory="${torque.output.dir}"
+ outputFile="report.${torque.project}.datadtd.generation"
+ templatePath="${torque.templatePath}"
+ useClasspath="${torque.useClasspath}"
+ xmlFile="${torque.schema.dir}/${torque.project}-schema.xml"
/>
</target>
@@ -382,6 +436,7 @@
<target
name="om"
+ depends="check-use-classpath"
description="==> generates the Peer-based object model for your project">
<echo message="+------------------------------------------+"/>
@@ -395,42 +450,32 @@
<antcall target="om-template"/>
</target>
- <target
- name="om-classpath"
- if="useClasspath">
-
- <echo message="using classpath"/>
-
+ <target name="om-classpath" if="torque.internal.useClasspath">
<torque-data-model
- contextProperties="${build.properties}"
- controlTemplate="${OMControlTemplate}"
- outputDirectory="${torque.home}/${outputDirectory}/java"
- useClasspath="${useClasspath}"
- outputFile="report.${project}.om.generation"
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.om}"
+ outputDirectory="${torque.java.dir}"
+ outputFile="report.${torque.project}.om.generation"
+ targetDatabase="${torque.database}"
targetPackage="${targetPackage}"
- targetDatabase="${database}">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ useClasspath="${torque.useClasspath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
</torque-data-model>
</target>
- <target
- name="om-template"
- unless="useClasspath">
-
- <echo message="using template path ${templatePath}"/>
-
+ <target name="om-template" unless="torque.internal.useClasspath">
<torque-data-model
- contextProperties="${build.properties}"
- controlTemplate="${OMControlTemplate}"
- outputDirectory="${torque.home}/${outputDirectory}/java"
- templatePath="${templatePath}"
- outputFile="report.${project}.om.generation"
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.om}"
+ outputDirectory="${torque.java.dir}"
+ outputFile="report.${torque.project}.om.generation"
+ targetDatabase="${torque.database}"
targetPackage="${targetPackage}"
- targetDatabase="${database}">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ templatePath="${torque.templatePath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
@@ -445,24 +490,14 @@
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="${outputDirectory}/java"/>
- <property name="build.dest" value="bin/classes"/>
- <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}">
+ <mkdir dir="${torque.compile.build.dir}"/>
+
+ <javac
+ debug="${torque.compile.debug}"
+ deprecation="${torque.compile.deprecation}"
+ destdir="${torque.compile.build.dir}"
+ optimize="${torque.compile.optimize}"
+ srcdir="${torque.compile.src.dir}">
<classpath refid="torque-classpath"/>
</javac>
</target>
@@ -482,8 +517,8 @@
description="==> creates an xml schema from an sql schema">
<torque-sql-transform
- inputFile="schema/schema.sql"
- outputFile="schema/schema.xml"
+ inputFile="${torque.schema.dir}/schema.sql"
+ outputFile="${torque.schema.dir}/schema.xml"
/>
</target>
@@ -495,25 +530,23 @@
name="javadocs"
description="==> generates the API documentation">
- <mkdir dir="${torque.home}/${outputDirectory}/javadoc"/>
+ <mkdir dir="${torque.javadoc.dir}"/>
<javadoc
- sourcepath="${torque.home}/${outputDirectory}/java"
- packagenames="${targetPackage}.*"
- destdir="${outputDirectory}/javadoc"
author="true"
+ destdir="${torque.javadoc.dir}"
+ packagenames="${targetPackage}.*"
private="true"
- version="true"
- use="true">
+ sourcepath="${torque.java.dir}"
+ use="true"
+ version="true">
<classpath refid="torque-classpath"/>
</javadoc>
</target>
<!-- =================================================================== -->
- <!-- =================================================================== -->
<!-- O J B S T U F F -->
<!-- =================================================================== -->
- <!-- =================================================================== -->
<target
name="ojb-repository">
@@ -525,16 +558,16 @@
<echo message="+------------------------------------------+"/>
<torque-data-model
- contextProperties="${build.properties}"
- controlTemplate="ojb/repository/Control.vm"
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.ojb}"
+ targetDatabase="${torque.database}"
targetPackage="${targetPackage}"
- targetDatabase="${database}"
- outputDirectory="${torque.home}/${outputDirectory}/ojb"
- useClasspath="${useClasspath}"
- templatePath="${templatePath}"
- sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
- outputFile="report.${project}.ojb.generation">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ outputDirectory="${torque.ojb.dir}"
+ outputFile="report.${torque.project}.ojb.generation"
+ sqldbmap="${torque.sql.dir}/sqldb.map"
+ templatePath="${torque.templatePath}"
+ useClasspath="${torque.useClasspath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
</fileset>
</torque-data-model>
@@ -550,16 +583,16 @@
<echo message="+------------------------------------------+"/>
<torque-data-model
- contextProperties="${build.properties}"
- controlTemplate="ojb/model/Control.vm"
+ contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.ojbModel}"
+ targetDatabase="${torque.database}"
targetPackage="${targetPackage}"
- targetDatabase="${database}"
- outputDirectory="${torque.home}/${outputDirectory}/ojb"
- useClasspath="${useClasspath}"
- templatePath="${templatePath}"
- sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
- outputFile="report.${project}.ojb.generation">
- <fileset dir="${torque.home}/${schemaDirectory}">
+ outputDirectory="${torque.ojb.dir}"
+ outputFile="report.${torque.project}.ojb.generation"
+ sqldbmap="${torque.sql.dir}/sqldb.map"
+ templatePath="${torque.templatePath}"
+ useClasspath="${torque.useClasspath}">
+ <fileset dir="${torque.schema.dir}">
<include name="*-schema.xml"/>
</fileset>
</torque-data-model>
Index: default.properties
===================================================================
RCS file: default.properties
diff -N default.properties
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ default.properties 15 Jul 2002 06:56:31 -0000
@@ -0,0 +1,173 @@
+#
+# This file maps old properties (and their defaults) to the
+# new properties to maintain backwards compatibility.
+#
+# Note: lib.dir/torque.lib.dir and build.properties/
+# torque.contextProperties are handled manually in
+# the build-torque.xml
+#
+# Old properties that are commented out are just
+# place holders and could be removed other than they
+# help me know what I have and haven't changed.
+
+
+#######################################
+#
+# B A S I C P R O P E R T I E S
+#
+#######################################
+
+torque.home = .
+
+# project = bookstore
+# database = postgresql
+idTableXMLFile =
+documentationFormat = html
+initialID = 101
+
+torque.project = ${project}
+torque.database = ${database}
+torque.idTableXMLFile = ${idTableXMLFile}
+torque.doc.format = ${documentationFormat}
+torque.initialID = ${initialID}
+
+#######################################
+#
+# D I R E C T O R I E S
+#
+#######################################
+
+outputDirectory = src
+schemaDirectory = schema
+
+torque.output.dir = ${torque.home}/${outputDirectory}
+torque.schema.dir = ${torque.home}/${schemaDirectory}
+
+torque.doc.dir = ${torque.output.dir}/doc
+torque.java.dir = ${torque.output.dir}/java
+torque.javadoc.dir = ${torque.output.dir}/javadoc
+torque.ojb.dir = ${torque.output.dir}/ojb
+torque.sql.dir = ${torque.output.dir}/sql
+
+
+#######################################
+#
+# P A T H S
+#
+#######################################
+
+templatePath = templates
+useClasspath = false
+
+torque.templatePath = ${templatePath}
+torque.useClasspath = ${useClasspath}
+
+
+#######################################
+#
+# D A T A B A S E S E T T I N G S
+#
+#######################################
+
+# createDatabaseUrl = jdbc:postgresql://127.0.0.1:5432/template1
+# buildDatabaseUrl = jdbc:postgresql://127.0.0.1:5432/bookstore
+# databaseUrl = jdbc:postgresql://127.0.0.1:5432/bookstore
+# databaseDriver = org.postgresql.Driver
+# databaseUser = jvanzyl
+# databasePassword =
+# databaseHost = 127.0.0.1
+
+torque.database.createUrl = ${createDatabaseUrl}
+torque.database.url = ${databaseUrl}
+torque.database.driver = ${databaseDriver}
+torque.database.user = ${databaseUser}
+torque.database.password = ${databasePassword}
+torque.database.host = ${databaseHost}
+
+
+#######################################
+#
+# C O N T R O L T E M P L A T E S
+#
+#######################################
+
+SQLControlTemplate = sql/base/Control.vm
+OMControlTemplate = om/Control.vm
+idTableControlTemplate = sql/id-table/Control.vm
+DataDTDControlTemplate = data/Control.vm
+DataDumpControlTemplate = data/dump/Control.vm
+DataSQLControlTemplate = sql/load/Control.vm
+DocControlTemplate = doc/Control.vm
+
+torque.template.sql = ${SQLControlTemplate}
+torque.template.om = ${OMControlTemplate}
+torque.template.idTable = ${idTableControlTemplate}
+torque.template.dataDtd = ${DataDTDControlTemplate}
+torque.template.dataDump = ${DataDumpControlTemplate}
+torque.template.dataSql = ${DataSQLControlTemplate}
+torque.template.doc = ${DocControlTemplate}
+torque.template.sqlDbInit = sql/db-init/Control.vm
+torque.template.ojb = ojb/repository/Control.vm
+torque.template.ojbModel = ojb/model/Control.vm
+
+
+#######################################
+#
+# C O M P I L E S E T T I N G S
+#
+#######################################
+
+src.dir = ${torque.java.dir}
+build.dest = bin/classes
+debug = on
+deprecation = off
+optimize = off
+
+torque.compile.src.dir = ${src.dir}
+torque.compile.build.dir = ${build.dest}
+torque.compile.debug = ${debug}
+torque.compile.deprecation = ${deprecation}
+torque.compile.optimize = ${optimize}
+
+
+#######################################
+#
+# T E M P L A T E V A R I A B L E S
+#
+# Eventually, I'd like to see any variables that are used by
+# the templates specifically designated as so via a naming
+# convention such as torque.context.xxx.
+#
+# Then when Texen loads the contextProperites, it can
+# screen from torque.context.xxx and forget all the other
+# junk.
+#
+#######################################
+
+addGetByNameMethod = true
+addIntakeRetrievable = false
+addSaveMethod = true
+addTimeStamp = true
+basePrefix = Base
+complexObjectModel = true
+overloadKeySetters = true
+useManagers = false
+useClasspath = false
+targetPackage = org.apache.torque
+
+# torque.context.addGetByNameMethod = ${addGetByNameMethod}
+# torque.context.addIntakeRetrievable = ${addIntakeRetrievable}
+# torque.context.addSaveMethod = ${addSaveMethod}
+# torque.context.addTimeStamp = ${addTimeStamp}
+# torque.context.basePrefix = ${basePrefix}
+# torque.context.complexObjectModel = ${complexObjectModel}
+# torque.context.overloadKeySetters = ${overloadKeySetters}
+# torque.context.useManagers = ${useManagers}
+# torque.context.useClasspath = ${useClasspath}
+# torque.context.targetPackage = ${targetPackage}
+
+#### Left ####
+# database.manual.creation
+# databaseSchema
+# dababaseName
+# buildDatabaseUrl
\ No newline at end of file
Index: build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/build.xml,v
retrieving revision 1.53
diff -u -r1.53 build.xml
--- build.xml 25 Jun 2002 01:59:17 -0000 1.53
+++ build.xml 15 Jul 2002 06:57:38 -0000
@@ -33,6 +33,13 @@
target="test-classpath"/>
</target>
+ <!-- Include the default.properties in the classes dir. -->
+ <property name="maven.core.callback.post-compile.buildFile" value="build.xml"/>
+ <property name="maven.core.callback.post-compile.buildTarget" value="post-compile"/>
+ <target name="post-compile">
+ <copy file="src/conf/default.properties"
+todir="target/classes/org/apache/torque"/>
+ </target>
+
<!-- maven:start -->
<!-- ================================================================== -->
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>