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: tao $'
10
  *    '$Date: 2007-02-09 13:23:17 -0800 (Fri, 09 Feb 2007) $'
11
  *    '$Revision: 3174 $'
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="**/*.sql"/>
407
          <exclude name="**/CVS*"/>
408
          <exclude name="**/.#*"/>
409
        </fileset>
410
      </copy>
411
      <available file="lib/style/common/emlb6toeml2" type="dir"
412
                 property="styles.not.needed"/>
413
   </target>
414

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
598

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

    
604
   </target>
605

    
606

    
607

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

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

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

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

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

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

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

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

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

    
725
   </target>
726

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

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

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

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

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

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

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

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

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

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

    
838
    </target>
839

    
840

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

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

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

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

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

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

    
947

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1145
        <formatter type="plain" />
1146

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

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

    
1158
              <echo>testtorun: ${testtorun}</echo>
1159

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

    
1174
        <formatter type="plain" />
1175

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

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

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

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

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

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

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

    
1255
        <formatter type="plain" />
1256

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

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

    
1270

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

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

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

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

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

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

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

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

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

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

    
1405
 <target name="gridprepare" depends="gridinit, prepare">
1406
 </target>
1407

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

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

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

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

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

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

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

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

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

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

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

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

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