-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.xml
More file actions
executable file
·924 lines (858 loc) · 43.8 KB
/
build.xml
File metadata and controls
executable file
·924 lines (858 loc) · 43.8 KB
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
<?xml version="1.0"?>
<!--
* '$RCSfile: build.xml,v $'
* Authors: @authors@
* Release: @release@
*
* '$Author: mlee $'
* '$Date: 2006-09-06 21:54:38 $'
* '$Revision: 1.101 $'
*
* Authors: Chad Berkley
* Copyright: 2002 Regents of the University of California and the
* National Center for Ecological Analysis and Synthesis
*
* See http://jakarta.apache.org for details on Ant
*
-->
<!--
============================================================================
Usage Tips
**********
This build file should be used with the build.properties file in the same
directory. It also requires the web/build.xml file for the web installation.
A normal installation goes like this:
Set the variables in build.properties then
ant install
***now start/restart tomcat/apache. after tomcat and apache are started (or restarted)
***note that if tomcat is already running and you have it set to reload when
***it finds a new war file, you shouldn't have to manually restart it. Apache
***only needs to be restarted if something major happens. Usually as long as
***tomcat restarts on it's own, you're ok to go to the next step.
ant web-install
Try your url (i.e. http://localhost/vegbank) in your browser. If any of the
links don't work go back and fix the properties in your build.properties file.
If you want to do a clean install (removing the build files and re-compiling) do
ant clean install
or to completely flush your system of all vegbank related stuff and start
completely from scratch do
ant full-clean install
Target List
***********
Target Description
****** ***********
init initialize variables and pull properties from build.properties
setFilters sets the text filters to automatically change the @x@ variables
prepare copy files to prepare for compilation
setclasspath set the classpath for compilation
compile compile all java classes
jar put all java classes into a jar file
warPrepare copy files needed to build the war file (for servlet
initialization)
war create the war file
install install the war file to the servlet container
web-install install the static web files from the web/ directory (uses
the web/build.xml file)
clean delete the build and dist dirs
full-clean delete the build, dist, vegbank.home, apache.document.root,
and the servlet context
generateDBSQL generate the SQL to create a blank database from the datamodel
generateBeans generate the java beans needed for compilation
dbVerify verify that the database and the datamodel are the same. create
the status documents for the admin status display
runxmlcache caches the xml representation of each bean with accession numbers
in the observation, plantconcept, commconcept, project and
party tables. This is needed to upgrade the database to use
xml caching for xml downloads.
createdb creates an empty vegbank database from the existing sql scripts.
the created database should be valid according to the newest
schema.
populateDD populates the data dictionary tables based on docs/xml/db_model_vegbank.xml
binbuild copy the bin files to build and update tokens
bin install the bin files into the /usr/vegbank/bin dir
============================================================================
-->
<project name="vegbank" default="war" basedir=".">
<!--set up the correct variables-->
<target name="init">
<!--** customize these properties after customizing build.properties **-->
<!--general props-->
<property file="build.properties"/>
<!-- ensure that all the required properties are there: -->
<fail unless="apache.document.root" message="'apache.document.root' is required in build.properties" />
<fail unless="authenticationServletHost" message="'authenticationServletHost' is required in build.properties" />
<fail unless="backupDir" message="'backupDir' is required in build.properties" />
<fail unless="communityRequestServletHost" message="'communityRequestServletHost' is required in build.properties" />
<fail unless="database.accession.key.preassign" message="'database.accession.key.preassign' is required in build.properties" />
<fail unless="databaseConnectString" message="'databaseConnectString' is required in build.properties" />
<fail unless="databaseDriverClass" message="'databaseDriverClass' is required in build.properties" />
<fail unless="databaseDriverType" message="'databaseDriverType' is required in build.properties" />
<fail unless="databaseName" message="'databaseName' is required in build.properties" />
<fail unless="databasePort" message="'databasePort' is required in build.properties" />
<fail unless="databaseType" message="'databaseType' is required in build.properties" />
<fail unless="databaseUser" message="'databaseUser' is required in build.properties" />
<fail unless="databaseUserPassword" message="'databaseUserPassword' is required in build.properties" />
<fail unless="eighty_eighty" message="'eighty_eighty' is required in build.properties" />
<fail unless="geoCoordRequestServletHost" message="'geoCoordRequestServletHost' is required in build.properties" />
<fail unless="googlemaps_apikey" message="'googlemaps_apikey' is required in build.properties" />
<fail unless="hostname" message="'hostname' is required in build.properties" />
<fail unless="insert.maxConnections" message="'insert.maxConnections' is required in build.properties" />
<fail unless="insert.minConnections" message="'insert.minConnections' is required in build.properties" />
<fail unless="java1.4.home.dir" message="'java1.4.home.dir' is required in build.properties" />
<fail unless="logFile" message="'logFile' is required in build.properties" />
<fail unless="machine_url" message="'machine_url' is required in build.properties" />
<fail unless="mail_host" message="'mail_host' is required in build.properties" />
<fail unless="mail_port" message="'mail_port' is required in build.properties" />
<fail unless="maxConnectionUsers" message="'maxConnectionUsers' is required in build.properties" />
<fail unless="pgdumpPath" message="'pgdumpPath' is required in build.properties" />
<fail unless="plantRequestServletHost" message="'plantRequestServletHost' is required in build.properties" />
<fail unless="psqlPath" message="'psqlPath' is required in build.properties" />
<fail unless="query.maxConnections" message="'query.maxConnections' is required in build.properties" />
<fail unless="query.minConnections" message="'query.minConnections' is required in build.properties" />
<fail unless="resetTime" message="'resetTime' is required in build.properties" />
<fail unless="systemEmail" message="'systemEmail' is required in build.properties" />
<fail unless="tomcat" message="'tomcat' is required in build.properties" />
<fail unless="vegbank.accession.prefix" message="'vegbank.accession.prefix' is required in build.properties" />
<fail unless="vegbank.data.dir" message="'vegbank.data.dir' is required in build.properties" />
<fail unless="vegbank.export.dir" message="'vegbank.export.dir' is required in build.properties" />
<fail unless="vegbank.export.dirname" message="'vegbank.export.dirname' is required in build.properties" />
<fail unless="vegbank.home.dir" message="'vegbank.home.dir' is required in build.properties" />
<fail unless="vegbank.schema.data" message="'vegbank.schema.data' is required in build.properties" />
<fail unless="vegbank.schema.exportdata" message="'vegbank.schema.exportdata' is required in build.properties" />
<fail unless="vegbank.schema.model" message="'vegbank.schema.model' is required in build.properties" />
<fail unless="vegbank.web.dir" message="'vegbank.web.dir' is required in build.properties" />
<fail unless="webapps.dir" message="'webapps.dir' is required in build.properties" />
<!-- END OF REQD PROPS -->
<property name="name" value="vegbank"/>
<property name="version" value="1.2.1"/>
<property name="vegbankHome" value="${vegbank.home.dir}"/>
<property name="dataPath" value="${vegbankHome}/data"/>
<property name="binPath" value="${vegbankHome}/bin"/>
<property name="libPath" value="${vegbankHome}/lib"/>
<property name="exportPath" value="${vegbankHome}/export"/>
<property name="uploadPath" value="${vegbankHome}/upload"/>
<property name="dataSchemaName" value="${vegbank.schema.data}"/>
<property name="dataExportSchemaName" value="${vegbank.schema.exportdata}"/>
<property name="modelSchemaName" value="${vegbank.schema.model}"/>
<!--servlet/web container props-->
<property name="tomcatVersion" value="5"/>
<property name="context" value="${name}"/>
<property name="webapps" value="${webapps.dir}"/>
<property name="contextDir" value="${webapps}/${name}"/>
<property name="webServerDir" value="${apache.document.root}"/>
<property name="host" value="${hostname}"/>
<property name="serverUrl" value="http://${host}"/>
<property name="contextUrl" value="${serverUrl}/${context}"/>
<property name="vegdocs" value="/vegdocs"/>
<!--database props-->
<property name="databasePassword" value="${databaseUserPassword}"/>
<!--mail server props-->
<property name="mailServer" value="${mail_host}"/>
<property name="mailPort" value="${mail_port}"/>
<property name="listserv" value="http://lists.nceas.ucsb.edu/vegbank/mailman/listinfo/"/>
<property name="listservArchive" value="http://lists.nceas.ucsb.edu/vegbank/pipermail/"/>
<property name="listservUserOptions" value="http://lists.nceas.ucsb.edu/vegbank/mailman/options/"/>
<!--rmi server props-->
<property name="rmiServer" value="${rmiserver}"/>
<!--** do not edit below here unless you really know what you're doing **-->
<property name="databaseConnection" value="${databaseConnectString}"/>
<property name="buildDir" value="build"/>
<property name="srcDir" value="src"/>
<property name="classDir" value="classes"/>
<property name="docsDir" value="docs"/>
<property name="libDir" value="lib"/>
<property name="distDir" value="dist"/>
<property name="webDir" value="web"/>
<property name="cacheDir" value="cache"/>
<property name="helpDir" value="${webDir}/help"/>
<property name="buildStatusDir" value="${buildDir}/status"/>
<property name="webStatusDir" value="${webServerDir}/status"/>
<property name="sqlSrcDir" value="${srcDir}/sql"/>
</target>
<!--set the inline copy filters. do not edit these directly. If you want
to edit these, do it in the properties in init. -->
<target name="setFilters" depends="init">
<tstamp>
<format property="currentTime" pattern="MM/dd/yyyy hh:mm:ss aa"/>
</tstamp>
<filter token="databaseType" value="${databaseType}"/>
<filter token="databaseUser" value="${databaseUser}"/>
<filter token="databaseUserPassword" value="${databasePassword}"/>
<filter token="databasePort" value="${databasePort}"/>
<filter token="hostname" value="${host}"/>
<filter token="databaseDriverType" value="${databaseDriverType}"/>
<filter token="databaseDriverClass" value="${databaseDriverClass}"/>
<filter token="databaseConnectString" value="${databaseConnection}"/>
<filter token="databaseName" value="${databaseName}"/>
<filter token="database.accession.key.preassign" value="${database.accession.key.preassign}" />
<filter token="database.accession.alt.key" value="${database.accession.alt.key}" />
<filter token="vegbank.accession.prefix" value="${vegbank.accession.prefix}" />
<filter token="psqlPath" value="${psqlPath}"/>
<filter token="vegbankVersion" value="${version}"/>
<filter token="vegbank.data.dir" value="${dataPath}/"/>
<filter token="vegbank.export.dirname" value="${exportPath}/"/>
<filter token="vegbank.home.dir" value="${vegbankHome}/"/>
<filter token="vegbank.web.dir" value="${webServerDir}/"/>
<filter token="schemaLocation" value="${webServerDir}/vegdocs/xml/"/>
<filter token="vegbankSchemaName" value="${dataSchemaName}"/>
<filter token="vegbankExportSchemaName" value="${dataExportSchemaName}"/>
<!-- End filters created from build.${context}.properties -->
<!-- Copied these straight from the veg_plot build.xml, are they relevant ? -->
<!-- Servlet specific -->
<filter token="mailHost" value="${mailServer}"/>
<filter token="mailPort" value="${mailPort}"/>
<filter token="machineURL" value="${host}"/>
<filter token="serverAddress" value="${host}"/>
<filter token="systemEmail" value="${systemEmail}"/>
<filter token="genericForm" value="${context}/forms/generic_form.html"/>
<filter token="genericTemplate" value="${context}/forms/tmp.html"/>
<filter token="rmiserver" value="${rmiServer}"/>
<filter token="uploadDir" value="${uploadPath}"/>
<filter token="servlet_lib_dir" value="${webapps}/lib"/>
<filter token="webapps_dir" value="${webapps}" />
<filter token="servlet_context" value="${contextDir}/"/>
<!-- backup properties -->
<filter token="pgdumpPath" value="${pgdumpPath}"/>
<filter token="backupDir" value="${backupDir}"/>
<!--loadfiles for the web stuff-->
<property name="web.temp.dir" value="web/temp"/>
<ant antfile="build.xml" target="tokenfiles" dir="${webDir}" inheritAll="false" />
<ant antfile="build.xml" target="views-autogen" dir="${webDir}" inheritAll="false" />
<!--load main filters files-->
<filter filtersfile="${web.temp.dir}/filters.properties"/>
<filter filtersfile="${web.temp.dir}/placeurl.properties"/>
<!-- get filters for data dictionary defns: -->
<filter filtersfile="${web.temp.dir}/dd_defns_tokens.properties" />
<filter filtersfile="${web.temp.dir}/manual_filters.properties"/>
<filter filtersfile="${web.temp.dir}/closedlist-tokens.properties"/>
<!--filters for the web pages-->
<loadfile srcfile="${web.temp.dir}/webpage_top.html" property="webpage_top_html" />
<loadfile srcfile="${web.temp.dir}/webpage_stylesheets_declaration.html" property="webpage_stylesheets_declaration" />
<loadfile srcfile="${web.temp.dir}/webpage_footer_small.html" property="webpage_footer_small_html" />
<loadfile srcfile="${web.temp.dir}/webpage_footer.html" property="webpage_footer_html" />
<loadfile srcfile="${web.temp.dir}/webpage_masthead_small.html" property="webpage_masthead_small_html" />
<loadfile srcfile="${web.temp.dir}/webpage_masthead.html" property="webpage_masthead_html" />
<loadfile srcfile="${web.temp.dir}/webpage_head.html" property="webpage_head_html" />
<loadfile srcfile="${web.temp.dir}/webpage_top.html" property="webpage_top_html" />
<!--filters for the web install-->
<filter token="webpage_top_html" value="${webpage_top_html}" />
<filter token="webpage_head_html" value="${webpage_head_html}" />
<filter token="webpage_masthead_html" value="${webpage_masthead_html}" />
<filter token="webpage_masthead_small_html" value="${webpage_masthead_small_html}" />
<filter token="webpage_footer_html" value="${webpage_footer_html}" />
<filter token="webpage_footer_small_html" value="${webpage_footer_small_html}" />
<filter token="webpage_stylesheets_declaration" value="${webpage_stylesheets_declaration}" />
<filter token="webpage_stylesheets_declaration_html" value="${webpage_stylesheets_declaration}"/>
<!--connection filters from the old build file-->
<filter token="machine_url" value="${serverUrl}"/>
<filter token="eighty_eighty" value="${eighty_eighty}"/>
<filter token="googlemaps_apikey" value="${googlemaps_apikey}" />
<filter token="dist" value="dist"/>
<filter token="hostname" value="${host}"/>
<filter token="version" value="development"/>
<filter token="base_url" value=""/>
<filter token="server_address" value="${serverUrl}"/>
<filter token="web_context" value="${contextUrl}/"/>
<filter token="get_link" value="/get/"/>
<filter token="cite_link" value="/cite/"/>
<filter token="image_server" value="${contextUrl}/images/"/>
<filter token="minimumwidth" value="650"/>
<!-- this is the minimum value for width of header and footer -->
<!-- the following is a duplicate : -->
<filter token="images_link" value="${contextUrl}/images/"/>
<filter token="stylesheet" value=""/>
<!-- this is handled in default head token -->
<!-- NO PARAMS on next token -->
<filter token="plotquery_page" value="${contextUrl}/forms/plot-query.jsp"/>
<!-- params allowed and encouraged on next 2 tokens -->
<filter token="plotquery_page_simple" value="${contextUrl}/forms/plot-query.jsp?simplemode=true"/>
<filter token="plotquery_page_advanced" value="${contextUrl}/forms/plot-query.jsp"/>
<filter token="uploaddata_page" value="${contextUrl}/forms/uploadFile.html"/>
<filter token="browseplotspage" value="/browse" />
<filter token="general_link" value="${contextUrl}/general/"/>
<filter token="ajax_link" value="${contextUrl}/ajax/"/>
<filter token="forms_url" value="${contextUrl}/forms/"/>
<filter token="views_link" value="${contextUrl}/views/"/>
<!--<filter token="cache_link" value="${contextUrl}/cache/"/>-->
<filter token="admin_url" value="${contextUrl}/admin/"/>
<!-- add second token for forms, which is similarly named as other links -->
<filter token="forms_link" value="${contextUrl}/forms/"/>
<filter token="includes_link" value="${contextUrl}/includes/"/>
<filter token="pubs_link" value="${vegdocs}/pubs/"/>
<filter token="history_link" value="${vegdocs}/history/"/>
<filter token="news_link" value="${vegdocs}/news/"/>
<!-- add link for page name that links to help frame jsp -->
<filter token="jspHelpPage" value="${contextUrl}/forms/getHelp.jsp"/>
<!-- location and filename of xml index page -->
<filter token="design_link" value="${vegdocs}/design/"/>
<filter token="panel_link" value="${vegdocs}/panel/"/>
<filter token="workshop_link" value="${vegdocs}/workshop/"/>
<filter token="vegbranch_link" value="${vegdocs}/vegbranch/"/>
<filter token="vegbranch_demo_link" value="${vegdocs}/vegbranch/docs/demo/"/>
<filter token="searchplugins_link" value="${vegdocs}/searchplugins/"/>
<filter token="xml_link" value="${vegdocs}/xml/"/>
<filter token="NativeXMLIndexPage" value="${vegdocs}/xml/vegbank-xml-index.html"/>
<filter token="help_link" value="${vegdocs}/help/"/>
<filter token="help" value="${vegdocs}/help/"/>
<filter token="manual_link" value="${vegdocs}/help/manual/"/>
<!-- SERVLETS -->
<filter token="framework_servlet" value="${contextUrl}/servlet/framework"/>
<filter token="usermanagement_servlet" value="${contextUrl}/servlet/usermanagement"/>
<filter token="datarequestservlet" value="${contextUrl}/servlet/DataRequestServlet"/>
<filter token="datasubmitservlet" value="${contextUrl}/servlet/DataSubmitServlet"/>
<filter token="nestedquerybuilder" value="${contextUrl}/servlet/QueryBuilderServlet"/>
<filter token="authenticationservlet" value="${contextUrl}/servlet/authenticate"/>
<!-- listserv -->
<filter token="listservinfo_link" value="${listserv}"/>
<filter token="listservarchive_link" value="${listservArchive}"/>
<filter token="listservuser_link" value="${listservUserOptions}" />
<!-- Struts -->
<filter token="DisplayUploadPlotAction" value="${contextUrl}/DisplayUploadPlotAction.do"/>
<!--Other-->
<filter token="subst_lt" value="<"/>
<filter token="subst_gt" value=">"/>
</target>
<!--copy files to the build directory and prepare for compilation-->
<target name="prepare" depends="setFilters">
<property name="buildSrcDir" value="${buildDir}/${srcDir}"/>
<property name="buildClassDir" value="${buildDir}/${classDir}"/>
<property name="buildLibDir" value="${buildDir}/lib"/>
<property name="javaSrcDir" value="${srcDir}/java"/>
<property name="includesDir" value="${webDir}/includes"/>
<mkdir dir="${buildSrcDir}"/>
<mkdir dir="${buildClassDir}"/>
<mkdir dir="${buildLibDir}"/>
<mkdir dir="${dataPath}"/>
<mkdir dir="${exportPath}"/>
<mkdir dir="${uploadPath}"/>
<mkdir dir="${apache.document.root}"/>
<mkdir dir="${buildStatusDir}"/>
<mkdir dir="${webStatusDir}"/>
<mkdir dir="${binPath}"/>
<!--copy the java src to the build/src dir-->
<copy todir="${buildSrcDir}" filtering="yes">
<fileset dir="${javaSrcDir}">
<exclude name="**/CVS*"/>
<exclude name="**/.#*"/>
</fileset>
</copy>
<!--copy .properties files-->
<copy todir="${buildClassDir}" filtering="yes">
<fileset dir="${javaSrcDir}">
<include name="**/*.properties"/>
</fileset>
</copy>
<copy todir="${buildClassDir}" filtering="yes">
<fileset dir="${includesDir}">
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<!--copy the bin files to the build/bin directory-->
<target name="binbuild" depends="setFilters">
<!-- backups: -->
<mkdir dir="${buildDir}/bin"/>
<copy todir="${buildDir}/bin" filtering="yes" overwrite="yes">
<fileset dir="bin">
<include name="**/*"/>
</fileset>
</copy>
<chmod dir="${buildDir}/bin" perm="777" includes="**/*.sh"/>
<chmod file="${buildDir}/bin/vbdump" perm="777"/>
<chmod file="${buildDir}/bin/runAccGen" perm="777"/>
<chmod file="${buildDir}/bin/runKwGen" perm="777"/>
</target>
<!--copy the bin files to the bin directory-->
<target name="bin" depends="binbuild">
<!-- backups: -->
<mkdir dir="${backupDir}"/>
<copy todir="${binPath}" filtering="yes" overwrite="yes">
<fileset dir="bin">
<include name="**/*"/>
</fileset>
</copy>
<chmod dir="${binPath}" perm="777" includes="**/*.sh"/>
<chmod file="${binPath}/vbdump" perm="777"/>
<chmod file="${binPath}/runAccGen" perm="777"/>
<chmod file="${binPath}/runKwGen" perm="777"/>
</target>
<!--set the classpath-->
<target name="setclasspath">
<path id="projectClassPath">
<!-- Project jars -->
<pathelement location="./"/>
<pathelement location="${buildSrcDir}"/>
<pathelement location="./"/>
<fileset dir="lib/">
<include name="**/*.jar"/>
</fileset>
</path>
<property name="classpath" refid="projectClassPath"/>
</target>
<!--compile all files in build/src to build/classes-->
<target name="compile" depends="setclasspath, prepare, generateBeans">
<echo>classpath: ${classpath}</echo>
<javac srcdir="${buildSrcDir}"
destdir="${buildClassDir}"
classpath="${classpath}"
debug="on"
source="11"/>
</target>
<!--jar all classes in build/classes to vegbank.jar-->
<target name="jar" depends="compile">
<jar destfile="${buildDir}/${name}.jar" update="true">
<fileset dir="${buildClassDir}"/>
</jar>
</target>
<!--get everything in the right place to build the war file-->
<target name="warPrepare" depends="jar">
<property name="buildWarDir" value="${buildDir}/war"/>
<property name="srcWebInfDir" value="web/src/web/WEB-INF"/>
<property name="warWebInfDir" value="${buildWarDir}/WEB-INF" />
<property name="warLib" value="${buildWarDir}/lib" />
<property name="warContext" value="${buildWarDir}/${context}" />
<property name="warContextCacheDir" value="${warContext}/${cacheDir}"/>
<property name="cacheRawDir" value="${warContextCacheDir}/views/raw/" />
<mkdir dir="${cacheRawDir}" />
<mkdir dir="${warLib}" />
<mkdir dir="${warWebInfDir}" />
<mkdir dir="${warContext}" />
<mkdir dir="${warContextCacheDir}"/>
<mkdir dir="${cacheRawDir}"/>
<!--copy the vegbank.jar file-->
<copy file="${buildDir}/${name}.jar" todir="${warLib}" filtering="no"/>
<!--copy the other jar files-->
<copy todir="${warLib}" filtering="no">
<fileset dir="${libDir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<!--copy the WEB-INF support files-->
<copy todir="${warWebInfDir}" filtering="yes">
<fileset dir="${srcWebInfDir}">
<include name="**/*.tld"/>
<include name="**/*.xml"/>
<exclude name="**/web.xml"/>
</fileset>
</copy>
<!--copy the web files-->
<copy todir="${warContext}" filtering="yes">
<fileset dir="${webDir}">
<include name="*.jsp"/>
<include name="*.html"/>
</fileset>
</copy>
<copy todir="${warContext}/includes" filtering="yes">
<fileset dir="${webDir}/includes">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${warContext}/general" filtering="yes">
<fileset dir="${webDir}/general">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${warContext}/forms" filtering="yes">
<fileset dir="${webDir}/forms">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${warContext}/images" filtering="no">
<fileset dir="${webDir}/images">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${warContext}/ajax" filtering="yes">
<fileset dir="${webDir}/ajax"/>
</copy>
<copy todir="${warContext}/admin" filtering="yes">
<fileset dir="${webDir}/admin"/>
</copy>
<copy todir="${warContext}/views" filtering="yes">
<fileset dir="${webDir}/views">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${warContext}" filtering="yes">
<fileset dir="${buildSrcDir}">
<include name="velocity.properties"/>
</fileset>
</copy>
<copy todir="${warContext}/xsl" filtering="yes">
<fileset dir="${srcDir}/xsl">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${apache.document.root}/vegdocs/xml" filtering="yes">
<fileset dir="${buildDir}/lib">
<include name="*.xsd"/>
</fileset>
</copy>
<!--<copy todir="${cacheRawDir}" filtering="yes">
<fileset dir="${webDir}/views/raw">
<include name="raw_countdata.jsp"/>
<include name="raw_recentprojects.jsp"/>
</fileset>
</copy>-->
</target>
<!--war build directory to vegbank.war-->
<target name="war" depends="warPrepare">
<mkdir dir="${distDir}" />
<war destfile="${distDir}/${context}.war"
webxml="${srcWebInfDir}/web.xml">
<fileset dir="${warContext}"/>
<lib dir="${warLib}"/>
<webinf dir="${warWebInfDir}"/>
</war>
</target>
<!--install war file to target webapps dir-->
<target name="install" depends="war">
<antcall target="bin" /> <!-- copy the bin files -->
<copy todir="${libPath}" filtering="no">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="build">
<include name="vegbank.jar"/>
</fileset>
</copy>
<copy todir="${webapps}" filtering="no">
<fileset dir="${distDir}">
<include name="${context}.war"/>
</fileset>
</copy>
<!--<ant antfile="build.xml" target="deploy-all" dir="${webDir}"/>-->
</target>
<!--install the web files-->
<target name="web-install" depends="dbVerify">
<ant antfile="build.xml" target="deploy-full-from-main-dir" dir="${webDir}" inheritAll="false" />
<antcall target="web-install-status" />
</target>
<target name="web-install-status" depends="dbVerify">
<echo file="${buildStatusDir}/deploy-props.txt"> -----------------DEPLOY PROPS STATUS------------------------@subst_lt@br/@subst_gt@ Properties last deployed at time: ${currentTime} @subst_lt@br/@subst_gt@ Connection to database Name: ${databaseName} @subst_lt@br/@subst_gt@ Deployed from : ${basedir} @subst_lt@br/@subst_gt@ vegbank version: ${version} @subst_lt@br/@subst_gt@ ---------------------------------------------------------------------@subst_lt@br/@subst_gt@ </echo>
<property name="verify_readme" value=" differences are checked for between the actual database model (as implemented in postgresql) and the model specified in docs/xml/db_model_vegbank.xml. The diff file will show fields different or missing from one of the model xml file and the actual database. The database fields are followed by 'dil' and the model fields by the same, but with one of the letters capitalized, symbolizing that it is either a Denormalized field, Implementation field or Logical field. "/>
<echo file="${buildStatusDir}/verify.readme">${verify_readme} The Diff file is displayed on screen unless there are no differences.</echo>
<!-- check the model, but don't fail on errors! -->
<!--<antcall target="db_verify"/>-->
<!-- copy status files to the file to server -->
<copy todir="${webStatusDir}" filtering="yes" overwrite="yes">
<fileset dir="${buildStatusDir}" includes="*.*"/>
</copy>
</target>
<!--clean the install back to a clean slate-->
<target name="clean" depends="init">
<delete dir="${buildDir}"/>
<delete dir="${distDir}"/>
</target>
<!--deletes the build dir but also any contents of a previous installation-->
<target name="full-clean" depends="clean">
<delete>
<fileset dir="${vegbank.home.dir}">
<include name="**/*"/>
<exclude name="logs/"/>
</fileset>
</delete>
<delete>
<fileset dir="${apache.document.root}" includes="**/*.*"/>
</delete>
<!--<delete>
<fileset dir="${vegbank.web.dir}" includes="**/*.*"/>
</delete>-->
<delete file="${webapps}/${context}.war"/>
<delete dir="${webapps}/${context}"/>
</target>
<!--target that generates the sql to build a blank database-->
<target name="generateDBSQL" depends="setFilters">
<!-- generate the database creating SQL, and SQL to populate some of it -->
<property name="jdbc-jar" value="lib/postgresql-8.1-405.jdbc2.jar"/>
<xslt in="${docsDir}/xml/db_model_vegbank.xml"
out="${buildDir}/sql/vegbank.sql"
style="${srcDir}/xsl/VegBankModel2SQL.xsl"/>
<!-- generate the sql for populating the data dictionary within the database -->
<xslt in="${docsDir}/xml/db_model_vegbank.xml"
out="${buildDir}/sql/populate-datadictionary.sql"
style="${docsDir}/xml/dbmodel-to-ddtables.xsl" force="true"/>
<copy todir="${buildDir}/sql" filtering="yes" overwrite="yes">
<fileset dir="${srcDir}/sql" includes="**/*.*"/>
</copy>
</target>
<!--
**************************************************************************
Targets below this line are helper targets that get depended on by
other targets but should generally never be called by themselves.
**************************************************************************
-->
<!--Michael's new method of checking the database to match model xml-->
<target name="dbVerify" depends="prepare">
<!-- set to not fail unless already set -->
<condition property="failOnModelDiff" value="false">
<not>
<isset property="failOnModelDiff"/>
</not>
</condition>
<!-- validate first -->
<echo>Validating model XML against schema: at ${docsDir}/xml/${vegbank.schema.model}</echo>
<!--<xmlvalidate file="${docsDir}/xml/db_model_vegbank.xml" failonerror="true">-->
<xmlvalidate failonerror="yes" lenient="yes" warn="yes"
classname="org.apache.xerces.parsers.SAXParser"
classpath="lib/xercesImpl.jar"
file="${docsDir}/xml/db_model_vegbank.xml">
<!--<attribute name="http://apache.org/xml/features/validation/schema" value="true"/>-->
<attribute name="http://xml.org/sax/features/namespaces" value="true"/>
<property name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
value="${docs.dir}/xml/${vegbank.schema.model}"/>
</xmlvalidate>
<!-- get ideal model output -->
<xslt in="${docsDir}/xml/db_model_vegbank.xml"
out="${buildStatusDir}/logicalmodel.txt"
style="${docsDir}/xml/checkModelAgainstDB.xsl"
force="true"/>
<!-- get acutal model output -->
<echo>Checking model with databaseUser '${databaseUser}' for database '${databaseName}'</echo>
<exec dir="." executable="psql">
<arg line="-U ${databaseUser} ${databaseName} -f ${sqlSrcDir}/verifyActualModel.sql -o ${buildStatusDir}/actualmodel.txt -At "/>
</exec>
<!-- compare ideal logical model to acutal model -->
<property name="verify_readme"
value=" differences are checked for between the actual database model (as implemented in postgresql) and the model specified in docs/xml/db_model_vegbank.xml. The diff file will show fields different or missing from one of the model xml file and the actual database. The database fields are followed by 'dil' and the model fields by the same, but with one of the letters capitalized, symbolizing that it is either a Denormalized field, Implementation field or Logical field. "/>
<echo> If the next line does not have 'Diff results: 0', and the build
failed, this is because ${verify_readme} The diff file is located here:</echo>
<echo file="${buildStatusDir}/verify.readme">${verify_readme} The Diff file is
displayed on screen unless there are no differences.</echo>
<echo>${buildStatusDir}/modeldiffs.txt</echo>
<exec dir="${buildStatusDir}" executable="diff"
output="${buildStatusDir}/modeldiffs.txt" resultproperty="diffResult"
failonerror="${failOnModelDiff}">
<arg line=" -ibwB ./logicalmodel.txt ./actualmodel.txt "/>
</exec>
<echo>============================== VERIFY RESULTS ================================</echo>
<echo>Diff results: ${diffResult} (0 means success, 1 means failure)</echo>
<condition property="verifyMessage" value="_____ db model matches actual database (great!) _____" else=" ###### DB MODEL FAILS TO MATCH THE ACTUAL DATABASE - PLEASE SEE ${buildStatusDir}/modeldiffs.txt ######### ">
<equals arg1="${diffResult}" arg2="0"></equals>
</condition>
<echo>${verifyMessage}</echo>
<echo>${verifyMessage}</echo>
<echo>${verifyMessage}</echo>
</target>
<!-- ================================================================= -->
<!-- Generate model beans, XML Digester rules, XML schema and JSP from -->
<!-- the datamodel XML and generate utility -->
<!-- javabeans -->
<!-- ================================================================= -->
<target name="generateBeans" depends="prepare">
<!-- DOES NOT PICKUP CORRECT XSLT PROCCESOR FOR ME -->
<property name="xslSrcDir" value="${srcDir}/xsl"/>
<property name="buildBeanSrcDir" value="${buildSrcDir}/org/vegbank/common/model"/>
<property name="buildModelUtilitySrcDir" value="${buildBeanSrcDir}/utility"/>
<property name="vegbankSchemaData" value="${dataSchemaName}"/>
<property name="modelGeneratedFlag" value="${buildSrcDir}/generate_java_datamodel-HAS_BEEN_RUN_FLAG"/>
<path id="classpath.compilation">
<pathelement path="${buildClassDir}"/>
<pathelement path="${buildSrcDir}"/>
<!-- Pick up non java resources -->
<fileset dir="${libDir}">
<include name="**/*jar"/>
</fileset>
</path>
<echo>Generating the regular VBModelBeans ... using ${xslSrcDir}/VegBankModel2Java.xsl building to ${buildBeanSrcDir}/</echo>
<java classname="org.apache.xalan.xslt.Process" fork="true" classpath="lib/xalan.jar:lib/xercesImpl.jar:lib/xml-apis.jar">
<arg line="-IN ${docsDir}/xml/db_model_vegbank.xml -XSL ${xslSrcDir}/VegBankModel2Java.xsl -OUT ${modelGeneratedFlag} -PARAM outdir ${buildBeanSrcDir}/"/>
</java>
<echo>Generate the Utility javabeans e.g. statelist from ${docsDir}/xml/utility into ... ${buildModelUtilitySrcDir}/ using ${xslSrcDir}/UtilityXMLToJavaBeans.xsl</echo>
<java classname="org.apache.xalan.xslt.Process" fork="true" classpath="lib/xalan.jar:lib/xercesImpl.jar:lib/xml-apis.jar">
<arg line="-IN ${docsDir}/xml/utility/UtilityBeans.xml -XSL ${xslSrcDir}/UtilityXMLToJavaBeans.xsl -OUT ${modelGeneratedFlag} -PARAM outdir ${buildModelUtilitySrcDir}/"/>
</java>
<echo>Generate the vegbank schema xsd file ... ${buildLibDir}/${vegbankSchemaData}</echo>
<java classname="org.apache.xalan.xslt.Process" fork="true" classpath="lib/xalan.jar:lib/xercesImpl.jar:lib/xml-apis.jar">
<arg line="-IN ${docsDir}/xml/db_model_vegbank.xml -XSL ${docsDir}/xml/dbmodel-to-schema.xsl -OUT ${buildLibDir}/${vegbankSchemaData}"/>
</java>
</target>
<!--
Runs the xml utility to cache xml to the database. this is only needed
as a bootstrap for older databases that don't contain any cached xml.
new insertions automatically cache the xml for those plots inserted.
-->
<target name="runxmlcache" depends="jar">
<java classname="org.vegbank.common.utility.XMLUtil" fork="true">
<classpath>
<pathelement location="build/vegbank.jar"/>
<pathelement path="${classpath}"/>
</classpath>
<jvmarg value="-Xmx1024m"/>
</java>
</target>
<!--creates an empty vegbank database from the existing sql scripts. the
created database should be valid according to the newest schema
-->
<target name="createdb" depends="generateDBSQL">
<!-- set in generateDBSQL <property name="jdbc-jar" value="lib/postgresql-8.1-405.jdbc2.jar"/> -->
<echo>**************Building Main DB with vegbank.sql****************</echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/vegbank.sql"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo>************** Creating Aggregrates ****************</echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/create_aggregrates.sql"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo>************** Creating Extras ****************</echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/create_extras.sql"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo>************** Creating Indices ****************</echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/createIndices.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo>************** views ****************</echo>
<echo> ::::::: drop views first ::::::::: </echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/drop_vegbank_views.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo> :::::::::: now, really creating views ::::::::: </echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/create_vegbank_views.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo>************** populating config tables ****************</echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/vegbank_populate_configtables.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo>************** populating and creating temporary tables ****************</echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/create_temp_tbls.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo> :::::::::: working on any views that got missed earlier ::::::::: </echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/create_vegbank_views.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<!-- THIS IS ONLY NEEDED FOR OLD DATABASE UPGRADES, but this is creating a fresh db: <echo>************** applying vegbank-changes for version ${version} ****************</echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/vegbank-changes-${version}.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql> -->
<echo>************** creating admin user ****************</echo>
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/create_admin_user.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
<echo>************** populate data dictionary ****************</echo>
<antcall target="populateDD" />
<echo>************** now verifying that database is correct ****************</echo>
<antcall target="dbVerify" />
<echo>***************************************************************</echo>
<echo>Your database is now created. Please login as the user
'admin@vegbank.org' with password 'vbadmin' and change the password
ASAP. This user is the super user and will allow you to create other
accounts.</echo>
<echo>***************************************************************</echo>
</target>
<!-- populates the data dictionary tables by getting db_model_vegbank.xml
styled into SQL -->
<target name="populateDD" depends="generateDBSQL">
<sql driver="${databaseDriverClass}"
url="${databaseConnectString}"
userid="${databaseUser}"
password="${databaseUserPassword}"
src="${buildDir}/sql/populate-datadictionary.sql"
onerror="continue"
autocommit="true">
<classpath>
<pathelement location="${jdbc-jar}"/>
</classpath>
</sql>
</target>
<!-- this target resets the admin password to the default -->
<target name="seedAdminPassword" depends="jar">
<java classname="org.vegbank.common.utility.UserDatabaseAccess" fork="true" classpath="${classpath}:build/vegbank.jar">
<arg line="seedAdmin"/>
</java>
</target>
<!-- this target updates all of the passwords in the usr table to use an MD5
digest instead of clear text-->
<target name="updateAllPasswords" depends="jar">
<java classname="org.vegbank.common.utility.UserDatabaseAccess" fork="true" classpath="${classpath}:build/vegbank.jar">
<arg line="convertPasswords"/>
</java>
</target>
</project>