Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: perry $'
10
  *    '$Date: 2006-11-29 17:50:19 -0800 (Wed, 29 Nov 2006) $'
11
  *    '$Revision: 3105 $'
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
   </target>
83

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

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

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

    
130
      <property name="debug" value="on" />
131
      <property name="debuglevel" value="55" />
132

    
133
      <property name="morphosourcedir" value="../morpho" />
134
      <property name="defaultcontenttype" value="application/octet-stream" />
135
      <property name="utilitiesdir" value="../utilities" />
136

    
137
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
138
      <echo>*********** set jsdk to ${jsdk}</echo>
139
  </target>
140

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

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

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

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

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

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

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

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

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

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

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

    
387
   </target>
388

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

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

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

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

    
422
   <target name="jar" depends="compile,geteml"
423
    description="Compiles and jars metacat java code to metacat.jar in build dir">
424

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

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

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

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

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

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

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

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

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

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

    
514
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
515
            description="Calls getemlpre2 and geteml2+ targets" />
516

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

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

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

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

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

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

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

    
581
   <target  name="copyxsl"
582
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
583

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

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

    
592

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

    
598
   </target>
599

    
600

    
601

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

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

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

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

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

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

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

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

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

    
719
   </target>
720

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

    
736

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

    
775
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
776
           description="Installs spatial option for metacat">
777

    
778
      <property name="spatial.dir" value="./lib/spatial"/>
779
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
780
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
781

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

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

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

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

    
811
      <!-- Copy the rest of the modified geoserver web-inf files
812
      <copy todir="${war.webinf}" filtering="no">
813
        <fileset dir="${spatial.webinf-mods}">
814
          <exclude name="web.xml.combined"/>
815
        </fileset>
816
      </copy> -->
817

    
818
    </target>
819

    
820

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

    
880
   <target name="install-registry" depends="init,getConversionXSL"
881
            description="Install Registry">
882

    
883
      <copy file="${srcdir}/perl/register-dataset.cgi"
884
            todir="${inst.cgi.dir}" filtering="yes"/>
885
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
886

    
887
      <mkdir dir="${temp-dir}" />
888
      <copy todir="${temp-dir}" filtering="yes">
889
       <fileset dir="lib/style/common/emlb6toeml2">
890
         <include name="*.xsl"/>
891
         <include name="*.xml"/>
892
       </fileset>
893
      </copy>
894

    
895
      <echo message="Install Registry completed." />
896
   </target>
897

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

    
926

    
927
   <target name="install-skin" depends="init"
928
            description="Install a Skin">
929

    
930
      <input message="Please enter name of the skin"
931
             addproperty="skin-name"/>
932

    
933
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
934
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
935
       <fileset dir="lib/style/skins/${skin-name}">
936
           <exclude name="**/*.png"/>
937
           <exclude name="**/*.gif"/>
938
           <exclude name="**/*.jpg"/>
939
           <exclude name="**/CVS*"/>
940
           <exclude name="**/.#*"/>
941
       </fileset>
942
      </copy>
943
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
944
       <fileset dir="lib/style/skins/${skin-name}">
945
           <include name="**/*.png"/>
946
           <include name="**/*.gif"/>
947
           <include name="**/*.jpg"/>
948
           <exclude name="**/CVS*"/>
949
           <exclude name="**/.#*"/>
950
       </fileset>
951
      </copy>
952
      <copy todir="${installdir}/style/common" filtering="yes">
953
       <fileset dir="lib/style/common">
954
           <include name="*.js"/>
955
           <include name="*.jsp"/>
956
           <include name="*.css"/>
957
           <exclude name="*.png"/>
958
           <exclude name="*.gif"/>
959
           <exclude name="*.jpg"/>
960
           <exclude name="**/CVS*"/>
961
           <exclude name="**/.#*"/>
962
       </fileset>
963
      </copy>
964
      <!--
965
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
966
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
967
       <fileset dir="lib/style/skins/${skin-name}/images">
968
           <include name="*.png"/>
969
           <include name="*.gif"/>
970
           <include name="*.jpg"/>
971
       </fileset>
972
      </copy>
973
      -->
974

    
975
      <echo message="Install Skin completed." />
976
   </target>
977

    
978
   <target name="war" depends="warPrepare,warMSSQL,install-spatial"
979
            description="Create a web archive (WAR) for servlet deployment">
980
       <mkdir dir="${dist.dir}" />
981
       <war destfile="${dist.dir}/${metacat.context}.war"
982
            webxml="${build.war}/web.xml">
983
         <fileset dir="${war.context}"/>
984
         <lib dir="${war.lib}"/>
985
         <webinf dir="${war.webinf}"/>
986
       </war>
987
   </target>
988
	
989
	
990

    
991
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
992
            description="Prepare files for creating a web archive (WAR)">
993

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

    
1056
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
1057
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
1058
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
1059
   </target>
1060

    
1061
   <target name="getConversionXSL" depends="prepare"
1062
            unless="styles.not.needed"
1063
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1064

    
1065
     <echo>Enter CVS password: </echo>
1066
     <cvs cvsRoot="${cvsroot}"
1067
          package="${eml-module}"
1068
          tag="${eml2_0_1-tag}"
1069
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
1070

    
1071
     <mkdir dir="lib/style/common/emlb6toeml2" />
1072
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1073
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
1074
         <include name="*.xsl"/>
1075
         <include name="*.xml"/>
1076
       </fileset>
1077
      </copy>
1078
   </target>
1079

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

    
1102
      <jar jarfile="${build.dir}/${name}-junittests.jar"
1103
        basedir="${build.tests}"
1104
                includes="**/*.class" />
1105
   </target>
1106

    
1107
   <target name="test" depends="testprep"
1108
            description="Uses the ant junit task to run all JUnit tests">
1109

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

    
1124
        <formatter type="plain" />
1125

    
1126
        <batchtest fork="yes" todir="${build.dir}">
1127
          <fileset dir="${build.tests}">
1128
            <include name="**/*.class" />
1129
          </fileset>
1130
        </batchtest>
1131
     </junit>
1132
   </target>
1133

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

    
1137
              <echo>testtorun: ${testtorun}</echo>
1138

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

    
1153
        <formatter type="plain" />
1154

    
1155
        <batchtest fork="yes" todir="${build.dir}">
1156
          <fileset dir="${build.tests}">
1157
            <include name="**/${testtorun}.class" />
1158
          </fileset>
1159
        </batchtest>
1160
     </junit>
1161
   </target>
1162

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

    
1188
  <target name="gethttpclient" depends="prepare"
1189
            description="checks out and compiles morpho httpclient code">
1190
  <!--mkdir dir="${morphosourcedir}" -->
1191
        <cvs cvsRoot="${cvsroot}"
1192
             package="morpho"
1193
             dest="." />
1194
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1195
   </target>
1196

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

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

    
1218
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1219
                    basedir="${build.metacatnettest}"
1220
                    includes="**/*.class" />
1221

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

    
1234
        <formatter type="plain" />
1235

    
1236
        <batchtest fork="yes" todir="${build.dir}">
1237
          <fileset dir="${build.metacatnettest}">
1238
            <include name="**/*.class" />
1239
          </fileset>
1240
        </batchtest>
1241
     </junit>
1242
   </target>
1243

    
1244
   <target name="cleanweb" depends="clean"
1245
            description="deletes tomcat web context dir and all its contents">
1246
     <delete dir="${installdir}" />
1247
   </target>
1248

    
1249

    
1250
   <target name="clean" depends="init"
1251
            description="deletes build dir and files that can be regenerated form the release">
1252
       <delete dir="${build.dir}" />
1253
       <delete dir="${dist.dir}" />
1254
   </target>
1255

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

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

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

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

    
1327
  <target name="distsrc" depends="dist"
1328
            description="prepares a source distribution">
1329
      <mkdir dir="${ver.src}"/>
1330
      <copy todir="${ver.src}">
1331
        <fileset dir="./src"/>
1332
      </copy>
1333
      <mkdir dir="${util.dir}"/>
1334
      <copy todir="${util.dir}">
1335
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1336
      </copy>
1337
  	  
1338
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1339
  	  <copy todir="${ecogrid-dist-dir}">
1340
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1341
  	  </copy>
1342

    
1343
      <delete file="./${name}-src-${release}.zip"/>
1344
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1345
      <delete file="./${name}-src-${release}.tar.gz" />
1346
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1347
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1348
                src="./${name}-src-${release}.tar"/>
1349
      <delete file="./${name}-src-${release}.tar" />
1350
      <delete dir="${dist.dir}"/>
1351
  </target>
1352

    
1353
   <target name="stylesheettest">
1354
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1355
      <param name="displaymodule" expression="${displaymodule}"/>
1356
      <param name="docid" expression="${input}"/>
1357
      <param name="entitytype" expression="${entitytype}"/>
1358
      <param name="entityindex" expression="${entityindex}"/>
1359
      <outputproperty name="method" value="html"/>
1360
      <outputproperty name="standalone" value="yes"/>
1361
      <outputproperty name="encoding" value="iso8859_1"/>
1362
      <outputproperty name="indent" value="yes"/>
1363
    </xslt>
1364
  </target>
1365

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

    
1382
 <target name="gridprepare" depends="gridinit, prepare">
1383
 </target>
1384

    
1385
  <target name="compileinterface" depends="clean, gridprepare">
1386
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1387
  </target>
1388

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

    
1410
   <target name="decorateWSDL" depends="generateWSDL">
1411
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1412
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1413
            fork="yes"
1414
            classpathref="webservicepath" failonerror="true" >
1415
        <arg value="${binding.file}"/>
1416
        <arg value="${wsdl.file}"/>
1417
      </java>
1418
   </target>
1419

    
1420
   <target name="generatestubs" depends="decorateWSDL">
1421
      <echo message=" Generating stubs " />
1422
      <echo message="wsdl file is ${wsdl.file}"/>
1423
      <echo message="build.src is ${build.src}"/>
1424
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1425
            classpathref="webservicepath" failonerror="true" >
1426
         <arg value="${wsdl.file}"/>
1427
    </java>
1428
  </target>
1429

    
1430
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1431
     <echo message=" Compiling stubs " />
1432
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1433
     <echo message=" Compiling impl " />
1434
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1435
  </target>
1436

    
1437
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1438
     <echo message=" jar stubs classes " />
1439
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1440
     <echo message=" jar impl classes " />
1441
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1442
  </target>
1443

    
1444
  <target name="gar" depends="jarStubsAndImpl">
1445
     <echo message=" jar the gar file"/>
1446
     <mkdir dir="${build.dir}/gar"/>
1447
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1448
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1449
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1450
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1451
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1452
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1453
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1454
  </target>
1455

    
1456
  <target name="compilewebclient" depends="prepare">
1457
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1458
  </target>
1459

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

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

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

    
1511
    <path id="lsid.classpath">
1512
        <fileset dir="${lsid.lib.dir}">
1513
            <patternset refid="lsid.jars"/>
1514
        </fileset>
1515
        <fileset dir="${lib.dir}">
1516
            <patternset refid="lsid.jars"/>
1517
        </fileset>
1518
        <fileset dir="${lib.dir}">
1519
            <include name="xalan.jar" />
1520
            <include name="xml-apis.jar" />
1521
        </fileset>
1522
        <fileset dir="${build.dir}">
1523
            <include name="metacat-client.jar" />
1524
        </fileset>
1525
    </path>
1526

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