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: tao $'
10
  *    '$Date: 2004-06-07 13:20:08 -0700 (Mon, 07 Jun 2004) $'
11
  *    '$Revision: 2180 $'
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://${httpserver}"/>
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="eml2_0_0namespace"       value="eml://ecoinformatics.org/eml-2.0.0" />
183
      <property name="eml2_1_0namespace"       value="eml://ecoinformatics.org/eml-2.1.0" />
184
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
185
      <property name="eml-css"             value="eml_xsl.css"/>
186
      <property name="eml-module.default.css"
187
                                           value="default.css"/>
188
      <property name="conversion-module"   value="webmdentry" />
189

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
390
   <target name="geteml2+" depends="prepare"
391
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
392
     <echo>Enter CVS password: </echo>
393
     <cvs cvsRoot="${cvsroot}"
394
          package="${eml-module}"
395
          tag="${eml2-tag}"
396
          dest="${build.tmp}/eml_${eml2-tag}" />
397
     <mkdir dir="lib/schema" />
398
     <copy todir="lib/schema" filtering="yes">
399
       <fileset dir="${build.tmp}/eml_${eml2-tag}/${eml-module}">
400
         <include name="*.xsd"/>
401
       </fileset>
402

    
403
       <!-- shouldn't we have a mapper here like this??
404
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
405

    
406
       Jing's code didn't nave one - does it need to be added?
407
       NOTE that eml-version is set to beta 6, so this would need changing -->
408

    
409
     </copy>
410
     <antcall target="copyxsl">
411
        <param name="cvs.tagname" value="${eml2-tag}" />
412
     </antcall>
413
   </target>
414

    
415

    
416

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

    
420
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
421

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

    
428

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

    
434
   </target>
435

    
436

    
437

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

    
450
   <target name="schemasql" depends="prepare"
451
            description="Registers the Schema with the new Metacat instance">
452
     <echo/>
453
     <echo>Registering the Schema with the new Metacat instance...</echo>
454
     <sql driver="${dbDriver}"
455
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
456
          url="${jdbc-connect}"
457
          userid="${user}"
458
          password="${password}"
459
          src="${build.src}/loadschema.sql" />
460
   </target>
461

    
462
   <target name="installdb" depends="prepare"
463
            description="Installs the database tables">
464
     <echo/>
465
     <echo>Installing the database tables...</echo>
466
     <sql driver="${dbDriver}"
467
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
468
          url="${jdbc-connect}"
469
          userid="${user}"
470
          password="${password}"
471
          src="${build.src}/${install-sql}" />
472
   </target>
473

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

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

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

    
510
   <target name="install" depends="war" description="* Full Install *">
511
       <mkdir dir="${datafilepath}" />
512
       <mkdir dir="${inlinedatafilepath}" />
513
       <chmod dir="${datafilepath}" perm="ug+w" />
514
       <mkdir dir="${temp-dir}"/>
515
       <chmod dir="${temp-dir}" perm="ug+w" />
516
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
517
   </target>
518

    
519
   <target name="upgrade" depends="install"
520
          description="* Upgrade an existing metacat installation with a new version *">
521
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
522
   </target>
523

    
524
   <target name="install-registry" depends="init,getConversionXSL"
525
            description="Install Registry">
526

    
527
      <copy file="${srcdir}/perl/register-dataset.cgi"
528
            todir="${inst.cgi.dir}" filtering="yes"/>
529
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
530

    
531
      <mkdir dir="${temp-dir}" />
532
     <copy todir="${temp-dir}" filtering="yes">
533
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
534
         <include name="*.xsl"/>
535
         <include name="*.xml"/>
536
       </fileset>
537
     </copy>
538

    
539
      <echo message="Install Registry completed." />
540
   </target>
541

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

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

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

    
563
      <echo message="Install Skin completed." />
564
   </target>
565

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

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

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

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

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

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

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

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

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

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

    
672
        <formatter type="plain" />
673

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

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

    
685
              <echo>testtorun: ${testtorun}</echo>
686

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

    
695
        <formatter type="plain" />
696

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

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

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

    
733
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
734
   <target name="nettest" depends="install"
735
            description="compiles and runs the metacatnettest code">
736

    
737
      <echo>***********************************
738
      Please run ant gethttpclient first!
739
      ***********************************
740
      </echo>
741
      <!-- copy and compile the tests into a jar file -->
742
      <mkdir dir="${build.metacatnettest}"/>
743
      <javac srcdir="${junitnettestsdir}"
744
             destdir="${build.metacatnettest}"
745
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
746
             includes="**/*.java" />
747

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

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

    
760
        <formatter type="plain" />
761

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

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

    
775

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

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

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

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

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

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

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

    
858
   <target name="stylesheettest">
859
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
860
      <param name="displaymodule" expression="${displaymodule}"/>
861
      <param name="docid" expression="${input}"/>
862
      <param name="entitytype" expression="${entitytype}"/>
863
      <param name="entityindex" expression="${entityindex}"/>
864
      <outputproperty name="method" value="html"/>
865
      <outputproperty name="standalone" value="yes"/>
866
      <outputproperty name="encoding" value="iso8859_1"/>
867
      <outputproperty name="indent" value="yes"/>
868
    </xslt>
869
  </target>
870

    
871
 <target name="gridinit" depends="init">
872
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
873
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
874
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
875
   <property environment="env"/>
876
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
877
    <path id="webservicepath">
878
        <pathelement location="."/>
879
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
880
        <pathelement location="${build.dest}"/>
881
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
882
           <include name="*.jar"/>
883
        </fileset>
884
      </path>
885
</target>
886

    
887
 <target name="gridprepare" depends="gridinit, prepare">
888
 </target>
889

    
890
  <target name="compileinterface" depends="clean, gridprepare">
891
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
892
  </target>
893

    
894
  <target name="generateWSDL" depends="compileinterface">
895
    <echo message="Generating wsdl from ${interface.name} interface"/>
896
    <java classname="${java2wsdl.tool}"
897
          dir="${build.src}" fork="yes"
898
          classpathref="webservicepath"  failonerror="true" >
899
      <arg value="-P"/>
900
      <arg value="${interface.name}PortType"/>
901
      <arg value="-S"/>
902
      <arg value="${interface.name}Service"/>
903
      <arg value="-y"/>
904
      <arg value="WRAPPED"/>
905
      <arg value="-u"/>
906
      <arg value="LITERAL"/>
907
      <arg value="-l"/>
908
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
909
      <arg value="-n"/>
910
      <arg value="http://${services.namespace}/${interface.name}"/>
911
      <arg value="${interface.package}.${interface.name}"/>
912
    </java>
913
  </target>
914

    
915
   <target name="decorateWSDL" depends="generateWSDL">
916
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
917
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
918
            fork="yes"
919
            classpathref="webservicepath" failonerror="true" >
920
        <arg value="${binding.file}"/>
921
        <arg value="${wsdl.file}"/>
922
      </java>
923
   </target>
924

    
925
   <target name="generatestubs" depends="decorateWSDL">
926
      <echo message=" Generating stubs " />
927
      <echo message="wsdl file is ${wsdl.file}"/>
928
      <echo message="build.src is ${build.src}"/>
929
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
930
            classpathref="webservicepath" failonerror="true" >
931
         <arg value="${wsdl.file}"/>
932
    </java>
933
  </target>
934

    
935
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
936
     <echo message=" Compiling stubs " />
937
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
938
     <echo message=" Compiling impl " />
939
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
940
  </target>
941

    
942
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
943
     <echo message=" jar stubs classes " />
944
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
945
     <echo message=" jar impl classes " />
946
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
947
  </target>
948

    
949
  <target name="gar" depends="jarStubsAndImpl">
950
     <echo message=" jar the gar file"/>
951
     <mkdir dir="${build.dir}/gar"/>
952
     <mkdir dir="${build.dir}/gar/schema/edu"/>
953
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
954
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
955
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
956
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
957
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
958
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
959
  </target>
960

    
961
  <target name="compilewebclient" depends="prepare">
962
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
963
  </target>
964

    
965
  <target name="runwebclient" depends="compilewebclient">
966
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
967
           dir="${build.dest}" fork="yes"
968
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
969
         <arg value="${serviceUrl}"/>
970
         <arg value="${docid}"/>
971
     </java>
972
  </target>
973
</project>
(5-5/5)