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-12-18 16:20:49 -0800 (Mon, 18 Dec 2006) $'
11
  *    '$Revision: 3131 $'
12
  *
13
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15
  *
16
  * usage: ant [compile|jar|install|jdoc]
17
  *
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License as published by
20
  * the Free Software Foundation; either version 2 of the License, or
21
  * (at your option) any later version.
22
  *
23
  * This program is distributed in the hope that it will be useful,
24
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
  * GNU General Public License for more details.
27
  *
28
  * You should have received a copy of the GNU General Public License
29
  * along with this program; if not, write to the Free Software
30
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir=".">
33
  <property environment="env"/>
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
391
   </target>
392

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
596

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

    
602
   </target>
603

    
604

    
605

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

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

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

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

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

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

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

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

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

    
723
   </target>
724

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

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

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

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

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

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

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

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

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

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

    
836
    </target>
837

    
838

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

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

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

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

    
913
      <echo message="Install Registry completed." />
914
   </target>
915

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

    
944

    
945
   <target name="install-skin" depends="init"
946
            description="Install a Skin">
947

    
948
      <input message="Please enter name of the skin"
949
             addproperty="skin-name"/>
950

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

    
993
      <echo message="Install Skin completed." />
994
   </target>
995

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

    
1009
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
1010
            description="Prepare files for creating a web archive (WAR)">
1011

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

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

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

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

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

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

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

    
1125
   <target name="test" depends="testprep"
1126
            description="Uses the ant junit task to run all JUnit tests">
1127

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

    
1142
        <formatter type="plain" />
1143

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

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

    
1155
              <echo>testtorun: ${testtorun}</echo>
1156

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

    
1171
        <formatter type="plain" />
1172

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

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

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

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

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

    
1236
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1237
                    basedir="${build.metacatnettest}"
1238
                    includes="**/*.class" />
1239

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

    
1252
        <formatter type="plain" />
1253

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

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

    
1267

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

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

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

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

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

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

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

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

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

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

    
1402
 <target name="gridprepare" depends="gridinit, prepare">
1403
 </target>
1404

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

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

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

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

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

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

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

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

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

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

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

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

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