Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: jones $'
10
  *    '$Date: 2006-11-10 11:30:36 -0800 (Fri, 10 Nov 2006) $'
11
  *    '$Revision: 3080 $'
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"
187
                                           value="/style/common"/>
188
      <property name="style-common-cvsrelpath"
189
                                           value="lib${style-common-relpath}"/>
190
      <property name="style-common-fullpath"
191
                                           value="/${installdir}${style-common-relpath}"/>
192
      <property name="templates.dir"       value="${style-common-fullpath}/templates"/>
193
      <property name="style-common-path"
194
                                           value="/${metacat.context}${style-common-relpath}"/>
195
      <property name="style-skins-relpath" value="/style/skins"/>
196
      <property name="style-skins-path"    value="/${metacat.context}${style-skins-relpath}"/>
197
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
198
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
199
      <property name="config-dir"          value="${deploy.dir}/${style-skins-path}" />
200
      <property name="util-module"         value="utilities" />
201
      <property name="eml-module"          value="eml" />
202
      <property name="eml-version"         value="2.0.0beta6" />
203
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
204
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
205
      <property name="eml2_0_1-tag"        value="RELEASE_EML_2_0_1_UPDATE_3" />
206
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
207
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
208
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
209
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
210
      <property name="eml-css"             value="eml_xsl.css"/>
211
      <property name="eml-module.default.css"
212
                                           value="default.css"/>
213
   	  
214
      <!-- Config for registry variables -->
215
      <property name="scope"               value="obfs"/>
216
      <property name="responseForm"        value="genericResponse.tmpl"/>
217
      <property name="entryForm"           value="entryForm.tmpl"/>
218
      <property name="guide"               value="genericGuide.tmpl"/>
219
      <property name="loginForm"           value="loginForm.tmpl"/>
220
      <property name="confirmData"         value="confirmData.tmpl"/>
221
      <property name="deleteData"          value="deleteData.tmpl"/>
222
      <property name="genericHeader"       value="genericHeader.tmpl"/>
223
      <property name="genericFooter"       value="genericFooter.tmpl"/>
224
      <property name="adminname"           value="KNB Support"/>
225
      <property name="recipient"           value="knb-software\@nceas.ucsb.edu"/>
226

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

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

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

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

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

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

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

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

    
391
   </target>
392

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
596

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

    
602
   </target>
603

    
604

    
605

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

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

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

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

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

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

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

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

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

    
723
   </target>
724

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

    
740

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

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

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

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

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

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

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

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

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

    
828
    </target>
829

    
830

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

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

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

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

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

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

    
936

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1131
        <formatter type="plain" />
1132

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

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

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

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

    
1160
        <formatter type="plain" />
1161

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

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

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

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

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

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

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

    
1241
        <formatter type="plain" />
1242

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

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

    
1256

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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