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: jones $'
10
  *    '$Date: 2004-09-15 08:57:11 -0700 (Wed, 15 Sep 2004) $'
11
  *    '$Revision: 2277 $'
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
  <property environment="env"/>
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=jones,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_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
182
      <property name="eml2_0_1-tag"        value="RELEASE_EML_2_0_1" />
183
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
184
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
185
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
186
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
187
      <property name="eml-css"             value="eml_xsl.css"/>
188
      <property name="eml-module.default.css"
189
                                           value="default.css"/>
190
      <property name="conversion-module"   value="webmdentry" />
191

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

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

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

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

    
281
      <property name="dist.dir" value="dist"/>
282
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
283
      <property name="ver.src" value="${ver.dir}/src"/>
284

    
285
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
286
   </target>
287

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

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

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

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

    
318
   <target name="jar" depends="compile"
319
    description="Compiles and jars metacat java code to metacat.jar in build dir">
320

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

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

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

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

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

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

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

    
371
   <target  name="geteml" depends="getemlpre2,geteml2+"
372
            description="Calls getemlpre2 and geteml2+ targets" />
373

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

    
389
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
390
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
391
       <include name="**/*.xsl"/>
392
     </fileset>
393
     </copy>
394
   </target>
395

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

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

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

    
415
     </copy>
416
     <antcall target="copyxsl">
417
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
418
        <param name="dirname" value="eml-2.0.0" />
419
     </antcall>
420

    
421
     <echo>Enter CVS password: </echo>
422
     <cvs cvsRoot="${cvsroot}"
423
          package="${eml-module}"
424
          tag="${eml2_0_1-tag}"
425
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
426
     <mkdir dir="lib/schema/eml-2.0.1" />
427
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
428
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
429
         <include name="*.xsd"/>
430
       </fileset>
431
     </copy>
432
     <antcall target="copyxsl">
433
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
434
        <param name="dirname" value="eml-2.0.1" />
435
     </antcall>
436
   </target>
437

    
438

    
439

    
440
   <target  name="copyxsl"
441
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
442

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

    
445
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
446
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
447
       <include name="**/*.xsl"/>
448
     </fileset>
449
     </copy>
450

    
451

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

    
457
   </target>
458

    
459

    
460

    
461
   <target name="dtdschemasql" depends="prepare"
462
   description="Registers the DTDs with the new Metacat instance">
463
     <echo/>
464
     <echo>Registering the DTDs with the new Metacat instance...</echo>
465
     <sql driver="${dbDriver}"
466
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
467
          url="${jdbc-connect}"
468
          userid="${user}"
469
          password="${password}"
470
          src="${build.src}/loaddtdschema.sql" />
471
   </target>
472

    
473
   <target name="schemasql" depends="prepare"
474
            description="Registers the Schema with the new Metacat instance">
475
     <echo/>
476
     <echo>Registering the Schema with the new Metacat instance...</echo>
477
     <sql driver="${dbDriver}"
478
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
479
          url="${jdbc-connect}"
480
          userid="${user}"
481
          password="${password}"
482
          src="${build.src}/loadschema.sql" />
483
   </target>
484

    
485
   <target name="installdb" depends="prepare"
486
            description="Installs the database tables">
487
     <echo/>
488
     <echo>Installing the database tables...</echo>
489
     <sql driver="${dbDriver}"
490
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
491
          url="${jdbc-connect}"
492
          userid="${user}"
493
          password="${password}"
494
          src="${build.src}/${install-sql}" />
495
   </target>
496

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

    
509
   <target name="upgrade13" depends="prepare"
510
            description="Updates the database tables to upgrade to version 1.3">
511
     <echo/>
512
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
513
     <sql driver="${dbDriver}"
514
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
515
          url="${jdbc-connect}"
516
          userid="${user}"
517
          password="${password}"
518
          src="${build.src}/${upgrade-1.3-sql}" />
519
   </target>
520

    
521
   <target name="upgrade14" depends="prepare"
522
            description="Updates the database tables to upgrade to version 1.4">
523
     <echo/>
524
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
525
     <sql driver="${dbDriver}"
526
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
527
          url="${jdbc-connect}"
528
          userid="${user}"
529
          password="${password}"
530
          src="${build.src}/${upgrade-1.4-sql}" />
531
   </target>
532

    
533
   <target name="install" depends="war" description="* Full Install *">
534
       <mkdir dir="${datafilepath}" />
535
       <mkdir dir="${inlinedatafilepath}" />
536
       <chmod dir="${datafilepath}" perm="ug+w" />
537
       <mkdir dir="${temp-dir}"/>
538
       <chmod dir="${temp-dir}" perm="ug+w" />
539
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
540
   </target>
541

    
542
   <target name="upgrade" depends="install"
543
          description="* Upgrade an existing metacat installation with a new version *">
544
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
545
   </target>
546

    
547
   <target name="install-registry" depends="init,getConversionXSL"
548
            description="Install Registry">
549

    
550
      <copy file="${srcdir}/perl/register-dataset.cgi"
551
            todir="${inst.cgi.dir}" filtering="yes"/>
552
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
553

    
554
      <mkdir dir="${temp-dir}" />
555
     <copy todir="${temp-dir}" filtering="yes">
556
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
557
         <include name="*.xsl"/>
558
         <include name="*.xml"/>
559
       </fileset>
560
     </copy>
561

    
562
      <echo message="Install Registry completed." />
563
   </target>
564

    
565
   <target name="install-skin" depends="init"
566
            description="Install a Skin">
567

    
568
      <input message="Please enter name of the skin"
569
             addproperty="skin-name"/>
570

    
571
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
572
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
573
       <fileset dir="lib/style/skins/${skin-name}">
574
           <exclude name="*.png"/>
575
           <exclude name="*.gif"/>
576
           <exclude name="*.jpg"/>
577
           <exclude name="**/CVS*"/>
578
           <exclude name="**/.#*"/>
579
       </fileset>
580
      </copy>
581
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
582
       <fileset dir="lib/style/skins/${skin-name}">
583
           <include name="*.png"/>
584
           <include name="*.gif"/>
585
           <include name="*.jpg"/>
586
           <exclude name="**/CVS*"/>
587
           <exclude name="**/.#*"/>
588
       </fileset>
589
      </copy>
590
      <!--
591
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
592
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
593
       <fileset dir="lib/style/skins/${skin-name}/images">
594
           <include name="*.png"/>
595
           <include name="*.gif"/>
596
           <include name="*.jpg"/>
597
       </fileset>
598
      </copy>
599
      -->
600

    
601
      <echo message="Install Skin completed." />
602
   </target>
603

    
604
   <target name="war" depends="warPrepare,warMSSQL"
605
            description="Create a web archive (WAR) for servlet deployment">
606
       <war destfile="${build.dir}/${context}.war"
607
            webxml="${build.war}/web.xml">
608
         <fileset dir="${war.context}"/>
609
         <lib dir="${war.lib}"/>
610
         <webinf dir="${war.webinf}"/>
611
       </war>
612
   </target>
613

    
614
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
615
            description="Prepare files for creating a web archive (WAR)">
616

    
617
       <property name="war.lib" value="${build.war}/lib" />
618
       <property name="war.webinf" value="${build.war}/WEB-INF" />
619
       <property name="war.context" value="${build.war}/${context}" />
620
       <mkdir dir="${war.lib}" />
621
       <mkdir dir="${war.webinf}" />
622
       <mkdir dir="${war.context}" />
623

    
624
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
625
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
626
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
627
       <copy todir="${war.lib}" filtering="no">
628
         <fileset dir="lib">
629
           <include name="*.jar"/>
630
         </fileset>
631
         <fileset dir="lib/xalan">
632
           <include name="*.jar"/>
633
         </fileset>
634
       </copy>
635
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
636
       <copy file="lib/web.xml.${tomcatversion}"
637
             tofile="${build.war}/web.xml" />
638
       <copy file="lib/metacat.properties" todir="${war.webinf}"
639
             filtering="yes" />
640
       <copy todir="${war.context}" filtering="no">
641
         <fileset dir="lib">
642
           <include name="**/*.jpg"/>
643
           <include name="**/*.png"/>
644
           <include name="**/*.gif"/>
645
         </fileset>
646
       </copy>
647
       <copy todir="${war.context}" filtering="yes">
648
         <fileset dir="lib">
649
           <exclude name="*.jar"/>
650
           <exclude name="*.properties"/>
651
           <exclude name="web.xml"/>
652
           <exclude name="**/*.jpg"/>
653
           <exclude name="**/*.png"/>
654
           <exclude name="**/*.gif"/>
655
         </fileset>
656
       </copy>
657
       <copy todir="${war.context}" filtering="no">
658
         <fileset dir="lib">
659
           <include name="**/*.jpg"/>
660
           <include name="**/*.png"/>
661
           <include name="**/*.gif"/>
662
         </fileset>
663
       </copy>
664
   </target>
665

    
666
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
667
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
668
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
669
   </target>
670

    
671
   <target name="getConversionXSL" depends="prepare"
672
            unless="styles.not.needed"
673
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
674
     <echo>Enter CVS password: </echo>
675
     <cvs cvsRoot="${cvsroot-alternate}"
676
          package="${conversion-module}"
677
          dest="${build.tmp}" />
678
   </target>
679

    
680
   <target name="testprep" depends="jar,clientjar,harvesterjar">
681
      <mkdir dir="${build.tests}"/>
682
      <copy todir="${build.tests}" filtering="yes">
683
        <fileset dir="${testdir}">
684
          <include name="edu/**"/>
685
        </fileset>
686
      </copy>
687
      <!-- copy and compile the tests into a jar file -->
688
      <javac srcdir="${build.tests}"
689
             destdir="${build.tests}"
690
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
691
             debug="on"
692
       includes="**/*.java" />
693

    
694
      <jar jarfile="${build.dir}/${name}-junittests.jar"
695
        basedir="${build.tests}"
696
                includes="**/*.class" />
697
   </target>
698

    
699
   <target name="test" depends="testprep"
700
            description="Uses the ant junit task to run all JUnit tests">
701

    
702
      <!-- use the ant "junit" task to run JUnit tests. -->
703
      <junit printsummary="yes" haltonfailure="no" fork="yes"
704
             haltonerror="no">
705
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
706
        <classpath>
707
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
708
        </classpath>
709

    
710
        <formatter type="plain" />
711

    
712
        <batchtest fork="yes" todir="${build.dir}">
713
          <fileset dir="${build.tests}">
714
            <include name="**/*.class" />
715
          </fileset>
716
        </batchtest>
717
     </junit>
718
   </target>
719

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

    
723
              <echo>testtorun: ${testtorun}</echo>
724

    
725
      <!-- use the ant "junit" task to run JUnit tests. -->
726
      <junit printsummary="yes" haltonfailure="no" fork="yes"
727
             haltonerror="no">
728
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
729
        <classpath>
730
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
731
        </classpath>
732

    
733
        <formatter type="plain" />
734

    
735
        <batchtest fork="yes" todir="${build.dir}">
736
          <fileset dir="${build.tests}">
737
            <include name="**/${testtorun}.class" />
738
          </fileset>
739
        </batchtest>
740
     </junit>
741
   </target>
742

    
743
   <target name="testharvester"
744
           depends="testprep"
745
           description="Uses the ant junit task to test only the Harvester code">
746
     <junit printsummary="yes"
747
            haltonfailure="off"
748
            fork="yes"
749
            haltonerror="off">
750
       <classpath>
751
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
752
       </classpath>
753
       <formatter type="plain" />
754
       <batchtest fork="yes" todir="${build.dir}">
755
         <fileset dir="${build.tests}">
756
           <include name="**/harvesterClient/*.class" />
757
         </fileset>
758
       </batchtest>
759
     </junit>
760
   </target>
761

    
762
  <target name="gethttpclient" depends="prepare"
763
            description="checks out and compiles morpho httpclient code">
764
  <!--mkdir dir="${morphosourcedir}" -->
765
        <cvs cvsRoot="${cvsroot}"
766
             package="morpho"
767
             dest="." />
768
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
769
   </target>
770

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

    
775
      <echo>***********************************
776
      Please run ant gethttpclient first!
777
      ***********************************
778
      </echo>
779
      <!-- copy and compile the tests into a jar file -->
780
      <mkdir dir="${build.metacatnettest}"/>
781
      <javac srcdir="${junitnettestsdir}"
782
             destdir="${build.metacatnettest}"
783
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
784
             includes="**/*.java" />
785

    
786
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
787
                    basedir="${build.metacatnettest}"
788
                    includes="**/*.class" />
789

    
790
      <!-- use the ant "junit" task to run JUnit tests. -->
791
      <junit printsummary="yes" haltonfailure="no" fork="yes"
792
             haltonerror="no">
793
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
794
        <classpath>
795
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
796
        </classpath>
797

    
798
        <formatter type="plain" />
799

    
800
        <batchtest fork="yes" todir="${build.dir}">
801
          <fileset dir="${build.metacatnettest}">
802
            <include name="**/*.class" />
803
          </fileset>
804
        </batchtest>
805
     </junit>
806
   </target>
807

    
808
   <target name="cleanweb" depends="clean"
809
            description="deletes tomcat web context dir and all its contents">
810
     <delete dir="${installdir}" />
811
   </target>
812

    
813

    
814
   <target name="clean" depends="init"
815
            description="deletes build dir and any files copied to cvs sandbox by build process (jars, xsl) Currently *not* schema/DTDs">
816
       <delete dir="${build.dir}" />
817
       <delete file="lib/httpclient.jar" />
818
       <delete file="lib/utilities.jar" />
819
       <delete includeEmptyDirs="true" failonerror="false">
820
         <fileset dir="${style-common-cvsrelpath}">
821
           <include name="${eml-css}" />
822
           <include name="eml-*/*.xsl" />
823
           <include name="eml-*" />
824
         </fileset>
825
     </delete>
826
   </target>
827

    
828
   <target name="jdoc" depends="prepare"
829
            description="generates javadoc documentation">
830
       <javadoc packagenames="edu.ucsb.nceas.*"
831
           sourcepath="${build.src}"
832
           destdir="${build.javadocs}"
833
           author="true"
834
           version="true"
835
           use="true"
836
           windowtitle="${Name} API"
837
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
838
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
839
       />
840
   </target>
841

    
842
   <target name="dist" depends="jar,protocol,jdoc,geteml"
843
            description="prepares a full release distribution">
844
      <mkdir dir="${dist.dir}"/>
845
      <delete dir="${ver.dir}" />
846
      <mkdir dir="${ver.dir}"/>
847
      <copy todir="${ver.dir}">
848
        <fileset dir="."
849
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
850
      </copy>
851
      <copy todir="${ver.dir}" file="build.xml"/>
852
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
853
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
854

    
855
      <copy todir="${ver.dir}/docs" filtering="yes">
856
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
857
      </copy>
858
      <copy todir="${ver.dir}/docs" filtering="no">
859
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
860
      </copy>
861
      <copy todir="${ver.dir}/docs/dev">
862
        <fileset dir="${build.dir}/docs"/>
863
      </copy>
864
      <copy todir="${ver.dir}/src">
865
        <fileset dir="${build.dir}/src"/>
866
      </copy>
867

    
868
      <delete dir="./${ver.dir}/${build.dir}"/>
869
      <delete dir="./${ver.dir}/dist"/>
870
      <delete file="./${name}-${release}.zip"/>
871
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
872
      <delete file="./${name}-${release}.tar.gz" />
873
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
874
      <gzip zipfile="./${name}-${release}.tar.gz"
875
                src="./${name}-${release}.tar"/>
876
      <delete file="./${name}-${release}.tar" />
877
  </target>
878

    
879
  <target name="distsrc" depends="dist"
880
            description="prepares a source distribution">
881
      <mkdir dir="${ver.src}"/>
882
      <copy todir="${ver.src}">
883
        <fileset dir="./src"/>
884
      </copy>
885

    
886
      <delete file="./${name}-src-${release}.zip"/>
887
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
888
      <delete file="./${name}-src-${release}.tar.gz" />
889
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
890
      <gzip zipfile="./${name}-src-${release}.tar.gz"
891
                src="./${name}-src-${release}.tar"/>
892
      <delete file="./${name}-src-${release}.tar" />
893
      <delete dir="${dist.dir}"/>
894
  </target>
895

    
896
   <target name="stylesheettest">
897
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
898
      <param name="displaymodule" expression="${displaymodule}"/>
899
      <param name="docid" expression="${input}"/>
900
      <param name="entitytype" expression="${entitytype}"/>
901
      <param name="entityindex" expression="${entityindex}"/>
902
      <outputproperty name="method" value="html"/>
903
      <outputproperty name="standalone" value="yes"/>
904
      <outputproperty name="encoding" value="iso8859_1"/>
905
      <outputproperty name="indent" value="yes"/>
906
    </xslt>
907
  </target>
908

    
909
 <target name="gridinit" depends="init">
910
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
911
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
912
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
913
   <property environment="env"/>
914
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
915
    <path id="webservicepath">
916
        <pathelement location="."/>
917
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
918
        <pathelement location="${build.dest}"/>
919
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
920
           <include name="*.jar"/>
921
        </fileset>
922
      </path>
923
</target>
924

    
925
 <target name="gridprepare" depends="gridinit, prepare">
926
 </target>
927

    
928
  <target name="compileinterface" depends="clean, gridprepare">
929
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
930
  </target>
931

    
932
  <target name="generateWSDL" depends="compileinterface">
933
    <echo message="Generating wsdl from ${interface.name} interface"/>
934
    <java classname="${java2wsdl.tool}"
935
          dir="${build.src}" fork="yes"
936
          classpathref="webservicepath"  failonerror="true" >
937
      <arg value="-P"/>
938
      <arg value="${interface.name}PortType"/>
939
      <arg value="-S"/>
940
      <arg value="${interface.name}Service"/>
941
      <arg value="-y"/>
942
      <arg value="WRAPPED"/>
943
      <arg value="-u"/>
944
      <arg value="LITERAL"/>
945
      <arg value="-l"/>
946
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
947
      <arg value="-n"/>
948
      <arg value="http://${services.namespace}/${interface.name}"/>
949
      <arg value="${interface.package}.${interface.name}"/>
950
    </java>
951
  </target>
952

    
953
   <target name="decorateWSDL" depends="generateWSDL">
954
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
955
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
956
            fork="yes"
957
            classpathref="webservicepath" failonerror="true" >
958
        <arg value="${binding.file}"/>
959
        <arg value="${wsdl.file}"/>
960
      </java>
961
   </target>
962

    
963
   <target name="generatestubs" depends="decorateWSDL">
964
      <echo message=" Generating stubs " />
965
      <echo message="wsdl file is ${wsdl.file}"/>
966
      <echo message="build.src is ${build.src}"/>
967
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
968
            classpathref="webservicepath" failonerror="true" >
969
         <arg value="${wsdl.file}"/>
970
    </java>
971
  </target>
972

    
973
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
974
     <echo message=" Compiling stubs " />
975
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
976
     <echo message=" Compiling impl " />
977
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
978
  </target>
979

    
980
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
981
     <echo message=" jar stubs classes " />
982
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
983
     <echo message=" jar impl classes " />
984
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
985
  </target>
986

    
987
  <target name="gar" depends="jarStubsAndImpl">
988
     <echo message=" jar the gar file"/>
989
     <mkdir dir="${build.dir}/gar"/>
990
     <mkdir dir="${build.dir}/gar/schema/edu"/>
991
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
992
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
993
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
994
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
995
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
996
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
997
  </target>
998

    
999
  <target name="compilewebclient" depends="prepare">
1000
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1001
  </target>
1002

    
1003
  <target name="runwebclient" depends="compilewebclient">
1004
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1005
           dir="${build.dest}" fork="yes"
1006
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1007
         <arg value="${serviceUrl}"/>
1008
         <arg value="${docid}"/>
1009
     </java>
1010
  </target>
1011
</project>
(5-5/5)