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: perry $'
10
  *    '$Date: 2006-11-01 14:37:20 -0800 (Wed, 01 Nov 2006) $'
11
  *    '$Revision: 3072 $'
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="release" value="${release}"/>
275
      <filter token="servlet-path" value="${servlet-path}"/>
276
      <filter token="html-path" value="${html-path}"/>
277
      <filter token="user" value="${user}"/>
278
      <filter token="password" value="${password}"/>
279
      <filter token="mcuser" value="${mcuser}"/>
280
      <filter token="mcpassword" value="${mcpassword}"/>
281
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
282
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
283
      <filter token="knb-site-url" value="${knb-site-url}"/>
284
      <filter token="eml-css" value="${eml-css}"/>
285
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
286
      <filter token="style-skins-path" value="${style-skins-path}"/>
287
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
288
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
289
      <filter token="style-common-path" value="${style-common-path}"/>
290
      <filter token="templates.dir" value="${templates.dir}"/>
291

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

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

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

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

    
392
   </target>
393

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
597

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

    
603
   </target>
604

    
605

    
606

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

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

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

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

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

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

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

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

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

    
724
   </target>
725

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

    
741

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

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

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

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

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

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

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

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

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

    
829
    </target>
830

    
831

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

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

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

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

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

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

    
937

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1132
        <formatter type="plain" />
1133

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

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

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

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

    
1161
        <formatter type="plain" />
1162

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

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

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

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

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

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

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

    
1242
        <formatter type="plain" />
1243

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

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

    
1257

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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