Project

General

Profile

metacat / build.xml @ 3095

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: cjones $'
10
  *    '$Date: 2006-11-17 13:44:34 -0800 (Fri, 17 Nov 2006) $'
11
  *    '$Revision: 3095 $'
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
  <target name="check-db">
53
    <condition property="use-oracle">
54
      <equals arg1="${database}" arg2="oracle" />
55
    </condition>
56
    <condition property="use-postgresql">
57
      <equals arg1="${database}" arg2="postgresql" />
58
    </condition>
59
    <condition property="use-sqlserver">
60
      <equals arg1="${database}" arg2="sqlserver" />
61
    </condition>
62
  </target>
63

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

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

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

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

    
133
      <property name="debug" value="on" />
134
      <property name="debuglevel" value="55" />
135

    
136
      <property name="morphosourcedir" value="../morpho" />
137
      <property name="defaultcontenttype" value="application/octet-stream" />
138
      <property name="utilitiesdir" value="../utilities" />
139

    
140
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
141
      <echo>*********** set jsdk to ${jsdk}</echo>
142
  </target>
143

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

    
164
        <!-- Include geoserver, geotools, et. al. -->
165
        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
166
          <include name="*.jar"/>
167
        </fileset>
168
        <pathelement location="lib/spatial/geoserver/WEB-INF/classes"/>
169

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

    
225
      <property name="defaultStage"        value="initregister"/>
226
      <property name="defaultHeader"       value="genericHeader.tmpl"/>
227
      <property name="defaultFooter"       value="genericFooter.tmpl"/>
228
      <property name="defaultChangePass"   value="ldapChangePass.tmpl"/>
229
      <property name="defaultResetPass"    value="ldapResetPass.tmpl"/>
230
      <property name="changePassSuccess"   value="ldapChangePassSuccess.tmpl"/>
231
      <property name="resetPassSuccess"    value="ldapResetPassSuccess.tmpl"/>
232
      <property name="registerFailed"      value="ldapRegisterFailed.tmpl"/>
233
      <property name="registerLter"        value="ldapRegisterLter.tmpl"/>
234
      <property name="registerMatch"       value="ldapRegisterMatch.tmpl"/>
235
      <property name="registerSuccess"     value="ldapRegisterSuccess.tmpl"/>
236
      <property name="register"            value="ldapRegister.tmpl"/>
237
      <property name="searchResults"       value="searchResults.tmpl"/>
238

    
239
      <filter token="scope"                value="${scope}"/>
240
      <filter token="responseForm"         value="${responseForm}"/>
241
      <filter token="entryForm"            value="${entryForm}"/>
242
      <filter token="guide"                value="${guide}"/>
243
      <filter token="loginForm"            value="${loginForm}"/>
244
      <filter token="confirmData"          value="${confirmData}"/>
245
      <filter token="deleteData"           value="${deleteData}"/>
246
      <filter token="genericHeader"        value="${genericHeader}"/>
247
      <filter token="genericFooter"        value="${genericFooter}"/>
248
      <filter token="adminname"            value="${adminname}"/>
249
      <filter token="recipient"            value="${recipient}"/>
250

    
251
      <filter token="ldapurl"              value="ldap.ecoinformatics.org"/>
252
      <filter token="ldapSearchBase"       value="dc=ecoinformatics,dc=org"/>
253
      <filter token="ldap_user"            value="cn=Manager,dc=ecoinformatics,dc=org"/>
254
      <filter token="ldap_password"        value="ldap_password"/>
255
      <filter token="mailhost"             value="localhost"/>
256
      <filter token="sender"               value="knb-software\@nceas.ucsb.edu"/>
257
      <filter token="cgiurl"               value="${cgi-prefix}/ldapweb.cgi"/>
258

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

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

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

    
353
      <property name="dist.dir" value="dist"/>
354
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
355
      <property name="ver.src" value="${ver.dir}/src"/>
356
      <property name="util.dir" value="${dist.dir}/${util-module}"/>
357
          <!-- directories for creating a Harvest List Editor distribution -->
358
      <property name="dist.dir.hle" value="disthle"/>
359
      <property name="ver.dir.hle" value="${dist.dir.hle}/harvest-list-editor-${release}"/>
360
             
361
             
362
             <property name="ecogrid-target-name" value="metacatImpl"/>
363
             <property name="ecogrid-module-dest-dir" value =".."/>
364
             <property name="ecogrid-module" value="seek/projects/ecogrid"/>
365
             <property name="ecogrid-dist-dir" value="${dist.dir}/${ecogrid-module}"/>
366
             <property name="ecogrid-dir" value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
367

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

    
390
   </target>
391

    
392
   <target name="prepare" depends="init">
393
      <mkdir dir="${build.dir}"/>
394
      <mkdir dir="${build.src}"/>
395
      <mkdir dir="${build.dest}"/>
396
      <mkdir dir="${build.javadocs}"/>
397
      <mkdir dir="${build.tmp}"/>
398

    
399
      <copy todir="${build.src}" filtering="yes">
400
        <fileset dir="${srcdir}">
401
          <include name="edu/**"/>
402
          <include name="com/**"/>
403
          <include name="**/*.sql"/>
404
          <exclude name="**/CVS*"/>
405
          <exclude name="**/.#*"/>
406
        </fileset>
407
      </copy>
408
      <available file="lib/style/common/emlb6toeml2" type="dir"
409
                 property="styles.not.needed"/>
410
   </target>
411

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

    
415
       <javac srcdir="${build.src}"
416
              destdir="${build.dest}"
417
              debug="${debug}"
418
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
419
        <classpath>
420
          <path refid="compile.classpath"/>
421
        </classpath>
422
      </javac>
423
   </target>
424

    
425
   <target name="jar" depends="compile,geteml"
426
    description="Compiles and jars metacat java code to metacat.jar in build dir">
427

    
428
       <delete file="${build.dir}/${name}.jar" />
429
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
430
            excludes="**/protocols/ **/harvesterClient/" />
431
   </target>
432

    
433
   <target name="protocol" depends="compile"
434
    description="Compiles and jars protocol java code to protocol.jar in build dir">
435
       <delete file="${build.dir}/protocol.jar" />
436
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
437
            includes="**/protocols/" />
438
   </target>
439

    
440
   <target name="utilities" depends="config" if="utilities.required">
441
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
442
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
443
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
444
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
445
   </target>
446

    
447
   <target name="getutilities" depends="prepare"
448
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
449
     <echo>Enter CVS password: </echo>
450
     <cvs cvsRoot="${cvsroot}"
451
          package="${util-module}"
452
          dest="${build.tmp}" />
453
   </target>
454

    
455
   <target name="client" depends="utilities, prepare"
456
    description="Compiles metacat-client java code to build dir">
457
       <javac srcdir="${build.src}"
458
              destdir="${build.dest}"
459
              includes="edu/ucsb/nceas/metacat/client/*">
460
          <classpath>
461
            <path refid="compile.classpath"/>
462
          </classpath>
463
        </javac>
464
   </target>
465

    
466
   <target name="clientjar" depends="client"
467
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
468
       <delete file="${build.dir}/${name}-client.jar" />
469
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
470
            includes="**/metacat/client/" />
471
   </target>
472

    
473
    <target name="advancedsearchjar" depends="compile"
474
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
475
        <delete file="${build.dir}/advancedsearch.jar" />
476
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
477
             includes="**/metacat/advancedsearch/" />
478
    </target>
479

    
480
   <target name="harvester" depends="client"
481
           description="Compiles harvester java code to build dir">
482
       <javac srcdir="${build.src}"
483
              destdir="${build.dest}"
484
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
485
          <classpath>
486
            <path refid="compile.classpath"/>
487
          </classpath>
488
        </javac>
489
   </target>
490

    
491
   <target name="harvesterjar" depends="harvester"
492
           description="Compiles and jars harvester java code to harvester.jar in build dir">
493
       <delete file="${build.dir}/harvester.jar" />
494
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
495
            includes="**/metacat/harvesterClient/" />
496
   </target>
497

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

    
517
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
518
            description="Calls getemlpre2 and geteml2+ targets" />
519

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

    
535
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
536
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
537
       <include name="**/*.xsl"/>
538
     </fileset>
539
     </copy>
540
   </target>
541

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

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

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

    
561
     </copy>
562
     <!-- <antcall target="copyxsl">
563
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
564
        <param name="dirname" value="eml-2.0.0" />
565
     </antcall> -->
566

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

    
584
   <target  name="copyxsl"
585
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
586

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

    
589
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
590
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
591
       <include name="**/*.xsl"/>
592
     </fileset>
593
     </copy>
594

    
595

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

    
601
   </target>
602

    
603

    
604

    
605
   <target name="register-schemas" depends="prepare"
606
   description="Registers the Schemas with a new Metacat instance">
607
     <echo/>
608
     <echo>Registering the Schemas with the new Metacat instance...</echo>
609
     <sql driver="${dbDriver}"
610
          url="${jdbc-connect}"
611
          userid="${user}"
612
          password="${password}"
613
          src="${build.src}/loaddtdschema.sql">
614
       <classpath>
615
         <path refid="compile.classpath"/>
616
       </classpath>
617
     </sql>
618
   </target>
619

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

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

    
654
   <target name="upgrade12" depends="prepare"
655
            description="Updates the database tables to upgrade to version 1.2">
656
     <echo/>
657
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
658
     <sql driver="${dbDriver}"
659
          url="${jdbc-connect}"
660
          userid="${user}"
661
          password="${password}"
662
          src="${build.src}/${upgrade-1.2-sql}">
663
       <classpath>
664
         <path refid="compile.classpath"/>
665
       </classpath>
666
     </sql>
667
   </target>
668

    
669
   <target name="upgrade13" depends="prepare"
670
            description="Updates the database tables to upgrade to version 1.3">
671
     <echo/>
672
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
673
     <sql driver="${dbDriver}"
674
          url="${jdbc-connect}"
675
          userid="${user}"
676
          password="${password}"
677
          src="${build.src}/${upgrade-1.3-sql}">
678
       <classpath>
679
         <path refid="compile.classpath"/>
680
       </classpath>
681
     </sql>
682
   </target>
683

    
684
   <target name="upgrade14" depends="prepare"
685
            description="Updates the database tables to upgrade to version 1.4">
686
     <echo/>
687
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
688
     <sql driver="${dbDriver}"
689
          url="${jdbc-connect}"
690
          userid="${user}"
691
          password="${password}"
692
          src="${build.src}/${upgrade-1.4-sql}">
693
       <classpath>
694
         <path refid="compile.classpath"/>
695
       </classpath>
696
     </sql>
697
   </target>
698

    
699
   <target name="upgrade15" depends="sqlupgrade15"
700
           description="Updates the database tables to upgrade to version 1.5">
701
     <echo/>
702
     <echo>Updating the database tables to upgrade to version 1.5...</echo>
703
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
704
           todir="${build.tmp}" filtering="yes"/>
705

    
706
     <javac srcdir="${build.tmp}"
707
            destdir="${build.tmp}"
708
            debug="${debug}"
709
            includes="upgrade_db_to_1_5.java">
710
       <classpath>
711
         <path refid="compile.classpath"/>
712
       </classpath>
713
     </javac>
714

    
715
     <java classname="upgrade_db_to_1_5">
716
       <classpath>
717
         <path refid="compile.classpath"/>
718
         <fileset dir="${build.tmp}"/>
719
       </classpath>
720
     </java>
721

    
722
   </target>
723

    
724
   <target name="upgrade16" depends="prepare"
725
            description="Updates the database tables from version 1.5 to version 1.6">
726
     <echo/>
727
     <echo>Updating the database tables to upgrade to version 1.6...</echo>
728
     <sql driver="${dbDriver}"
729
          url="${jdbc-connect}"
730
          userid="${user}"
731
          password="${password}"
732
          src="${build.src}/${upgrade-1.6-sql}">
733
       <classpath>
734
         <path refid="compile.classpath"/>
735
       </classpath>
736
     </sql>
737
   </target>
738

    
739

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

    
778
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
779
           description="Installs spatial option for metacat">
780

    
781
      <property name="spatial.dir" value="./lib/spatial"/>
782
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
783
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
784

    
785
      <!-- Copy geoserver libs into ${war.lib} -->
786
      <copy todir="${war.lib}" filtering="no">
787
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
788
          <include name="**"/>
789
        </fileset>
790
      </copy>
791

    
792
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
793
      <copy todir="${war.webinf}" filtering="no">
794
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
795
          <exclude name="lib/**"/>
796
          <exclude name="web.xml"/>
797
        </fileset>
798
      </copy>
799

    
800
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
801
      <copy todir="${war.context}" filtering="no">
802
        <fileset dir="${spatial.geoserver.dir}">
803
          <exclude name="WEB-INF/**"/>
804
          <exclude name="index.jsp"/>
805
        </fileset>
806
      </copy>
807

    
808
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
809
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
810
          tofile="${war.context}/geoserver.jsp"
811
          overwrite="true"
812
          filtering="no"/>
813

    
814
      <!-- Copy the geoserver/metacat combined web.xml into ${build.war}/web.xml   -->
815
      <copy file="${spatial.webinf-mods}/web.xml.combined"
816
          tofile="${build.war}/web.xml"
817
          overwrite="true"
818
          filtering="no"/>
819

    
820
      <!-- Copy the rest of the modified geoserver web-inf files
821
      <copy todir="${war.webinf}" filtering="no">
822
        <fileset dir="${spatial.webinf-mods}">
823
          <exclude name="web.xml.combined"/>
824
        </fileset>
825
      </copy> -->
826

    
827
    </target>
828

    
829

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

    
889
   <target name="install-registry" depends="init,getConversionXSL"
890
            description="Install Registry">
891

    
892
      <copy file="${srcdir}/perl/register-dataset.cgi"
893
            todir="${inst.cgi.dir}" filtering="yes"/>
894
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
895

    
896
      <mkdir dir="${temp-dir}" />
897
      <copy todir="${temp-dir}" filtering="yes">
898
       <fileset dir="lib/style/common/emlb6toeml2">
899
         <include name="*.xsl"/>
900
         <include name="*.xml"/>
901
       </fileset>
902
      </copy>
903

    
904
      <echo message="Install Registry completed." />
905
   </target>
906

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

    
935

    
936
   <target name="install-skin" depends="init"
937
            description="Install a Skin">
938

    
939
      <input message="Please enter name of the skin"
940
             addproperty="skin-name"/>
941

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

    
984
      <echo message="Install Skin completed." />
985
   </target>
986

    
987
   <target name="war" depends="warPrepare,warMSSQL,install-spatial"
988
            description="Create a web archive (WAR) for servlet deployment">
989
       <mkdir dir="${dist.dir}" />
990
       <war destfile="${dist.dir}/${metacat.context}.war"
991
            webxml="${build.war}/web.xml">
992
         <fileset dir="${war.context}"/>
993
         <lib dir="${war.lib}"/>
994
         <webinf dir="${war.webinf}"/>
995
       </war>
996
   </target>
997
        
998
        
999

    
1000
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
1001
            description="Prepare files for creating a web archive (WAR)">
1002

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

    
1062
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
1063
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
1064
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
1065
   </target>
1066

    
1067
   <target name="getConversionXSL" depends="prepare"
1068
            unless="styles.not.needed"
1069
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1070

    
1071
     <echo>Enter CVS password: </echo>
1072
     <cvs cvsRoot="${cvsroot}"
1073
          package="${eml-module}"
1074
          tag="${eml2_0_1-tag}"
1075
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
1076

    
1077
     <mkdir dir="lib/style/common/emlb6toeml2" />
1078
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1079
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
1080
         <include name="*.xsl"/>
1081
         <include name="*.xml"/>
1082
       </fileset>
1083
      </copy>
1084
   </target>
1085

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

    
1108
      <jar jarfile="${build.dir}/${name}-junittests.jar"
1109
        basedir="${build.tests}"
1110
                includes="**/*.class" />
1111
   </target>
1112

    
1113
   <target name="test" depends="testprep"
1114
            description="Uses the ant junit task to run all JUnit tests">
1115

    
1116
      <!-- use the ant "junit" task to run JUnit tests. -->
1117
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1118
             haltonerror="no">
1119
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
1120
        <classpath>
1121
          <path refid="compile.classpath"/>
1122
          <fileset dir="${build.dir}">
1123
            <include name="${name}.jar"/>
1124
            <include name="${name}-client.jar"/>
1125
            <include name="harvester.jar"/>
1126
            <include name="${name}-junittests.jar"/>
1127
          </fileset>
1128
        </classpath>
1129

    
1130
        <formatter type="plain" />
1131

    
1132
        <batchtest fork="yes" todir="${build.dir}">
1133
          <fileset dir="${build.tests}">
1134
            <include name="**/*.class" />
1135
          </fileset>
1136
        </batchtest>
1137
     </junit>
1138
   </target>
1139

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

    
1143
              <echo>testtorun: ${testtorun}</echo>
1144

    
1145
      <!-- use the ant "junit" task to run JUnit tests. -->
1146
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1147
             haltonerror="no">
1148
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1149
        <classpath>
1150
          <path refid="compile.classpath"/>
1151
          <fileset dir="${build.dir}">
1152
            <include name="${name}.jar"/>
1153
            <include name="${name}-client.jar"/>
1154
            <include name="harvester.jar"/>
1155
            <include name="${name}-junittests.jar"/>
1156
          </fileset>
1157
        </classpath>
1158

    
1159
        <formatter type="plain" />
1160

    
1161
        <batchtest fork="yes" todir="${build.dir}">
1162
          <fileset dir="${build.tests}">
1163
            <include name="**/${testtorun}.class" />
1164
          </fileset>
1165
        </batchtest>
1166
     </junit>
1167
   </target>
1168

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

    
1194
  <target name="gethttpclient" depends="prepare"
1195
            description="checks out and compiles morpho httpclient code">
1196
  <!--mkdir dir="${morphosourcedir}" -->
1197
        <cvs cvsRoot="${cvsroot}"
1198
             package="morpho"
1199
             dest="." />
1200
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1201
   </target>
1202

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

    
1207
      <echo>***********************************
1208
      Please run ant gethttpclient first!
1209
      ***********************************
1210
      </echo>
1211
      <!-- copy and compile the tests into a jar file -->
1212
      <mkdir dir="${build.metacatnettest}"/>
1213
      <javac srcdir="${junitnettestsdir}"
1214
             destdir="${build.metacatnettest}"
1215
             includes="**/*.java">
1216
        <classpath>
1217
          <path refid="compile.classpath"/>
1218
          <fileset dir="${build.dir}">
1219
            <include name="${name}.jar"/>
1220
          </fileset>
1221
        </classpath>
1222
      </javac>
1223

    
1224
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1225
                    basedir="${build.metacatnettest}"
1226
                    includes="**/*.class" />
1227

    
1228
      <!-- use the ant "junit" task to run JUnit tests. -->
1229
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1230
             haltonerror="no">
1231
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1232
        <classpath>
1233
          <path refid="compile.classpath"/>
1234
          <fileset dir="${build.dir}">
1235
            <include name="${name}.jar"/>
1236
            <include name="${name}-junitnettests.jar"/>
1237
          </fileset>
1238
        </classpath>
1239

    
1240
        <formatter type="plain" />
1241

    
1242
        <batchtest fork="yes" todir="${build.dir}">
1243
          <fileset dir="${build.metacatnettest}">
1244
            <include name="**/*.class" />
1245
          </fileset>
1246
        </batchtest>
1247
     </junit>
1248
   </target>
1249

    
1250
   <target name="cleanweb" depends="clean"
1251
            description="deletes tomcat web context dir and all its contents">
1252
     <delete dir="${installdir}" />
1253
   </target>
1254

    
1255

    
1256
   <target name="clean" depends="init"
1257
            description="deletes build dir and files that can be regenerated form the release">
1258
       <delete dir="${build.dir}" />
1259
       <delete dir="${dist.dir}" />
1260
   </target>
1261

    
1262
   <target name="fullclean" depends="clean"
1263
            description="deletes even jars that depend on external sources such as stylesheets and jars">
1264
       <delete file="lib/httpclient.jar" />
1265
       <delete file="lib/utilities.jar" />
1266
       <delete includeEmptyDirs="true" failonerror="false">
1267
         <fileset dir="${style-common-cvsrelpath}">
1268
           <include name="${eml-css}" />
1269
           <include name="eml-*/*.xsl" />
1270
           <include name="eml-*" />
1271
         </fileset>
1272
       </delete>
1273
   </target>
1274

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

    
1292
   <target name="dist"
1293
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1294
            description="prepares a full release distribution">
1295
      <mkdir dir="${dist.dir}"/>
1296
      <delete dir="${ver.dir}" />
1297
      <mkdir dir="${ver.dir}"/>
1298
      <copy todir="${ver.dir}">
1299
        <fileset dir="."
1300
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1301
      </copy>
1302
      <copy todir="${ver.dir}" file="build.xml"/>
1303
      <copy todir="${ver.dir}" file="build.properties"/>
1304

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

    
1333
  <target name="distsrc" depends="dist"
1334
            description="prepares a source distribution">
1335
      <mkdir dir="${ver.src}"/>
1336
      <copy todir="${ver.src}">
1337
        <fileset dir="./src"/>
1338
      </copy>
1339
      <mkdir dir="${util.dir}"/>
1340
      <copy todir="${util.dir}">
1341
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1342
      </copy>
1343
            
1344
            <mkdir dir="${ecogrid-dist-dir}"/>
1345
            <copy todir="${ecogrid-dist-dir}">
1346
                  <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1347
            </copy>
1348

    
1349
      <delete file="./${name}-src-${release}.zip"/>
1350
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1351
      <delete file="./${name}-src-${release}.tar.gz" />
1352
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1353
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1354
                src="./${name}-src-${release}.tar"/>
1355
      <delete file="./${name}-src-${release}.tar" />
1356
      <delete dir="${dist.dir}"/>
1357
  </target>
1358

    
1359
   <target name="stylesheettest">
1360
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1361
      <param name="displaymodule" expression="${displaymodule}"/>
1362
      <param name="docid" expression="${input}"/>
1363
      <param name="entitytype" expression="${entitytype}"/>
1364
      <param name="entityindex" expression="${entityindex}"/>
1365
      <outputproperty name="method" value="html"/>
1366
      <outputproperty name="standalone" value="yes"/>
1367
      <outputproperty name="encoding" value="iso8859_1"/>
1368
      <outputproperty name="indent" value="yes"/>
1369
    </xslt>
1370
  </target>
1371

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

    
1388
 <target name="gridprepare" depends="gridinit, prepare">
1389
 </target>
1390

    
1391
  <target name="compileinterface" depends="clean, gridprepare">
1392
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1393
  </target>
1394

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

    
1416
   <target name="decorateWSDL" depends="generateWSDL">
1417
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1418
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1419
            fork="yes"
1420
            classpathref="webservicepath" failonerror="true" >
1421
        <arg value="${binding.file}"/>
1422
        <arg value="${wsdl.file}"/>
1423
      </java>
1424
   </target>
1425

    
1426
   <target name="generatestubs" depends="decorateWSDL">
1427
      <echo message=" Generating stubs " />
1428
      <echo message="wsdl file is ${wsdl.file}"/>
1429
      <echo message="build.src is ${build.src}"/>
1430
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1431
            classpathref="webservicepath" failonerror="true" >
1432
         <arg value="${wsdl.file}"/>
1433
    </java>
1434
  </target>
1435

    
1436
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1437
     <echo message=" Compiling stubs " />
1438
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1439
     <echo message=" Compiling impl " />
1440
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1441
  </target>
1442

    
1443
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1444
     <echo message=" jar stubs classes " />
1445
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1446
     <echo message=" jar impl classes " />
1447
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1448
  </target>
1449

    
1450
  <target name="gar" depends="jarStubsAndImpl">
1451
     <echo message=" jar the gar file"/>
1452
     <mkdir dir="${build.dir}/gar"/>
1453
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1454
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1455
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1456
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1457
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1458
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1459
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1460
  </target>
1461

    
1462
  <target name="compilewebclient" depends="prepare">
1463
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1464
  </target>
1465

    
1466
  <target name="runwebclient" depends="compilewebclient">
1467
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1468
           dir="${build.dest}" fork="yes"
1469
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1470
         <arg value="${serviceUrl}"/>
1471
         <arg value="${docid}"/>
1472
     </java>
1473
  </target>
1474
  
1475
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1476

    
1477
    <echo message="Compiling the metatcat shapefile creator"/>
1478
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1479
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1480
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1481
    </exec>
1482
  
1483
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1484
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1485
    </exec>
1486
  </target>
1487

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

    
1517
    <path id="lsid.classpath">
1518
        <fileset dir="${lsid.lib.dir}">
1519
            <patternset refid="lsid.jars"/>
1520
        </fileset>
1521
        <fileset dir="${lib.dir}">
1522
            <patternset refid="lsid.jars"/>
1523
        </fileset>
1524
        <fileset dir="${lib.dir}">
1525
            <include name="xalan.jar" />
1526
            <include name="xml-apis.jar" />
1527
        </fileset>
1528
        <fileset dir="${build.dir}">
1529
            <include name="metacat-client.jar" />
1530
        </fileset>
1531
    </path>
1532

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