Project

General

Profile

metacat / build.xml @ 2299

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: costa $'
10
  *    '$Date: 2004-09-17 08:39:45 -0700 (Fri, 17 Sep 2004) $'
11
  *    '$Revision: 2299 $'
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="harvester-registration-login-path" value="/${context}/servlet/HarvesterRegistrationLogin"/>
163
      <property name="harvester-registration-path"       value="/${context}/servlet/HarvesterRegistration"/>
164
      <property name="servlet-path"        value="/${context}/metacat"/>
165
      <property name="html-path"           value="/${context}"/>
166
      <property name="systemidserver"      value="http://${httpserver}"/>
167
      <property name="style-common-relpath"
168
                                           value="/style/common"/>
169
      <property name="style-common-cvsrelpath"
170
                                           value="lib${style-common-relpath}"/>
171
      <property name="style-common-fullpath"
172
                                           value="/${installdir}${style-common-relpath}"/>
173
      <property name="style-common-path"
174
                                           value="/${context}${style-common-relpath}"/>
175
      <property name="style-skins-relpath" value="/style/skins"/>
176
      <property name="style-skins-path"    value="/${context}${style-skins-relpath}"/>
177
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
178
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
179
      <property name="config-dir"          value="${webapps}/${style-skins-path}" />
180
      <property name="eml-module"          value="eml" />
181
      <property name="eml-version"         value="2.0.0beta6" />
182
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
183
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
184
      <property name="eml2_0_1-tag"        value="RELEASE_EML_2_0_1" />
185
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
186
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
187
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
188
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
189
      <property name="eml-css"             value="eml_xsl.css"/>
190
      <property name="eml-module.default.css"
191
                                           value="default.css"/>
192
      <property name="conversion-module"   value="webmdentry" />
193

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

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

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

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

    
285
      <property name="dist.dir" value="dist"/>
286
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
287
      <property name="ver.src" value="${ver.dir}/src"/>
288

    
289
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
290
   </target>
291

    
292
   <target name="prepare" depends="init">
293
      <mkdir dir="${build.dir}"/>
294
      <mkdir dir="${build.src}"/>
295
      <mkdir dir="${build.dest}"/>
296
      <mkdir dir="${build.javadocs}"/>
297
      <mkdir dir="${build.tmp}"/>
298

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

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

    
315
       <javac srcdir="${build.src}"
316
              destdir="${build.dest}"
317
              classpath="${cpath}"
318
              debug="${debug}"
319
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
320
   </target>
321

    
322
   <target name="jar" depends="compile"
323
    description="Compiles and jars metacat java code to metacat.jar in build dir">
324

    
325
       <delete file="${build.dir}/${name}.jar" />
326
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
327
            excludes="**/protocols/ **/harvesterClient/" />
328
   </target>
329

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

    
337
   <target name="utilities" depends="config">
338
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
339
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
340
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
341
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
342
   </target>
343

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

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

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

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

    
375
   <target  name="geteml" depends="getemlpre2,geteml2+"
376
            description="Calls getemlpre2 and geteml2+ targets" />
377

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

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

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

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

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

    
419
     </copy>
420
     <antcall target="copyxsl">
421
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
422
        <param name="dirname" value="eml-2.0.0" />
423
     </antcall>
424

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

    
442

    
443

    
444
   <target  name="copyxsl"
445
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
446

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

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

    
455

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

    
461
   </target>
462

    
463

    
464

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

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

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

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

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

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

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

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

    
551
   <target name="install-registry" depends="init,getConversionXSL"
552
            description="Install Registry">
553

    
554
      <copy file="${srcdir}/perl/register-dataset.cgi"
555
            todir="${inst.cgi.dir}" filtering="yes"/>
556
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
557

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

    
566
      <echo message="Install Registry completed." />
567
   </target>
568

    
569
   <target name="install-skin" depends="init"
570
            description="Install a Skin">
571

    
572
      <input message="Please enter name of the skin"
573
             addproperty="skin-name"/>
574

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

    
605
      <echo message="Install Skin completed." />
606
   </target>
607

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

    
618
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
619
            description="Prepare files for creating a web archive (WAR)">
620

    
621
       <property name="war.lib" value="${build.war}/lib" />
622
       <property name="war.webinf" value="${build.war}/WEB-INF" />
623
       <property name="war.context" value="${build.war}/${context}" />
624
       <mkdir dir="${war.lib}" />
625
       <mkdir dir="${war.webinf}" />
626
       <mkdir dir="${war.context}" />
627

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

    
670
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
671
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
672
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
673
   </target>
674

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

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

    
698
      <jar jarfile="${build.dir}/${name}-junittests.jar"
699
        basedir="${build.tests}"
700
                includes="**/*.class" />
701
   </target>
702

    
703
   <target name="test" depends="testprep"
704
            description="Uses the ant junit task to run all JUnit tests">
705

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

    
714
        <formatter type="plain" />
715

    
716
        <batchtest fork="yes" todir="${build.dir}">
717
          <fileset dir="${build.tests}">
718
            <include name="**/*.class" />
719
          </fileset>
720
        </batchtest>
721
     </junit>
722
   </target>
723

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

    
727
              <echo>testtorun: ${testtorun}</echo>
728

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

    
737
        <formatter type="plain" />
738

    
739
        <batchtest fork="yes" todir="${build.dir}">
740
          <fileset dir="${build.tests}">
741
            <include name="**/${testtorun}.class" />
742
          </fileset>
743
        </batchtest>
744
     </junit>
745
   </target>
746

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

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

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

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

    
790
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
791
                    basedir="${build.metacatnettest}"
792
                    includes="**/*.class" />
793

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

    
802
        <formatter type="plain" />
803

    
804
        <batchtest fork="yes" todir="${build.dir}">
805
          <fileset dir="${build.metacatnettest}">
806
            <include name="**/*.class" />
807
          </fileset>
808
        </batchtest>
809
     </junit>
810
   </target>
811

    
812
   <target name="cleanweb" depends="clean"
813
            description="deletes tomcat web context dir and all its contents">
814
     <delete dir="${installdir}" />
815
   </target>
816

    
817

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

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

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

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

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

    
883
  <target name="distsrc" depends="dist"
884
            description="prepares a source distribution">
885
      <mkdir dir="${ver.src}"/>
886
      <copy todir="${ver.src}">
887
        <fileset dir="./src"/>
888
      </copy>
889

    
890
      <delete file="./${name}-src-${release}.zip"/>
891
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
892
      <delete file="./${name}-src-${release}.tar.gz" />
893
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
894
      <gzip zipfile="./${name}-src-${release}.tar.gz"
895
                src="./${name}-src-${release}.tar"/>
896
      <delete file="./${name}-src-${release}.tar" />
897
      <delete dir="${dist.dir}"/>
898
  </target>
899

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

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

    
929
 <target name="gridprepare" depends="gridinit, prepare">
930
 </target>
931

    
932
  <target name="compileinterface" depends="clean, gridprepare">
933
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
934
  </target>
935

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

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

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

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

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

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

    
1003
  <target name="compilewebclient" depends="prepare">
1004
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1005
  </target>
1006

    
1007
  <target name="runwebclient" depends="compilewebclient">
1008
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1009
           dir="${build.dest}" fork="yes"
1010
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1011
         <arg value="${serviceUrl}"/>
1012
         <arg value="${docid}"/>
1013
     </java>
1014
  </target>
1015
</project>