Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: jones $'
10
  *    '$Date: 2004-09-20 22:46:37 -0700 (Mon, 20 Sep 2004) $'
11
  *    '$Revision: 2308 $'
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
      <filter token="administrators" value="${administrators}"/>
267

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
443

    
444

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

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

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

    
456

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

    
462
   </target>
463

    
464

    
465

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
715
        <formatter type="plain" />
716

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

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

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

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

    
738
        <formatter type="plain" />
739

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

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

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

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

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

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

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

    
803
        <formatter type="plain" />
804

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

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

    
818

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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