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: daigle $'
10
  *    '$Date: 2008-07-11 09:34:07 -0700 (Fri, 11 Jul 2008) $'
11
  *    '$Revision: 4098 $'
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
  
37
	
38
  <!-- Determine if installed ecogrid -->
39
  <condition property="enable.ecogrid">
40
    <equals arg1="${install.ecogrid}" arg2="true" />
41
  </condition>
42

    
43
   <target name="config">
44
   	  <property name="jsdk" value="${build.tomcat.dir}/common/lib/servlet-api.jar"/>
45
      <!-- usr for client testing, generally you don't need change-->
46
      <property name="mcuser"              value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org"/>
47
      <property name="mcpassword"          value="kepler"/>
48
      <property name="mcanotheruser"       value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org"/>
49
      <property name="mcanotherpassword"   value="yourpass"/>
50
   	  <property name="piscouser"           value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org"/>
51
   	  <property name="piscopassword"       value="yourpass"/>
52
   	  <property name="lteruser"            value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
53
   	  <property name="lterpassword"        value="yourpass"/>
54

    
55
      <property name="debug"               value="on" />
56
      <property name="debuglevel"          value="55" />
57

    
58
      <property name="morphosourcedir"     value="../morpho" />
59
      <property name="defaultcontenttype"  value="application/octet-stream" />
60
      <property name="utilitiesdir"        value="../utilities" />
61

    
62
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
63
      <echo>*********** set jsdk to ${jsdk}</echo>
64
  </target>
65

    
66
   <target name="init" depends="config">
67
      <path id="compile.classpath">
68
        <pathelement location="${jsdk}"/>
69
        <pathelement location="lib"/>
70
        <fileset dir="lib">
71
          <include name="*.jar"/>
72
        </fileset>
73
	<fileset dir="lib">
74
           <include name="xalan.jar"/>
75
         </fileset>
76
       <fileset dir="lib/lsid_lib">
77
         <include name="*.jar"/>
78
       </fileset>     	
79

    
80
        <!-- Include geoserver, geotools, et. al. -->
81
        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
82
          <include name="*.jar"/>
83
        </fileset>
84
        <pathelement location="lib/spatial/geoserver/WEB-INF/classes"/>
85

    
86
       </path>
87
      
88
      <!-- It is less likely you'll need to make any changes from here down,
89
           but customization is possible -->
90
      <property name="name"                value="metacat"/>
91
      <property name="Name"                value="MetaCat"/>
92
      <property name="debugprefix"         value="${Name}:"/>
93
      <property name="release"             value="${metacat.version}"/>
94
      <property name="style-common-relpath" value="/style/common"/>
95
      <property name="style-shared-relpath" value="/style/shared"/>
96
      <property name="schema-relpath"      value="/schema"/>
97
      <property name="style-common-cvsrelpath" value="lib${style-common-relpath}"/>
98
   	  <property name="schema-cvsrelpath"   value="lib${schema-relpath}"/>
99
      <property name="style-skins-relpath" value="/style/skins"/>
100
      <property name="util-module"         value="utilities" />
101
      <property name="eml-module"          value="eml" />
102
      <property name="eml-version"         value="2.0.0beta6" />
103
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
104
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
105
      <property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
106
      <property name="eml2_0_1-style-tag"  value="RELEASE_EML_2_0_1_UPDATE_6" />
107
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
108
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
109
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
110
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
111
      <property name="eml-css"             value="eml_xsl.css"/>
112
      <property name="eml-module.default.css"
113
                                           value="default.css"/>
114
   	  
115
      <!-- Config for registry variables -->
116
      <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties --> 
117
      <property name="scope"               value="obfs"/>
118
      <property name="responseForm"        value="genericResponse.tmpl"/>
119
      <property name="entryForm"           value="entryForm.tmpl"/>
120
      <property name="guide"               value="genericGuide.tmpl"/>
121
      <property name="loginForm"           value="loginForm.tmpl"/>
122
      <property name="confirmData"         value="confirmData.tmpl"/>
123
      <property name="deleteData"          value="deleteData.tmpl"/>
124
      <property name="genericHeader"       value="genericHeader.tmpl"/>
125
      <property name="genericFooter"       value="genericFooter.tmpl"/>
126

    
127
      <filter token="scope"                value="${scope}"/>
128
      <filter token="responseForm"         value="${responseForm}"/>
129
      <filter token="entryForm"            value="${entryForm}"/>
130
      <filter token="guide"                value="${guide}"/>
131
      <filter token="loginForm"            value="${loginForm}"/>
132
      <filter token="confirmData"          value="${confirmData}"/>
133
      <filter token="deleteData"           value="${deleteData}"/>
134
      <filter token="genericHeader"        value="${genericHeader}"/>
135
      <filter token="genericFooter"        value="${genericFooter}"/>
136
      <filter token="adminname"            value="${adminname}"/>
137
      <filter token="recipient"            value="${recipient}"/>
138
   	  <filter token="metacatVersion"       value="${metacat.version}"/>
139

    
140
      <filter token="docrooturl"           value="./" />
141
      <filter token="mcuser"               value="${mcuser}"/>
142
      <filter token="mcpassword"           value="${mcpassword}"/>
143
      <filter token="mcanotheruser"        value="${mcanotheruser}"/>
144
      <filter token="mcanotherpassword"    value="${mcanotherpassword}"/>
145
      <filter token="eml-css"              value="${eml-css}"/>
146
      <filter token="style-skins-relpath"  value="${style-skins-relpath}"/>
147
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
148

    
149
      <filter token="eml-version"          value="${eml-version}"/>
150
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
151
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
152
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
153
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
154
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
155
      <filter token="debuglevel"           value="${debuglevel}" />
156
      <filter token="defaultcontenttype"   value="${defaultcontenttype}" />
157
      <filter token="debugprefix"          value="${debugprefix}"/>
158
      <filter token="indexPaths"           value="${indexPaths}"/>
159

    
160
      <filter token="defaultStage"         value="${defaultStage}"/>
161
      <filter token="defaultHeader"        value="${defaultHeader}"/>
162
      <filter token="defaultFooter"        value="${defaultFooter}"/>
163
      <filter token="defaultChangePass"    value="${defaultChangePass}"/>
164
      <filter token="defaultResetPass"     value="${defaultResetPass}"/>
165
      <filter token="changePassSuccess"    value="${changePassSuccess}"/>
166
      <filter token="resetPassSuccess"     value="${resetPassSuccess}"/>
167
      <filter token="registerFailed"       value="${registerFailed}"/>
168
      <filter token="registerLter"         value="${registerLter}"/>
169
      <filter token="registerMatch"        value="${registerMatch}"/>
170
      <filter token="registerSuccess"      value="${registerSuccess}"/>
171
      <filter token="register"             value="${register}"/>
172
      <filter token="searchResults"        value="${searchResults}"/>
173
   	  <filter token="ldapMainServerFailure" value="${ldapMainServerFailure}"/>
174
   	  <filter token="lter-user"            value="${lteruser}"/>
175
   	  <filter token="lter-pass"            value="${lterpassword}"/>
176
      <filter token="pisco-user"           value="${piscouser}"/>
177
      <filter token="pisco-pass"           value="${piscopassword}"/>
178
   	   
179
       
180
   	  <filter token="timedreplication"     value="${timedreplication}" />
181
   	  <filter token="firsttimedreplication" value="${firsttimedreplication}" />
182
   	  <filter token="timedreplicationinterval" value="${timedreplicationinterval}" />
183
      
184
   	  <property name="srcdir"              value="./src" />
185
   	  <property name="lib.dir"             value="./lib" />
186
   	  <property name="docdir"              value="./docs" />
187
      <property name="testdir"             value="./test" />
188
      <property name="testtorun"           value="BuildIndexTest" />
189
      <property name="junittestsdir"       value="./test/edu/ucsb/nceas/metacattest" />
190
      <property name="junitnettestsdir"    value="./test/edu/ucsb/nceas/metacatnettest" />
191
      <property name="build.dir"           value="./build"/>
192
      <property name="build.src"           value="${build.dir}/src"/>
193
      <property name="build.dest"          value="${build.dir}/classes"/>
194
      <property name="build.samples"       value="${build.dir}/samples"/>
195
      <property name="build.tests"         value="${build.dir}/tests"/>
196
      <property name="build.tmp"           value="${build.dir}/tmp"/>
197
      <property name="build.metacattest"   value="${build.tests}/metacattest"/>
198
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
199
      <property name="build.data"          value="${build.dir}/data"/>
200
      <property name="build.javadocs"      value="${build.dir}/docs/api"/>
201
      <property name="build.war"           value="${build.dir}/war"/>
202
      <property name="dist.dir"            value="dist"/>
203
      <property name="ver.dir"             value="${dist.dir}/${name}-${release}"/>
204
      <property name="ver.src"             value="${ver.dir}/src"/>
205
      <property name="util.dir"            value="${dist.dir}/${util-module}"/>
206
	  <!-- directories for creating a Harvest List Editor distribution -->
207
      <property name="dist.dir.hle"        value="disthle"/>
208
      <property name="ver.dir.hle"         value="${dist.dir.hle}/harvest-list-editor-${release}"/>
209
	  
210
   	  <property name="ecogrid-target-name" value="metacatImpl"/>
211
   	  <property name="ecogrid-module-dest-dir" value =".."/>
212
   	  <property name="ecogrid-module"      value="seek/projects/ecogrid"/>
213
   	  <property name="ecogrid-dist-dir"    value="${dist.dir}/${ecogrid-module}"/>
214
   	  <property name="ecogrid-dir"         value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
215

    
216
      <property name="package.home"        value="edu/ucsb/nceas/metacat" />
217
      <condition property="utilities.required">
218
        <or>
219
          <not><available file="lib/httpclient.jar"/></not>
220
          <not><available file="lib/utilities.jar"/></not>
221
        </or>
222
      </condition>
223
      <condition property="eml.required">
224
        <or>
225
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
226
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
227
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
228
        </or>
229
      </condition>
230
   	  
231
      <condition property="ecogrid.required">
232
      	   <or>
233
             <not><available file="${ecogrid-dir}/build.properties"/></not>
234
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
235
           </or>
236
      </condition>
237

    
238
   </target>
239

    
240
   <target name="prepare" depends="init">
241
      <mkdir dir="${build.dir}"/>
242
      <mkdir dir="${build.src}"/>
243
      <mkdir dir="${build.dest}"/>
244
      <mkdir dir="${build.javadocs}"/>
245
      <mkdir dir="${build.tmp}"/>
246

    
247
      <copy todir="${build.src}" filtering="yes">
248
        <fileset dir="${srcdir}">
249
          <include name="edu/**"/>
250
          <include name="com/**"/>
251
          <include name="org/**"/>
252
          <include name="**/*.sql"/>
253
          <exclude name="**/CVS*"/>
254
          <exclude name="**/.#*"/>
255
        </fileset>
256
      </copy>
257
      <available file="lib/style/common/emlb6toeml2" type="dir"
258
                 property="styles.not.needed"/>
259
   </target>
260

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

    
264
       <javac srcdir="${build.src}"
265
              destdir="${build.dest}"
266
              debug="${debug}"
267
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
268
        <classpath>
269
          <path refid="compile.classpath"/>
270
        </classpath>
271
      </javac>
272
   </target>
273

    
274
   <target name="jar" depends="compile,geteml"
275
    description="Compiles and jars metacat java code to metacat.jar in build dir">
276

    
277
       <delete file="${build.dir}/${name}.jar" />
278
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
279
            excludes="**/protocols/ **/harvesterClient/" />
280
   </target>
281

    
282
   <target name="protocol" depends="compile"
283
    description="Compiles and jars protocol java code to protocol.jar in build dir">
284
       <delete file="${build.dir}/protocol.jar" />
285
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
286
            includes="**/protocols/" />
287
   </target>
288

    
289
   <target name="utilities" depends="config" if="utilities.required">
290
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
291
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
292
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
293
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
294
   </target>
295

    
296
   <target name="getutilities" depends="prepare"
297
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
298
     <echo>Enter CVS password: </echo>
299
     <cvs cvsRoot="${cvsroot}"
300
          package="${util-module}"
301
          dest="${build.tmp}" />
302
   </target>
303

    
304
   <target name="client" depends="utilities, prepare"
305
    description="Compiles metacat-client java code to build dir">
306
       <javac srcdir="${build.src}"
307
              destdir="${build.dest}"
308
              includes="edu/ucsb/nceas/metacat/client/*">
309
          <classpath>
310
            <path refid="compile.classpath"/>
311
          </classpath>
312
        </javac>
313
   </target>
314

    
315
   <target name="clientjar" depends="client"
316
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
317
       <delete file="${build.dir}/${name}-client.jar" />
318
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
319
            includes="**/metacat/client/" />
320
   </target>
321

    
322
    <target name="advancedsearchjar" depends="compile"
323
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
324
        <delete file="${build.dir}/advancedsearch.jar" />
325
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
326
             includes="**/metacat/advancedsearch/" />
327
    </target>
328

    
329
   <target name="harvester" depends="client"
330
           description="Compiles harvester java code to build dir">
331
       <javac srcdir="${build.src}"
332
              destdir="${build.dest}"
333
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
334
          <classpath>
335
            <path refid="compile.classpath"/>
336
          </classpath>
337
        </javac>
338
   </target>
339

    
340
   <target name="harvesterjar" depends="harvester"
341
           description="Compiles and jars harvester java code to harvester.jar in build dir">
342
       <delete file="${build.dir}/harvester.jar" />
343
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
344
            includes="**/metacat/harvesterClient/" />
345
   </target>
346

    
347
   <target name="harvestListEditorDist" depends="harvesterjar"
348
           description="Prepares a distribution of the Harvest List Editor tool">
349
       <mkdir dir="${dist.dir.hle}"/>
350
       <delete dir="${ver.dir.hle}" />
351
       <mkdir dir="${ver.dir.hle}"/>
352
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
353
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
354
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
355
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
356
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
357
       <delete file="./harvest-list-editor-${release}.zip"/>
358
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
359
       <delete file="./harvest-list-editor-${release}.tar.gz" />
360
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
361
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
362
             src="./harvest-list-editor-${release}.tar"/>
363
       <delete file="./harvest-list-editor-${release}.tar" />
364
   </target>
365

    
366
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
367
            description="Calls getemlpre2 and geteml2+ targets" />
368

    
369
   <target name="getemlpre2" depends="prepare" if="eml.required"
370
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
371
     <echo>Enter CVS password: </echo>
372
     <cvs cvsRoot="${cvsroot}"
373
          package="${eml-module}"
374
          tag="${eml-tag}"
375
          dest="${build.tmp}/eml_${eml-tag}" />
376
     <mkdir dir="lib/dtd" />
377
     <copy todir="lib/dtd" filtering="yes">
378
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
379
         <include name="*.dtd"/>
380
       </fileset>
381
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
382
     </copy>
383

    
384
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
385
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
386
       <include name="**/*.xsl"/>
387
     </fileset>
388
     </copy>
389
   </target>
390

    
391
   <target name="geteml2+" depends="prepare" if="eml.required"
392
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
393
     <echo>Enter CVS password: </echo>
394
     <cvs cvsRoot="${cvsroot}"
395
          package="${eml-module}"
396
          tag="${eml2_0_0-tag}"
397
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
398
     <mkdir dir="lib/schema/eml-2.0.0" />
399
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
400
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
401
         <include name="*.xsd"/>
402
       </fileset>
403

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

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

    
410
     </copy>
411
     <!-- <antcall target="copyxsl">
412
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
413
        <param name="dirname" value="eml-2.0.0" />
414
     </antcall> -->
415
   	
416
   	<!-- Checkout eml201 for given schema tag-->
417
     <echo>Enter CVS password: </echo>
418
     <cvs cvsRoot="${cvsroot}"
419
          package="${eml-module}"
420
          tag="${eml2_0_1-schema-tag}"
421
          dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
422
     <mkdir dir="lib/schema/eml-2.0.1" />
423
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
424
       <fileset dir="${build.tmp}/eml_${eml2_0_1-schema-tag}/${eml-module}">
425
         <include name="*.xsd"/>
426
       </fileset>
427
     </copy>
428
   	
429
   	<!-- Checkout eml201 again for given style sheet tag-->
430
   	<echo>Enter CVS password: </echo>
431
   	     <cvs cvsRoot="${cvsroot}"
432
   	          package="${eml-module}"
433
   	          tag="${eml2_0_1-style-tag}"
434
   	          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
435
     <antcall target="copyxsl">
436
        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
437
        <param name="dirname" value="eml-2.0.1" />
438
     </antcall>
439
   </target>
440

    
441
   <target  name="copyxsl"
442
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
443

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

    
446
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
447
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
448
       <include name="**/*.xsl"/>
449
     </fileset>
450
     </copy>
451

    
452

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

    
458
   </target>
459
	
460
   <target name="correctEML201Docs" depends="jar"
461
		            description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
462
	   	<copy todir="${build.dir}" file="lib/metacat.properties" filtering="yes"/>    
463
	   	 <java classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector" >
464
		         <classpath>
465
		          <path refid="compile.classpath"/>
466
		          <fileset dir="${build.dir}">
467
		            <include name="${name}.jar"/>
468
		          </fileset>
469
		        </classpath>
470
		      </java>
471
   </target>
472

    
473
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
474
           description="Installs spatial option for metacat">
475

    
476
      <property name="spatial.dir" value="./lib/spatial"/>
477
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
478
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
479

    
480
      <!-- Copy geoserver libs into ${war.lib} -->
481
      <copy todir="${war.lib}" filtering="no">
482
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
483
          <include name="**"/>
484
        </fileset>
485
      </copy>
486

    
487
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
488
      <copy todir="${war.webinf}" filtering="no">
489
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
490
          <exclude name="lib/**"/>
491
          <exclude name="web.xml"/>
492
        </fileset>
493
      </copy>
494

    
495
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
496
      <copy todir="${war.context}" filtering="no">
497
        <fileset dir="${spatial.geoserver.dir}">
498
          <exclude name="WEB-INF/**"/>
499
          <exclude name="index.jsp"/>
500
        </fileset>
501
      </copy>
502

    
503
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
504
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
505
          tofile="${war.context}/geoserver.jsp"
506
          overwrite="true"
507
          filtering="no"/>
508

    
509
      <!-- Copy the rest of the modified geoserver web-inf files
510
      <copy todir="${war.webinf}" filtering="no">
511
        <fileset dir="${spatial.webinf-mods}">
512
          <exclude name="web.xml.combined"/>
513
        </fileset>
514
      </copy> -->
515

    
516
    </target>
517

    
518
   <target name="dev-install" depends="clean, install-ecogrid" description="* Full Install For Development *">
519
     <copy file="${dist.dir}/${metacat.context}.war" todir="${dev.deploy.dir}"/>
520
   	 <delete dir="${dev.deploy.dir}/${metacat.context}" />
521
   	   <tstamp>
522
   	   	 <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa"/>
523
   	   </tstamp>
524
   	 <echo>Dev install completed at ${NOW}</echo> 	   	
525
   </target>
526

    
527
<!--
528
   <target name="install" depends="install-ecogrid" description="* Full Install *">
529
       <mkdir dir="${datafilepath}" />
530
       <mkdir dir="${inlinedatafilepath}" />
531
       <chmod dir="${datafilepath}" perm="ug+w" />
532
       <mkdir dir="${temp-dir}"/>
533
       <chmod dir="${temp-dir}" perm="ug+w" />
534
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
535
   	   <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
536
   </target>
537
-->
538
	
539
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
540
			    description="Install Ecogrid Compentent">
541
   	  <copyfile src="lib/metacat.url" dest="${ecogrid-dir}/conf/MetacatImpl/classes/metacat.properties" forceoverwrite="true" filtering="yes"/>
542
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
543
   	         <property name="context" value="${metacat.context}"/>
544
   	   	     <property name="target" value="${ecogrid-target-name}"/>
545
   	   	     <property name="metacat.dir" value="${metacat.dir}"/>
546
   	  </ant>
547
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
548
   	     <property name="context" value="${metacat.context}"/>
549
   	     <property name="target" value="${ecogrid-target-name}"/>
550
   	     <property name="metacat.dir" value="${metacat.dir}"/>
551
   	  </ant>
552
   	  <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
553
  	      <webinf dir="${ecogrid-dir}/lib">
554
   	        <include name="server-config.wsdd"/>
555
   	      </webinf>
556
   	  </war>
557
   	  <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
558
   	  
559
   
560
   </target>
561
   
562
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
563
	<echo>Enter CVS password: </echo>
564
	     <cvs cvsRoot="${cvsroot}"
565
	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
566
   </target>  
567
	
568
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
569
   	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
570
   	   	 <property name="context" value="${metacat.context}"/>
571
   	   	 <property name="target" value="${ecogrid-target-name}"/>
572
   	     <property name="metacat.dir" value="${metacat.dir}"/>
573
   	     <property name="hostname" value="localhost"/>
574
   	     <property name="port" value="${config.port}"/>
575
   	 </ant>
576
   </target>
577
	
578
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
579
      <delete file="${dev.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
580
   </target>
581

    
582
   <target name="install-registry" depends="init,getConversionXSL"
583
            description="Install Registry">
584

    
585
      <mkdir dir="${inst.cgi.dir}" />
586
      <copy file="${srcdir}/perl/register-dataset.cgi"
587
            todir="${inst.cgi.dir}"/>
588
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
589

    
590
      <!-- TODO SCW: set the permissions on this folder to be writable by the apache user -->
591
      <mkdir dir="${temp-dir}" />
592
      <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
593
                     used in readDocumentFromMetacat -->
594
      <copy todir="${temp-dir}" filtering="yes">
595
       <fileset dir="lib/style/common/emlb6toeml2">
596
         <include name="*.xsl"/>
597
         <include name="*.xml"/>
598
       </fileset>
599
      </copy>
600

    
601
      <echo message="Install Registry completed." />
602
   </target>
603

    
604
   <target name="install-ldap" depends="init"
605
            description="Install Metacat LDAP Access">
606

    
607
      <mkdir dir="${inst.cgi.dir}" />
608
      <copy file="${srcdir}/perl/ldapweb.cgi"
609
            todir="${inst.cgi.dir}" />
610
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
611
      <mkdir dir="${templates.dir}" />
612
      <copy todir="${templates.dir}">
613
        <fileset dir="lib/style/common/templates">
614
			<!-- SCW: Copy all files -->
615
        </fileset>
616
      </copy>
617
      <echo message="ldapweb install complete." />
618
   </target>
619

    
620

    
621
   <target name="install-skin" depends="init"
622
            description="Install a Skin">
623

    
624
      <input message="Please enter name of the skin"
625
             addproperty="skin-name"/>
626

    
627
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
628
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
629
       <fileset dir="lib/style/skins/${skin-name}">
630
           <exclude name="**/*.png"/>
631
           <exclude name="**/*.gif"/>
632
           <exclude name="**/*.jpg"/>
633
           <exclude name="**/CVS*"/>
634
           <exclude name="**/.#*"/>
635
       </fileset>
636
      </copy>
637
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
638
       <fileset dir="lib/style/skins/${skin-name}">
639
           <include name="**/*.png"/>
640
           <include name="**/*.gif"/>
641
           <include name="**/*.jpg"/>
642
           <exclude name="**/CVS*"/>
643
           <exclude name="**/.#*"/>
644
       </fileset>
645
      </copy>
646
      <copy todir="${installdir}/style/common" filtering="yes">
647
       <fileset dir="lib/style/common">
648
           <include name="*.js"/>
649
           <include name="*.jsp"/>
650
           <include name="*.css"/>
651
           <exclude name="*.png"/>
652
           <exclude name="*.gif"/>
653
           <exclude name="*.jpg"/>
654
           <exclude name="**/CVS*"/>
655
           <exclude name="**/.#*"/>
656
       </fileset>
657
      </copy>
658
      <!--
659
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
660
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
661
       <fileset dir="lib/style/skins/${skin-name}/images">
662
           <include name="*.png"/>
663
           <include name="*.gif"/>
664
           <include name="*.jpg"/>
665
       </fileset>
666
      </copy>
667
      -->
668

    
669
      <echo message="Install Skin completed." />
670
   </target>
671

    
672
   <target name="war" depends="warPrepare,install-spatial"
673
            description="Create a web archive (WAR) for servlet deployment">
674
       <mkdir dir="${dist.dir}" />
675
       <war destfile="${dist.dir}/${metacat.context}.war"
676
            webxml="${build.war}/web.xml">
677
         <fileset dir="${war.context}"/>
678
         <lib dir="${war.lib}"/>
679
         <webinf dir="${war.webinf}"/>
680
       </war>
681
   </target>
682
	
683
	
684

    
685
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
686
            description="Prepare files for creating a web archive (WAR)">
687

    
688
       <property name="war.lib" value="${build.war}/lib" />
689
       <property name="war.webinf" value="${build.war}/WEB-INF" />
690
       <property name="war.context" value="${build.war}/${metacat.context}" />
691
   	   <property name="war.webinf.sql" value="${war.webinf}/sql" />
692
   	   <property name="war.context.docs" value="${war.context}/docs" />
693
       <mkdir dir="${war.lib}" />
694
       <mkdir dir="${war.webinf}" />
695
       <mkdir dir="${war.context}" />
696
   	   <mkdir dir="${war.webinf.sql}" />
697
   	   <mkdir dir="${war.context.docs}" />
698
       
699
   	   <!--copy file="${lib.dir}/${jdbc.lib.oracle}" todir="${war.lib}" / -->
700
	   <!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
701
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
702
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
703
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
704
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
705
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
706
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
707
       <copy todir="${war.lib}" filtering="no">
708
         <fileset dir="lib">
709
<!--
710
         	<not>
711
               <filename name="${jdbc-jar-name}"/>
712
            </not>
713
-->
714
            <include name="*.jar"/>
715
         </fileset>
716
         <fileset dir="lib">
717
           <include name="xalan.jar"/>
718
           <include name="gwt*.jar"/>
719
         </fileset>
720
       </copy>
721
       <!-- MCD copy file="lib/web.xml.${tomcatversion}"
722
             tofile="${build.war}/web.xml" / -->
723
       <!-- MCD added next - Remove the tomcat5 reference-->
724
   	   <copy file="lib/web.xml.tomcat5"
725
   	             tofile="${build.war}/web.xml"/>
726
       <copy file="lib/metacat.properties" todir="${war.webinf}"
727
             filtering="yes" />
728
   	   <copy file="lib/metacat.properties.metadata.xml" todir="${war.webinf}"
729
   	             filtering="no" />
730
	   <copy file="lib/org.properties.metadata.xml" todir="${war.webinf}"
731
	             filtering="no" />
732
       <copy todir="${war.webinf}" filtering="yes">
733
	   	  <fileset dir="lib">
734
           <include name="skin.configs/**"/>
735
		  </fileset>
736
	   </copy>
737
       <copy file="lib/log4j.properties" todir="${war.webinf}"
738
             filtering="yes" />
739
       <copy todir="${war.context}" filtering="no">
740
         <fileset dir="lib">
741
           <include name="**/*.jpg"/>
742
           <include name="**/*.png"/>
743
           <include name="**/*.gif"/>
744
           <include name="LiveMap_30/**"/>
745
         </fileset>
746
       </copy>
747
       <copy todir="${war.context}" filtering="yes">
748
         <fileset dir="lib">
749
           <exclude name="*.jar"/>
750
           <exclude name="*.properties"/>
751
         	<exclude name="*.metadata.xml"/>
752
           <exclude name="web.xml"/>
753
           <exclude name="**/*.jpg"/>
754
           <exclude name="**/*.png"/>
755
           <exclude name="**/*.gif"/>
756
           <exclude name="lsid_lib/**"/>
757
           <exclude name="lsid_conf/**"/>
758
           <exclude name="LiveMap_30/**"/>
759
           <exclude name="skin.configs/**"/>
760
           <exclude name="spatial/geoserver/**"/>
761
           <exclude name="spatial/WEB-INF/**"/>
762
         </fileset>
763
       </copy>
764
   	   <copy todir="${war.context.docs}" filtering="yes">
765
   	         <fileset dir="docs">
766
   	           <include name="user/**"/>
767
   	         </fileset>
768
   	   </copy>
769
	   <copy todir="${war.webinf.sql}" filtering="yes">
770
	         <fileset dir="src">
771
	           <include name="**/*.sql"/>
772
	         </fileset>
773
	   </copy>
774
   </target>
775

    
776
   <target name="getConversionXSL" depends="prepare"
777
            unless="styles.not.needed"
778
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
779

    
780
     <echo>Enter CVS password: </echo>
781
     <cvs cvsRoot="${cvsroot}"
782
          package="${eml-module}"
783
          tag="${eml2_0_1-style-tag}"
784
          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
785

    
786
     <mkdir dir="lib/style/common/emlb6toeml2" />
787
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
788
       <fileset dir="${build.tmp}/eml_${eml2_0_1-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
789
         <include name="*.xsl"/>
790
         <include name="*.xml"/>
791
       </fileset>
792
      </copy>
793
   </target>
794

    
795
   <target name="testprep" depends="jar,clientjar,harvesterjar">
796
      <mkdir dir="${build.tests}"/>
797
      <copy todir="${build.tests}" filtering="yes">
798
        <fileset dir="${testdir}">
799
          <include name="edu/**"/>
800
        </fileset>
801
      </copy>
802
   	<copy todir="${build.tests}" file="lib/metacat.properties" filtering="yes">
803
   	        
804
   	 </copy>
805
      <!-- copy and compile the tests into a jar file -->
806
      <javac srcdir="${build.tests}"
807
             destdir="${build.tests}"
808
             debug="on"
809
             includes="**/*.java">
810
        <classpath>
811
          <path refid="compile.classpath"/>
812
          <fileset dir="${build.dir}">
813
            <include name="${name}.jar"/>
814
            <include name="${name}-client.jar"/>
815
            <include name="harvester.jar"/>
816
          </fileset>
817
        </classpath>
818
      </javac>
819

    
820
      <jar jarfile="${build.dir}/${name}-junittests.jar"
821
        basedir="${build.tests}"
822
                includes="**/*.class" />
823
   </target>
824

    
825
   <target name="test" depends="testprep"
826
            description="Uses the ant junit task to run all JUnit tests">
827

    
828
      <!-- use the ant "junit" task to run JUnit tests. -->
829
      <junit printsummary="yes" haltonfailure="no" fork="yes"
830
             haltonerror="no">
831
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
832
        <classpath>
833
          <path refid="compile.classpath"/>
834
          <fileset dir="${build.dir}">
835
            <include name="${name}.jar"/>
836
            <include name="${name}-client.jar"/>
837
            <include name="harvester.jar"/>
838
            <include name="${name}-junittests.jar"/>
839
          </fileset>
840
        </classpath>
841

    
842
        <formatter type="plain" />
843

    
844
        <batchtest fork="yes" todir="${build.dir}">
845
          <fileset dir="${build.tests}">
846
            <include name="**/*.class" />
847
          </fileset>
848
        </batchtest>
849
     </junit>
850
   </target>
851

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

    
855
              <echo>testtorun: ${testtorun}</echo>
856

    
857
      <!-- use the ant "junit" task to run JUnit tests. -->
858
      <junit printsummary="yes" haltonfailure="no" fork="yes"
859
             haltonerror="no" showoutput="yes">
860
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
861
        <classpath>
862
          <path refid="compile.classpath"/>
863
          <fileset dir="${build.dir}">
864
            <include name="${name}.jar"/>
865
            <include name="${name}-client.jar"/>
866
            <include name="harvester.jar"/>
867
            <include name="${name}-junittests.jar"/>
868
          </fileset>
869
        </classpath>
870

    
871
        <formatter type="plain" />
872

    
873
        <batchtest fork="yes" todir="${build.dir}">
874
          <fileset dir="${build.tests}">
875
            <include name="**/${testtorun}.class" />
876
          </fileset>
877
        </batchtest>
878
     </junit>
879
   </target>
880

    
881
   <target name="testharvester"
882
           depends="testprep"
883
           description="Uses the ant junit task to test only the Harvester code">
884
     <junit printsummary="yes"
885
            haltonfailure="off"
886
            fork="yes"
887
            haltonerror="off">
888
        <classpath>
889
          <path refid="compile.classpath"/>
890
          <fileset dir="${build.dir}">
891
            <include name="${name}.jar"/>
892
            <include name="${name}-client.jar"/>
893
            <include name="harvester.jar"/>
894
            <include name="${name}-junittests.jar"/>
895
          </fileset>
896
        </classpath>
897
       <formatter type="plain" />
898
       <batchtest fork="yes" todir="${build.dir}">
899
         <fileset dir="${build.tests}">
900
           <include name="**/harvesterClient/*.class" />
901
         </fileset>
902
       </batchtest>
903
     </junit>
904
   </target>
905

    
906
  <target name="gethttpclient" depends="prepare"
907
            description="checks out and compiles morpho httpclient code">
908
  <!--mkdir dir="${morphosourcedir}" -->
909
        <cvs cvsRoot="${cvsroot}"
910
             package="morpho"
911
             dest="." />
912
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
913
   </target>
914

    
915
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
916
   <target name="nettest" depends="dev-install"
917
            description="compiles and runs the metacatnettest code">
918

    
919
      <echo>***********************************
920
      Please run ant gethttpclient first!
921
      ***********************************
922
      </echo>
923
      <!-- copy and compile the tests into a jar file -->
924
      <mkdir dir="${build.metacatnettest}"/>
925
      <javac srcdir="${junitnettestsdir}"
926
             destdir="${build.metacatnettest}"
927
             includes="**/*.java">
928
        <classpath>
929
          <path refid="compile.classpath"/>
930
          <fileset dir="${build.dir}">
931
            <include name="${name}.jar"/>
932
          </fileset>
933
        </classpath>
934
      </javac>
935

    
936
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
937
                    basedir="${build.metacatnettest}"
938
                    includes="**/*.class" />
939

    
940
      <!-- use the ant "junit" task to run JUnit tests. -->
941
      <junit printsummary="yes" haltonfailure="no" fork="yes"
942
             haltonerror="no">
943
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
944
        <classpath>
945
          <path refid="compile.classpath"/>
946
          <fileset dir="${build.dir}">
947
            <include name="${name}.jar"/>
948
            <include name="${name}-junitnettests.jar"/>
949
          </fileset>
950
        </classpath>
951

    
952
        <formatter type="plain" />
953

    
954
        <batchtest fork="yes" todir="${build.dir}">
955
          <fileset dir="${build.metacatnettest}">
956
            <include name="**/*.class" />
957
          </fileset>
958
        </batchtest>
959
     </junit>
960
   </target>
961

    
962
   <target name="cleanweb" depends="clean"
963
            description="deletes tomcat web context dir and all its contents">
964
     <delete dir="${installdir}" />
965
   </target>
966

    
967

    
968
   <target name="clean" depends="init"
969
            description="deletes build dir and files that can be regenerated form the release">
970
       <delete dir="${build.dir}" />
971
       <delete dir="${dist.dir}" />
972
   </target>
973

    
974
	<target name="localclean" depends="clean"
975
	            description="deletes even jars that depend on external sources such as stylesheets and jars">
976
	       <delete file="lib/httpclient.jar" />
977
	       <delete file="lib/utilities.jar" />
978
	</target>	
979
	
980
   <target name="fullclean" depends="localclean"
981
            description="deletes code and eml">
982
       <delete includeEmptyDirs="true" failonerror="false">
983
         <fileset dir="${style-common-cvsrelpath}">
984
           <include name="${eml-css}" />
985
           <include name="eml-*/*.xsl" />
986
           <include name="eml-*" />
987
         </fileset>
988
       	 <fileset dir="${schema-cvsrelpath}">
989
       	   <include name="eml-*/*.xsd" />
990
       	 </fileset>
991
       </delete>
992
   </target>
993

    
994
   <target name="jdoc" depends="prepare"
995
            description="generates javadoc documentation">
996
       <javadoc packagenames="edu.ucsb.nceas.*"
997
           sourcepath="${build.src}"
998
           destdir="${build.javadocs}"
999
           author="true"
1000
           version="true"
1001
           use="true"
1002
           windowtitle="${Name} API"
1003
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1004
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1005
         <classpath>
1006
           <path refid="compile.classpath"/>
1007
         </classpath>
1008
       </javadoc>
1009
   </target>
1010

    
1011
   <target name="dist"
1012
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1013
            description="prepares a full release distribution">
1014
      <mkdir dir="${dist.dir}"/>
1015
      <delete dir="${ver.dir}" />
1016
      <mkdir dir="${ver.dir}"/>
1017
      <copy todir="${ver.dir}">
1018
        <fileset dir="."
1019
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1020
      </copy>
1021
      <copy todir="${ver.dir}" file="build.xml"/>
1022
      <copy todir="${ver.dir}" file="build.properties"/>
1023

    
1024
      <copy todir="${ver.dir}/docs" filtering="yes">
1025
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1026
      </copy>
1027
      <copy todir="${ver.dir}/docs" filtering="no">
1028
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1029
      </copy>
1030
      <copy todir="${ver.dir}/docs/dev">
1031
        <fileset dir="${build.dir}/docs"/>
1032
      </copy>
1033
      <copy todir="${ver.dir}/src">
1034
        <fileset dir="${build.dir}/src"/>
1035
      </copy>
1036
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1037
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1038
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1039
      <!--
1040
      <delete dir="./${ver.dir}/${build.dir}"/>
1041
      <delete dir="./${ver.dir}/dist"/>
1042
      -->
1043
      <delete file="./${name}-${release}.zip"/>
1044
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1045
      <delete file="./${name}-${release}.tar.gz" />
1046
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1047
      <gzip zipfile="./${name}-${release}.tar.gz"
1048
                src="./${name}-${release}.tar"/>
1049
      <delete file="./${name}-${release}.tar" />
1050
  </target>
1051

    
1052
  <target name="distsrc" depends="dist"
1053
            description="prepares a source distribution">
1054
      <mkdir dir="${ver.src}"/>
1055
      <copy todir="${ver.src}">
1056
        <fileset dir="./src"/>
1057
      </copy>
1058
      <mkdir dir="${util.dir}"/>
1059
      <copy todir="${util.dir}">
1060
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1061
      </copy>
1062
  	  
1063
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1064
  	  <copy todir="${ecogrid-dist-dir}">
1065
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1066
  	  </copy>
1067

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

    
1070
      <delete file="./${name}-src-${release}.zip"/>
1071
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1072
      <delete file="./${name}-src-${release}.tar.gz" />
1073
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1074
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1075
                src="./${name}-src-${release}.tar"/>
1076
      <delete file="./${name}-src-${release}.tar" />
1077
      <delete dir="${dist.dir}"/> 
1078
  </target>
1079

    
1080
   <target name="stylesheettest">
1081
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1082
      <param name="displaymodule" expression="${displaymodule}"/>
1083
      <param name="docid" expression="${input}"/>
1084
      <param name="entitytype" expression="${entitytype}"/>
1085
      <param name="entityindex" expression="${entityindex}"/>
1086
      <outputproperty name="method" value="html"/>
1087
      <outputproperty name="standalone" value="yes"/>
1088
      <outputproperty name="encoding" value="iso8859_1"/>
1089
      <outputproperty name="indent" value="yes"/>
1090
    </xslt>
1091
  </target>
1092

    
1093
 
1094
  <target name="compilewebclient" depends="prepare">
1095
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1096
  </target>
1097

    
1098
  <target name="runwebclient" depends="compilewebclient">
1099
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1100
           dir="${build.dest}" fork="yes"
1101
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1102
         <arg value="${serviceUrl}"/>
1103
         <arg value="${docid}"/>
1104
     </java>
1105
  </target>
1106
  
1107
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1108

    
1109
    <echo message="Compiling the metatcat shapefile creator"/>
1110
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1111
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1112
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1113
    </exec>
1114
  
1115
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1116
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1117
    </exec>
1118
  </target>
1119

    
1120
    <!-- LSID Authority support -->
1121
    <patternset id="lsid.jars">
1122
        <include name="axis.jar" />
1123
        <include name="commons-discovery-0.2.jar" />
1124
        <include name="jaxrpc.jar" />
1125
        <include name="lsid-client-1.1.1.jar" />
1126
        <include name="lsid-server-1.1.1.jar" />
1127
        <include name="saaj.jar" />
1128
        <include name="wsdl4j-1.5.1.jar" />
1129
        <include name="activation.jar" />
1130
        <include name="castor-0.9.5.jar" />
1131
        <include name="dnsjava-1.3.2.jar" />
1132
        <include name="mail.jar" />
1133
        <include name="commons-logging-1.0.4.jar" />
1134
        <!-- These jars may be needed but seem to not actually be,
1135
             so leaving them out for now
1136
        <include name="axis-ant.jar" />
1137
        -->
1138
        <!--<include name="GenCastor.class" />-->
1139
    </patternset>
1140
    <patternset id="lib.jars">
1141
        <include name="httpclient.jar" />
1142
        <include name="log4j-1.2.12.jar" />
1143
        <include name="utilities.jar" />
1144
        <include name="xercesImpl.jar" />
1145
        <include name="xalan.jar" />
1146
        <include name="xml-apis.jar" />
1147
    </patternset>
1148

    
1149
    <path id="lsid.classpath">
1150
        <fileset dir="${lsid.lib.dir}">
1151
            <patternset refid="lsid.jars"/>
1152
        </fileset>
1153
        <fileset dir="${lib.dir}">
1154
            <patternset refid="lsid.jars"/>
1155
        </fileset>
1156
        <fileset dir="${lib.dir}">
1157
            <include name="xalan.jar" />
1158
            <include name="xml-apis.jar" />
1159
        </fileset>
1160
        <fileset dir="${build.dir}">
1161
            <include name="metacat-client.jar" />
1162
        </fileset>
1163
    </path>
1164

    
1165
    <filterset id="configFilters">
1166
        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1167
                value="${config.hostname}" / -->
1168
        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1169
                value="${config.port}" / -->
1170
        <!-- MCD BYE filter token="METADATA_LABELS"
1171
                value="${config.metadataLabelLsid}" / -->
1172
        <!-- MCD BYE filter token="METACAT_SERVER"
1173
                value="${config.metacatserver}" / -->
1174
        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1175
                value="${config.lsidauthority}" / -->
1176
    </filterset>
1177
    
1178
    <target name="prepare-lsid"
1179
            depends="prepare,utilities,clientjar"
1180
            description="Configure files prior to compilation">
1181
        <mkdir dir="${lsid.build.dir}" />
1182
        <!-- Copy the properties file into the build -->
1183
        <copy file="${conf.dir}/metacat-lsid.properties"
1184
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1185
              overwrite="true">
1186
            <filterset refid="configFilters" />
1187
        </copy>
1188
        <copy file="${conf.dir}/log4j.properties"
1189
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1190
              overwrite="true">
1191
            <filterset refid="configFilters" />
1192
        </copy>
1193
        <!-- Copy config files into the build -->
1194
        <copy todir="${lsid.build.dir}/WEB-INF">
1195
            <fileset dir="${webinf.dir}"
1196
                     includes="**/*.wsdd" />
1197
        </copy>
1198
        <!-- Copy the metadata configuration files into the build -->
1199
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1200
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1201
            <fileset dir="${conf.dir}"
1202
                     includes="**/*.xml" />
1203
            <fileset dir="${conf.dir}"
1204
                     includes="**/*.xslt" />
1205
            <filterset refid="configFilters" />
1206
        </copy>
1207
        <!-- Copy services files into the build -->
1208
        <mkdir dir="${lsid.build.dir}/services" />
1209
        <copy todir="${lsid.build.dir}/services">
1210
            <fileset dir="${services.dir}" />
1211
            <filterset refid="configFilters" />
1212
        </copy>
1213
        <!-- Copy axis files into the build -->
1214
        <mkdir dir="${lsid.build.dir}" />
1215
        <copy todir="${lsid.build.dir}">
1216
            <fileset dir="${conf.dir}/axis"
1217
                     excludes="*.properties"/>
1218
        </copy>
1219
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1220
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1221
            <fileset dir="${conf.dir}/axis"
1222
                     includes="*.properties"/>
1223
        </copy>
1224
    </target>
1225
    
1226
    <target name="compile-lsid"
1227
            depends="prepare-lsid"
1228
            description="Compile Java sources">
1229
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1230
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1231
               destdir="${lsid.build.dir}/WEB-INF/classes"
1232
               debug="${compile.debug}"
1233
               deprecation="${compile.deprecation}"
1234
               optimize="${compile.optimize}">
1235
            <classpath refid="lsid.classpath" />
1236
        </javac>
1237
    </target>
1238
    
1239
    <target name="war-lsid"
1240
            depends="compile-lsid"
1241
            description="Create a war file for the application">
1242
        <mkdir dir="${dist.dir}" />
1243
        <war destfile="${dist.dir}/${authority.context}.war"
1244
             webxml="${webinf.dir}/web.xml">
1245
            <fileset dir="${lsid.build.dir}" />
1246
            <lib dir="${lsid.lib.dir}">
1247
                <patternset refid="lsid.jars"/>
1248
            </lib>
1249
            <lib dir="${lib.dir}">
1250
                <patternset refid="lib.jars"/>
1251
            </lib>
1252
            <lib dir="${lib.dir}">
1253
                <include name="xalan.jar" />
1254
                <include name="xml-apis.jar" />
1255
            </lib>
1256
            <lib dir="${build.dir}">
1257
                <include name="metacat-client.jar" />
1258
            </lib>
1259
        </war>
1260
    </target>
1261
    
1262
    <target name="deploy-lsid"
1263
            depends="war-lsid"
1264
            description="Deploy LSID war to servlet container">
1265
        <delete dir="${dev.deploy.dir}/${authority.context}" />
1266
        <delete file="${dev.deploy.dir}/${authority.context}.war" />
1267
        <mkdir dir="${dev.deploy.dir}" />
1268
        <copy todir="${dev.deploy.dir}">
1269
            <fileset dir="${dist.dir}" />
1270
        </copy>
1271
    </target>
1272
</project>
(5-5/5)