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: berkley $'
10
  *    '$Date: 2007-03-05 12:08:46 -0800 (Mon, 05 Mar 2007) $'
11
  *    '$Revision: 3194 $'
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}/common/lib/servlet.jar">
38
    <equals arg1="${tomcatversion}" arg2="tomcat4" />
39
  </condition>
40
  <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
41
    <equals arg1="${tomcatversion}" arg2="tomcat5" />
42
  </condition>
43
	
44
  <!-- Determine if installed ecogrid -->
45
  <condition property="enable.ecogrid">
46
    <equals arg1="${install.ecogrid}" arg2="true" />
47
  </condition>
48

    
49
  <target name="check-db">
50
    <condition property="use-oracle">
51
      <equals arg1="${database}" arg2="oracle" />
52
    </condition>
53
    <condition property="use-postgresql">
54
      <equals arg1="${database}" arg2="postgresql" />
55
    </condition>
56
    <condition property="use-sqlserver">
57
      <equals arg1="${database}" arg2="sqlserver" />
58
    </condition>
59
  </target>
60

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

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

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

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

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

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

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

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

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

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

    
226
      <property name="defaultStage"        value="initregister"/>
227
      <property name="defaultHeader"       value="genericHeader.tmpl"/>
228
      <property name="defaultFooter"       value="genericFooter.tmpl"/>
229
      <property name="defaultChangePass"   value="ldapChangePass.tmpl"/>
230
      <property name="defaultResetPass"    value="ldapResetPass.tmpl"/>
231
      <property name="changePassSuccess"   value="ldapChangePassSuccess.tmpl"/>
232
      <property name="resetPassSuccess"    value="ldapResetPassSuccess.tmpl"/>
233
      <property name="registerFailed"      value="ldapRegisterFailed.tmpl"/>
234
      <property name="registerLter"        value="ldapRegisterLter.tmpl"/>
235
      <property name="registerMatch"       value="ldapRegisterMatch.tmpl"/>
236
      <property name="registerSuccess"     value="ldapRegisterSuccess.tmpl"/>
237
      <property name="register"            value="ldapRegister.tmpl"/>
238
      <property name="searchResults"       value="searchResults.tmpl"/>
239
   	  <property name="ldapMainServerFailure" value="ldapMainServerFailure.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="style-shared-path" value="${style-shared-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
   	  <filter token="ldapMainServerFailure" value="${ldapMainServerFailure}"/>
332
       
333
   	  <filter token="timedreplication" value="${timedreplication}" />
334
   	  <filter token="firsttimedreplication" value="${firsttimedreplication}" />
335
   	  <filter token="timedreplicationinterval" value="${timedreplicationinterval}" />
336
      
337
   	  <property name="srcdir" value="./src" />
338
   	  <property name="lib.dir" value="./lib" />
339
      <property name="testdir" value="./test" />
340
      <property name="testtorun" value="BuildIndexTest" />
341
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
342
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
343
      <property name="build.dir" value="./build"/>
344
      <property name="build.src" value="${build.dir}/src"/>
345
      <property name="build.dest" value="${build.dir}/classes"/>
346
      <property name="build.docs" value="${build.dir}/docs"/>
347
      <property name="build.samples" value="${build.dir}/samples"/>
348
      <property name="build.tests" value="${build.dir}/tests"/>
349
      <property name="build.tmp" value="${build.dir}/tmp"/>
350
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
351
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
352
      <property name="build.data" value="${build.dir}/data"/>
353
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
354
      <property name="build.war" value="${build.dir}/war"/>
355

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

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

    
393
   </target>
394

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
599

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

    
605
   </target>
606

    
607

    
608

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

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

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

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

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

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

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

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

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

    
726
   </target>
727

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

    
743
   <target name="upgrade17" depends="prepare"
744
            description="Updates the database tables from version 1.6 to version 1.7">
745
     <echo/>
746
     <echo>Updating the database tables to upgrade to version 1.7...</echo>
747
     <sql driver="${dbDriver}"
748
          url="${jdbc-connect}"
749
          userid="${user}"
750
          password="${password}"
751
          src="${build.src}/${upgrade-1.7-sql}">
752
       <classpath>
753
         <path refid="compile.classpath"/>
754
       </classpath>
755
     </sql>
756
   </target>
757

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

    
796
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
797
           description="Installs spatial option for metacat">
798

    
799
      <property name="spatial.dir" value="./lib/spatial"/>
800
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
801
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
802

    
803
      <!-- Copy geoserver libs into ${war.lib} -->
804
      <copy todir="${war.lib}" filtering="no">
805
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
806
          <include name="**"/>
807
        </fileset>
808
      </copy>
809

    
810
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
811
      <copy todir="${war.webinf}" filtering="no">
812
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
813
          <exclude name="lib/**"/>
814
          <exclude name="web.xml"/>
815
        </fileset>
816
      </copy>
817

    
818
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
819
      <copy todir="${war.context}" filtering="no">
820
        <fileset dir="${spatial.geoserver.dir}">
821
          <exclude name="WEB-INF/**"/>
822
          <exclude name="index.jsp"/>
823
        </fileset>
824
      </copy>
825

    
826
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
827
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
828
          tofile="${war.context}/geoserver.jsp"
829
          overwrite="true"
830
          filtering="no"/>
831

    
832
      <!-- Copy the rest of the modified geoserver web-inf files
833
      <copy todir="${war.webinf}" filtering="no">
834
        <fileset dir="${spatial.webinf-mods}">
835
          <exclude name="web.xml.combined"/>
836
        </fileset>
837
      </copy> -->
838

    
839
    </target>
840

    
841

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

    
901
   <target name="install-registry" depends="init,getConversionXSL"
902
            description="Install Registry">
903

    
904
      <copy file="${srcdir}/perl/register-dataset.cgi"
905
            todir="${inst.cgi.dir}" filtering="yes"/>
906
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
907

    
908
      <mkdir dir="${temp-dir}" />
909
      <copy todir="${temp-dir}" filtering="yes">
910
       <fileset dir="lib/style/common/emlb6toeml2">
911
         <include name="*.xsl"/>
912
         <include name="*.xml"/>
913
       </fileset>
914
      </copy>
915

    
916
      <echo message="Install Registry completed." />
917
   </target>
918

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

    
948

    
949
   <target name="install-skin" depends="init"
950
            description="Install a Skin">
951

    
952
      <input message="Please enter name of the skin"
953
             addproperty="skin-name"/>
954

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

    
997
      <echo message="Install Skin completed." />
998
   </target>
999

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

    
1013
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
1014
            description="Prepare files for creating a web archive (WAR)">
1015

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

    
1079
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
1080
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
1081
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
1082
   </target>
1083

    
1084
   <target name="getConversionXSL" depends="prepare"
1085
            unless="styles.not.needed"
1086
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1087

    
1088
     <echo>Enter CVS password: </echo>
1089
     <cvs cvsRoot="${cvsroot}"
1090
          package="${eml-module}"
1091
          tag="${eml2_0_1-tag}"
1092
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
1093

    
1094
     <mkdir dir="lib/style/common/emlb6toeml2" />
1095
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1096
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
1097
         <include name="*.xsl"/>
1098
         <include name="*.xml"/>
1099
       </fileset>
1100
      </copy>
1101
   </target>
1102

    
1103
   <target name="testprep" depends="jar,clientjar,harvesterjar">
1104
      <mkdir dir="${build.tests}"/>
1105
      <copy todir="${build.tests}" filtering="yes">
1106
        <fileset dir="${testdir}">
1107
          <include name="edu/**"/>
1108
        </fileset>
1109
      </copy>
1110
      <!-- copy and compile the tests into a jar file -->
1111
      <javac srcdir="${build.tests}"
1112
             destdir="${build.tests}"
1113
             debug="on"
1114
             includes="**/*.java">
1115
        <classpath>
1116
          <path refid="compile.classpath"/>
1117
          <fileset dir="${build.dir}">
1118
            <include name="${name}.jar"/>
1119
            <include name="${name}-client.jar"/>
1120
            <include name="harvester.jar"/>
1121
          </fileset>
1122
        </classpath>
1123
      </javac>
1124

    
1125
      <jar jarfile="${build.dir}/${name}-junittests.jar"
1126
        basedir="${build.tests}"
1127
                includes="**/*.class" />
1128
   </target>
1129

    
1130
   <target name="test" depends="testprep"
1131
            description="Uses the ant junit task to run all JUnit tests">
1132

    
1133
      <!-- use the ant "junit" task to run JUnit tests. -->
1134
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1135
             haltonerror="no">
1136
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
1137
        <classpath>
1138
          <path refid="compile.classpath"/>
1139
          <fileset dir="${build.dir}">
1140
            <include name="${name}.jar"/>
1141
            <include name="${name}-client.jar"/>
1142
            <include name="harvester.jar"/>
1143
            <include name="${name}-junittests.jar"/>
1144
          </fileset>
1145
        </classpath>
1146

    
1147
        <formatter type="plain" />
1148

    
1149
        <batchtest fork="yes" todir="${build.dir}">
1150
          <fileset dir="${build.tests}">
1151
            <include name="**/*.class" />
1152
          </fileset>
1153
        </batchtest>
1154
     </junit>
1155
   </target>
1156

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

    
1160
              <echo>testtorun: ${testtorun}</echo>
1161

    
1162
      <!-- use the ant "junit" task to run JUnit tests. -->
1163
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1164
             haltonerror="no">
1165
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1166
        <classpath>
1167
          <path refid="compile.classpath"/>
1168
          <fileset dir="${build.dir}">
1169
            <include name="${name}.jar"/>
1170
            <include name="${name}-client.jar"/>
1171
            <include name="harvester.jar"/>
1172
            <include name="${name}-junittests.jar"/>
1173
          </fileset>
1174
        </classpath>
1175

    
1176
        <formatter type="plain" />
1177

    
1178
        <batchtest fork="yes" todir="${build.dir}">
1179
          <fileset dir="${build.tests}">
1180
            <include name="**/${testtorun}.class" />
1181
          </fileset>
1182
        </batchtest>
1183
     </junit>
1184
   </target>
1185

    
1186
   <target name="testharvester"
1187
           depends="testprep"
1188
           description="Uses the ant junit task to test only the Harvester code">
1189
     <junit printsummary="yes"
1190
            haltonfailure="off"
1191
            fork="yes"
1192
            haltonerror="off">
1193
        <classpath>
1194
          <path refid="compile.classpath"/>
1195
          <fileset dir="${build.dir}">
1196
            <include name="${name}.jar"/>
1197
            <include name="${name}-client.jar"/>
1198
            <include name="harvester.jar"/>
1199
            <include name="${name}-junittests.jar"/>
1200
          </fileset>
1201
        </classpath>
1202
       <formatter type="plain" />
1203
       <batchtest fork="yes" todir="${build.dir}">
1204
         <fileset dir="${build.tests}">
1205
           <include name="**/harvesterClient/*.class" />
1206
         </fileset>
1207
       </batchtest>
1208
     </junit>
1209
   </target>
1210

    
1211
  <target name="gethttpclient" depends="prepare"
1212
            description="checks out and compiles morpho httpclient code">
1213
  <!--mkdir dir="${morphosourcedir}" -->
1214
        <cvs cvsRoot="${cvsroot}"
1215
             package="morpho"
1216
             dest="." />
1217
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1218
   </target>
1219

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

    
1224
      <echo>***********************************
1225
      Please run ant gethttpclient first!
1226
      ***********************************
1227
      </echo>
1228
      <!-- copy and compile the tests into a jar file -->
1229
      <mkdir dir="${build.metacatnettest}"/>
1230
      <javac srcdir="${junitnettestsdir}"
1231
             destdir="${build.metacatnettest}"
1232
             includes="**/*.java">
1233
        <classpath>
1234
          <path refid="compile.classpath"/>
1235
          <fileset dir="${build.dir}">
1236
            <include name="${name}.jar"/>
1237
          </fileset>
1238
        </classpath>
1239
      </javac>
1240

    
1241
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1242
                    basedir="${build.metacatnettest}"
1243
                    includes="**/*.class" />
1244

    
1245
      <!-- use the ant "junit" task to run JUnit tests. -->
1246
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1247
             haltonerror="no">
1248
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1249
        <classpath>
1250
          <path refid="compile.classpath"/>
1251
          <fileset dir="${build.dir}">
1252
            <include name="${name}.jar"/>
1253
            <include name="${name}-junitnettests.jar"/>
1254
          </fileset>
1255
        </classpath>
1256

    
1257
        <formatter type="plain" />
1258

    
1259
        <batchtest fork="yes" todir="${build.dir}">
1260
          <fileset dir="${build.metacatnettest}">
1261
            <include name="**/*.class" />
1262
          </fileset>
1263
        </batchtest>
1264
     </junit>
1265
   </target>
1266

    
1267
   <target name="cleanweb" depends="clean"
1268
            description="deletes tomcat web context dir and all its contents">
1269
     <delete dir="${installdir}" />
1270
   </target>
1271

    
1272

    
1273
   <target name="clean" depends="init"
1274
            description="deletes build dir and files that can be regenerated form the release">
1275
       <delete dir="${build.dir}" />
1276
       <delete dir="${dist.dir}" />
1277
   </target>
1278

    
1279
   <target name="fullclean" depends="clean"
1280
            description="deletes even jars that depend on external sources such as stylesheets and jars">
1281
       <delete file="lib/httpclient.jar" />
1282
       <delete file="lib/utilities.jar" />
1283
       <delete includeEmptyDirs="true" failonerror="false">
1284
         <fileset dir="${style-common-cvsrelpath}">
1285
           <include name="${eml-css}" />
1286
           <include name="eml-*/*.xsl" />
1287
           <include name="eml-*" />
1288
         </fileset>
1289
       </delete>
1290
   </target>
1291

    
1292
   <target name="jdoc" depends="prepare"
1293
            description="generates javadoc documentation">
1294
       <javadoc packagenames="edu.ucsb.nceas.*"
1295
           sourcepath="${build.src}"
1296
           destdir="${build.javadocs}"
1297
           author="true"
1298
           version="true"
1299
           use="true"
1300
           windowtitle="${Name} API"
1301
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1302
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1303
         <classpath>
1304
           <path refid="compile.classpath"/>
1305
         </classpath>
1306
       </javadoc>
1307
   </target>
1308

    
1309
   <target name="dist"
1310
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1311
            description="prepares a full release distribution">
1312
      <mkdir dir="${dist.dir}"/>
1313
      <delete dir="${ver.dir}" />
1314
      <mkdir dir="${ver.dir}"/>
1315
      <copy todir="${ver.dir}">
1316
        <fileset dir="."
1317
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1318
      </copy>
1319
      <copy todir="${ver.dir}" file="build.xml"/>
1320
      <copy todir="${ver.dir}" file="build.properties"/>
1321

    
1322
      <copy todir="${ver.dir}/docs" filtering="yes">
1323
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1324
      </copy>
1325
      <copy todir="${ver.dir}/docs" filtering="no">
1326
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1327
      </copy>
1328
      <copy todir="${ver.dir}/docs/dev">
1329
        <fileset dir="${build.dir}/docs"/>
1330
      </copy>
1331
      <copy todir="${ver.dir}/src">
1332
        <fileset dir="${build.dir}/src"/>
1333
      </copy>
1334
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1335
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1336
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1337
      <!--
1338
      <delete dir="./${ver.dir}/${build.dir}"/>
1339
      <delete dir="./${ver.dir}/dist"/>
1340
      -->
1341
      <delete file="./${name}-${release}.zip"/>
1342
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1343
      <delete file="./${name}-${release}.tar.gz" />
1344
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1345
      <gzip zipfile="./${name}-${release}.tar.gz"
1346
                src="./${name}-${release}.tar"/>
1347
      <delete file="./${name}-${release}.tar" />
1348
  </target>
1349

    
1350
  <target name="distsrc" depends="dist"
1351
            description="prepares a source distribution">
1352
      <mkdir dir="${ver.src}"/>
1353
      <copy todir="${ver.src}">
1354
        <fileset dir="./src"/>
1355
      </copy>
1356
      <mkdir dir="${util.dir}"/>
1357
      <copy todir="${util.dir}">
1358
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1359
      </copy>
1360
  	  
1361
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1362
  	  <copy todir="${ecogrid-dist-dir}">
1363
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1364
  	  </copy>
1365

    
1366
      <delete file="${ver.dir}/lib/utilities.jar"/>
1367

    
1368
      <delete file="./${name}-src-${release}.zip"/>
1369
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1370
      <delete file="./${name}-src-${release}.tar.gz" />
1371
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1372
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1373
                src="./${name}-src-${release}.tar"/>
1374
      <delete file="./${name}-src-${release}.tar" />
1375
      <delete dir="${dist.dir}"/> 
1376
  </target>
1377

    
1378
   <target name="stylesheettest">
1379
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1380
      <param name="displaymodule" expression="${displaymodule}"/>
1381
      <param name="docid" expression="${input}"/>
1382
      <param name="entitytype" expression="${entitytype}"/>
1383
      <param name="entityindex" expression="${entityindex}"/>
1384
      <outputproperty name="method" value="html"/>
1385
      <outputproperty name="standalone" value="yes"/>
1386
      <outputproperty name="encoding" value="iso8859_1"/>
1387
      <outputproperty name="indent" value="yes"/>
1388
    </xslt>
1389
  </target>
1390

    
1391
 <target name="gridinit" depends="init">
1392
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1393
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1394
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1395
   <property environment="env"/>
1396
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1397
    <path id="webservicepath">
1398
        <pathelement location="."/>
1399
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1400
        <pathelement location="${build.dest}"/>
1401
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1402
           <include name="*.jar"/>
1403
        </fileset>
1404
      </path>
1405
</target>
1406

    
1407
 <target name="gridprepare" depends="gridinit, prepare">
1408
 </target>
1409

    
1410
  <target name="compileinterface" depends="clean, gridprepare">
1411
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1412
  </target>
1413

    
1414
  <target name="generateWSDL" depends="compileinterface">
1415
    <echo message="Generating wsdl from ${interface.name} interface"/>
1416
    <java classname="${java2wsdl.tool}"
1417
          dir="${build.src}" fork="yes"
1418
          classpathref="webservicepath"  failonerror="true" >
1419
      <arg value="-P"/>
1420
      <arg value="${interface.name}PortType"/>
1421
      <arg value="-S"/>
1422
      <arg value="${interface.name}Service"/>
1423
      <arg value="-y"/>
1424
      <arg value="WRAPPED"/>
1425
      <arg value="-u"/>
1426
      <arg value="LITERAL"/>
1427
      <arg value="-l"/>
1428
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1429
      <arg value="-n"/>
1430
      <arg value="http://${services.namespace}/${interface.name}"/>
1431
      <arg value="${interface.package}.${interface.name}"/>
1432
    </java>
1433
  </target>
1434

    
1435
   <target name="decorateWSDL" depends="generateWSDL">
1436
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1437
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1438
            fork="yes"
1439
            classpathref="webservicepath" failonerror="true" >
1440
        <arg value="${binding.file}"/>
1441
        <arg value="${wsdl.file}"/>
1442
      </java>
1443
   </target>
1444

    
1445
   <target name="generatestubs" depends="decorateWSDL">
1446
      <echo message=" Generating stubs " />
1447
      <echo message="wsdl file is ${wsdl.file}"/>
1448
      <echo message="build.src is ${build.src}"/>
1449
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1450
            classpathref="webservicepath" failonerror="true" >
1451
         <arg value="${wsdl.file}"/>
1452
    </java>
1453
  </target>
1454

    
1455
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1456
     <echo message=" Compiling stubs " />
1457
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1458
     <echo message=" Compiling impl " />
1459
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1460
  </target>
1461

    
1462
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1463
     <echo message=" jar stubs classes " />
1464
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1465
     <echo message=" jar impl classes " />
1466
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1467
  </target>
1468

    
1469
  <target name="gar" depends="jarStubsAndImpl">
1470
     <echo message=" jar the gar file"/>
1471
     <mkdir dir="${build.dir}/gar"/>
1472
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1473
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1474
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1475
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1476
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1477
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1478
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1479
  </target>
1480

    
1481
  <target name="compilewebclient" depends="prepare">
1482
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1483
  </target>
1484

    
1485
  <target name="runwebclient" depends="compilewebclient">
1486
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1487
           dir="${build.dest}" fork="yes"
1488
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1489
         <arg value="${serviceUrl}"/>
1490
         <arg value="${docid}"/>
1491
     </java>
1492
  </target>
1493
  
1494
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1495

    
1496
    <echo message="Compiling the metatcat shapefile creator"/>
1497
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1498
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1499
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1500
    </exec>
1501
  
1502
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1503
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1504
    </exec>
1505
  </target>
1506

    
1507
    <!-- LSID Authority support -->
1508
    <patternset id="lsid.jars">
1509
        <include name="axis.jar" />
1510
        <include name="commons-discovery-0.2.jar" />
1511
        <include name="jaxrpc.jar" />
1512
        <include name="lsid-client-1.1.1.jar" />
1513
        <include name="lsid-server-1.1.1.jar" />
1514
        <include name="saaj.jar" />
1515
        <include name="wsdl4j-1.5.1.jar" />
1516
        <include name="activation.jar" />
1517
        <include name="castor-0.9.5.jar" />
1518
        <include name="dnsjava-1.3.2.jar" />
1519
        <include name="mail.jar" />
1520
        <include name="commons-logging-1.0.4.jar" />
1521
        <!-- These jars may be needed but seem to not actually be,
1522
             so leaving them out for now
1523
        <include name="axis-ant.jar" />
1524
        -->
1525
        <!--<include name="GenCastor.class" />-->
1526
    </patternset>
1527
    <patternset id="lib.jars">
1528
        <include name="httpclient.jar" />
1529
        <include name="log4j-1.2.12.jar" />
1530
        <include name="utilities.jar" />
1531
        <include name="xercesImpl.jar" />
1532
        <include name="xalan.jar" />
1533
        <include name="xml-apis.jar" />
1534
    </patternset>
1535

    
1536
    <path id="lsid.classpath">
1537
        <fileset dir="${lsid.lib.dir}">
1538
            <patternset refid="lsid.jars"/>
1539
        </fileset>
1540
        <fileset dir="${lib.dir}">
1541
            <patternset refid="lsid.jars"/>
1542
        </fileset>
1543
        <fileset dir="${lib.dir}">
1544
            <include name="xalan.jar" />
1545
            <include name="xml-apis.jar" />
1546
        </fileset>
1547
        <fileset dir="${build.dir}">
1548
            <include name="metacat-client.jar" />
1549
        </fileset>
1550
    </path>
1551

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