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: sgarg $'
10
  *    '$Date: 2004-07-26 16:22:09 -0700 (Mon, 26 Jul 2004) $'
11
  *    '$Revision: 2232 $'
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_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="MetacatClientTest" />
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
           <include name="*.*"/>
575
           <exclude name="*.png"/>
576
           <exclude name="*.gif"/>
577
           <exclude name="*.jpg"/>
578
       </fileset>
579
      </copy>
580
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
581
       <fileset dir="lib/style/skins/${skin-name}">
582
           <include name="*.png"/>
583
           <include name="*.gif"/>
584
           <include name="*.jpg"/>
585
       </fileset>
586
      </copy>
587
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
588
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
589
       <fileset dir="lib/style/skins/${skin-name}/images">
590
           <include name="*.png"/>
591
           <include name="*.gif"/>
592
           <include name="*.jpg"/>
593
       </fileset>
594
      </copy>
595

    
596
      <echo message="Install Skin completed." />
597
   </target>
598

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

    
609
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
610
            description="Prepare files for creating a web archive (WAR)">
611

    
612
       <property name="war.lib" value="${build.war}/lib" />
613
       <property name="war.webinf" value="${build.war}/WEB-INF" />
614
       <property name="war.context" value="${build.war}/${context}" />
615
       <mkdir dir="${war.lib}" />
616
       <mkdir dir="${war.webinf}" />
617
       <mkdir dir="${war.context}" />
618

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

    
661
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
662
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
663
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
664
   </target>
665

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

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

    
689
      <jar jarfile="${build.dir}/${name}-junittests.jar"
690
        basedir="${build.tests}"
691
                includes="**/*.class" />
692
   </target>
693

    
694
   <target name="test" depends="testprep"
695
            description="Uses the ant junit task to run all JUnit tests">
696

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

    
705
        <formatter type="plain" />
706

    
707
        <batchtest fork="yes" todir="${build.dir}">
708
          <fileset dir="${build.tests}">
709
            <include name="**/*.class" />
710
          </fileset>
711
        </batchtest>
712
     </junit>
713
   </target>
714

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

    
718
              <echo>testtorun: ${testtorun}</echo>
719

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

    
728
        <formatter type="plain" />
729

    
730
        <batchtest fork="yes" todir="${build.dir}">
731
          <fileset dir="${build.tests}">
732
            <include name="**/${testtorun}.class" />
733
          </fileset>
734
        </batchtest>
735
     </junit>
736
   </target>
737

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

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

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

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

    
781
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
782
                    basedir="${build.metacatnettest}"
783
                    includes="**/*.class" />
784

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

    
793
        <formatter type="plain" />
794

    
795
        <batchtest fork="yes" todir="${build.dir}">
796
          <fileset dir="${build.metacatnettest}">
797
            <include name="**/*.class" />
798
          </fileset>
799
        </batchtest>
800
     </junit>
801
   </target>
802

    
803
   <target name="cleanweb" depends="clean"
804
            description="deletes tomcat web context dir and all its contents">
805
     <delete dir="${installdir}" />
806
   </target>
807

    
808

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

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

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

    
850
      <copy todir="${ver.dir}/docs" filtering="yes">
851
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
852
      </copy>
853
      <copy todir="${ver.dir}/docs" filtering="no">
854
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
855
      </copy>
856
      <copy todir="${ver.dir}/docs/dev">
857
        <fileset dir="${build.dir}/docs"/>
858
      </copy>
859
      <copy todir="${ver.dir}/src">
860
        <fileset dir="${build.dir}/src"/>
861
      </copy>
862

    
863
      <delete dir="./${ver.dir}/${build.dir}"/>
864
      <delete dir="./${ver.dir}/dist"/>
865
      <delete file="./${name}-${release}.zip"/>
866
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
867
      <delete file="./${name}-${release}.tar.gz" />
868
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
869
      <gzip zipfile="./${name}-${release}.tar.gz"
870
                src="./${name}-${release}.tar"/>
871
      <delete file="./${name}-${release}.tar" />
872
  </target>
873

    
874
  <target name="distsrc" depends="dist"
875
            description="prepares a source distribution">
876
      <mkdir dir="${ver.src}"/>
877
      <copy todir="${ver.src}">
878
        <fileset dir="./src"/>
879
      </copy>
880

    
881
      <delete file="./${name}-src-${release}.zip"/>
882
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
883
      <delete file="./${name}-src-${release}.tar.gz" />
884
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
885
      <gzip zipfile="./${name}-src-${release}.tar.gz"
886
                src="./${name}-src-${release}.tar"/>
887
      <delete file="./${name}-src-${release}.tar" />
888
      <delete dir="${dist.dir}"/>
889
  </target>
890

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

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

    
920
 <target name="gridprepare" depends="gridinit, prepare">
921
 </target>
922

    
923
  <target name="compileinterface" depends="clean, gridprepare">
924
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
925
  </target>
926

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

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

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

    
968
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
969
     <echo message=" Compiling stubs " />
970
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
971
     <echo message=" Compiling impl " />
972
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
973
  </target>
974

    
975
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
976
     <echo message=" jar stubs classes " />
977
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
978
     <echo message=" jar impl classes " />
979
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
980
  </target>
981

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

    
994
  <target name="compilewebclient" depends="prepare">
995
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
996
  </target>
997

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