Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: costa $'
10
  *    '$Date: 2004-04-26 13:29:10 -0700 (Mon, 26 Apr 2004) $'
11
  *    '$Revision: 2135 $'
12
  *
13
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15
  *
16
  * usage: ant [compile|jar|install|jdoc]
17
  *
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License as published by
20
  * the Free Software Foundation; either version 2 of the License, or
21
  * (at your option) any later version.
22
  *
23
  * This program is distributed in the hope that it will be useful,
24
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
  * GNU General Public License for more details.
27
  *
28
  * You should have received a copy of the GNU General Public License
29
  * along with this program; if not, write to the Free Software
30
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir=".">
33

    
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35

    
36
  <target name="check-db">
37
    <condition property="use-oracle">
38
      <equals arg1="${database}" arg2="oracle" />
39
    </condition>
40
    <condition property="use-postgresql">
41
      <equals arg1="${database}" arg2="postgresql" />
42
    </condition>
43
    <condition property="use-sqlserver">
44
      <equals arg1="${database}" arg2="sqlserver" />
45
    </condition>
46
  </target>
47

    
48
  <target name="oracle" if="use-oracle">
49
     <!-- Customize these properties if you are using oracle -->
50
     <echo message="Using oracle..."/>
51
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
52
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
53
     <property name="jdbc" value="${jdbc_base}/classes111.zip" />
54
     <!-- Property to indicate is not MSSQL installation-->
55
     <property name="other" value="yes"/>
56
     <property name="install-sql" 
57
               value="xmltables.sql" />
58
     <property name="upgrade-1.2-sql" 
59
               value="upgrade-db-to-1.2.sql" />
60
     <property name="upgrade-1.3-sql" 
61
               value="upgrade-db-to-1.3.sql" />
62
     <property name="upgrade-1.4-sql" 
63
               value="upgrade-db-to-1.4.sql" />
64
   </target>
65

    
66
   <target name="postgresql" if="use-postgresql">
67
     <!-- Customize these properties if you are using postgres -->
68
     <echo message="Using PostgreSQL..."/>
69
     <property name="dbDriver" value="org.postgresql.Driver"/>
70
     <property name="dbAdapter"
71
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
72
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
73
     <!-- Property to indicate is not MSSQL installation-->
74
     <property name="other" value="yes"/>
75
     <property name="install-sql" 
76
               value="xmltables_postgres.sql" />
77
     <property name="upgrade-1.2-sql" 
78
               value="upgrade-db-to-1.2_postgres.sql" />
79
     <property name="upgrade-1.3-sql" 
80
               value="upgrade-db-to-1.3_postgres.sql" />
81
     <property name="upgrade-1.4-sql" 
82
               value="upgrade-db-to-1.4_postgres.sql" />
83
    </target>
84
   
85
   <target name="sqlserver" if="use-sqlserver">
86
     <!-- Customize these properties if you are using SQL server -->
87
     <echo message="Using SQL Server..."/>
88
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
89
     <property name="dbAdapter"
90
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
91
     <property name="jdbc" value="${jdbc-base}/msbase.jar" />
92
     <property name="jdbc-add1" value="${jdbc-base}/msutil.jar" />
93
     <property name="jdbc-add2" value="${jdbc-base}/mssqlserver.jar" />
94
     <!-- Property to indicate is a MSSQL installation-->
95
     <property name="MSSQL" value="yes"/>
96
     <property name="install-sql" 
97
               value="xmltables-sqlserver.sql" />
98
   </target>
99

    
100
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
101
      <!-- usr for client testing, generally you don't need change-->
102
      <property name="mcuser" value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org"/>
103
      <property name="mcpassword" value=""/>
104
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
105
      <property name="mcanotherpassword" value=""/>
106

    
107
      <property name="debug" value="on" />
108
      <property name="debuglevel" value="55" />
109

    
110
      <property name="morphosourcedir" value="../morpho" />
111
      <property name="defaultcontenttype" value="application/octet-stream" />
112
      <property name="utilitiesdir" value="../utilities" />
113
    
114
      <!-- Make sure these paths match the location of the jar files
115
           on your system, the defaults should usually work -->
116
      <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
117
        <equals arg1="${tomcatversion}" arg2="tomcat3" />
118
      </condition>
119
      <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
120
        <equals arg1="${tomcatversion}" arg2="tomcat4" />
121
      </condition>
122
      <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
123
        <equals arg1="${tomcatversion}" arg2="tomcat5" />
124
      </condition>
125
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
126
      <echo>*********** set jsdk to ${jsdk}</echo>
127
      <property name="xmlp"
128
                value="lib/xercesImpl.jar" />
129
      <property name="cos"
130
                value="lib/cos.jar" />
131
      <property name="morpho"
132
                value="lib/morpho.jar" />
133
      <property name="xalan"
134
                value="lib/xalan/xalan.jar" />
135
      <property name="apis"
136
                value="lib/xalan/xml-apis.jar" />
137
      <property name="httpclient"
138
                value="lib/httpclient.jar" />
139
      <property name="emlparser"
140
                value="lib/eml.jar" />
141
      <property name="configxml"
142
                value="lib/configxml.jar" />
143
      <property name="itislib"
144
                value="lib/itislib.jar" />
145
      <property name="emlparser"
146
      
147
                value="lib/eml.jar" />
148
      <property name="util"
149
                value="lib/utilities.jar" />
150
  </target>
151

    
152
   <target name="init" depends="config">
153
      <!-- It is less likely you'll need to make any changes from here down,
154
           but customization is possible -->
155
      <property name="installdir"          value="${webapps}/${context}" />
156
      <property name="temp-dir"            value="/tmp/${context}" />
157
      <property name="name"                value="metacat"/>
158
      <property name="Name"                value="MetaCat"/>
159
      <property name="debugprefix"         value="${Name}:"/>
160
      <property name="release"             value="1.4.0"/>
161
      <property name="replication-path"    value="/${context}/servlet/replication"/>
162
      <property name="servlet-path"        value="/${context}/metacat"/>
163
      <property name="html-path"           value="/${context}"/>
164
      <property name="systemidserver"      value="http://${server}"/>
165
      <property name="style-common-relpath" 
166
                                           value="/style/common"/>
167
      <property name="style-common-cvsrelpath" 
168
                                           value="lib${style-common-relpath}"/>
169
      <property name="style-common-fullpath" 
170
                                           value="/${installdir}${style-common-relpath}"/>
171
      <property name="style-common-path" 
172
                                           value="/${context}${style-common-relpath}"/>
173
      <property name="style-skins-relpath" value="/style/skins"/>
174
      <property name="style-skins-path"    value="/${context}${style-skins-relpath}"/>
175
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
176
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
177
      <property name="config-dir"          value="${webapps}/${style-skins-path}" />
178
      <property name="eml-module"          value="eml" />
179
      <property name="eml-version"         value="2.0.0beta6" />
180
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
181
      <property name="eml2-tag"            value="EML_2_0_0_FOR_METACAT" />
182
      <property name="eml2namespace"       value="eml://ecoinformatics.org/eml-2.0.0" />
183
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
184
      <property name="eml-css"             value="eml_xsl.css"/>
185
      <property name="eml-module.default.css"
186
                                           value="default.css"/>
187
      <property name="conversion-module"   value="webmdentry" />
188

    
189
      <!-- Config for registry variables -->
190
      <property name="scope"               value="obfs"/>
191
      <property name="responseForm"        value="genericResponse.tmpl"/>
192
      <property name="entryForm"           value="entryForm.tmpl"/>
193
      <property name="guide"               value="genericGuide.tmpl"/>
194
      <property name="confirmData" value="confirmData.tmpl"/>
195
      <property name="deleteData" value="deleteData.tmpl"/>
196
      <property name="genericHeader" value="genericHeader.tmpl"/>
197
      <property name="genericFooter" value="genericFooter.tmpl"/>
198
      <property name="adminname" value="KNB Support"/>
199
      <property name="recipient" value="knb-software\@nceas.ucsb.edu"/>
200
      <filter token="scope" value="${scope}"/>
201
      <filter token="responseForm" value="${responseForm}"/>
202
      <filter token="entryForm" value="${entryForm}"/>
203
      <filter token="guide" value="${guide}"/>      
204
      <filter token="confirmData" value="${confirmData}"/>
205
      <filter token="deleteData" value="${deleteData}"/>
206
      <filter token="genericHeader" value="${genericHeader}"/>
207
      <filter token="genericFooter" value="${genericFooter}"/>
208
      <filter token="adminname" value="${adminname}"/>
209
      <filter token="recipient" value="${recipient}"/>
210

    
211
      <property name="cpath"
212
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${cos}:${morpho}:${emlparser}:${jdbc-add1}:${jdbc-add2}:${util}:${httpclient}"/>
213

    
214
      <filter token="docrooturl" value="./" />
215
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
216
      <filter token="dbDriver" value="${dbDriver}"/>
217
      <filter token="dbAdapter" value="${dbAdapter}"/>
218
      <filter token="install-dir" value="${installdir}"/>
219
      <filter token="temp-dir" value="${temp-dir}"/>
220
      <filter token="server" value="${server}"/>
221
      <filter token="systemidserver" value="${systemidserver}"/>
222
      <filter token="cgi-prefix" value="${cgi-prefix}"/>
223
      <filter token="ldapUrl" value="${ldapUrl}"/>
224
      <filter token="replication-log" value="${replication-log}"/>
225
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
226
      <filter token="release" value="${release}"/>
227
      <filter token="servlet-path" value="${servlet-path}"/>
228
      <filter token="html-path" value="${html-path}"/>
229
      <filter token="user" value="${user}"/>
230
      <filter token="password" value="${password}"/>
231
      <filter token="mcuser" value="${mcuser}"/>
232
      <filter token="mcpassword" value="${mcpassword}"/>
233
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
234
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
235
      <filter token="knb-site-url" value="${knb-site-url}"/>
236
      <filter token="eml-css" value="${eml-css}"/>
237
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
238
      <filter token="style-skins-path" value="${style-skins-path}"/>
239
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
240
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
241
      <filter token="style-common-path" value="${style-common-path}"/>
242
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
243
      <filter token="style-path" value="${style-skins-path}"/>
244
      <filter token="replication-path" value="${replication-path}"/>
245
      <filter token="config-dir" value="${config-dir}"/>
246
      <filter token="default-style" value="${default-style}"/>
247
      <filter token="eml-version" value="${eml-version}"/>
248
      <filter token="eml2namespace" value="${eml2namespace}"/>
249
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
250
      <filter token="context" value="${context}"/>
251
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
252
      <filter token="debuglevel" value="${debuglevel}" />
253
      <filter token="datafilepath" value="${datafilepath}" />
254
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
255
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
256
      <filter token="debugprefix" value="${debugprefix}"/>
257

    
258
      <property name="srcdir" value="./src" />
259
      <property name="testdir" value="./test" />
260
      <property name="testtorun" value="MetacatClientTest" />
261
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
262
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
263
      <property name="build.dir" value="./build"/>
264
      <property name="build.src" value="${build.dir}/src"/>
265
      <property name="build.dest" value="${build.dir}/classes"/>
266
      <property name="build.docs" value="${build.dir}/docs"/>
267
      <property name="build.samples" value="${build.dir}/samples"/>
268
      <property name="build.tests" value="${build.dir}/tests"/>
269
      <property name="build.tmp" value="${build.dir}/tmp"/>
270
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
271
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
272
      <property name="build.data" value="${build.dir}/data"/>
273
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
274
      <property name="build.war" value="${build.dir}/war"/>
275

    
276
      <property name="dist.dir" value="dist"/>
277
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
278
      <property name="ver.src" value="${ver.dir}/src"/>
279

    
280
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
281
   </target>
282

    
283
   <target name="prepare" depends="init">
284
      <mkdir dir="${build.dir}"/>
285
      <mkdir dir="${build.src}"/>
286
      <mkdir dir="${build.dest}"/>
287
      <mkdir dir="${build.javadocs}"/>
288
      <mkdir dir="${build.tmp}"/>
289

    
290
      <copy todir="${build.src}" filtering="yes">
291
        <fileset dir="${srcdir}">
292
          <include name="edu/**"/>
293
          <include name="com/**"/>
294
          <include name="**/*.sql"/>
295
          <exclude name="**/CVS*"/>
296
          <exclude name="**/.#*"/>
297
        </fileset>
298
      </copy>
299
      <available file="build/tmp/${conversion-module}" type="dir" 
300
                 property="styles.not.needed"/>
301
   </target>
302

    
303
   <target name="compile" depends="prepare,utilities"
304
    description="Compiles java code to build dir, and copies metacat props files there">
305

    
306
       <javac srcdir="${build.src}"
307
              destdir="${build.dest}"
308
              classpath="${cpath}"
309
              debug="${debug}"
310
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
311
   </target>
312

    
313
   <target name="jar" depends="compile"
314
    description="Compiles and jars metacat java code to metacat.jar in build dir">
315

    
316
       <delete file="${build.dir}/${name}.jar" />
317
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
318
            excludes="**/protocols/ **/harvesterClient/" />
319
   </target>
320

    
321
   <target name="protocol" depends="compile"
322
    description="Compiles and jars protocol java code to protocol.jar in build dir">
323
       <delete file="${build.dir}/protocol.jar" />
324
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
325
            includes="**/protocols/" />
326
   </target>
327

    
328
   <target name="utilities" depends="config">
329
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
330
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
331
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
332
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
333
   </target>
334

    
335
   <target name="client" depends="utilities, prepare"
336
    description="Compiles metacat-client java code to build dir">
337
       <javac srcdir="${build.src}"
338
              destdir="${build.dest}"
339
              classpath="${cpath}"
340
              includes="edu/ucsb/nceas/metacat/client/*" />
341
   </target>
342

    
343
   <target name="clientjar" depends="client"
344
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
345
       <delete file="${build.dir}/${name}-client.jar" />
346
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
347
            includes="**/metacat/client/" />
348
   </target>
349

    
350
   <target name="harvester" depends="client"
351
           description="Compiles harvester java code to build dir">
352
       <echo message="classpath is:   ${cpath}"/>
353
       <javac srcdir="${build.src}"
354
              destdir="${build.dest}"
355
              classpath="${cpath}"
356
              includes="edu/ucsb/nceas/metacat/harvesterClient/*" />
357
   </target>
358

    
359
   <target name="harvesterjar" depends="harvester"
360
           description="Compiles and jars harvester java code to harvester.jar in build dir">
361
       <delete file="${build.dir}/harvester.jar" />
362
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
363
            includes="**/metacat/harvesterClient/" />
364
   </target>
365

    
366
   <target  name="geteml" depends="getemlpre2,geteml2+" 
367
            description="Calls getemlpre2 and geteml2+ targets" />
368

    
369
   <target name="getemlpre2" depends="prepare"
370
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
371
     <echo>Enter CVS password: </echo>
372
     <cvs cvsRoot="${cvsroot}"
373
          package="${eml-module}"
374
          tag="${eml-tag}"
375
          dest="${build.tmp}/eml_${eml-tag}" />
376
     <mkdir dir="lib/dtd" />
377
     <copy todir="lib/dtd" filtering="yes">
378
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
379
         <include name="*.dtd"/>
380
       </fileset>
381
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
382
     </copy>
383
     <antcall target="copyxsl">
384
        <param name="cvs.tagname" value="${eml-tag}" />
385
     </antcall>
386
   </target>
387

    
388
   <target name="geteml2+" depends="prepare"
389
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
390
     <echo>Enter CVS password: </echo>
391
     <cvs cvsRoot="${cvsroot}"
392
          package="${eml-module}"
393
          tag="${eml2-tag}"
394
          dest="${build.tmp}/eml_${eml2-tag}" />
395
     <mkdir dir="lib/schema" />
396
     <copy todir="lib/schema" filtering="yes">
397
       <fileset dir="${build.tmp}/eml_${eml2-tag}/${eml-module}">
398
         <include name="*.xsd"/>
399
       </fileset>
400
       
401
       <!-- shouldn't we have a mapper here like this??
402
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
403
       
404
       Jing's code didn't nave one - does it need to be added? 
405
       NOTE that eml-version is set to beta 6, so this would need changing -->
406
     
407
     </copy>
408
     <antcall target="copyxsl">
409
        <param name="cvs.tagname" value="${eml2-tag}" />
410
     </antcall>
411
   </target>
412
   
413
   
414

    
415
   <target  name="copyxsl" 
416
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
417

    
418
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
419
     
420
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
421
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style">
422
       <include name="**/*.xsl"/>
423
     </fileset>
424
     </copy>
425
     
426

    
427
     <!-- now copy default css from eml module and put it in style-common-path 
428
          dir with a new name, so other skin-specific css can import it if reqd -->
429
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
430
           tofile="${style-common-cvsrelpath}/${eml-css}" />
431

    
432
   </target>
433
   
434
   
435
   
436
   <target name="dtdschemasql" depends="prepare"
437
   description="Registers the DTDs with the new Metacat instance">
438
     <echo/>
439
     <echo>Registering the DTDs with the new Metacat instance...</echo>
440
     <sql driver="${dbDriver}"
441
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
442
          url="${jdbc-connect}"
443
          userid="${user}"
444
          password="${password}"
445
          src="${build.src}/loaddtdschema.sql" />
446
   </target>
447

    
448
   <target name="schemasql" depends="prepare"
449
            description="Registers the Schema with the new Metacat instance">
450
     <echo/>
451
     <echo>Registering the Schema with the new Metacat instance...</echo>
452
     <sql driver="${dbDriver}"
453
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
454
          url="${jdbc-connect}"
455
          userid="${user}"
456
          password="${password}"
457
          src="${build.src}/loadschema.sql" />
458
   </target>
459
   
460
   <target name="installdb" depends="prepare"
461
            description="Installs the database tables">
462
     <echo/>
463
     <echo>Installing the database tables...</echo>
464
     <sql driver="${dbDriver}"
465
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
466
          url="${jdbc-connect}"
467
          userid="${user}"
468
          password="${password}"
469
          src="${build.src}/${install-sql}" />
470
   </target>
471

    
472
   <target name="upgrade12" depends="prepare"
473
            description="Updates the database tables to upgrade to version 1.2">
474
     <echo/>
475
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
476
     <sql driver="${dbDriver}"
477
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
478
          url="${jdbc-connect}"
479
          userid="${user}"
480
          password="${password}"
481
          src="${build.src}/${upgrade-1.2-sql}" />
482
   </target>
483

    
484
   <target name="upgrade13" depends="prepare"
485
            description="Updates the database tables to upgrade to version 1.3">
486
     <echo/>
487
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
488
     <sql driver="${dbDriver}"
489
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
490
          url="${jdbc-connect}"
491
          userid="${user}"
492
          password="${password}"
493
          src="${build.src}/${upgrade-1.3-sql}" />
494
   </target>
495

    
496
   <target name="upgrade14" depends="prepare"
497
            description="Updates the database tables to upgrade to version 1.4">
498
     <echo/>
499
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
500
     <sql driver="${dbDriver}"
501
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
502
          url="${jdbc-connect}"
503
          userid="${user}"
504
          password="${password}"
505
          src="${build.src}/${upgrade-1.4-sql}" />
506
   </target>
507

    
508
   <target name="install" depends="war" description="* Full Install *">
509
       <mkdir dir="${datafilepath}" />
510
       <mkdir dir="${inlinedatafilepath}" />
511
       <chmod dir="${datafilepath}" perm="ug+w" />
512
       <mkdir dir="${temp-dir}"/>
513
       <chmod dir="${temp-dir}" perm="ug+w" />
514
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
515
   </target>
516
   
517
   <target name="upgrade" depends="install" 
518
          description="* Upgrade an existing metacat installation with a new version *">
519
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
520
   </target>
521

    
522
   <target name="install-registry" depends="init,getConversionXSL" 
523
            description="Install Registry">
524
            
525
      <copy file="${srcdir}/perl/register-dataset.cgi"
526
            todir="${inst.cgi.dir}" filtering="yes"/>
527
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
528
  
529
      <mkdir dir="${temp-dir}" />
530
     <copy todir="${temp-dir}" filtering="yes">
531
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
532
         <include name="*.xsl"/>
533
         <include name="*.xml"/>
534
       </fileset>
535
     </copy>
536

    
537
      <echo message="Install Registry completed." />
538
   </target>
539

    
540
   <target name="install-skin" depends="init" 
541
            description="Install a Skin">
542

    
543
      <input message="Please enter name of the skin" 
544
             addproperty="skin-name"/>
545

    
546
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
547
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
548
       <fileset dir="lib/style/skins/${skin-name}">
549
           <include name="*.*"/>
550
           <exclude name="*.png"/>
551
           <exclude name="*.gif"/>
552
       </fileset>
553
      </copy>
554
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
555
       <fileset dir="lib/style/skins/${skin-name}">
556
           <include name="*.png"/>
557
           <include name="*.gif"/>
558
       </fileset>
559
      </copy>
560

    
561
      <echo message="Install Skin completed." />
562
   </target>
563

    
564
   <target name="war" depends="warPrepare,warMSSQL"
565
            description="Create a web archive (WAR) for servlet deployment">
566
       <war destfile="${build.dir}/${context}.war" 
567
            webxml="${build.war}/web.xml">
568
         <fileset dir="${war.context}"/>
569
         <lib dir="${war.lib}"/>
570
         <webinf dir="${war.webinf}"/>
571
       </war>
572
   </target>
573

    
574
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
575
            description="Prepare files for creating a web archive (WAR)">
576

    
577
       <property name="war.lib" value="${build.war}/lib" />
578
       <property name="war.webinf" value="${build.war}/WEB-INF" />
579
       <property name="war.context" value="${build.war}/${context}" />
580
       <mkdir dir="${war.lib}" />
581
       <mkdir dir="${war.webinf}" />
582
       <mkdir dir="${war.context}" />
583

    
584
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
585
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
586
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
587
       <copy todir="${war.lib}" filtering="no">
588
         <fileset dir="lib">
589
           <include name="*.jar"/>
590
         </fileset>
591
         <fileset dir="lib/xalan">
592
           <include name="*.jar"/>
593
         </fileset>
594
       </copy>
595
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
596
       <copy file="lib/web.xml.${tomcatversion}"
597
             tofile="${build.war}/web.xml" />
598
       <copy file="lib/metacat.properties" todir="${war.webinf}"
599
             filtering="yes" />
600
       <copy todir="${war.context}" filtering="no">
601
         <fileset dir="lib">
602
           <include name="**/*.jpg"/>
603
           <include name="**/*.png"/>
604
           <include name="**/*.gif"/>
605
         </fileset>
606
       </copy>
607
       <copy todir="${war.context}" filtering="yes">
608
         <fileset dir="lib">
609
           <exclude name="*.jar"/>
610
           <exclude name="*.properties"/>
611
           <exclude name="web.xml"/>
612
           <exclude name="**/*.jpg"/>
613
           <exclude name="**/*.png"/>
614
           <exclude name="**/*.gif"/>
615
         </fileset>
616
       </copy>
617
       <copy todir="${war.context}" filtering="no">
618
         <fileset dir="lib">
619
           <include name="**/*.jpg"/>
620
           <include name="**/*.png"/>
621
           <include name="**/*.gif"/>
622
         </fileset>
623
       </copy>
624
   </target>
625

    
626
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
627
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
628
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
629
   </target>
630

    
631
   <target name="getConversionXSL" depends="prepare" 
632
            unless="styles.not.needed"
633
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
634
     <echo>Enter CVS password: </echo>
635
     <cvs cvsRoot="${cvsroot-alternate}"
636
          package="${conversion-module}"
637
          dest="${build.tmp}" />
638
   </target>
639

    
640
   <target name="testprep" depends="jar,clientjar,harvesterjar">
641
      <mkdir dir="${build.tests}"/>
642
      <copy todir="${build.tests}" filtering="yes">
643
        <fileset dir="${testdir}">
644
          <include name="edu/**"/>
645
        </fileset>
646
      </copy>
647
      <!-- copy and compile the tests into a jar file -->
648
      <javac srcdir="${build.tests}"
649
             destdir="${build.tests}"
650
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
651
             debug="on"
652
       includes="**/*.java" />
653

    
654
      <jar jarfile="${build.dir}/${name}-junittests.jar"
655
        basedir="${build.tests}"
656
                includes="**/*.class" />
657
   </target>
658

    
659
   <target name="test" depends="testprep"
660
            description="Uses the ant junit task to run all JUnit tests">
661

    
662
      <!-- use the ant "junit" task to run JUnit tests. -->
663
      <junit printsummary="yes" haltonfailure="no" fork="yes"
664
             haltonerror="no">
665
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
666
        <classpath>
667
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
668
        </classpath>
669

    
670
        <formatter type="plain" />
671

    
672
        <batchtest fork="yes" todir="${build.dir}">
673
          <fileset dir="${build.tests}">
674
            <include name="**/*.class" />
675
          </fileset>
676
        </batchtest>
677
     </junit>
678
   </target>
679

    
680
    <target name="runonetest" depends="testprep"
681
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
682

    
683
              <echo>testtorun: ${testtorun}</echo>
684

    
685
      <!-- use the ant "junit" task to run JUnit tests. -->
686
      <junit printsummary="yes" haltonfailure="no" fork="yes"
687
             haltonerror="no">
688
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
689
        <classpath>
690
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
691
        </classpath>
692

    
693
        <formatter type="plain" />
694

    
695
        <batchtest fork="yes" todir="${build.dir}">
696
          <fileset dir="${build.tests}">
697
            <include name="**/${testtorun}.class" />
698
          </fileset>
699
        </batchtest>
700
     </junit>
701
   </target>
702

    
703
   <target name="testharvester" 
704
           depends="testprep"
705
           description="Uses the ant junit task to test only the Harvester code">
706
     <junit printsummary="yes" 
707
            haltonfailure="off" 
708
            fork="yes"
709
            haltonerror="off">
710
       <classpath>
711
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
712
       </classpath>
713
       <formatter type="plain" />
714
       <batchtest fork="yes" todir="${build.dir}">
715
         <fileset dir="${build.tests}">
716
           <include name="**/harvesterClient/*.class" />
717
         </fileset>
718
       </batchtest>
719
     </junit>
720
   </target>
721

    
722
  <target name="gethttpclient" depends="prepare"
723
            description="checks out and compiles morpho httpclient code">
724
  <!--mkdir dir="${morphosourcedir}" -->
725
        <cvs cvsRoot="${cvsroot}"
726
             package="morpho"
727
             dest="." />
728
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
729
   </target>
730

    
731
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
732
   <target name="nettest" depends="install"
733
            description="compiles and runs the metacatnettest code">
734
            
735
      <echo>***********************************
736
      Please run ant gethttpclient first!
737
      ***********************************
738
      </echo>
739
      <!-- copy and compile the tests into a jar file -->
740
      <mkdir dir="${build.metacatnettest}"/>
741
      <javac srcdir="${junitnettestsdir}"
742
             destdir="${build.metacatnettest}"
743
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
744
             includes="**/*.java" />
745

    
746
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
747
                    basedir="${build.metacatnettest}"
748
                    includes="**/*.class" />
749

    
750
      <!-- use the ant "junit" task to run JUnit tests. -->
751
      <junit printsummary="yes" haltonfailure="no" fork="yes"
752
             haltonerror="no">
753
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
754
        <classpath>
755
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
756
        </classpath>
757

    
758
        <formatter type="plain" />
759

    
760
        <batchtest fork="yes" todir="${build.dir}">
761
          <fileset dir="${build.metacatnettest}">
762
            <include name="**/*.class" />
763
          </fileset>
764
        </batchtest>
765
     </junit>
766
   </target>
767

    
768
   <target name="cleanweb" depends="clean"
769
            description="deletes tomcat web context dir and all its contents">
770
     <delete dir="${installdir}" />
771
   </target>
772

    
773

    
774
   <target name="clean" depends="init"
775
            description="deletes build dir and any files copied to cvs sandbox by build process (jars, xsl) Currently *not* schema/DTDs">
776
       <delete dir="${build.dir}" />
777
       <delete file="lib/httpclient.jar" />
778
       <delete file="lib/utilities.jar" />
779
       <delete includeEmptyDirs="true" failonerror="false">
780
         <fileset dir="${style-common-cvsrelpath}">
781
           <include name="${eml-css}" />
782
           <include name="eml-*/*.xsl" />
783
           <include name="eml-*" />
784
         </fileset>
785
     </delete>
786
   </target>
787

    
788
   <target name="jdoc" depends="prepare"
789
            description="generates javadoc documentation">
790
       <javadoc packagenames="edu.ucsb.nceas.*"
791
           sourcepath="${build.src}"
792
           destdir="${build.javadocs}"
793
           author="true"
794
           version="true"
795
           use="true"
796
           windowtitle="${Name} API"
797
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
798
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
799
       />
800
   </target>
801

    
802
   <target name="dist" depends="jar,protocol,jdoc,geteml"
803
            description="prepares a full release distribution">
804
      <mkdir dir="${dist.dir}"/>
805
      <delete dir="${ver.dir}" />
806
      <mkdir dir="${ver.dir}"/>
807
      <copy todir="${ver.dir}">
808
        <fileset dir="."
809
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
810
      </copy>
811
      <copy todir="${ver.dir}" file="build.xml"/>
812
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
813
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
814

    
815
      <copy todir="${ver.dir}/docs" filtering="yes">
816
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
817
      </copy>
818
      <copy todir="${ver.dir}/docs" filtering="no">
819
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
820
      </copy>
821
      <copy todir="${ver.dir}/docs/dev">
822
        <fileset dir="${build.dir}/docs"/>
823
      </copy>
824
      <copy todir="${ver.dir}/src">
825
        <fileset dir="${build.dir}/src"/>
826
      </copy>
827

    
828
      <delete dir="./${ver.dir}/${build.dir}"/>
829
      <delete dir="./${ver.dir}/dist"/>
830
      <delete file="./${name}-${release}.zip"/>
831
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
832
      <delete file="./${name}-${release}.tar.gz" />
833
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
834
      <gzip zipfile="./${name}-${release}.tar.gz"
835
                src="./${name}-${release}.tar"/>
836
      <delete file="./${name}-${release}.tar" />
837
  </target>
838

    
839
  <target name="distsrc" depends="dist"
840
            description="prepares a source distribution">
841
      <mkdir dir="${ver.src}"/>
842
      <copy todir="${ver.src}">
843
        <fileset dir="./src"/>
844
      </copy>
845

    
846
      <delete file="./${name}-src-${release}.zip"/>
847
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
848
      <delete file="./${name}-src-${release}.tar.gz" />
849
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
850
      <gzip zipfile="./${name}-src-${release}.tar.gz"
851
                src="./${name}-src-${release}.tar"/>
852
      <delete file="./${name}-src-${release}.tar" />
853
      <delete dir="${dist.dir}"/>
854
  </target>
855

    
856
   <target name="stylesheettest">
857
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
858
      <param name="displaymodule" expression="${displaymodule}"/>
859
      <param name="docid" expression="${input}"/>
860
      <param name="entitytype" expression="${entitytype}"/>
861
      <param name="entityindex" expression="${entityindex}"/>
862
      <outputproperty name="method" value="html"/>
863
      <outputproperty name="standalone" value="yes"/>
864
      <outputproperty name="encoding" value="iso8859_1"/>
865
      <outputproperty name="indent" value="yes"/>
866
    </xslt>
867
  </target>
868
  
869
 <target name="gridinit" depends="init">
870
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
871
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
872
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
873
   <property environment="env"/>
874
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
875
    <path id="webservicepath">
876
        <pathelement location="."/>
877
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
878
        <pathelement location="${build.dest}"/>
879
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
880
           <include name="*.jar"/>
881
        </fileset>
882
      </path>
883
</target>
884

    
885
 <target name="gridprepare" depends="gridinit, prepare">
886
 </target> 
887
  
888
  <target name="compileinterface" depends="clean, gridprepare">
889
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
890
  </target>
891
  
892
  <target name="generateWSDL" depends="compileinterface">
893
    <echo message="Generating wsdl from ${interface.name} interface"/>
894
    <java classname="${java2wsdl.tool}"
895
          dir="${build.src}" fork="yes"
896
          classpathref="webservicepath"  failonerror="true" >
897
      <arg value="-P"/>
898
      <arg value="${interface.name}PortType"/>
899
      <arg value="-S"/>
900
      <arg value="${interface.name}Service"/>
901
      <arg value="-y"/>
902
      <arg value="WRAPPED"/>
903
      <arg value="-u"/>
904
      <arg value="LITERAL"/>
905
      <arg value="-l"/>
906
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
907
      <arg value="-n"/>
908
      <arg value="http://${services.namespace}/${interface.name}"/>
909
      <arg value="${interface.package}.${interface.name}"/>
910
    </java>
911
  </target>
912
  
913
   <target name="decorateWSDL" depends="generateWSDL">
914
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
915
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
916
            fork="yes"
917
            classpathref="webservicepath" failonerror="true" >
918
        <arg value="${binding.file}"/>
919
        <arg value="${wsdl.file}"/>
920
      </java>
921
   </target>
922
   
923
   <target name="generatestubs" depends="decorateWSDL">
924
      <echo message=" Generating stubs " />
925
      <echo message="wsdl file is ${wsdl.file}"/>
926
      <echo message="build.src is ${build.src}"/>
927
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
928
            classpathref="webservicepath" failonerror="true" >
929
         <arg value="${wsdl.file}"/>
930
    </java>
931
  </target>
932
  
933
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
934
     <echo message=" Compiling stubs " />
935
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
936
     <echo message=" Compiling impl " />
937
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
938
  </target>
939
  
940
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
941
     <echo message=" jar stubs classes " />
942
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
943
     <echo message=" jar impl classes " />
944
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
945
  </target>
946
  
947
  <target name="gar" depends="jarStubsAndImpl">
948
     <echo message=" jar the gar file"/>
949
     <mkdir dir="${build.dir}/gar"/>
950
     <mkdir dir="${build.dir}/gar/schema/edu"/>
951
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
952
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
953
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
954
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
955
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
956
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
957
  </target>
958
  
959
  <target name="compilewebclient" depends="prepare">
960
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
961
  </target>
962
  
963
  <target name="runwebclient" depends="compilewebclient">
964
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication" 
965
           dir="${build.dest}" fork="yes"
966
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
967
         <arg value="${serviceUrl}"/>
968
         <arg value="${docid}"/>
969
     </java>
970
  </target>
971
</project>
(5-5/5)