-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
945 lines (698 loc) · 34.4 KB
/
build.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
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project [
<!ENTITY buildJava SYSTEM "./build_java.xml">
<!ENTITY buildDB SYSTEM "./build_db.xml">
]>
<project name="VO-URP-builder - GitHub" default="about" basedir=".">
<description>
This build file can be considered as the transformer tool for any Data Model in XMI format to other documents :
- XML schemas (xsd)
- documentation (html)
- java formatted code (JPA / JAXB compliant) + javadoc
- DDL script (microsoft sql server / postgresql databases / oracle soon ?)
- TAP VOTABLEs
Authors : [email protected], [email protected]
This Version : 01 october 2011
</description>
<!-- set global properties for this build -->
<property name="vo-urp.title" value="VO-URP"/>
<property name="vo-urp.vendor" value="Gerard Lemson, Laurent Bourges"/>
<property name="vo-urp.version" value="0.x"/>
<tstamp>
<format property="build.date.extension" pattern="yyyyMMddHHmmss" />
</tstamp>
<!--
Get build properties (general).
Should only contain the location of the directory where input properties and data model can be found.
-->
<property file="build.properties"/>
<fail unless="input" message="Must define property 'input' in build.properties (indicating project directory) !"/>
<echo>input = ${input}</echo>
<property file="${input}/project.properties" />
<!-- do not change -->
<property name="xmi2intermediate" value="xmi2intermediate.xsl"/>
<property name="model_package" value="org.ivoa.dm.model"/>
<property name="build.src.file" value="vo-urp-src.jar"/>
<!-- read pipeline configuration properties -->
<fail unless="project.name" message="Must define property 'project.name' in ${props.file} (name of this project) !" />
<fail unless="project.version" message="Must define property 'project.version' in ${input}/project.properties !" />
<fail unless="source" message="Must define property 'source' in ${input}/project.properties (the source data model file as xmi 2.x) !" />
<fail unless="xmi2intermediate" message="Must define property 'xmi2intermediate' in ${input}/project.properties (the basic xmi2intermediate xsl file) !"/>
<fail unless="root_package" message="Must define property 'root_package' in ${input}/project.properties (the root package) !" />
<fail unless="targetnamespace_root" message="Must define property 'targetnamespace_root' in ${input}/project.properties (the target namespace root) !" />
<fail unless="schemalocation_root" message="Must define property 'schemalocation_root' in ${input}/project.properties (the schema location root) !" />
<!-- convert target switches to ant conditionnal properties -->
<fail unless="target.db.active" message="Must define property 'target.db.active' in ${input}/project.properties (true if db targets should run) !" />
<fail unless="target.run.active" message="Must define property 'target.run.active' in ${input}/project.properties (true if run target should run) !" />
<fail unless="target.weaving.active" message="Must define property 'target.weaving.active' in ${input}/project.properties (true if weaving target should run) !" />
<condition property="has.test">
<isset property="sources.test"/>
</condition>
<condition property="target.db.do">
<equals arg1="${target.db.active}" arg2="true" trim="true" />
</condition>
<condition property="target.db.backup.do">
<equals arg1="${target.db.backup.active}" arg2="true" trim="true" />
</condition>
<condition property="target.run.do">
<and>
<equals arg1="${target.run.active}" arg2="true" trim="true" />
<isset property="sources.test"/>
</and>
</condition>
<condition property="target.weaving.do">
<equals arg1="${target.weaving.active}" arg2="true" trim="true" />
</condition>
<!-- output files -->
<property name="source_checked" value="${project.name}_CHECK.xml" />
<property name="source_filtered" value="${project.name}_FILTER.xml" />
<!--
<property name="source_intermediate" value="${project.name}_INTERMEDIATE.xml" />
-->
<property name="source_intermediate" value="${project.name}.vo-urp.xml" />
<!-- vo-urp paths -->
<property name="root" location="." />
<property name="res" location="./res" />
<property name="templates" location="./templates" />
<property name="libs" location="./libs" />
<property name="sources" location="./src" />
<property name="classes" location="./classes" />
<!-- define and instantiate output directories -->
<property name="output" location="${input}/output"/>
<property name="build" location="${input}/build"/>
<property name="dist" location="${input}/dist"/>
<property name="properties" location="${input}/properties"/>
<property name="dist.lib" location="${dist}/lib" />
<property name="javadoc" location="${dist}/doc" />
<property name="outputHTML" location="${output}/html"/>
<property name="outputJava" location="${output}/java"/>
<property name="sources.gen" location="${outputJava}" />
<property name="output.xsd" location="${output}/schema" />
<property name="build" location="./build" />
<property name="build.src" location="${build}/src" />
<property name="build.gen" location="${build}/gen" />
<property name="build.weaving" location="${build}/weaving" />
<property name="build.test" location="${build}/test" />
<property name="build.xsd" location="${build}/xsd" />
<property name="test" location="${input}/${sources.test}"/>
<!-- preamble file, may be set in project.properties -->
<property name="html.preamble.file" value="output/html/preamble.html"/>
<property name="html.preamble" location="${input}/${html.preamble.file}"/>
<property name="webapp.member.role" value="${project.name}-member"/>
<property name="webapp.admin.role" value="${project.name}-admin"/>
<!-- graphviz properties -->
<available property="graphviz.check" file="${graphviz.path}" />
<property name="graphviz.png" value="${project.name}.png"/>
<property name="graphviz.map" value="${project.name}.cmap"/>
<!-- <property name="graphviz.map" value="${project.name}.cmap"/> -->
<property name="graphviz.map.placeholder" value="___GRAPHVIZ_MAP___"/>
<!-- JDBC drivers -->
<fileset id="jdbcfiles" dir="${libs}/jdbc">
<!-- postgres 8.x driver -->
<include name="postgresql-8.3-603.jdbc3.jar"/>
<!-- sql server 2005 driver -->
<include name="sqljdbc-2005-1.2.jar"/>
</fileset>
<!-- class path for JDBC drivers -->
<path id="jdbc-drivers.class.path">
<fileset refid="jdbcfiles"/>
</path>
<!-- adds README.txt to default excludes -->
<defaultexcludes echo="false" add="**/README.txt" />
<!-- presets -->
<!-- Performs an XSL translation of an XML file using the Saxon processor. -->
<presetdef name="xslt2">
<!-- The processor=SaxonLiaison setting causes our custom XSLTLiaison class to be used. -->
<!-- This works around bug #41314: http://issues.apache.org/bugzilla/show_bug.cgi?id=41314 -->
<xslt force="true" classpath="${libs}/saxon9.jar:${libs}/anthack/libs/ant-trax.jar:${libs}/anthack/" processor="SaxonLiaison">
<outputproperty name="{http://saxon.sf.net/}indent-spaces" value="2" />
</xslt>
</presetdef>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!-- targets -->
<!-- target init : timestamp -->
<target name="init">
<!-- define and instantiate output directories -->
<mkdir dir="${output}"/>
<mkdir dir="${build}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${properties}"/>
<mkdir dir="${dist.lib}"/>
<mkdir dir="${javadoc}"/>
<mkdir dir="${outputJava}"/>
<mkdir dir="${build}"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${build.gen}"/>
<mkdir dir="${build.weaving}"/>
<mkdir dir="${libs}/jalopy/bin"/>
<tstamp>
<format property="build.date" pattern="dd/MM/yyyy HH:mm:ss" />
</tstamp>
<echo>-------------------------------------------------------------------------------</echo>
<echo> ${project.vendor} </echo>
<echo> ${project.title} - ${project.version} </echo>
<echo>-------------------------------------------------------------------------------</echo>
<echo> Build File </echo>
<echo>-------------------------------------------------------------------------------</echo>
<echo> Contacts : ${project.authors} </echo>
<echo> Build date : ${build.date} </echo>
<echo>-------------------------------------------------------------------------------</echo>
<echo> project name : ${project.name} </echo>
<echo> source : ${source} </echo>
<echo> root package : ${root_package} </echo>
<echo> model package : ${model_package} </echo>
<echo> schema location : ${schemalocation_root} </echo>
<echo> target namespace : ${targetnamespace_root} </echo>
<echo>-------------------------------------------------------------------------------</echo>
<echo> target.run.active : ${target.run.active} </echo>
<echo>-------------------------------------------------------------------------------</echo>
<!-- up to date checks -->
<!-- checks if input & xslt are modified compare to intermediate document -->
<uptodate property="intermediate.notRequired">
<srcfiles dir="${input}" includes="${source}" />
<srcfiles dir="${res}" includes="xmiCheck.xsl" />
<srcfiles dir="${res}" includes="xmiFilter.xsl" />
<srcfiles dir="${res}" includes="${xmi2intermediate}" />
<mapper type="merge" to="${output}/${source_intermediate}" />
</uptodate>
<!-- checks if intermediate & xslt documents are modified compare to xsd-gen.log -->
<uptodate property="xsd.notRequired">
<srcfiles dir="${output}" includes="${source_intermediate}" />
<srcfiles dir="${res}" includes="intermediate2xsd.xsl" />
<srcfiles dir="${res}" includes="common.xsl" />
<srcfiles dir="${res}" includes="common-xsd.xsl" />
<mapper type="merge" to="${output}/schema/xsd-gen.log" />
</uptodate>
<!-- checks if intermediate & xslt documents are modified compare to ddl-gen.log -->
<uptodate property="ddl.notRequired">
<srcfiles dir="${output}" includes="${source_intermediate}" />
<srcfiles dir="${res}" includes="intermediate2ddl.xsl" />
<srcfiles dir="${res}" includes="common-ddl.xsl" />
<srcfiles dir="${res}" includes="utype.xsl" />
<mapper type="merge" to="${output}/ddl/ddl-gen.log" />
</uptodate>
<!-- checks if intermediate & xslt documents are modified compare to tap-gen.log -->
<uptodate property="tap.notRequired">
<srcfiles dir="${output}" includes="${source_intermediate}" />
<srcfiles dir="${res}" includes="intermediate2tap.xsl" />
<srcfiles dir="${res}" includes="intermediate2ddl.xsl" />
<srcfiles dir="${res}" includes="common-ddl.xsl" />
<srcfiles dir="${res}" includes="utype.xsl" />
<mapper type="merge" to="${output}/tap/tap-gen.log" />
</uptodate>
<!-- checks if intermediate & xslt documents are modified compare to java-gen.log -->
<uptodate property="java.notRequired">
<srcfiles dir="${output}" includes="${source_intermediate}" />
<srcfiles dir="${res}" includes="intermediate2java.xsl" />
<srcfiles dir="${res}" includes="common.xsl" />
<srcfiles dir="${res}" includes="common-ddl.xsl" />
<srcfiles dir="${res}" includes="common-xsd.xsl" />
<srcfiles dir="${res}" includes="jpa.xsl" />
<srcfiles dir="${res}" includes="jaxb.xsl" />
<srcfiles dir="${templates}" includes="persistence-template.xml" />
<!-- check if src/ java code has changed -->
<srcfiles dir="${sources}" includes="**/*" />
<srcfiles dir="${output}" includes="${source_intermediate}" />
<mapper type="merge" to="${sources.gen}/java-gen.log" />
</uptodate>
</target>
<!-- target about : -->
<target name="about" depends="init" description="show information for public targets">
<echo>available ant targets : </echo>
<echo>-------------------------------------------------------------------------------</echo>
<echo> - cleanAll : CLEANS outputs </echo>
<echo> - makeAll : make all transformations (uml -> metaModel -> others) </echo>
<echo> - forceMakeAll : CLEANS outputs and then make all transformations (makeAll) </echo>
<echo>-------------------------------------------------------------------------------</echo>
</target>
<!-- main target : generates all documents -->
<target name="makeAll" depends="init, process" description="make all transformations">
<echo>makeAll : done.</echo>
</target>
<!-- main target : force to generate all documents -->
<target name="forceMakeAll" depends="init, cleanOutput, cleanJava" description="CLEANS outputs and make all transformations (forced)">
<ant target="makeAll" inheritAll="false" />
<echo>forceMakeAll : done.</echo>
</target>
<!-- main target : force to clean all generated products -->
<target name="cleanAll" depends="init, cleanOutput, cleanJava" description="CLEANS outputs">
<echo>cleanAll : done.</echo>
</target>
<!-- target cleanOutput : clean all output files (ddl, java, schema ...) -->
<target name="cleanOutput">
<echo>cleaning directory : ${output} ...</echo>
<!-- do not remove directories to have respect for .svn directories -->
<delete includeemptydirs="false" verbose="true">
<fileset dir="${output}">
<exclude name="java/**/*" />
</fileset>
</delete>
<echo>cleaned directory : ${output} : done.</echo>
</target>
<!-- target cleanOutput : clean java output files -->
<target name="cleanJavaOutput">
<echo>cleaning directory : ${outputJava} ...</echo>
<!-- do not remove directories to have respect for .svn directories -->
<delete includeemptydirs="false" verbose="true">
<fileset dir="${outputJava}" />
</delete>
<echo>cleaned directory : ${outputJava} : done.</echo>
</target>
<!-- create and compile Java code. Useful for quick testing. -->
<target name="runJava">
<property name="source" value="${source}" />
<property name="source_filtered" value="${source_filtered}" />
<ant target="processXMI2Intermediate" inheritAll="false">
<propertyset>
<propertyref prefix="source" />
<propertyref prefix="source_filtered" />
</propertyset>
</ant>
<ant target="processIntermediate2Java" inheritAll="false">
<propertyset>
<propertyref prefix="source" />
<propertyref prefix="source_filtered" />
</propertyset>
</ant>
<!-- build web app -->
<ant target="buildWeb" />
</target>
<!-- target process : xslt pipeline + DB + test cases -->
<target name="process">
<property name="source" value="${source}" />
<property name="source_filtered" value="${source_filtered}" />
<ant target="processXMI2Intermediate" inheritAll="false">
<propertyset>
<propertyref prefix="source" />
<propertyref prefix="source_filtered" />
</propertyset>
</ant>
<ant target="processIntermediate2XSD" inheritAll="false">
<propertyset>
<propertyref prefix="source" />
<propertyref prefix="source_filtered" />
</propertyset>
</ant>
<ant target="processIntermediate2DDL" inheritAll="false">
<propertyset>
<propertyref prefix="source" />
<propertyref prefix="source_filtered" />
</propertyset>
</ant>
<ant target="processIntermediate2TAP" inheritAll="false">
<propertyset>
<propertyref prefix="source" />
<propertyref prefix="source_filtered" />
</propertyset>
</ant>
<ant target="processIntermediate2Java" inheritAll="false">
<propertyset>
<propertyref prefix="source" />
<propertyref prefix="source_filtered" />
</propertyset>
</ant>
<!-- update DB if needed -->
<if>
<equals arg1="${target.db.active}" arg2="true"/>
<then>
<ant target="DB-setup" />
</then>
</if>
<!-- build web app -->
<ant target="buildWeb" />
<!-- run test cases if needed -->
<ant target="run" />
</target>
<target name="DB-setup" depends="DB-retrieveDDLs,DB-initFor" description="Setup database, perform migration if requested">
<!-- copy files from ddl-s to backup, in case there are no files in the DB yet. So at least some
files will be there when drop is called. That may cause problems -->
<if>
<equals arg1="${target.db.backup.active}" arg2="true"/>
<then>
<echo>Perform backup</echo>
<doSqlTarget autocommit="true" onerror="continue" src="${ddl.directory}/backup/backupTables.sql" />
<ant target="DB-clean"/>
<ant target="DB-create"/>
<doSqlTarget autocommit="false" onerror="continue" errorproperty="migrateerror" src="${ddl.directory}/backup/migrateTables.sql" />
<if>
<isset property="migrateerror"/>
<then>
<echo>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</echo>
<echo>Error while migrating: fix migration script and run by hand</echo>
<echo>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</echo>
</then>
<else>
<doSqlTarget autocommit="true" onerror="continue" src="${ddl.directory}/backup/dropBackupTables.sql" />
</else>
</if>
</then>
<else>
<echo>No backup required</echo>
<ant target="DB-clean"/>
<ant target="DB-create"/>
</else>
</if>
</target>
<!-- target buildJava : makes both java libraries and the vo-urp browser web application -->
<target name="buildJava" description="build both java libraries and the web application">
<ant target="makeOutput" />
<ant target="buildWeb" />
</target>
<!-- target buildWeb : makes the vo-urp browser web application -->
<target name="buildWeb" description="build web application only">
<ant antfile="webapp/vo-urp-browser/build.xml" target="deployTomcat" inheritAll="false">
<property name="input" location="${input}"/>
<property name="schemalocation_root" value="${schemalocation_root}"/>
<property name="webapp.member.role" value="${webapp.member.role}"/>
<property name="webapp.admin.role" value="${webapp.admin.role}"/>
<property name="build.date.extension" value="${build.date.extension}"/>
</ant>
</target>
<!-- target processXMI2Intermediate : check the XMI model, filter it and generate the intermediate model -->
<target name="processXMI2Intermediate" unless="intermediate.notRequired">
<ant target="checkSource">
<property name="source_checked" value="${source_checked}" />
</ant>
<ant target="filterSource" />
<ant target="run_xmi2intermediate" />
</target>
<!-- target processIntermediate2XSD : generates XML Schemas, XML samples and HTML documentation -->
<target name="processIntermediate2XSD" unless="xsd.notRequired">
<ant target="run_intermediate2xsd" />
<ant target="run_intermediate2html" />
<!--
<ant target="run_intermediate2xml" />
-->
</target>
<!-- target processIntermediate2DDL : generates DDL scripts -->
<target name="processIntermediate2DDL" unless="ddl.notRequired">
<ant target="run_intermediate2ddl" />
</target>
<!-- target processIntermediate2TAP : generates TAP model -->
<target name="processIntermediate2TAP" unless="tap.notRequired">
<ant target="run_intermediate2tap" />
</target>
<!-- target processIntermediate2Java : clean java outputs, generates java code from intermediate model and compiles java codes -->
<target name="processIntermediate2Java" unless="java.notRequired">
<ant target="cleanJavaOutput" />
<ant target="run_intermediate2java" />
<ant target="makeOutput" />
</target>
<!-- generic targets -->
<!-- target checkSource : check xmi well formed tags in source document -->
<target name="checkSource">
<echo>checkSource : starting checks on file ${input}/${source}</echo>
<xslt2 in="${input}/${source}" out="${output}/${source_checked}" style="${res}/xmiCheck.xsl" />
<echo>checkSource : done.</echo>
</target>
<!-- target filterSource : remove all xmi:Extension tags in source document -->
<target name="filterSource">
<echo>filterSource : starting filter on file ${input}/${source}</echo>
<xslt2 in="${input}/${source}" out="${output}/${source_filtered}" style="${res}/xmiFilter.xsl" />
<echo>filterSource : done.</echo>
</target>
<target name="generateAll">
<property name="source" value="${source}" />
<property name="source_filtered" value="${source_filtered}" />
<ant target="run_xmi2intermediate" inheritAll="true"/>
<ant target="run_intermediate2ddl" inheritAll="true"/>
<ant target="run_intermediate2gvd" inheritAll="true"/>
<ant target="run_intermediate2html" inheritAll="true"/>
<ant target="run_intermediate2java" inheritAll="true"/>
<!-- <ant target="run_intermediate2rdf" inheritAll="true"/> -->
<ant target="run_intermediate2tap" inheritAll="true"/>
<ant target="run_intermediate2xml" inheritAll="true"/>
<ant target="run_intermediate2xsd" inheritAll="true"/>
</target>
<!-- target run_xmi2intermediate : transform the source model (xmi) to the intermediate model -->
<target name="run_xmi2intermediate">
<ant target="xmi2intermediate">
<property name="source" value="${input}/${source}" />
<property name="source_filtered" value="${source_intermediate}" />
</ant>
</target>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
VO-URP generation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<target name="run_vo-urp">
<!-- run all vo-urp targets -->
<property name="source" value="${source}" />
<property name="source_filtered" value="${source_filtered}" />
<ant target="run_xmi2vo-urp" inheritAll="true"/>
<ant target="run_vo-urp2html" inheritAll="true"/>
</target>
<!-- target run_xmi2vo-urp : transform the source model (xmi) to the vo-urp model
then generate the utype-s-->
<target name="run_xmi2vo-urp">
<fail unless="xmi2vo-urp" message="Must define property 'xmi2vo-urp' in ${input}/project.properties (the basic xmi2vo-urp translaytion script) !"/>
<xslt2 in="${input}/${source}" out="${input}/TEMP_${source_intermediate}" style="${res}/${xmi2vo-urp}">
<param name="root_package" expression="${root_package}" />
<param name="model_package" expression="${model_package}" />
</xslt2>
<xslt2 in="${input}/TEMP_${source_intermediate}"
out="${input}/${source_intermediate}"
style="${res}/generate-utypes4vo-urp.xsl">
</xslt2>
<delete file="${input}/TEMP_${source_intermediate}"/>
</target>
<target name="run_vo-urp2modelproxy">
<echo>run_vo-urp2html : starting generate HTML from file ${output}/${source_intermediate}</echo>
<xslt2 in="${input}/${source_intermediate}" out="${input}/${project.name}.modelproxy.xml"
style="${res}/vo-urp2modelproxy.xsl">
</xslt2>
</target>
<target name="run_vo-urp2html" depends="run_vo-urp2gvd">
<echo>run_vo-urp2html : starting generate HTML from file ${output}/${source_intermediate}</echo>
<xslt2 in="${input}/${source_intermediate}" out="${input}/${project.name}.html"
style="${res}/vo-urp2html.xsl">
<param name="project_name" expression="${project.name}"/>
<param name="graphviz_png" if="graphviz.path" expression="${graphviz.png}"/>
<param name="graphviz_map" if="graphviz.path" expression="${graphviz.map.placeholder}"/>
<param name="preamble" expression="${html.preamble}"/>
</xslt2>
<!--
<copy todir="${input}">
<fileset dir="css">
<include name="*.css" />
</fileset>
</copy>
-->
<ant target="postGenerateHTML_vo-urp" />
<echo>run_vo-urp2html : done.</echo>
</target>
<!-- target run_intermediate2gvd : generates Object Graphs (graphviz tool) from intermediate model -->
<!-- note : this target not included in the standard pipeline : run it manually -->
<target name="run_vo-urp2gvd" if="graphviz.path">
<echo>run_vo-urp2gvd : starting generate GraphViz from file ${output}/${source_intermediate}</echo>
<xslt2 in="${input}/${source_intermediate}" out="${input}/${project.name}.gvd" style="${res}/vo-urp2gvd.xsl" />
<exec executable="${graphviz.path}" dir="${input}" >
<arg value="-Tcmapx" />
<arg value="-o${graphviz.map}" />
<arg value="-Tpng"/>
<arg value="-o${graphviz.png}"/>
<arg value="${project.name}.gvd"/>
</exec>
<echo>run_vo-urp2gvd : done.</echo>
</target>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- target xmi2intermediate : GenTool preprocessor generating according to ivoaDMMetamodel.xsd -->
<target name="xmi2intermediate">
<echo>xmi2intermediate : starting generate intermediate model from file ${output}/${source}</echo>
<xslt2 in="${source}" out="${output}/${source_filtered}" style="${res}/${xmi2intermediate}">
<param name="root_package" expression="${root_package}" />
<param name="model_package" expression="${model_package}" />
<param name="modelversion" expression="${project.version}"/>
</xslt2>
<echo>xmi2intermediate : done.</echo>
</target>
<!-- target run_intermediate2xsd : generates XML schemas from intermediate model -->
<target name="run_intermediate2xsd">
<echo>run_intermediate2xsd : starting generate XSD files from file ${output}/${source_intermediate}</echo>
<xslt2 in="${output}/${source_intermediate}" out="${output.xsd}/xsd-gen.log" style="${res}/intermediate2xsd.xsl">
<param name="targetnamespace_root" expression="${targetnamespace_root}" />
<param name="schemalocation_root" expression="${schemalocation_root}" />
<param name="generateAppinfo" expression="true" />
<param name="project_name" expression="${project.name}" />
</xslt2>
<copy verbose="true" todir="${output}/schema" preservelastmodified="true">
<fileset file="./xsd/base.xsd" />
</copy>
<echo>run_intermediate2xsd : done.</echo>
</target>
<!-- generate template XML docs for each of the root elements -->
<target name="run_intermediate2xml">
<echo>run_intermediate2xml : starting generate XML sample documents from file ${output}/${source_intermediate}</echo>
<xslt2 in="${output}/${source_intermediate}" out="${output}/xml-samples/xml-gen.log" style="${res}/intermediate2xml.xsl">
<param name="targetnamespace_root" expression="${targetnamespace_root}" />
</xslt2>
<echo>run_intermediate2xml : done.</echo>
</target>
<!-- target run_readSKOS : generates SKOS vocabularie and trasforms them -->
<!-- note : this target not included in the standard pipeline : run it manually -->
<target name="run_readSKOS">
<echo>run_intermediateSKOS2simpleSKOS : starting generate Simple SKOS files from SKOS URIs in ${output}/${source_intermediate}</echo>
<xslt2 in="${output}/${source_intermediate}" out="${output}/skos/skos-gen.log" style="${res}/readSKOS.xsl"/>
<echo>run_intermediate2xsd : done.</echo>
</target>
<!-- target run_intermediate2html : generates HTML Documentation from intermediate model -->
<target name="run_intermediate2html" depends="run_intermediate2gvd">
<echo>run_intermediate2html : starting generate HTML from file ${output}/${source_intermediate}</echo>
<xslt2 in="${output}/${source_intermediate}" out="${output}/html/${project.name}.html"
style="${res}/intermediate2html_v2.xsl">
<param name="project_name" expression="${project.name}"/>
<param name="graphviz_png" if="graphviz.path" expression="${graphviz.png}"/>
<param name="graphviz_map" if="graphviz.path" expression="${graphviz.map.placeholder}"/>
<param name="preamble" expression="${html.preamble}"/>
</xslt2>
<copy todir="${output}/html">
<fileset dir="css">
<include name="*.css" />
</fileset>
</copy>
<ant target="postGenerateHTML" />
<echo>run_intermediate2html : done.</echo>
</target>
<target name="postGenerateHTML" if="graphviz.path" >
<loadfile property="map" srcfile="${outputHTML}/${graphviz.map}"/>
<replace file="${outputHTML}/${project.name}.html" token="${graphviz.map.placeholder}" value="${map}"/>
</target>
<target name="postGenerateHTML_vo-urp" if="graphviz.path" >
<loadfile property="map" srcfile="${input}/${graphviz.map}"/>
<replace file="${input}/${project.name}.html" token="${graphviz.map.placeholder}" value="${map}"/>
</target>
<!-- target run_intermediate2rdf : generates a RDF instance from intermediate model -->
<target name="run_intermediate2rdf" >
<echo>run_intermediate2rdf : starting generate RDF from file ${output}/${source_intermediate}</echo>
<xslt2 in="${output}/${source_intermediate}" out="${output}/rdf/{project.name}.rdf" style="${res}/intermediate2rdf.xsl"/>
<echo>run_intermediate2rdf : done.</echo>
</target>
<!-- target run_intermediate2gvd : generates Object Graphs (graphviz tool) from intermediate model -->
<!-- note : this target not included in the standard pipeline : run it manually -->
<target name="run_intermediate2gvd" if="graphviz.path">
<echo>run_vo-run_intermediate2gvd : starting generate GraphViz from file ${output}/${source_intermediate}</echo>
<xslt2 in="${output}/${source_intermediate}" out="${output}/html/${project.name}.gvd" style="${res}/intermediate2gvd.xsl" />
<exec executable="${graphviz.path}" dir="${outputHTML}" >
<arg value="-Tcmapx" />
<arg value="-o${graphviz.map}" />
<arg value="-Tpng"/>
<arg value="-o${graphviz.png}"/>
<arg value="${project.name}.gvd"/>
</exec>
<echo>run_intermediate2gvd : done.</echo>
</target>
<!-- target run_intermediate2ddl : generates DDL script from intermediate model -->
<target name="run_intermediate2ddl">
<echo>run_intermediate2ddl : starting generate DDL from file ${output}/${source_intermediate}</echo>
<xslt2 in="${output}/${source_intermediate}" out="${output}/ddl/ddl-gen.log" style="${res}/intermediate2ddl.xsl">
<param name="vendor" expression="mssqlserver" />
<param name="project_name" expression="${project.name}" />
<param name="schema" expression="${tap.target_schema}" />
</xslt2>
<mkdir dir="${output}/ddl/mssqlserver/backup/" />
<copy todir="${output}/ddl/mssqlserver/backup">
<fileset dir="${output}/ddl/mssqlserver">
<include name="dropTables.sql" />
<include name="dropViews.sql" />
<include name="backupTables.sql" />
<include name="migrateTables.sql" />
<include name="dropBackupTables.sql" />
</fileset>
</copy>
<!--
<xslt2 in="${output}/${source_intermediate}" out="${output}/ddl/ddl-gen.log" style="${res}/intermediate2ddl_singletable.xsl">
<param name="vendor" expression="mssqlserver" />
<param name="project_name" expression="${project.name}" />
<param name="schema" expression="${tap.target_schema}" />
</xslt2>
-->
<xslt2 in="${output}/${source_intermediate}" out="${output}/ddl/ddl-gen.log" style="${res}/intermediate2ddl.xsl">
<param name="vendor" expression="postgres" />
<param name="project_name" expression="${project.name}" />
<param name="schema" expression="${tap.target_schema}" />
</xslt2>
<xslt2 in="${output}/${source_intermediate}" out="${output}/ddl/ddl-gen.log" style="${res}/intermediate2ddl.xsl" >
<param name="vendor" expression="mysql" />
<param name="project_name" expression="${project.name}" />
<param name="schema" expression="${tap.target_schema}" />
</xslt2>
<echo>run_intermediate2ddl : done.</echo>
</target>
<target name="DB-rebuild" description="generate DDL, clean and create database structure">
<ant target="run_intermediate2ddl"/>
<!-- update DB if needed -->
<ant target="DB-setup" />
</target>
<!-- target run_intermediate2tap : generates TAP metadata VOTables from intermediate model -->
<target name="run_intermediate2tap">
<echo>run_intermediate2tap : starting generate TAP metadata VOTables from file ${output}/${source_intermediate}</echo>
<xslt2 in="${output}/${source_intermediate}" out="${output}/tap/tap-gen.log" style="${res}/intermediate2tap.xsl">
<param name="mode" expression="tableset" />
<param name="project_name" expression="${project.name}" />
</xslt2>
<xslt2 in="${output}/${source_intermediate}" out="${output}/tap/mssqlserver/tap-gen.log" style="${res}/intermediate2tap.xsl">
<param name="mode" expression="tap_schema" />
<param name="vendor" expression="mssqlserver" />
<param name="target_database" expression="${tap.target_database}" />
<param name="target_schema" expression="${tap.target_schema}" />
<param name="project_name" expression="${project.name}" />
</xslt2>
<xslt2 in="${output}/${source_intermediate}" out="${output}/tap/postgres/tap-gen.log" style="${res}/intermediate2tap.xsl">
<param name="mode" expression="tap_schema" />
<param name="vendor" expression="postgres" />
<param name="target_database" expression="${tap.target_database}" />
<param name="target_schema" expression="${tap.target_schema}" />
<param name="project_name" expression="${project.name}" />
</xslt2>
<xslt2 in="${output}/${source_intermediate}" out="${output}/tap/tap-gen.log" style="${res}/intermediate2tap.xsl">
<param name="mode" expression="vodataservice" />
<param name="project_name" expression="${project.name}" />
</xslt2>
<xslt2 in="${output}/${source_intermediate}" out="${output}/tap/tap-gen.log" style="${res}/intermediate2tap.xsl">
<param name="mode" expression="votable" />
<param name="project_name" expression="${project.name}" />
</xslt2>
<echo>run_intermediate2tap : done.</echo>
</target>
<!-- target run_intermediate2java : generates java classes from intermediate model -->
<target name="run_intermediate2java">
<echo>run_intermediate2java : starting filter on file ${output}/${source}</echo>
<mkdir dir="${sources.gen}/" />
<copy tofile="${properties}/persistence.xml" filtering="true" verbose="true" overwrite="true">
<fileset file="${templates}/persistence-template.xml" />
<filterset>
<filter token="jpa.persistence.unit" value="${jpa.persistence.unit}" />
</filterset>
</copy>
<copy tofile="${properties}/jpa-config.properties" filtering="true" verbose="true" overwrite="true">
<fileset file="${templates}/jpa-config.properties.template" />
<filterset>
<filter token="jpa.database" value="${jpa.database}" />
<filter token="targetdb.driver" value="${targetdb.driver}" />
<filter token="targetdb.url" value="${targetdb.url}" />
<filter token="targetdb.user" value="${targetdb.user}" />
<filter token="targetdb.password" value="${targetdb.password}" />
<filter token="targetdb.admin" value="${targetdb.admin}" />
<filter token="targetdb.adminpassword" value="${targetdb.adminpassword}" />
</filterset>
</copy>
<xslt2 in="${output}/${source_intermediate}" out="${sources.gen}/java-gen.log" style="${res}/intermediate2java.xsl">
<param name="root_package" expression="${root_package}" />
<param name="model_package" expression="${model_package}" />
<param name="targetnamespace_root" expression="${targetnamespace_root}" />
<param name="persistence.xml" expression="${properties}/persistence.xml"/>
<param name="databaseSchema" expression="${tap.target_schema}" />
</xslt2>
<echo>run_intermediate2java : done.</echo>
</target>
<!-- include db targets -->
&buildDB;
<!-- include java code targets -->
&buildJava;
<!-- target echo : echos properties -->
<target name="echo" depends="init">
<echoproperties />
</target>
<target name="doNothing" >
<echo>Doing nothing ......................................</echo>
</target>
</project>