-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild-torque.xml
875 lines (764 loc) · 35.8 KB
/
build-torque.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
<project name="Torque" default="main" basedir=".">
<!--
#/* Copyright 2002-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<!--
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).
-->
<!--
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 name="torque.contextProperties" value="${build.properties}"/>
<property file="${torque.contextProperties}"/>
<property name="lib.dir" value="lib"/>
<property name="torque.lib.dir" value="${lib.dir}"/>
<property name="torque.jar" value="torque-gen-3.1.1.jar"/>
<!--
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="${torque.lib.dir}">
<include name="**/commons-collections-3.1.jar"/>
<include name="**/commons-lang-1.0.1.jar"/>
<include name="**/log4j-1.2.8.jar"/>
<include name="**/${torque.jar}"/>
<include name="**/velocity-1.3.1.jar"/>
<include name="**/village-2.0-dev-20030825.jar"/>
<include name="**/xercesImpl-2.0.2.jar"/>
<include name="**/xmlParserAPIs-2.0.2.jar"/>
<include name="**/*.jar"/>
</fileset>
</path>
<!--
The default.properties file will map old properties to the new ones along
with setting the correct defaults.
-->
<property resource="org/apache/torque/default.properties">
<classpath>
<path refid="torque-classpath"/>
</classpath>
</property>
<!--
Do forward declarations of all of our tasks to
centralize them and clean up the targets.
-->
<taskdef
name="torque-data-model"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueDataModelTask"/>
<taskdef
name="torque-data-dump"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueDataDumpTask"/>
<taskdef
name="torque-data-sql"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueDataSQLTask"/>
<taskdef
name="torque-doc"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueDocumentationTask"/>
<taskdef
name="torque-jdbc-transform"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueJDBCTransformTask"/>
<taskdef
name="torque-package-to-path"
classpathref="torque-classpath"
classname="org.apache.torque.task.PackageAsPathTask"/>
<taskdef
name="torque-sql"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueSQLTask"/>
<taskdef
name="torque-sql-exec"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueSQLExec"/>
<taskdef
name="torque-sql-transform"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueSQLTransformTask"/>
<!-- ================================================================ -->
<!-- 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="sql"/>
<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>
<!-- ================================================================ -->
<!-- C H E C K R U N O N L Y O N S C H E M A C H A N G E -->
<!-- ================================================================ -->
<!-- Maps the torque.runOnlyOnSchemaChange to -->
<!-- torque.internal.runOnlyOnSchemaChange -->
<!-- ================================================================ -->
<target name="check-run-only-on-schema-change">
<condition property="torque.internal.runOnlyOnSchemaChange">
<equals arg1="${torque.runOnlyOnSchemaChange}" 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 -->
<!-- to the base Torque tables! The tables you require for your -->
<!-- project should be specified in project-schema.xml. -->
<!-- ================================================================ -->
<target
name="sql-check"
depends="check-run-only-on-schema-change"
if="torque.internal.runOnlyOnSchemaChange">
<uptodate
property="torque.internal.sql.uptodate"
targetfile="${torque.sql.dir}/${torque.project}-schema.sql">
<srcfiles dir="${torque.schema.dir}" includes="**/*-schema.xml" />
</uptodate>
</target>
<target
name="sql"
depends="check-use-classpath, sql-check"
unless="torque.internal.sql.uptodate"
description="==> generates the SQL for your project">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL for YOUR Torque project! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<antcall target="sql-classpath"/>
<antcall target="sql-template"/>
</target>
<target name="sql-classpath" if="torque.internal.useClasspath">
<echo message="loading templates from classpath"/>
<torque-sql
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}"
includes="${torque.schema.sql.includes}"
excludes="${torque.schema.sql.excludes}"
/>
</torque-sql>
</target>
<target name="sql-template" unless="torque.internal.useClasspath">
<echo message="loading templates from ${torque.templatePath}"/>
<torque-sql
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}"
includes="${torque.schema.sql.includes}"
excludes="${torque.schema.sql.excludes}"
/>
</torque-sql>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E D O C S -->
<!-- ================================================================ -->
<!-- Generates documentation to -->
<!-- ${torque.doc.dir}/project-schema.html -->
<!-- ================================================================ -->
<target
name="doc"
description="==> generates documentation for your datamodel">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating docs for YOUR datamodel! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-doc
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}"
includes="${torque.schema.doc.includes}"
excludes="${torque.schema.doc.excludes}"
/>
</torque-doc>
</target>
<!-- ================================================================ -->
<!-- S H U T D O W N C H E C K -->
<!-- ================================================================ -->
<!-- Hack to check if we need to shutdown the DB after we're done -->
<!-- using it. At the moment, the only DB which this must be done for -->
<!-- is HSQLDB when running in the "In-Process" mode. -->
<!-- As this mode can be specified without a keyword, we just check -->
<!-- that the JDBC URL (specified in the dbUrlToCheck property) is -->
<!-- an HSQLDB URL, but not one of the other modes. -->
<!-- ================================================================ -->
<target name="shutdown-check">
<condition property="torque.internal.shutdownAfterSql">
<and>
<contains string="${dbUrlToCheck}" substring="jdbc:hsqldb" />
<not>
<or>
<contains string="${dbUrlToCheck}"
substring="jdbc:hsqldb:hsql://" />
<contains string="${dbUrlToCheck}"
substring="jdbc:hsqldb:hsqls://" />
<contains string="${dbUrlToCheck}"
substring="jdbc:hsqldb:http://" />
<contains string="${dbUrlToCheck}"
substring="jdbc:hsqldb:https://" />
</or>
</not>
</and>
</condition>
</target>
<!-- ================================================================ -->
<!-- A P P E N D S H U T D O W N S Q L -->
<!-- ================================================================ -->
<!-- Appends a SHUTDOWN statement to the file specified in the -->
<!-- shutdownAppendFile property after first checking that it's -->
<!-- necessary using the shutdown-check task. -->
<!-- ================================================================ -->
<target name="append-shutdown-sql"
depends="shutdown-check"
if="torque.internal.shutdownAfterSql">
<echo file="${shutdownAppendFile}" append="true">;
SHUTDOWN;
</echo>
</target>
<!-- ================================================================ -->
<!-- A D D S H U T D O W N S Q L F I L E -->
<!-- ================================================================ -->
<!-- Adds a shutdown.sql file to the sql dir with a SHUTDOWN -->
<!-- statement in it and also adds this file to sqldb.map after first -->
<!-- checking that it's necessary using the shutdown-check task. -->
<!-- ================================================================ -->
<target name="add-shutdown-sql-file"
depends="shutdown-check"
if="torque.internal.shutdownAfterSql">
<echo file="${torque.sql.dir}/shutdown.sql"
message="SHUTDOWN;" />
<echo file="${torque.sql.dir}/sqldb.map" append="true"
message="shutdown.sql=${torque.project}" />
</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="create-db-check">
<condition property="torque.internal.manualCreation">
<equals arg1="${torque.database.manualCreation}" arg2="true"/>
</condition>
</target>
<target
name="create-db"
unless="torque.internal.manualCreation"
depends="create-db-check"
description="==> generates the target database">
<torque-data-model
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}"
includes="${torque.schema.create-db.includes}"
excludes="${torque.schema.create-db.excludes}"
/>
</torque-data-model>
<!-- Append the SHUTDOWN statement if need be -->
<antcall target="append-shutdown-sql">
<param name="dbUrlToCheck"
value="${torque.database.createUrl}" />
<param name="shutdownAppendFile"
value="${torque.sql.dir}/create-db.sql" />
</antcall>
<echo>
Executing the create-db.sql script ...
</echo>
<sql
autocommit="true"
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>
<!-- ================================================================ -->
<!-- I N S E R T S I N G L E S Q L F I L E S -->
<!-- ================================================================ -->
<target
name="insert-sql"
description="==> inserts the generated sql ">
<!-- Add the shutdown.sql file if need be -->
<antcall target="add-shutdown-sql-file">
<param name="dbUrlToCheck"
value="${torque.database.buildUrl}" />
</antcall>
<torque-sql-exec
autocommit="true"
driver="${torque.database.driver}"
onerror="continue"
password="${torque.database.password}"
sqldbmap="${torque.sql.dir}/sqldb.map"
srcDir="${torque.sql.dir}"
url="${torque.database.buildUrl}"
userid="${torque.database.user}"
delimiter="${torque.delimiter}">
<classpath refid="torque-classpath"/>
</torque-sql-exec>
</target>
<!-- ================================================================ -->
<!-- J D B C TO X M L -->
<!-- ================================================================ -->
<target
name="jdbc"
description="==> jdbc to xml">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating XML from JDBC connection ! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<torque-jdbc-transform
dbDriver="${torque.database.driver}"
dbPassword="${torque.database.password}"
dbSchema="${torque.database.schema}"
dbUrl="${torque.database.url}"
dbUser="${torque.database.user}"
outputFile="${torque.schema.dir}/schema.xml"
sameJavaName="${torque.sameJavaName}"
/>
</target>
<!-- ================================================================ -->
<!-- Generate SQL from XML data file -->
<!-- ================================================================ -->
<target
name="datasql"
description="==> generates sql from data xml">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL from data XML ! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<torque-data-sql
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>
<!-- ================================================================ -->
<!-- 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"
description="==> generates initialization sql for ID Broker">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating initialization SQL |"/>
<echo message="| for ID Broker system! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-sql
contextProperties="${torque.contextProperties}"
controlTemplate="${torque.template.idTable}"
outputDirectory="${torque.sql.dir}"
outputFile="report.idtable-init.sql.generation"
sqldbmap="${torque.sql.dir}/sqldb.map"
suffix="-idtable-init"
targetDatabase="${torque.database}"
templatePath="${torque.templatePath}"
useClasspath="${torque.useClasspath}">
<fileset dir="${torque.schema.dir}"
includes="${torque.schema.init-sql.includes}"
excludes="${torque.schema.init-sql.excludes}"
/>
</torque-sql>
</target>
<!-- ================================================================ -->
<!-- Dump data from database into xml file -->
<!-- ================================================================ -->
<target
name="datadump"
description="==> dump data from database into xml file">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Dumping the data from database into XML |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<torque-data-dump
contextProperties="${torque.contextProperties}"
controlTemplate="${torque.template.dataDump}"
databaseDriver="${torque.database.driver}"
databaseName="${torque.database.name}"
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>
<!-- ================================================================ -->
<!-- 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="datadtd"
description="==> generates the DATA DTD for your project">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Data DTD for YOUR Torque project! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<torque-data-model
contextProperties="${torque.contextProperties}"
controlTemplate="${torque.template.dataDtd}"
outputDirectory="${torque.schema.dir}"
outputFile="report.${torque.project}.datadtd.generation"
templatePath="${torque.templatePath}"
useClasspath="${torque.useClasspath}"
xmlFile="${torque.schema.dir}/${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 Torque OM! -->
<!-- ================================================================ -->
<target
name="om-check"
depends="check-run-only-on-schema-change"
if="torque.internal.runOnlyOnSchemaChange">
<uptodate
property="torque.internal.om.uptodate"
targetfile="${torque.java.dir}/report.${torque.project}.om.generation">
<srcfiles dir="${torque.schema.dir}" includes="**/*-schema.xml" />
</uptodate>
</target>
<target
name="om"
depends="check-use-classpath, om-check"
unless="torque.internal.om.uptodate"
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 Torque project! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<antcall target="om-classpath"/>
<antcall target="om-template"/>
<!-- antcall target="zip-base-om"/ -->
</target>
<target name="om-classpath" if="torque.internal.useClasspath">
<torque-data-model
contextProperties="${torque.contextProperties}"
controlTemplate="${torque.template.om}"
outputDirectory="${torque.java.dir}"
outputFile="report.${torque.project}.om.generation"
targetDatabase="${torque.database}"
targetPackage="${torque.targetPackage}"
useClasspath="${torque.useClasspath}">
<fileset dir="${torque.schema.dir}"
includes="${torque.schema.om.includes}"
excludes="${torque.schema.om.excludes}"
/>
</torque-data-model>
</target>
<target name="om-template" unless="torque.internal.useClasspath">
<torque-data-model
contextProperties="${torque.contextProperties}"
controlTemplate="${torque.template.om}"
outputDirectory="${torque.java.dir}"
outputFile="report.${torque.project}.om.generation"
targetDatabase="${torque.database}"
targetPackage="${torque.targetPackage}"
templatePath="${torque.templatePath}">
<fileset dir="${torque.schema.dir}"
includes="${torque.schema.om.includes}"
excludes="${torque.schema.om.excludes}"
/>
</torque-data-model>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E O M Z I P F I L E -->
<!-- ================================================================ -->
<!-- Moves the files out of your source tree and into a zip file. -->
<!-- ================================================================ -->
<target name="check-om-zip">
<condition property="torque.internal.omzip.src.base">
<equals arg1="${torque.omzip.src.base}" arg2="true"/>
</condition>
<condition property="torque.internal.omzip.src.extension">
<equals arg1="${torque.omzip.src.extension}" arg2="true"/>
</condition>
<condition property="torque.internal.omzip.bin.base">
<equals arg1="${torque.omzip.bin.base}" arg2="true"/>
</condition>
<condition property="torque.internal.omzip.bin.extension">
<equals arg1="${torque.omzip.bin.extension}" arg2="true"/>
</condition>
<condition property="torque.internal.omzip.deleteFiles">
<equals arg1="${torque.omzip.deleteFiles}" arg2="true"/>
</condition>
</target>
<target
name="om-zip"
depends="check-om-zip"
description="==> moves source om files to separate jar and out of the source tree">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Zipping the Object Model files for YOUR |"/>
<echo message="| Torque project! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<!-- Perform the package to path converison. -->
<torque-package-to-path
name="torque.internal.omzip.packagePath"
package="${torque.targetPackage}"
/>
<!-- See if the source files need jar'ed. -->
<antcall target="om-zip-worker">
<param name="torque.internal.omzip.type" value="src"/>
<param name="torque.internal.omzip.pattern" value="base"/>
<param name="torque.internal.omzip.files" value="java"/>
<param name="torque.internal.omzip.dir" value="${torque.java.dir}"/>
</antcall>
<antcall target="om-zip-worker">
<param name="torque.internal.omzip.type" value="src"/>
<param name="torque.internal.omzip.pattern" value="extension"/>
<param name="torque.internal.omzip.files" value="java"/>
<param name="torque.internal.omzip.dir" value="${torque.java.dir}"/>
</antcall>
<!-- See if the class files need jar'ed. -->
<antcall target="om-zip-worker">
<param name="torque.internal.omzip.type" value="bin"/>
<param name="torque.internal.omzip.pattern" value="base"/>
<param name="torque.internal.omzip.files" value="class"/>
<param name="torque.internal.omzip.dir" value="${torque.compile.build.dir}"/>
</antcall>
<antcall target="om-zip-worker">
<param name="torque.internal.omzip.type" value="bin"/>
<param name="torque.internal.omzip.pattern" value="extension"/>
<param name="torque.internal.omzip.files" value="class"/>
<param name="torque.internal.omzip.dir" value="${torque.compile.build.dir}"/>
</antcall>
</target>
<target
name="om-zip-worker"
if="torque.internal.omzip.${torque.internal.omzip.type}.${torque.internal.omzip.pattern}">
<!-- Base files that typically aren't modified. -->
<patternset id="torque.internal.omzip.pattern.base">
<include name="${torque.internal.omzip.packagePath}/${torque.basePrefix}*.${torque.internal.omzip.files}"/>
<include name="${torque.internal.omzip.packagePath}/map/*MapBuilder.${torque.internal.omzip.files}"/>
</patternset>
<!-- Extension files that typically are modified. -->
<patternset id="torque.internal.omzip.pattern.extension">
<include name="${torque.internal.omzip.packagePath}/*.${torque.internal.omzip.files}"/>
</patternset>
<jar
jarfile="${torque.omzip.dir}/${torque.project}-om-${torque.internal.omzip.type}.jar"
update="true">
<fileset dir="${torque.internal.omzip.dir}">
<patternset refid="torque.internal.omzip.pattern.${torque.internal.omzip.pattern}"/>
</fileset>
</jar>
<antcall target="om-zip-worker-delete"/>
</target>
<target
name="om-zip-worker-delete"
if="torque.internal.omzip.deleteFiles">
<!-- Base files that typically aren't modified. -->
<patternset id="torque.internal.omzip.pattern.base">
<include name="${torque.internal.omzip.packagePath}/${torque.basePrefix}*.*"/>
<include name="${torque.internal.omzip.packagePath}/map/*MapBuilder.*"/>
</patternset>
<!-- Extension files that typically are modified. -->
<patternset id="torque.internal.omzip.pattern.extension">
<include name="${torque.internal.omzip.packagePath}/*.*"/>
</patternset>
<delete>
<fileset dir="${torque.internal.omzip.dir}">
<patternset refid="torque.internal.omzip.pattern.${torque.internal.omzip.pattern}"/>
</fileset>
</delete>
</target>
<!-- =================================================================== -->
<!-- C O M P I L E O M -->
<!-- =================================================================== -->
<target
name="compile"
description="==> compiles the OM classes">
<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>
<!-- =================================================================== -->
<!-- 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="sql2xml"
description="==> creates an xml schema from an sql schema">
<torque-sql-transform
inputFile="${torque.schema.dir}/schema.sql"
outputFile="${torque.schema.dir}/schema.xml"
/>
</target>
<!-- ================================================================== -->
<!-- J A V A D O C -->
<!-- ================================================================== -->
<target
name="javadocs"
description="==> generates the API documentation">
<mkdir dir="${torque.javadoc.dir}"/>
<javadoc
author="true"
destdir="${torque.javadoc.dir}"
packagenames="${torque.targetPackage}.*"
private="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"
description="==> generates the repository and om for ojb (experimental)">
<antcall target="ojb-repository"/>
<antcall target="ojb-model"/>
</target>
<target
name="ojb-repository"
description="==> generates the repository for ojb (experimental)">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating OJB repository |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-data-model
contextProperties="${torque.contextProperties}"
controlTemplate="${torque.template.ojb}"
targetDatabase="${torque.database}"
targetPackage="${torque.targetPackage}"
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}"
includes="${torque.schema.ojb.includes}"
excludes="${torque.schema.ojb.excludes}"
/>
</torque-data-model>
</target>
<target
name="ojb-model"
description="==> generates an object model for ojb (experimental)">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating OJB model |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-data-model
contextProperties="${torque.contextProperties}"
controlTemplate="${torque.template.ojbModel}"
targetDatabase="${torque.database}"
targetPackage="${torque.targetPackage}"
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}"
includes="${torque.schema.ojb.includes}"
excludes="${torque.schema.ojb.excludes}"
/>
</torque-data-model>
</target>
</project>