Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: jones $'
10
  *    '$Date: 2006-11-23 00:32:01 -0800 (Thu, 23 Nov 2006) $'
11
  *    '$Revision: 3099 $'
12
  *
13
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15
  *
16
  * usage: ant [compile|jar|install|jdoc]
17
  *
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License as published by
20
  * the Free Software Foundation; either version 2 of the License, or
21
  * (at your option) any later version.
22
  *
23
  * This program is distributed in the hope that it will be useful,
24
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
  * GNU General Public License for more details.
27
  *
28
  * You should have received a copy of the GNU General Public License
29
  * along with this program; if not, write to the Free Software
30
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir=".">
33
  <property environment="env"/>
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35

    
36
  <!-- Determine which tomcat we are using and tomcat-specific settings -->
37
  <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
38
    <equals arg1="${tomcatversion}" arg2="tomcat3" />
39
  </condition>
40
  <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
41
    <equals arg1="${tomcatversion}" arg2="tomcat4" />
42
  </condition>
43
  <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
44
    <equals arg1="${tomcatversion}" arg2="tomcat5" />
45
  </condition>
46
	
47
  <!-- Determine if installed ecogrid -->
48
  <condition property="enable.ecogrid">
49
    <equals arg1="${install.ecogrid}" arg2="true" />
50
  </condition>
51

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
390
   </target>
391

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
595

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

    
601
   </target>
602

    
603

    
604

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

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

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

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

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

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

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

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

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

    
722
   </target>
723

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

    
739

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

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

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

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

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

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

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

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

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

    
827
    </target>
828

    
829

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

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

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

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

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

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

    
935

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1133
        <formatter type="plain" />
1134

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

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

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

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

    
1162
        <formatter type="plain" />
1163

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

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

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

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

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

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

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

    
1243
        <formatter type="plain" />
1244

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

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

    
1258

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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