Project

General

Profile

metacat / build.xml @ 3065

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: berkley $'
10
  *    '$Date: 2006-10-10 12:07:27 -0700 (Tue, 10 Oct 2006) $'
11
  *    '$Revision: 3059 $'
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
  <!-- Determine which tomcat we are using and tomcat-specific settings -->
37
  <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
38
    <equals arg1="${tomcatversion}" arg2="tomcat3" />
39
  </condition>
40
  <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
41
    <equals arg1="${tomcatversion}" arg2="tomcat4" />
42
  </condition>
43
  <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
44
    <equals arg1="${tomcatversion}" arg2="tomcat5" />
45
  </condition>
46
        
47
  <!-- Determine if installed ecogrid -->
48
  <condition property="enable.ecogrid">
49
    <equals arg1="${install.ecogrid}" arg2="true" />
50
  </condition>
51

    
52
  <!-- Determine if geoserver and spatial options are to be enabled   -->
53
  <condition property="enable.spatial">
54
    <equals arg1="${install.spatial}" arg2="true" />
55
  </condition>
56
        
57
  <target name="check-db">
58
    <condition property="use-oracle">
59
      <equals arg1="${database}" arg2="oracle" />
60
    </condition>
61
    <condition property="use-postgresql">
62
      <equals arg1="${database}" arg2="postgresql" />
63
    </condition>
64
    <condition property="use-sqlserver">
65
      <equals arg1="${database}" arg2="sqlserver" />
66
    </condition>
67
  </target>
68

    
69
  <target name="oracle" if="use-oracle">
70
     <!-- Customize these properties if you are using oracle -->
71
     <echo message="Using oracle..."/>
72
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
73
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
74
     <property name="jdbc-jar-name" value="classes111.zip" />
75
     <property name="jdbc" value="${jdbc_base}/${jdbc-jar-name}" />
76
     <!-- Property to indicate is not MSSQL installation-->
77
     <property name="other" value="yes"/>
78
     <property name="install-sql"
79
               value="xmltables.sql" />
80
     <property name="upgrade-1.2-sql"
81
               value="upgrade-db-to-1.2.sql" />
82
     <property name="upgrade-1.3-sql"
83
               value="upgrade-db-to-1.3.sql" />
84
     <property name="upgrade-1.4-sql"
85
               value="upgrade-db-to-1.4.sql" />
86
     <property name="upgrade-1.5-sql"
87
               value="upgrade-db-to-1.5.sql" />
88
     <property name="upgrade-1.6-sql"
89
               value="upgrade-db-to-1.6.sql" />
90
   </target>
91

    
92
   <target name="postgresql" if="use-postgresql">
93
     <!-- Customize these properties if you are using postgres -->
94
     <echo message="Using PostgreSQL..."/>
95
     <property name="dbDriver" value="org.postgresql.Driver"/>
96
     <property name="dbAdapter"
97
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
98
     <property name="jdbc-jar-name" value="postgresql-8.0-312.jdbc3.jar" />
99
     <property name="jdbc" value="lib/${jdbc-jar-name}" />
100
     <!-- Property to indicate is not MSSQL installation-->
101
     <property name="other" value="yes"/>
102
     <property name="install-sql"
103
               value="xmltables-postgres.sql" />
104
     <property name="upgrade-1.2-sql"
105
               value="upgrade-db-to-1.2-postgres.sql" />
106
     <property name="upgrade-1.3-sql"
107
               value="upgrade-db-to-1.3-postgres.sql" />
108
     <property name="upgrade-1.4-sql"
109
               value="upgrade-db-to-1.4-postgres.sql" />
110
     <property name="upgrade-1.5-sql"
111
               value="upgrade-db-to-1.5-postgres.sql" />
112
     <property name="upgrade-1.6-sql"
113
               value="upgrade-db-to-1.6-postgres.sql" />
114
    </target>
115

    
116
   <target name="sqlserver" if="use-sqlserver">
117
     <!-- Customize these properties if you are using SQL server -->
118
     <echo message="Using SQL Server..."/>
119
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
120
     <property name="dbAdapter"
121
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
122
     <property name="jdbc" value="${jdbc_base}/msbase.jar" />
123
     <property name="jdbc-add1" value="${jdbc_base}/msutil.jar" />
124
     <property name="jdbc-add2" value="${jdbc_base}/mssqlserver.jar" />
125
     <!-- Property to indicate is a MSSQL installation-->
126
     <property name="MSSQL" value="yes"/>
127
     <property name="install-sql"
128
               value="xmltables-sqlserver.sql" />
129
   </target>
130

    
131
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
132
      <!-- usr for client testing, generally you don't need change-->
133
      <property name="mcuser" value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org"/>
134
      <property name="mcpassword" value="kepler"/>
135
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
136
      <property name="mcanotherpassword" value=""/>
137

    
138
      <property name="debug" value="on" />
139
      <property name="debuglevel" value="55" />
140

    
141
      <property name="morphosourcedir" value="../morpho" />
142
      <property name="defaultcontenttype" value="application/octet-stream" />
143
      <property name="utilitiesdir" value="../utilities" />
144

    
145
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
146
      <echo>*********** set jsdk to ${jsdk}</echo>
147
  </target>
148

    
149
   <target name="init" depends="config">
150
      <path id="compile.classpath">
151
        <pathelement location="${jsdk}"/>
152
        <pathelement location="lib" />
153
        <fileset dir="lib">
154
          <include name="*.jar"/>
155
        </fileset>
156
        <fileset dir="lib">
157
           <include name="xalan.jar"/>
158
         </fileset>
159
       <fileset dir="lib/lsid_lib">
160
         <include name="*.jar"/>
161
       </fileset>
162
       <fileset dir="${jdbc_base}">
163
         <include name="${jdbc-jar-name}"/>
164
          <include name="msbase.jar"/>
165
          <include name="msutil.jar"/>
166
          <include name="mssqlserver.jar"/>
167
       </fileset>
168

    
169
        <!-- Include geoserver, geotools, et. al. -->
170
        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
171
          <include name="*.jar"/>
172
        </fileset>
173
        <pathelement location="lib/spatial/geoserver/WEB-INF/classes"/>
174

    
175
       </path>
176
      
177
      <!-- It is less likely you'll need to make any changes from here down,
178
           but customization is possible -->
179
      <property name="installdir"          value="${deploy.dir}/${metacat.context}" />
180
      <property name="temp-dir"            value="/tmp/${metacat.context}" />
181
      <property name="name"                value="metacat"/>
182
      <property name="Name"                value="MetaCat"/>
183
      <property name="debugprefix"         value="${Name}:"/>
184
      <property name="release"             value="1.6.0"/>
185
      <property name="replication-path"    value="/${metacat.context}/servlet/replication"/>
186
      <property name="harvester-registration-login-path" value="/${metacat.context}/harvesterRegistrationLogin"/>
187
      <property name="harvester-registration-path"       value="/${metacat.context}/harvesterRegistration"/>
188
      <property name="servlet-path"        value="/${metacat.context}/metacat"/>
189
      <property name="html-path"           value="/${metacat.context}"/>
190
      <property name="systemidserver"      value="${http.protocol}://${httpserver}"/>
191
      <property name="style-common-relpath"
192
                                           value="/style/common"/>
193
      <property name="style-common-cvsrelpath"
194
                                           value="lib${style-common-relpath}"/>
195
      <property name="style-common-fullpath"
196
                                           value="/${installdir}${style-common-relpath}"/>
197
      <property name="templates.dir"       value="${style-common-fullpath}/templates"/>
198
      <property name="style-common-path"
199
                                           value="/${metacat.context}${style-common-relpath}"/>
200
      <property name="style-skins-relpath" value="/style/skins"/>
201
      <property name="style-skins-path"    value="/${metacat.context}${style-skins-relpath}"/>
202
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
203
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
204
      <property name="config-dir"          value="${deploy.dir}/${style-skins-path}" />
205
      <property name="util-module"         value="utilities" />
206
      <property name="eml-module"          value="eml" />
207
      <property name="eml-version"         value="2.0.0beta6" />
208
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
209
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
210
      <property name="eml2_0_1-tag"        value="RELEASE_EML_2_0_1_UPDATE_3" />
211
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
212
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
213
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
214
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
215
      <property name="eml-css"             value="eml_xsl.css"/>
216
      <property name="eml-module.default.css"
217
                                           value="default.css"/>
218
             
219
      <!-- Config for registry variables -->
220
      <property name="scope"               value="obfs"/>
221
      <property name="responseForm"        value="genericResponse.tmpl"/>
222
      <property name="entryForm"           value="entryForm.tmpl"/>
223
      <property name="guide"               value="genericGuide.tmpl"/>
224
      <property name="loginForm"           value="loginForm.tmpl"/>
225
      <property name="confirmData"         value="confirmData.tmpl"/>
226
      <property name="deleteData"          value="deleteData.tmpl"/>
227
      <property name="genericHeader"       value="genericHeader.tmpl"/>
228
      <property name="genericFooter"       value="genericFooter.tmpl"/>
229
      <property name="adminname"           value="KNB Support"/>
230
      <property name="recipient"           value="knb-software\@nceas.ucsb.edu"/>
231

    
232
      <property name="defaultStage"        value="initregister"/>
233
      <property name="defaultHeader"       value="genericHeader.tmpl"/>
234
      <property name="defaultFooter"       value="genericFooter.tmpl"/>
235
      <property name="defaultChangePass"   value="ldapChangePass.tmpl"/>
236
      <property name="defaultResetPass"    value="ldapResetPass.tmpl"/>
237
      <property name="changePassSuccess"   value="ldapChangePassSuccess.tmpl"/>
238
      <property name="resetPassSuccess"    value="ldapResetPassSuccess.tmpl"/>
239
      <property name="registerFailed"      value="ldapRegisterFailed.tmpl"/>
240
      <property name="registerLter"        value="ldapRegisterLter.tmpl"/>
241
      <property name="registerMatch"       value="ldapRegisterMatch.tmpl"/>
242
      <property name="registerSuccess"     value="ldapRegisterSuccess.tmpl"/>
243
      <property name="register"            value="ldapRegister.tmpl"/>
244
      <property name="searchResults"       value="searchResults.tmpl"/>
245

    
246
      <filter token="scope"                value="${scope}"/>
247
      <filter token="responseForm"         value="${responseForm}"/>
248
      <filter token="entryForm"            value="${entryForm}"/>
249
      <filter token="guide"                value="${guide}"/>
250
      <filter token="loginForm"            value="${loginForm}"/>
251
      <filter token="confirmData"          value="${confirmData}"/>
252
      <filter token="deleteData"           value="${deleteData}"/>
253
      <filter token="genericHeader"        value="${genericHeader}"/>
254
      <filter token="genericFooter"        value="${genericFooter}"/>
255
      <filter token="adminname"            value="${adminname}"/>
256
      <filter token="recipient"            value="${recipient}"/>
257

    
258
      <filter token="ldapurl"              value="ldap.ecoinformatics.org"/>
259
      <filter token="ldapSearchBase"       value="dc=ecoinformatics,dc=org"/>
260
      <filter token="ldap_user"            value="cn=Manager,dc=ecoinformatics,dc=org"/>
261
      <filter token="ldap_password"        value="ldap_password"/>
262
      <filter token="mailhost"             value="localhost"/>
263
      <filter token="sender"               value="knb-software\@nceas.ucsb.edu"/>
264
      <filter token="cgiurl"               value="${cgi-prefix}/ldapweb.cgi"/>
265

    
266
      <filter token="docrooturl" value="./" />
267
      <filter token="database" value="${database}" />
268
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
269
      <filter token="dbDriver" value="${dbDriver}"/>
270
      <filter token="dbAdapter" value="${dbAdapter}"/>
271
      <filter token="install-dir" value="${installdir}"/>
272
      <filter token="temp-dir" value="${temp-dir}"/>
273
      <filter token="server" value="${server}"/>
274
      <filter token="systemidserver" value="${systemidserver}"/>
275
      <filter token="cgi-prefix" value="${cgi-prefix}"/>
276
      <filter token="ldapUrl" value="${ldapUrl}"/>
277
      <filter token="replication-log" value="${replication-log}"/>
278
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
279
      <filter token="release" value="${release}"/>
280
      <filter token="servlet-path" value="${servlet-path}"/>
281
      <filter token="html-path" value="${html-path}"/>
282
      <filter token="user" value="${user}"/>
283
      <filter token="password" value="${password}"/>
284
      <filter token="mcuser" value="${mcuser}"/>
285
      <filter token="mcpassword" value="${mcpassword}"/>
286
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
287
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
288
      <filter token="knb-site-url" value="${knb-site-url}"/>
289
      <filter token="eml-css" value="${eml-css}"/>
290
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
291
      <filter token="style-skins-path" value="${style-skins-path}"/>
292
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
293
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
294
      <filter token="style-common-path" value="${style-common-path}"/>
295
      <filter token="templates.dir" value="${templates.dir}"/>
296

    
297
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
298
      <filter token="style-path" value="${style-skins-path}"/>
299
      <filter token="replication-path" value="${replication-path}"/>
300
      <filter token="harvester-registration-login-path" value="${harvester-registration-login-path}"/>
301
      <filter token="harvester-registration-path" value="${harvester-registration-path}"/>
302
      <filter token="config-dir" value="${config-dir}"/>
303
      <filter token="default-style" value="${default-style}"/>
304
      <filter token="eml-version" value="${eml-version}"/>
305
      <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}"/>
306
      <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}"/>
307
      <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}"/>
308
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
309
      <filter token="context" value="${metacat.context}"/>
310
             <filter token="httpserver" value="${httpserver}"/>
311
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
312
      <filter token="debuglevel" value="${debuglevel}" />
313
      <filter token="datafilepath" value="${datafilepath}" />
314
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
315
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
316
      <filter token="debugprefix" value="${debugprefix}"/>
317
      <filter token="administrators" value="${administrators}"/>
318
      <filter token="moderators" value="${moderators}"/>
319
      <filter token="allowedSubmitters" value="${allowedSubmitters}"/>
320
      <filter token="deniedSubmitters" value="${deniedSubmitters}"/>
321
      <filter token="indexPaths" value="${indexPaths}"/>
322

    
323
      <filter token="defaultStage" value="${defaultStage}"/>
324
      <filter token="defaultHeader" value="${defaultHeader}"/>
325
      <filter token="defaultFooter" value="${defaultFooter}"/>
326
      <filter token="defaultChangePass" value="${defaultChangePass}"/>
327
      <filter token="defaultResetPass" value="${defaultResetPass}"/>
328
      <filter token="changePassSuccess" value="${changePassSuccess}"/>
329
      <filter token="resetPassSuccess" value="${resetPassSuccess}"/>
330
      <filter token="registerFailed" value="${registerFailed}"/>
331
      <filter token="registerLter" value="${registerLter}"/>
332
      <filter token="registerMatch" value="${registerMatch}"/>
333
      <filter token="registerSuccess" value="${registerSuccess}"/>
334
      <filter token="register" value="${register}"/>
335
      <filter token="searchResults" value="${searchResults}"/>
336
       
337
             <filter token="timedreplication" value="${timedreplication}" />
338
             <filter token="firsttimedreplication" value="${firsttimedreplication}" />
339
             <filter token="timedreplicationinterval" value="${timedreplicationinterval}" />
340
      
341
             <property name="srcdir" value="./src" />
342
             <property name="lib.dir" value="./lib" />
343
      <property name="testdir" value="./test" />
344
      <property name="testtorun" value="BuildIndexTest" />
345
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
346
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
347
      <property name="build.dir" value="./build"/>
348
      <property name="build.src" value="${build.dir}/src"/>
349
      <property name="build.dest" value="${build.dir}/classes"/>
350
      <property name="build.docs" value="${build.dir}/docs"/>
351
      <property name="build.samples" value="${build.dir}/samples"/>
352
      <property name="build.tests" value="${build.dir}/tests"/>
353
      <property name="build.tmp" value="${build.dir}/tmp"/>
354
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
355
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
356
      <property name="build.data" value="${build.dir}/data"/>
357
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
358
      <property name="build.war" value="${build.dir}/war"/>
359

    
360
      <property name="dist.dir" value="dist"/>
361
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
362
      <property name="ver.src" value="${ver.dir}/src"/>
363
      <property name="util.dir" value="${dist.dir}/${util-module}"/>
364
          <!-- directories for creating a Harvest List Editor distribution -->
365
      <property name="dist.dir.hle" value="disthle"/>
366
      <property name="ver.dir.hle" value="${dist.dir.hle}/harvest-list-editor-${release}"/>
367
             
368
             
369
             <property name="ecogrid-target-name" value="metacatImpl"/>
370
             <property name="ecogrid-module-dest-dir" value =".."/>
371
             <property name="ecogrid-module" value="seek/projects/ecogrid"/>
372
             <property name="ecogrid-dist-dir" value="${dist.dir}/${ecogrid-module}"/>
373
             <property name="ecogrid-dir" value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
374

    
375
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
376
      <condition property="utilities.required">
377
        <or>
378
          <not><available file="lib/httpclient.jar"/></not>
379
          <not><available file="lib/utilities.jar"/></not>
380
        </or>
381
      </condition>
382
      <condition property="eml.required">
383
        <or>
384
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
385
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
386
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
387
        </or>
388
      </condition>
389
             
390
      <condition property="ecogrid.required">
391
                 <or>
392
             <not><available file="${ecogrid-dir}/build.properties"/></not>
393
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
394
           </or>
395
      </condition>
396

    
397
   </target>
398

    
399
   <target name="prepare" depends="init">
400
      <mkdir dir="${build.dir}"/>
401
      <mkdir dir="${build.src}"/>
402
      <mkdir dir="${build.dest}"/>
403
      <mkdir dir="${build.javadocs}"/>
404
      <mkdir dir="${build.tmp}"/>
405

    
406
      <copy todir="${build.src}" filtering="yes">
407
        <fileset dir="${srcdir}">
408
          <include name="edu/**"/>
409
          <include name="com/**"/>
410
          <include name="**/*.sql"/>
411
          <exclude name="**/CVS*"/>
412
          <exclude name="**/.#*"/>
413
        </fileset>
414
      </copy>
415
      <available file="lib/style/common/emlb6toeml2" type="dir"
416
                 property="styles.not.needed"/>
417
   </target>
418

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

    
422
       <javac srcdir="${build.src}"
423
              destdir="${build.dest}"
424
              debug="${debug}"
425
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
426
        <classpath>
427
          <path refid="compile.classpath"/>
428
        </classpath>
429
      </javac>
430
   </target>
431

    
432
   <target name="jar" depends="compile,geteml"
433
    description="Compiles and jars metacat java code to metacat.jar in build dir">
434

    
435
       <delete file="${build.dir}/${name}.jar" />
436
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
437
            excludes="**/protocols/ **/harvesterClient/" />
438
   </target>
439

    
440
   <target name="protocol" depends="compile"
441
    description="Compiles and jars protocol java code to protocol.jar in build dir">
442
       <delete file="${build.dir}/protocol.jar" />
443
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
444
            includes="**/protocols/" />
445
   </target>
446

    
447
   <target name="utilities" depends="config" if="utilities.required">
448
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
449
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
450
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
451
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
452
   </target>
453

    
454
   <target name="getutilities" depends="prepare"
455
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
456
     <echo>Enter CVS password: </echo>
457
     <cvs cvsRoot="${cvsroot}"
458
          package="${util-module}"
459
          dest="${build.tmp}" />
460
   </target>
461

    
462
   <target name="client" depends="utilities, prepare"
463
    description="Compiles metacat-client java code to build dir">
464
       <javac srcdir="${build.src}"
465
              destdir="${build.dest}"
466
              includes="edu/ucsb/nceas/metacat/client/*">
467
          <classpath>
468
            <path refid="compile.classpath"/>
469
          </classpath>
470
        </javac>
471
   </target>
472

    
473
   <target name="clientjar" depends="client"
474
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
475
       <delete file="${build.dir}/${name}-client.jar" />
476
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
477
            includes="**/metacat/client/" />
478
   </target>
479

    
480
    <target name="advancedsearchjar" depends="compile"
481
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
482
        <delete file="${build.dir}/advancedsearch.jar" />
483
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
484
             includes="**/metacat/advancedsearch/" />
485
    </target>
486

    
487
   <target name="harvester" depends="client"
488
           description="Compiles harvester java code to build dir">
489
       <javac srcdir="${build.src}"
490
              destdir="${build.dest}"
491
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
492
          <classpath>
493
            <path refid="compile.classpath"/>
494
          </classpath>
495
        </javac>
496
   </target>
497

    
498
   <target name="harvesterjar" depends="harvester"
499
           description="Compiles and jars harvester java code to harvester.jar in build dir">
500
       <delete file="${build.dir}/harvester.jar" />
501
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
502
            includes="**/metacat/harvesterClient/" />
503
   </target>
504

    
505
   <target name="harvestListEditorDist" depends="harvesterjar"
506
           description="Prepares a distribution of the Harvest List Editor tool">
507
       <mkdir dir="${dist.dir.hle}"/>
508
       <delete dir="${ver.dir.hle}" />
509
       <mkdir dir="${ver.dir.hle}"/>
510
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
511
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
512
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
513
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
514
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
515
       <delete file="./harvest-list-editor-${release}.zip"/>
516
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
517
       <delete file="./harvest-list-editor-${release}.tar.gz" />
518
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
519
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
520
             src="./harvest-list-editor-${release}.tar"/>
521
       <delete file="./harvest-list-editor-${release}.tar" />
522
   </target>
523

    
524
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
525
            description="Calls getemlpre2 and geteml2+ targets" />
526

    
527
   <target name="getemlpre2" depends="prepare" if="eml.required"
528
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
529
     <echo>Enter CVS password: </echo>
530
     <cvs cvsRoot="${cvsroot}"
531
          package="${eml-module}"
532
          tag="${eml-tag}"
533
          dest="${build.tmp}/eml_${eml-tag}" />
534
     <mkdir dir="lib/dtd" />
535
     <copy todir="lib/dtd" filtering="yes">
536
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
537
         <include name="*.dtd"/>
538
       </fileset>
539
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
540
     </copy>
541

    
542
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
543
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
544
       <include name="**/*.xsl"/>
545
     </fileset>
546
     </copy>
547
   </target>
548

    
549
   <target name="geteml2+" depends="prepare" if="eml.required"
550
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
551
     <echo>Enter CVS password: </echo>
552
     <cvs cvsRoot="${cvsroot}"
553
          package="${eml-module}"
554
          tag="${eml2_0_0-tag}"
555
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
556
     <mkdir dir="lib/schema/eml-2.0.0" />
557
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
558
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
559
         <include name="*.xsd"/>
560
       </fileset>
561

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

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

    
568
     </copy>
569
     <!-- <antcall target="copyxsl">
570
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
571
        <param name="dirname" value="eml-2.0.0" />
572
     </antcall> -->
573

    
574
     <echo>Enter CVS password: </echo>
575
     <cvs cvsRoot="${cvsroot}"
576
          package="${eml-module}"
577
          tag="${eml2_0_1-tag}"
578
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
579
     <mkdir dir="lib/schema/eml-2.0.1" />
580
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
581
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
582
         <include name="*.xsd"/>
583
       </fileset>
584
     </copy>
585
     <antcall target="copyxsl">
586
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
587
        <param name="dirname" value="eml-2.0.1" />
588
     </antcall>
589
   </target>
590

    
591
   <target  name="copyxsl"
592
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
593

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

    
596
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
597
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
598
       <include name="**/*.xsl"/>
599
     </fileset>
600
     </copy>
601

    
602

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

    
608
   </target>
609

    
610

    
611

    
612
   <target name="register-schemas" depends="prepare"
613
   description="Registers the Schemas with a new Metacat instance">
614
     <echo/>
615
     <echo>Registering the Schemas with the new Metacat instance...</echo>
616
     <sql driver="${dbDriver}"
617
          url="${jdbc-connect}"
618
          userid="${user}"
619
          password="${password}"
620
          src="${build.src}/loaddtdschema.sql">
621
       <classpath>
622
         <path refid="compile.classpath"/>
623
       </classpath>
624
     </sql>
625
   </target>
626

    
627
   <target name="installdb" depends="prepare"
628
            description="Installs the database tables">
629
     <echo/>
630
     <echo>Installing the database tables...</echo>
631
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
632
     <echo/>
633
     <sql driver="${dbDriver}"
634
          url="${jdbc-connect}"
635
          userid="${user}"
636
          password="${password}"
637
          src="${build.src}/${install-sql}">
638
       <classpath>
639
         <path refid="compile.classpath"/>
640
       </classpath>
641
     </sql>
642
   </target>
643

    
644
   <target name="dropdb" depends="prepare"
645
            description="WARNING: Drops the database tables">
646
     <echo/>
647
     <echo>Dropping the database tables...</echo>
648
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
649
     <echo/>
650
     <sql driver="${dbDriver}"
651
          url="${jdbc-connect}"
652
          userid="${user}"
653
          password="${password}"
654
          src="${build.src}/drop-postgres.sql">
655
       <classpath>
656
         <path refid="compile.classpath"/>
657
       </classpath>
658
     </sql>
659
   </target>
660

    
661
   <target name="upgrade12" depends="prepare"
662
            description="Updates the database tables to upgrade to version 1.2">
663
     <echo/>
664
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
665
     <sql driver="${dbDriver}"
666
          url="${jdbc-connect}"
667
          userid="${user}"
668
          password="${password}"
669
          src="${build.src}/${upgrade-1.2-sql}">
670
       <classpath>
671
         <path refid="compile.classpath"/>
672
       </classpath>
673
     </sql>
674
   </target>
675

    
676
   <target name="upgrade13" depends="prepare"
677
            description="Updates the database tables to upgrade to version 1.3">
678
     <echo/>
679
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
680
     <sql driver="${dbDriver}"
681
          url="${jdbc-connect}"
682
          userid="${user}"
683
          password="${password}"
684
          src="${build.src}/${upgrade-1.3-sql}">
685
       <classpath>
686
         <path refid="compile.classpath"/>
687
       </classpath>
688
     </sql>
689
   </target>
690

    
691
   <target name="upgrade14" depends="prepare"
692
            description="Updates the database tables to upgrade to version 1.4">
693
     <echo/>
694
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
695
     <sql driver="${dbDriver}"
696
          url="${jdbc-connect}"
697
          userid="${user}"
698
          password="${password}"
699
          src="${build.src}/${upgrade-1.4-sql}">
700
       <classpath>
701
         <path refid="compile.classpath"/>
702
       </classpath>
703
     </sql>
704
   </target>
705

    
706
   <target name="upgrade15" depends="sqlupgrade15"
707
           description="Updates the database tables to upgrade to version 1.5">
708
     <echo/>
709
     <echo>Updating the database tables to upgrade to version 1.5...</echo>
710
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
711
           todir="${build.tmp}" filtering="yes"/>
712

    
713
     <javac srcdir="${build.tmp}"
714
            destdir="${build.tmp}"
715
            debug="${debug}"
716
            includes="upgrade_db_to_1_5.java">
717
       <classpath>
718
         <path refid="compile.classpath"/>
719
       </classpath>
720
     </javac>
721

    
722
     <java classname="upgrade_db_to_1_5">
723
       <classpath>
724
         <path refid="compile.classpath"/>
725
         <fileset dir="${build.tmp}"/>
726
       </classpath>
727
     </java>
728

    
729
   </target>
730

    
731
   <target name="upgrade16" depends="prepare"
732
            description="Updates the database tables from version 1.5 to version 1.6">
733
     <echo/>
734
     <echo>Updating the database tables to upgrade to version 1.6...</echo>
735
     <sql driver="${dbDriver}"
736
          url="${jdbc-connect}"
737
          userid="${user}"
738
          password="${password}"
739
          src="${build.src}/${upgrade-1.6-sql}">
740
       <classpath>
741
         <path refid="compile.classpath"/>
742
       </classpath>
743
     </sql>
744
   </target>
745

    
746

    
747
   <target name="sqlupgrade15" depends="prepare">
748
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
749
      <sql driver="${dbDriver}"
750
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
751
          url="${jdbc-connect}"
752
          userid="${user}"
753
          password="${password}"
754
          src="${build.src}/${upgrade-1.5-sql}" />
755
      <sql driver="${dbDriver}"
756
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
757
          url="${jdbc-connect}"
758
          userid="${user}"
759
          password="${password}"
760
          rdbms="oracle"
761
          delimiter="/">
762
        <transaction>
763
           CREATE TRIGGER xml_returnfield_before_insert
764
           BEFORE INSERT ON xml_returnfield FOR EACH ROW
765
           BEGIN
766
              SELECT xml_returnfield_id_seq.nextval
767
                 INTO :new.returnfield_id
768
                 FROM dual;
769
           END;
770
           /
771
        </transaction>
772
        <transaction>
773
           CREATE TRIGGER xml_queryresult_before_insert
774
           BEFORE INSERT ON xml_queryresult FOR EACH ROW
775
           BEGIN
776
              SELECT xml_queryresult_id_seq.nextval
777
              INTO :new.queryresult_id
778
              FROM dual;
779
           END;
780
           /
781
        </transaction>
782
      </sql>
783
   </target>
784

    
785
   <target name="install-spatial" depends="jar,clientjar,harvesterjar" if="enable.spatial"
786
           description="Installs spatial option for metacat">
787

    
788
      <property name="spatial.dir" value="./lib/spatial"/>
789
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
790
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
791

    
792
      <!-- Copy geoserver libs into ${war.lib} -->
793
      <copy todir="${war.lib}" filtering="no">
794
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
795
          <include name="**"/>
796
        </fileset>
797
      </copy>
798

    
799
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
800
      <copy todir="${war.webinf}" filtering="no">
801
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
802
          <exclude name="lib/**"/>
803
          <exclude name="web.xml"/>
804
        </fileset>
805
      </copy>
806

    
807
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
808
      <copy todir="${war.context}" filtering="no">
809
        <fileset dir="${spatial.geoserver.dir}">
810
          <exclude name="WEB-INF/**"/>
811
          <exclude name="index.jsp"/>
812
        </fileset>
813
      </copy>
814

    
815
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
816
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
817
          tofile="${war.context}/geoserver.jsp"
818
          overwrite="true"
819
          filtering="no"/>
820

    
821
      <!-- Copy the geoserver/metacat combined web.xml into ${build.war}/web.xml   -->
822
      <copy file="${spatial.webinf-mods}/web.xml.combined"
823
          tofile="${build.war}/web.xml"
824
          overwrite="true"
825
          filtering="no"/>
826

    
827
      <!-- Copy the rest of the modified geoserver web-inf files
828
      <copy todir="${war.webinf}" filtering="no">
829
        <fileset dir="${spatial.webinf-mods}">
830
          <exclude name="web.xml.combined"/>
831
        </fileset>
832
      </copy> -->
833

    
834
    </target>
835

    
836

    
837
   <target name="install" depends="install-ecogrid" description="* Full Install *">
838
       <mkdir dir="${datafilepath}" />
839
       <mkdir dir="${inlinedatafilepath}" />
840
       <chmod dir="${datafilepath}" perm="ug+w" />
841
       <mkdir dir="${temp-dir}"/>
842
       <chmod dir="${temp-dir}" perm="ug+w" />
843
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
844
              <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
845
   </target>
846
        
847
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
848
                            description="Install Ecogrid Compentent">
849
             <copyfile src="lib/metacat.url" dest="${ecogrid-dir}/conf/MetacatImpl/classes/metacat.properties" forceoverwrite="true" filtering="yes"/>
850
             <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
851
                    <property name="context" value="${metacat.context}"/>
852
                           <property name="target" value="${ecogrid-target-name}"/>
853
                           <property name="metacat.dir" value="${metacat.dir}"/>
854
             </ant>
855
             <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
856
                <property name="context" value="${metacat.context}"/>
857
                <property name="target" value="${ecogrid-target-name}"/>
858
                <property name="metacat.dir" value="${metacat.dir}"/>
859
             </ant>
860
             <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
861
                <webinf dir="${ecogrid-dir}/lib">
862
                   <include name="server-config.wsdd"/>
863
                 </webinf>
864
             </war>
865
             <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
866
             
867
   
868
   </target>
869
   
870
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
871
        <echo>Enter CVS password: </echo>
872
             <cvs cvsRoot="${cvsroot}"
873
                  package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
874
   </target>
875
        
876
           
877
   <target name="upgrade" depends="install"
878
          description="* Upgrade an existing metacat installation with a new version *">
879
       <unwar src="${deploy.dir}/${metacat.context}.war" dest="${deploy.dir}/${metacat.context}" />
880
   </target>
881
        
882
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
883
            <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
884
                       <property name="context" value="${metacat.context}"/>
885
                       <property name="target" value="${ecogrid-target-name}"/>
886
                <property name="metacat.dir" value="${metacat.dir}"/>
887
                <property name="hostname" value="${config.hostname}"/>
888
                <property name="port" value="${config.port}"/>
889
            </ant>
890
   </target>
891
        
892
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
893
      <delete file="${deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
894
   </target>
895

    
896
   <target name="install-registry" depends="init,getConversionXSL"
897
            description="Install Registry">
898

    
899
      <copy file="${srcdir}/perl/register-dataset.cgi"
900
            todir="${inst.cgi.dir}" filtering="yes"/>
901
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
902

    
903
      <mkdir dir="${temp-dir}" />
904
      <copy todir="${temp-dir}" filtering="yes">
905
       <fileset dir="lib/style/common/emlb6toeml2">
906
         <include name="*.xsl"/>
907
         <include name="*.xml"/>
908
       </fileset>
909
      </copy>
910

    
911
      <echo message="Install Registry completed." />
912
   </target>
913

    
914
   <target name="install-ldap" depends="init">
915
      <copy file="${srcdir}/perl/ldapweb.cgi"
916
            todir="${inst.cgi.dir}" filtering="yes"/>
917
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
918
      <copy file="lib/ldapweb.cfg"
919
            todir="${inst.cgi.dir}" filtering="yes"/>
920
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
921
      <mkdir dir="${templates.dir}" />
922
      <copy todir="${templates.dir}" filtering="yes">
923
        <fileset dir="lib/style/common/templates">
924
            <include name="${defaultChangePass}"/>
925
            <include name="${defaultResetPass}"/>
926
            <include name="${changePassSuccess}"/>
927
            <include name="${resetPassSuccess}"/>
928
            <include name="${registerFailed}"/>
929
            <include name="${registerLter}"/>
930
            <include name="${registerMatch}"/>
931
            <include name="${registerSuccess}"/>
932
            <include name="${register}"/>
933
            <include name="${searchResults}"/>
934
            <include name="${defaultHeader}"/>
935
            <include name="${defaultFooter}"/>
936
            <include name="${responseForm}"/>
937
        </fileset>
938
      </copy>
939
      <echo message="ldapweb install complete." />
940
   </target>
941

    
942

    
943
   <target name="install-skin" depends="init"
944
            description="Install a Skin">
945

    
946
      <input message="Please enter name of the skin"
947
             addproperty="skin-name"/>
948

    
949
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
950
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
951
       <fileset dir="lib/style/skins/${skin-name}">
952
           <exclude name="**/*.png"/>
953
           <exclude name="**/*.gif"/>
954
           <exclude name="**/*.jpg"/>
955
           <exclude name="**/CVS*"/>
956
           <exclude name="**/.#*"/>
957
       </fileset>
958
      </copy>
959
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
960
       <fileset dir="lib/style/skins/${skin-name}">
961
           <include name="**/*.png"/>
962
           <include name="**/*.gif"/>
963
           <include name="**/*.jpg"/>
964
           <exclude name="**/CVS*"/>
965
           <exclude name="**/.#*"/>
966
       </fileset>
967
      </copy>
968
      <copy todir="${installdir}/style/common" filtering="yes">
969
       <fileset dir="lib/style/common">
970
           <include name="*.js"/>
971
           <include name="*.jsp"/>
972
           <include name="*.css"/>
973
           <exclude name="*.png"/>
974
           <exclude name="*.gif"/>
975
           <exclude name="*.jpg"/>
976
           <exclude name="**/CVS*"/>
977
           <exclude name="**/.#*"/>
978
       </fileset>
979
      </copy>
980
      <!--
981
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
982
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
983
       <fileset dir="lib/style/skins/${skin-name}/images">
984
           <include name="*.png"/>
985
           <include name="*.gif"/>
986
           <include name="*.jpg"/>
987
       </fileset>
988
      </copy>
989
      -->
990

    
991
      <echo message="Install Skin completed." />
992
   </target>
993

    
994
   <target name="war" depends="warPrepare,warMSSQL,install-spatial"
995
            description="Create a web archive (WAR) for servlet deployment">
996
       <mkdir dir="${dist.dir}" />
997
       <war destfile="${dist.dir}/${metacat.context}.war"
998
            webxml="${build.war}/web.xml">
999
         <fileset dir="${war.context}"/>
1000
         <lib dir="${war.lib}"/>
1001
         <webinf dir="${war.webinf}"/>
1002
       </war>
1003
   </target>
1004
        
1005
        
1006

    
1007
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
1008
            description="Prepare files for creating a web archive (WAR)">
1009

    
1010
       <property name="war.lib" value="${build.war}/lib" />
1011
       <property name="war.webinf" value="${build.war}/WEB-INF" />
1012
       <property name="war.context" value="${build.war}/${metacat.context}" />
1013
       <mkdir dir="${war.lib}" />
1014
       <mkdir dir="${war.webinf}" />
1015
       <mkdir dir="${war.context}" />
1016
       
1017
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
1018
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
1019
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
1020
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
1021
       <copy todir="${war.lib}" filtering="no">
1022
         <fileset dir="lib">
1023
            <not>
1024
               <filename name="${jdbc-jar-name}"/>
1025
            </not>
1026
            <include name="*.jar"/>
1027
         </fileset>
1028
         <fileset dir="lib">
1029
           <include name="xalan.jar"/>
1030
         </fileset>
1031
       </copy>
1032
       <copy file="lib/web.xml.${tomcatversion}"
1033
             tofile="${build.war}/web.xml" />
1034
       <copy file="lib/metacat.properties" todir="${war.webinf}"
1035
             filtering="yes" />
1036
       <copy todir="${war.webinf}" filtering="yes">
1037
                     <fileset dir="lib">
1038
           <include name="skin.configs/**"/>
1039
                  </fileset>
1040
           </copy>
1041
       <copy file="lib/log4j.properties" todir="${war.webinf}"
1042
             filtering="yes" />
1043
       <copy todir="${war.context}" filtering="no">
1044
         <fileset dir="lib">
1045
           <include name="**/*.jpg"/>
1046
           <include name="**/*.png"/>
1047
           <include name="**/*.gif"/>
1048
           <include name="LiveMap_30/**"/>
1049
         </fileset>
1050
       </copy>
1051
       <copy todir="${war.context}" filtering="yes">
1052
         <fileset dir="lib">
1053
           <exclude name="*.jar"/>
1054
           <exclude name="*.properties"/>
1055
           <exclude name="web.xml"/>
1056
           <exclude name="**/*.jpg"/>
1057
           <exclude name="**/*.png"/>
1058
           <exclude name="**/*.gif"/>
1059
           <exclude name="lsid_lib/**"/>
1060
           <exclude name="lsid_conf/**"/>
1061
           <exclude name="LiveMap_30/**"/>
1062
           <exclude name="skin.configs/**"/>
1063
           <exclude name="spatial/geoserver/**"/>
1064
           <exclude name="spatial/WEB-INF/**"/>
1065
         </fileset>
1066
       </copy>
1067
   </target>
1068

    
1069
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
1070
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
1071
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
1072
   </target>
1073

    
1074
   <target name="getConversionXSL" depends="prepare"
1075
            unless="styles.not.needed"
1076
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1077

    
1078
     <echo>Enter CVS password: </echo>
1079
     <cvs cvsRoot="${cvsroot}"
1080
          package="${eml-module}"
1081
          tag="${eml2_0_1-tag}"
1082
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
1083

    
1084
     <mkdir dir="lib/style/common/emlb6toeml2" />
1085
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1086
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
1087
         <include name="*.xsl"/>
1088
         <include name="*.xml"/>
1089
       </fileset>
1090
      </copy>
1091
   </target>
1092

    
1093
   <target name="testprep" depends="jar,clientjar,harvesterjar">
1094
      <mkdir dir="${build.tests}"/>
1095
      <copy todir="${build.tests}" filtering="yes">
1096
        <fileset dir="${testdir}">
1097
          <include name="edu/**"/>
1098
        </fileset>
1099
      </copy>
1100
      <!-- copy and compile the tests into a jar file -->
1101
      <javac srcdir="${build.tests}"
1102
             destdir="${build.tests}"
1103
             debug="on"
1104
             includes="**/*.java">
1105
        <classpath>
1106
          <path refid="compile.classpath"/>
1107
          <fileset dir="${build.dir}">
1108
            <include name="${name}.jar"/>
1109
            <include name="${name}-client.jar"/>
1110
            <include name="harvester.jar"/>
1111
          </fileset>
1112
        </classpath>
1113
      </javac>
1114

    
1115
      <jar jarfile="${build.dir}/${name}-junittests.jar"
1116
        basedir="${build.tests}"
1117
                includes="**/*.class" />
1118
   </target>
1119

    
1120
   <target name="test" depends="testprep"
1121
            description="Uses the ant junit task to run all JUnit tests">
1122

    
1123
      <!-- use the ant "junit" task to run JUnit tests. -->
1124
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1125
             haltonerror="no">
1126
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
1127
        <classpath>
1128
          <path refid="compile.classpath"/>
1129
          <fileset dir="${build.dir}">
1130
            <include name="${name}.jar"/>
1131
            <include name="${name}-client.jar"/>
1132
            <include name="harvester.jar"/>
1133
            <include name="${name}-junittests.jar"/>
1134
          </fileset>
1135
        </classpath>
1136

    
1137
        <formatter type="plain" />
1138

    
1139
        <batchtest fork="yes" todir="${build.dir}">
1140
          <fileset dir="${build.tests}">
1141
            <include name="**/*.class" />
1142
          </fileset>
1143
        </batchtest>
1144
     </junit>
1145
   </target>
1146

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

    
1150
              <echo>testtorun: ${testtorun}</echo>
1151

    
1152
      <!-- use the ant "junit" task to run JUnit tests. -->
1153
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1154
             haltonerror="no">
1155
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1156
        <classpath>
1157
          <path refid="compile.classpath"/>
1158
          <fileset dir="${build.dir}">
1159
            <include name="${name}.jar"/>
1160
            <include name="${name}-client.jar"/>
1161
            <include name="harvester.jar"/>
1162
            <include name="${name}-junittests.jar"/>
1163
          </fileset>
1164
        </classpath>
1165

    
1166
        <formatter type="plain" />
1167

    
1168
        <batchtest fork="yes" todir="${build.dir}">
1169
          <fileset dir="${build.tests}">
1170
            <include name="**/${testtorun}.class" />
1171
          </fileset>
1172
        </batchtest>
1173
     </junit>
1174
   </target>
1175

    
1176
   <target name="testharvester"
1177
           depends="testprep"
1178
           description="Uses the ant junit task to test only the Harvester code">
1179
     <junit printsummary="yes"
1180
            haltonfailure="off"
1181
            fork="yes"
1182
            haltonerror="off">
1183
        <classpath>
1184
          <path refid="compile.classpath"/>
1185
          <fileset dir="${build.dir}">
1186
            <include name="${name}.jar"/>
1187
            <include name="${name}-client.jar"/>
1188
            <include name="harvester.jar"/>
1189
            <include name="${name}-junittests.jar"/>
1190
          </fileset>
1191
        </classpath>
1192
       <formatter type="plain" />
1193
       <batchtest fork="yes" todir="${build.dir}">
1194
         <fileset dir="${build.tests}">
1195
           <include name="**/harvesterClient/*.class" />
1196
         </fileset>
1197
       </batchtest>
1198
     </junit>
1199
   </target>
1200

    
1201
  <target name="gethttpclient" depends="prepare"
1202
            description="checks out and compiles morpho httpclient code">
1203
  <!--mkdir dir="${morphosourcedir}" -->
1204
        <cvs cvsRoot="${cvsroot}"
1205
             package="morpho"
1206
             dest="." />
1207
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1208
   </target>
1209

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

    
1214
      <echo>***********************************
1215
      Please run ant gethttpclient first!
1216
      ***********************************
1217
      </echo>
1218
      <!-- copy and compile the tests into a jar file -->
1219
      <mkdir dir="${build.metacatnettest}"/>
1220
      <javac srcdir="${junitnettestsdir}"
1221
             destdir="${build.metacatnettest}"
1222
             includes="**/*.java">
1223
        <classpath>
1224
          <path refid="compile.classpath"/>
1225
          <fileset dir="${build.dir}">
1226
            <include name="${name}.jar"/>
1227
          </fileset>
1228
        </classpath>
1229
      </javac>
1230

    
1231
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1232
                    basedir="${build.metacatnettest}"
1233
                    includes="**/*.class" />
1234

    
1235
      <!-- use the ant "junit" task to run JUnit tests. -->
1236
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1237
             haltonerror="no">
1238
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1239
        <classpath>
1240
          <path refid="compile.classpath"/>
1241
          <fileset dir="${build.dir}">
1242
            <include name="${name}.jar"/>
1243
            <include name="${name}-junitnettests.jar"/>
1244
          </fileset>
1245
        </classpath>
1246

    
1247
        <formatter type="plain" />
1248

    
1249
        <batchtest fork="yes" todir="${build.dir}">
1250
          <fileset dir="${build.metacatnettest}">
1251
            <include name="**/*.class" />
1252
          </fileset>
1253
        </batchtest>
1254
     </junit>
1255
   </target>
1256

    
1257
   <target name="cleanweb" depends="clean"
1258
            description="deletes tomcat web context dir and all its contents">
1259
     <delete dir="${installdir}" />
1260
   </target>
1261

    
1262

    
1263
   <target name="clean" depends="init"
1264
            description="deletes build dir and files that can be regenerated form the release">
1265
       <delete dir="${build.dir}" />
1266
       <delete dir="${dist.dir}" />
1267
   </target>
1268

    
1269
   <target name="fullclean" depends="clean"
1270
            description="deletes even jars that depend on external sources such as stylesheets and jars">
1271
       <delete file="lib/httpclient.jar" />
1272
       <delete file="lib/utilities.jar" />
1273
       <delete includeEmptyDirs="true" failonerror="false">
1274
         <fileset dir="${style-common-cvsrelpath}">
1275
           <include name="${eml-css}" />
1276
           <include name="eml-*/*.xsl" />
1277
           <include name="eml-*" />
1278
         </fileset>
1279
       </delete>
1280
   </target>
1281

    
1282
   <target name="jdoc" depends="prepare"
1283
            description="generates javadoc documentation">
1284
       <javadoc packagenames="edu.ucsb.nceas.*"
1285
           sourcepath="${build.src}"
1286
           destdir="${build.javadocs}"
1287
           author="true"
1288
           version="true"
1289
           use="true"
1290
           windowtitle="${Name} API"
1291
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1292
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1293
         <classpath>
1294
           <path refid="compile.classpath"/>
1295
         </classpath>
1296
       </javadoc>
1297
   </target>
1298

    
1299
   <target name="dist"
1300
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1301
            description="prepares a full release distribution">
1302
      <mkdir dir="${dist.dir}"/>
1303
      <delete dir="${ver.dir}" />
1304
      <mkdir dir="${ver.dir}"/>
1305
      <copy todir="${ver.dir}">
1306
        <fileset dir="."
1307
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1308
      </copy>
1309
      <copy todir="${ver.dir}" file="build.xml"/>
1310
      <copy todir="${ver.dir}" file="build.properties"/>
1311

    
1312
      <copy todir="${ver.dir}/docs" filtering="yes">
1313
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1314
      </copy>
1315
      <copy todir="${ver.dir}/docs" filtering="no">
1316
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1317
      </copy>
1318
      <copy todir="${ver.dir}/docs/dev">
1319
        <fileset dir="${build.dir}/docs"/>
1320
      </copy>
1321
      <copy todir="${ver.dir}/src">
1322
        <fileset dir="${build.dir}/src"/>
1323
      </copy>
1324
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1325
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1326
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1327
      <!--
1328
      <delete dir="./${ver.dir}/${build.dir}"/>
1329
      <delete dir="./${ver.dir}/dist"/>
1330
      -->
1331
      <delete file="./${name}-${release}.zip"/>
1332
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1333
      <delete file="./${name}-${release}.tar.gz" />
1334
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1335
      <gzip zipfile="./${name}-${release}.tar.gz"
1336
                src="./${name}-${release}.tar"/>
1337
      <delete file="./${name}-${release}.tar" />
1338
  </target>
1339

    
1340
  <target name="distsrc" depends="dist"
1341
            description="prepares a source distribution">
1342
      <mkdir dir="${ver.src}"/>
1343
      <copy todir="${ver.src}">
1344
        <fileset dir="./src"/>
1345
      </copy>
1346
      <mkdir dir="${util.dir}"/>
1347
      <copy todir="${util.dir}">
1348
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1349
      </copy>
1350
            
1351
            <mkdir dir="${ecogrid-dist-dir}"/>
1352
            <copy todir="${ecogrid-dist-dir}">
1353
                  <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1354
            </copy>
1355

    
1356
      <delete file="./${name}-src-${release}.zip"/>
1357
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1358
      <delete file="./${name}-src-${release}.tar.gz" />
1359
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1360
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1361
                src="./${name}-src-${release}.tar"/>
1362
      <delete file="./${name}-src-${release}.tar" />
1363
      <delete dir="${dist.dir}"/>
1364
  </target>
1365

    
1366
   <target name="stylesheettest">
1367
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1368
      <param name="displaymodule" expression="${displaymodule}"/>
1369
      <param name="docid" expression="${input}"/>
1370
      <param name="entitytype" expression="${entitytype}"/>
1371
      <param name="entityindex" expression="${entityindex}"/>
1372
      <outputproperty name="method" value="html"/>
1373
      <outputproperty name="standalone" value="yes"/>
1374
      <outputproperty name="encoding" value="iso8859_1"/>
1375
      <outputproperty name="indent" value="yes"/>
1376
    </xslt>
1377
  </target>
1378

    
1379
 <target name="gridinit" depends="init">
1380
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1381
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1382
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1383
   <property environment="env"/>
1384
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1385
    <path id="webservicepath">
1386
        <pathelement location="."/>
1387
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1388
        <pathelement location="${build.dest}"/>
1389
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1390
           <include name="*.jar"/>
1391
        </fileset>
1392
      </path>
1393
</target>
1394

    
1395
 <target name="gridprepare" depends="gridinit, prepare">
1396
 </target>
1397

    
1398
  <target name="compileinterface" depends="clean, gridprepare">
1399
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1400
  </target>
1401

    
1402
  <target name="generateWSDL" depends="compileinterface">
1403
    <echo message="Generating wsdl from ${interface.name} interface"/>
1404
    <java classname="${java2wsdl.tool}"
1405
          dir="${build.src}" fork="yes"
1406
          classpathref="webservicepath"  failonerror="true" >
1407
      <arg value="-P"/>
1408
      <arg value="${interface.name}PortType"/>
1409
      <arg value="-S"/>
1410
      <arg value="${interface.name}Service"/>
1411
      <arg value="-y"/>
1412
      <arg value="WRAPPED"/>
1413
      <arg value="-u"/>
1414
      <arg value="LITERAL"/>
1415
      <arg value="-l"/>
1416
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1417
      <arg value="-n"/>
1418
      <arg value="http://${services.namespace}/${interface.name}"/>
1419
      <arg value="${interface.package}.${interface.name}"/>
1420
    </java>
1421
  </target>
1422

    
1423
   <target name="decorateWSDL" depends="generateWSDL">
1424
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1425
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1426
            fork="yes"
1427
            classpathref="webservicepath" failonerror="true" >
1428
        <arg value="${binding.file}"/>
1429
        <arg value="${wsdl.file}"/>
1430
      </java>
1431
   </target>
1432

    
1433
   <target name="generatestubs" depends="decorateWSDL">
1434
      <echo message=" Generating stubs " />
1435
      <echo message="wsdl file is ${wsdl.file}"/>
1436
      <echo message="build.src is ${build.src}"/>
1437
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1438
            classpathref="webservicepath" failonerror="true" >
1439
         <arg value="${wsdl.file}"/>
1440
    </java>
1441
  </target>
1442

    
1443
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1444
     <echo message=" Compiling stubs " />
1445
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1446
     <echo message=" Compiling impl " />
1447
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1448
  </target>
1449

    
1450
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1451
     <echo message=" jar stubs classes " />
1452
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1453
     <echo message=" jar impl classes " />
1454
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1455
  </target>
1456

    
1457
  <target name="gar" depends="jarStubsAndImpl">
1458
     <echo message=" jar the gar file"/>
1459
     <mkdir dir="${build.dir}/gar"/>
1460
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1461
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1462
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1463
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1464
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1465
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1466
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1467
  </target>
1468

    
1469
  <target name="compilewebclient" depends="prepare">
1470
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1471
  </target>
1472

    
1473
  <target name="runwebclient" depends="compilewebclient">
1474
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1475
           dir="${build.dest}" fork="yes"
1476
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1477
         <arg value="${serviceUrl}"/>
1478
         <arg value="${docid}"/>
1479
     </java>
1480
  </target>
1481
  
1482
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1483

    
1484
    <echo message="Compiling the metatcat shapefile creator"/>
1485
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1486
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1487
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1488
    </exec>
1489
  
1490
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1491
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1492
    </exec>
1493
  </target>
1494

    
1495
    <!-- LSID Authority support -->
1496
    <patternset id="lsid.jars">
1497
        <include name="axis.jar" />
1498
        <include name="commons-discovery-0.2.jar" />
1499
        <include name="jaxrpc.jar" />
1500
        <include name="lsid-client-1.1.1.jar" />
1501
        <include name="lsid-server-1.1.1.jar" />
1502
        <include name="saaj.jar" />
1503
        <include name="wsdl4j-1.5.1.jar" />
1504
        <include name="activation.jar" />
1505
        <include name="castor-0.9.5.jar" />
1506
        <include name="dnsjava-1.3.2.jar" />
1507
        <include name="mail.jar" />
1508
        <include name="commons-logging-1.0.4.jar" />
1509
        <!-- These jars may be needed but seem to not actually be,
1510
             so leaving them out for now
1511
        <include name="axis-ant.jar" />
1512
        -->
1513
        <!--<include name="GenCastor.class" />-->
1514
    </patternset>
1515
    <patternset id="lib.jars">
1516
        <include name="httpclient.jar" />
1517
        <include name="log4j-1.2.12.jar" />
1518
        <include name="utilities.jar" />
1519
        <include name="xercesImpl.jar" />
1520
        <include name="xalan.jar" />
1521
        <include name="xml-apis.jar" />
1522
    </patternset>
1523

    
1524
    <path id="lsid.classpath">
1525
        <fileset dir="${lsid.lib.dir}">
1526
            <patternset refid="lsid.jars"/>
1527
        </fileset>
1528
        <fileset dir="${lib.dir}">
1529
            <patternset refid="lsid.jars"/>
1530
        </fileset>
1531
        <fileset dir="${lib.dir}">
1532
            <include name="xalan.jar" />
1533
            <include name="xml-apis.jar" />
1534
        </fileset>
1535
        <fileset dir="${build.dir}">
1536
            <include name="metacat-client.jar" />
1537
        </fileset>
1538
    </path>
1539

    
1540
    <filterset id="configFilters">
1541
        <filter token="LSID_AUTHORITY_HOSTNAME"
1542
                value="${config.hostname}" />
1543
        <filter token="LSID_AUTHORITY_PORT"
1544
                value="${config.port}" />
1545
        <filter token="METADATA_LABELS"
1546
                value="${config.metadataLabelLsid}" />
1547
        <filter token="METACAT_SERVER"
1548
                value="${config.metacatserver}" />
1549
        <filter token="LSID_AUTHORITY_STRING"
1550
                value="${config.lsidauthority}" />
1551
    </filterset>
1552
    
1553
    <target name="prepare-lsid"
1554
            depends="prepare,utilities,clientjar"
1555
            description="Configure files prior to compilation">
1556
        <mkdir dir="${lsid.build.dir}" />
1557
        <!-- Copy the properties file into the build -->
1558
        <copy file="${conf.dir}/metacat-lsid.properties"
1559
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1560
              overwrite="true">
1561
            <filterset refid="configFilters" />
1562
        </copy>
1563
        <copy file="${conf.dir}/log4j.properties"
1564
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1565
              overwrite="true">
1566
            <filterset refid="configFilters" />
1567
        </copy>
1568
        <!-- Copy config files into the build -->
1569
        <copy todir="${lsid.build.dir}/WEB-INF">
1570
            <fileset dir="${webinf.dir}"
1571
                     includes="**/*.wsdd" />
1572
        </copy>
1573
        <!-- Copy the metadata configuration files into the build -->
1574
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1575
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1576
            <fileset dir="${conf.dir}"
1577
                     includes="**/*.xml" />
1578
            <fileset dir="${conf.dir}"
1579
                     includes="**/*.xslt" />
1580
            <filterset refid="configFilters" />
1581
        </copy>
1582
        <!-- Copy services files into the build -->
1583
        <mkdir dir="${lsid.build.dir}/services" />
1584
        <copy todir="${lsid.build.dir}/services">
1585
            <fileset dir="${services.dir}" />
1586
            <filterset refid="configFilters" />
1587
        </copy>
1588
        <!-- Copy axis files into the build -->
1589
        <mkdir dir="${lsid.build.dir}" />
1590
        <copy todir="${lsid.build.dir}">
1591
            <fileset dir="${conf.dir}/axis"
1592
                     excludes="*.properties"/>
1593
        </copy>
1594
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1595
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1596
            <fileset dir="${conf.dir}/axis"
1597
                     includes="*.properties"/>
1598
        </copy>
1599
    </target>
1600
    
1601
    <target name="compile-lsid"
1602
            depends="prepare-lsid"
1603
            description="Compile Java sources">
1604
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1605
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1606
               destdir="${lsid.build.dir}/WEB-INF/classes"
1607
               debug="${compile.debug}"
1608
               deprecation="${compile.deprecation}"
1609
               optimize="${compile.optimize}">
1610
            <classpath refid="lsid.classpath" />
1611
        </javac>
1612
    </target>
1613
    
1614
    <target name="war-lsid"
1615
            depends="compile-lsid"
1616
            description="Create a war file for the application">
1617
        <mkdir dir="${dist.dir}" />
1618
        <war destfile="${dist.dir}/${authority.context}.war"
1619
             webxml="${webinf.dir}/web.xml">
1620
            <fileset dir="${lsid.build.dir}" />
1621
            <lib dir="${lsid.lib.dir}">
1622
                <patternset refid="lsid.jars"/>
1623
            </lib>
1624
            <lib dir="${lib.dir}">
1625
                <patternset refid="lib.jars"/>
1626
            </lib>
1627
            <lib dir="${lib.dir}">
1628
                <include name="xalan.jar" />
1629
                <include name="xml-apis.jar" />
1630
            </lib>
1631
            <lib dir="${build.dir}">
1632
                <include name="metacat-client.jar" />
1633
            </lib>
1634
        </war>
1635
    </target>
1636
    
1637
    <target name="deploy-lsid"
1638
            depends="war-lsid"
1639
            description="Deploy LSID war to servlet container">
1640
        <delete dir="${deploy.dir}/${authority.context}" />
1641
        <delete file="${deploy.dir}/${authority.context}.war" />
1642
        <mkdir dir="${deploy.dir}" />
1643
        <copy todir="${deploy.dir}">
1644
            <fileset dir="${dist.dir}" />
1645
        </copy>
1646
    </target>
1647
</project>