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-08-22 16:30:07 -0700 (Fri, 22 Aug 2008) $'
11
  *    '$Revision: 4304 $'
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
      <!-- MCD BYE in metacat.properties property name="debuglevel"          value="55" / -->
57

    
58
      <property name="morphosourcedir"     value="../morpho" />
59
      <!-- MCD BYE in metacat.properties property name="defaultcontenttype"  value="application/octet-stream" / -->
60
      <property name="utilitiesdir"        value="../utilities" />
61
      <property name="installdir"        value="${dev.deploy.dir}/${metacat.context}" />
62

    
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
      <!-- MCD BYE filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" / -->
155
      <!-- MCD BYE filter filter token="debuglevel"           value="${debuglevel}" / -->
156
      <!-- MCD BYE 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
   	  <!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
181
   	  <!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
182
   	  <!-- MCD BYE 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="cgidir"              value="./cgi-bin" />
188
      <property name="testdir"             value="./test" />
189
      <property name="testtorun"           value="BuildIndexTest" />
190
      <property name="junittestsdir"       value="./test/edu/ucsb/nceas/metacattest" />
191
      <property name="junitnettestsdir"    value="./test/edu/ucsb/nceas/metacatnettest" />
192
      <property name="build.dir"           value="./build"/>
193
      <property name="build.src"           value="${build.dir}/src"/>
194
      <property name="build.dest"          value="${build.dir}/classes"/>
195
      <property name="build.samples"       value="${build.dir}/samples"/>
196
      <property name="build.tests"         value="${build.dir}/tests"/>
197
      <property name="build.tmp"           value="${build.dir}/tmp"/>
198
      <property name="build.metacattest"   value="${build.tests}/metacattest"/>
199
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
200
      <property name="build.data"          value="${build.dir}/data"/>
201
      <property name="build.javadocs"      value="${build.dir}/docs/api"/>
202
      <property name="build.war"           value="${build.dir}/war"/>
203
      <property name="dist.dir"            value="dist"/>
204
      <property name="ver.dir"             value="${dist.dir}/${name}-${release}"/>
205
      <property name="ver.src"             value="${ver.dir}/src"/>
206
      <property name="util.dir"            value="${dist.dir}/${util-module}"/>
207
	  <!-- directories for creating a Harvest List Editor distribution -->
208
      <property name="dist.dir.hle"        value="disthle"/>
209
      <property name="ver.dir.hle"         value="${dist.dir.hle}/harvest-list-editor-${release}"/>
210
	  
211
   	  <property name="ecogrid-target-name" value="metacatImpl"/>
212
   	  <property name="ecogrid-module-dest-dir" value =".."/>
213
   	  <property name="ecogrid-module"      value="seek/projects/ecogrid"/>
214
   	  <property name="ecogrid-dist-dir"    value="${dist.dir}/${ecogrid-module}"/>
215
   	  <property name="ecogrid-dir"         value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
216

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

    
239
   </target>
240

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
453

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

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

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

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

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

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

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

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

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

    
517
    </target>
518

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

    
528
<!--
529
   <target name="install" depends="install-ecogrid" description="* Full Install *">
530
       <mkdir dir="${datafilepath}" />
531
       <mkdir dir="${inlinedatafilepath}" />
532
       <chmod dir="${datafilepath}" perm="ug+w" />
533
       <mkdir dir="${temp-dir}"/>
534
       <chmod dir="${temp-dir}" perm="ug+w" />
535
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
536
   	   <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
537
   </target>
538
-->
539
	
540
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
541
			    description="Install Ecogrid Compentent">
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
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
684
            description="Prepare files for creating a web archive (WAR)">
685

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

    
786
       <!-- TODO SCW: set the permissions on this folder to be writable by the apache user -->
787
       <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
788
                   used in readDocumentFromMetacat -->
789
   	   <!-- TODO MCD copy temp files to actual location using config util?? -->
790
       <copy todir="${war.context.temp}" filtering="yes">
791
         <fileset dir="lib/style/common/emlb6toeml2">
792
           <include name="*.xsl"/>
793
           <include name="*.xml"/>
794
         </fileset>
795
       </copy>
796
   	
797
       <!-- ldap cgi section -->
798
       <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
799
       <!-- chmod file="${war.context.cgi}/ldapweb.cgi" perm="ugo+x" / -->
800
       <copy todir="${war.context.templates}">
801
         <fileset dir="lib/style/common/templates">
802
			<!-- SCW: Copy all files -->
803
         </fileset>
804
       </copy>
805
   </target>
806

    
807
   <target name="getConversionXSL" depends="prepare"
808
            unless="styles.not.needed"
809
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
810

    
811
     <echo>Enter CVS password: </echo>
812
     <cvs cvsRoot="${cvsroot}"
813
          package="${eml-module}"
814
          tag="${eml2_0_1-style-tag}"
815
          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
816

    
817
     <mkdir dir="lib/style/common/emlb6toeml2" />
818
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
819
       <fileset dir="${build.tmp}/eml_${eml2_0_1-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
820
         <include name="*.xsl"/>
821
         <include name="*.xml"/>
822
       </fileset>
823
      </copy>
824
   </target>
825

    
826
   <target name="testprep" depends="jar,clientjar,harvesterjar">
827
      <mkdir dir="${build.tests}"/>
828
      <copy todir="${build.tests}" filtering="yes">
829
        <fileset dir="${testdir}">
830
          <include name="edu/**"/>
831
        </fileset>
832
      </copy>
833
   	  <copy todir="${build.tests}" file="lib/metacat.properties" filtering="yes"/>
834
   	  <copy todir="${build.tests}" file="lib/metacat.properties.metadata.xml" filtering="yes"/>
835
   	  <copy todir="${build.tests}" file="lib/org.properties.metadata.xml" filtering="yes"/>
836
 	  <copy todir="${build.tests}" file="lib/ldap.properties.metadata.xml" filtering="yes"/>
837

    
838
      <!-- copy and compile the tests into a jar file -->
839
      <javac srcdir="${build.tests}"
840
             destdir="${build.tests}"
841
             debug="on"
842
             includes="**/*.java">
843
        <classpath>
844
          <path refid="compile.classpath"/>
845
          <fileset dir="${build.dir}">
846
            <include name="${name}.jar"/>
847
            <include name="${name}-client.jar"/>
848
            <include name="harvester.jar"/>
849
          </fileset>
850
        </classpath>
851
      </javac>
852

    
853
      <jar jarfile="${build.dir}/${name}-junittests.jar"
854
        basedir="${build.tests}"
855
                includes="**/*.class" />
856
   </target>
857

    
858
   <target name="test" depends="testprep"
859
            description="Uses the ant junit task to run all JUnit tests">
860

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

    
875
        <formatter type="plain" />
876

    
877
        <batchtest fork="yes" todir="${build.dir}">
878
          <fileset dir="${build.tests}">
879
            <include name="**/*.class"/>
880
          	<exclude name="**/MCTestCase.class" />
881
          	<exclude name="**/ClientViewHelperTest.class" />
882
          </fileset>
883
        </batchtest>
884
     </junit>
885
   </target>
886

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

    
890
              <echo>testtorun: ${testtorun}</echo>
891

    
892
      <!-- use the ant "junit" task to run JUnit tests. -->
893
      <junit printsummary="yes" haltonfailure="no" fork="yes"
894
             haltonerror="no" showoutput="yes">
895
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
896
        <classpath>
897
          <path refid="compile.classpath"/>
898
          <fileset dir="${build.dir}">
899
            <include name="${name}.jar"/>
900
            <include name="${name}-client.jar"/>
901
            <include name="harvester.jar"/>
902
            <include name="${name}-junittests.jar"/>
903
          </fileset>
904
        </classpath>
905

    
906
        <formatter type="plain" />
907

    
908
        <batchtest fork="yes" todir="${build.dir}">
909
          <fileset dir="${build.tests}">
910
            <include name="**/${testtorun}.class" />
911
          </fileset>
912
        </batchtest>
913
     </junit>
914
   </target>
915

    
916
   <target name="testharvester"
917
           depends="testprep"
918
           description="Uses the ant junit task to test only the Harvester code">
919
     <junit printsummary="yes"
920
            haltonfailure="off"
921
            fork="yes"
922
            haltonerror="off">
923
        <classpath>
924
          <path refid="compile.classpath"/>
925
          <fileset dir="${build.dir}">
926
            <include name="${name}.jar"/>
927
            <include name="${name}-client.jar"/>
928
            <include name="harvester.jar"/>
929
            <include name="${name}-junittests.jar"/>
930
          </fileset>
931
        </classpath>
932
       <formatter type="plain" />
933
       <batchtest fork="yes" todir="${build.dir}">
934
         <fileset dir="${build.tests}">
935
           <include name="**/harvesterClient/*.class" />
936
         </fileset>
937
       </batchtest>
938
     </junit>
939
   </target>
940

    
941
  <target name="gethttpclient" depends="prepare"
942
            description="checks out and compiles morpho httpclient code">
943
  <!--mkdir dir="${morphosourcedir}" -->
944
        <cvs cvsRoot="${cvsroot}"
945
             package="morpho"
946
             dest="." />
947
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
948
   </target>
949

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

    
954
      <echo>***********************************
955
      Please run ant gethttpclient first!
956
      ***********************************
957
      </echo>
958
      <!-- copy and compile the tests into a jar file -->
959
      <mkdir dir="${build.metacatnettest}"/>
960
      <javac srcdir="${junitnettestsdir}"
961
             destdir="${build.metacatnettest}"
962
             includes="**/*.java">
963
        <classpath>
964
          <path refid="compile.classpath"/>
965
          <fileset dir="${build.dir}">
966
            <include name="${name}.jar"/>
967
          </fileset>
968
        </classpath>
969
      </javac>
970

    
971
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
972
                    basedir="${build.metacatnettest}"
973
                    includes="**/*.class" />
974

    
975
      <!-- use the ant "junit" task to run JUnit tests. -->
976
      <junit printsummary="yes" haltonfailure="no" fork="yes"
977
             haltonerror="no">
978
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
979
        <classpath>
980
          <path refid="compile.classpath"/>
981
          <fileset dir="${build.dir}">
982
            <include name="${name}.jar"/>
983
            <include name="${name}-junitnettests.jar"/>
984
          </fileset>
985
        </classpath>
986

    
987
        <formatter type="plain" />
988

    
989
        <batchtest fork="yes" todir="${build.dir}">
990
          <fileset dir="${build.metacatnettest}">
991
            <include name="**/*.class" />
992
          </fileset>
993
        </batchtest>
994
     </junit>
995
   </target>
996

    
997
   <target name="cleanweb" depends="clean"
998
            description="deletes tomcat web context dir and all its contents">
999
     <delete dir="${installdir}" />
1000
   </target>
1001

    
1002

    
1003
   <target name="clean" depends="init"
1004
            description="deletes build dir and files that can be regenerated form the release">
1005
       <delete dir="${build.dir}" />
1006
       <delete dir="${dist.dir}" />
1007
   </target>
1008

    
1009
	<target name="localclean" depends="clean"
1010
	            description="deletes even jars that depend on external sources such as stylesheets and jars">
1011
	       <delete file="lib/httpclient.jar" />
1012
	       <delete file="lib/utilities.jar" />
1013
	</target>	
1014
	
1015
   <target name="fullclean" depends="localclean"
1016
            description="deletes code and eml">
1017
       <delete includeEmptyDirs="true" failonerror="false">
1018
         <fileset dir="${style-common-cvsrelpath}">
1019
           <include name="${eml-css}" />
1020
           <include name="eml-*/*.xsl" />
1021
           <include name="eml-*" />
1022
         </fileset>
1023
       	 <fileset dir="${schema-cvsrelpath}">
1024
       	   <include name="eml-*/*.xsd" />
1025
       	 </fileset>
1026
       </delete>
1027
   </target>
1028

    
1029
   <target name="jdoc" depends="prepare"
1030
            description="generates javadoc documentation">
1031
       <javadoc packagenames="edu.ucsb.nceas.*"
1032
           sourcepath="${build.src}"
1033
           destdir="${build.javadocs}"
1034
           author="true"
1035
           version="true"
1036
           use="true"
1037
           windowtitle="${Name} API"
1038
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1039
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1040
         <classpath>
1041
           <path refid="compile.classpath"/>
1042
         </classpath>
1043
       </javadoc>
1044
   </target>
1045

    
1046
   <target name="dist"
1047
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1048
            description="prepares a full release distribution">
1049
      <mkdir dir="${dist.dir}"/>
1050
      <delete dir="${ver.dir}" />
1051
      <mkdir dir="${ver.dir}"/>
1052
      <copy todir="${ver.dir}">
1053
        <fileset dir="."
1054
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1055
      </copy>
1056
      <copy todir="${ver.dir}" file="build.xml"/>
1057
      <copy todir="${ver.dir}" file="build.properties"/>
1058

    
1059
      <copy todir="${ver.dir}/docs" filtering="yes">
1060
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1061
      </copy>
1062
      <copy todir="${ver.dir}/docs" filtering="no">
1063
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1064
      </copy>
1065
      <copy todir="${ver.dir}/docs/dev">
1066
        <fileset dir="${build.dir}/docs"/>
1067
      </copy>
1068
      <copy todir="${ver.dir}/src">
1069
        <fileset dir="${build.dir}/src"/>
1070
      </copy>
1071
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1072
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/ -->
1073
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/ -->
1074
      <!--
1075
      <delete dir="./${ver.dir}/${build.dir}"/>
1076
      <delete dir="./${ver.dir}/dist"/>
1077
      -->
1078
      <delete file="./${name}-${release}.zip"/>
1079
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1080
      <delete file="./${name}-${release}.tar.gz" />
1081
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1082
      <gzip zipfile="./${name}-${release}.tar.gz"
1083
                src="./${name}-${release}.tar"/>
1084
      <delete file="./${name}-${release}.tar" />
1085
  </target>
1086

    
1087
  <target name="distsrc" depends="dist"
1088
            description="prepares a source distribution">
1089
      <mkdir dir="${ver.src}"/>
1090
      <copy todir="${ver.src}">
1091
        <fileset dir="./src"/>
1092
      </copy>
1093
      <mkdir dir="${util.dir}"/>
1094
      <copy todir="${util.dir}">
1095
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1096
      </copy>
1097
  	  
1098
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1099
  	  <copy todir="${ecogrid-dist-dir}">
1100
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1101
  	  </copy>
1102

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

    
1105
      <delete file="./${name}-src-${release}.zip"/>
1106
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1107
      <delete file="./${name}-src-${release}.tar.gz" />
1108
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1109
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1110
                src="./${name}-src-${release}.tar"/>
1111
      <delete file="./${name}-src-${release}.tar" />
1112
      <delete dir="${dist.dir}"/> 
1113
  </target>
1114

    
1115
   <target name="stylesheettest">
1116
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1117
      <param name="displaymodule" expression="${displaymodule}"/>
1118
      <param name="docid" expression="${input}"/>
1119
      <param name="entitytype" expression="${entitytype}"/>
1120
      <param name="entityindex" expression="${entityindex}"/>
1121
      <outputproperty name="method" value="html"/>
1122
      <outputproperty name="standalone" value="yes"/>
1123
      <outputproperty name="encoding" value="iso8859_1"/>
1124
      <outputproperty name="indent" value="yes"/>
1125
    </xslt>
1126
  </target>
1127

    
1128
 
1129
  <target name="compilewebclient" depends="prepare">
1130
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1131
  </target>
1132

    
1133
  <target name="runwebclient" depends="compilewebclient">
1134
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1135
           dir="${build.dest}" fork="yes"
1136
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1137
         <arg value="${serviceUrl}"/>
1138
         <arg value="${docid}"/>
1139
     </java>
1140
  </target>
1141
  
1142
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1143

    
1144
    <echo message="Compiling the metatcat shapefile creator"/>
1145
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1146
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1147
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1148
    </exec>
1149
  
1150
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1151
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1152
    </exec>
1153
  </target>
1154

    
1155
    <!-- LSID Authority support -->
1156
    <patternset id="lsid.jars">
1157
        <include name="axis.jar" />
1158
        <include name="commons-discovery-0.2.jar" />
1159
        <include name="jaxrpc.jar" />
1160
        <include name="lsid-client-1.1.1.jar" />
1161
        <include name="lsid-server-1.1.1.jar" />
1162
        <include name="saaj.jar" />
1163
        <include name="wsdl4j-1.5.1.jar" />
1164
        <include name="activation.jar" />
1165
        <include name="castor-0.9.5.jar" />
1166
        <include name="dnsjava-1.3.2.jar" />
1167
        <include name="mail.jar" />
1168
        <include name="commons-logging-1.0.4.jar" />
1169
        <!-- These jars may be needed but seem to not actually be,
1170
             so leaving them out for now
1171
        <include name="axis-ant.jar" />
1172
        -->
1173
        <!--<include name="GenCastor.class" />-->
1174
    </patternset>
1175
    <patternset id="lib.jars">
1176
        <include name="httpclient.jar" />
1177
        <include name="log4j-1.2.12.jar" />
1178
        <include name="utilities.jar" />
1179
        <include name="xercesImpl.jar" />
1180
        <include name="xalan.jar" />
1181
        <include name="xml-apis.jar" />
1182
    </patternset>
1183

    
1184
    <path id="lsid.classpath">
1185
        <fileset dir="${lsid.lib.dir}">
1186
            <patternset refid="lsid.jars"/>
1187
        </fileset>
1188
        <fileset dir="${lib.dir}">
1189
            <patternset refid="lsid.jars"/>
1190
        </fileset>
1191
        <fileset dir="${lib.dir}">
1192
            <include name="xalan.jar" />
1193
            <include name="xml-apis.jar" />
1194
        </fileset>
1195
        <fileset dir="${build.dir}">
1196
            <include name="metacat-client.jar" />
1197
        </fileset>
1198
    </path>
1199

    
1200
    <filterset id="configFilters">
1201
        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1202
                value="${config.hostname}" / -->
1203
        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1204
                value="${config.port}" / -->
1205
        <!-- MCD BYE filter token="METADATA_LABELS"
1206
                value="${config.metadataLabelLsid}" / -->
1207
        <!-- MCD BYE filter token="METACAT_SERVER"
1208
                value="${config.metacatserver}" / -->
1209
        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1210
                value="${config.lsidauthority}" / -->
1211
    </filterset>
1212
    
1213
    <target name="prepare-lsid"
1214
            depends="prepare,utilities,clientjar"
1215
            description="Configure files prior to compilation">
1216
        <mkdir dir="${lsid.build.dir}" />
1217
        <!-- Copy the properties file into the build -->
1218
        <copy file="${conf.dir}/metacat-lsid.properties"
1219
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1220
              overwrite="true">
1221
            <filterset refid="configFilters" />
1222
        </copy>
1223
        <copy file="${conf.dir}/log4j.properties"
1224
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1225
              overwrite="true">
1226
            <filterset refid="configFilters" />
1227
        </copy>
1228
        <!-- Copy config files into the build -->
1229
        <copy todir="${lsid.build.dir}/WEB-INF">
1230
            <fileset dir="${webinf.dir}"
1231
                     includes="**/*.wsdd" />
1232
        </copy>
1233
        <!-- Copy the metadata configuration files into the build -->
1234
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1235
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1236
            <fileset dir="${conf.dir}"
1237
                     includes="**/*.xml" />
1238
            <fileset dir="${conf.dir}"
1239
                     includes="**/*.xslt" />
1240
            <filterset refid="configFilters" />
1241
        </copy>
1242
        <!-- Copy services files into the build -->
1243
        <mkdir dir="${lsid.build.dir}/services" />
1244
        <copy todir="${lsid.build.dir}/services">
1245
            <fileset dir="${services.dir}" />
1246
            <filterset refid="configFilters" />
1247
        </copy>
1248
        <!-- Copy axis files into the build -->
1249
        <mkdir dir="${lsid.build.dir}" />
1250
        <copy todir="${lsid.build.dir}">
1251
            <fileset dir="${conf.dir}/axis"
1252
                     excludes="*.properties"/>
1253
        </copy>
1254
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1255
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1256
            <fileset dir="${conf.dir}/axis"
1257
                     includes="*.properties"/>
1258
        </copy>
1259
    </target>
1260
    
1261
    <target name="compile-lsid"
1262
            depends="prepare-lsid"
1263
            description="Compile Java sources">
1264
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1265
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1266
               destdir="${lsid.build.dir}/WEB-INF/classes"
1267
               debug="${compile.debug}"
1268
               deprecation="${compile.deprecation}"
1269
               optimize="${compile.optimize}">
1270
            <classpath refid="lsid.classpath" />
1271
        </javac>
1272
    </target>
1273
    
1274
    <target name="war-lsid"
1275
            depends="compile-lsid"
1276
            description="Create a war file for the application">
1277
        <mkdir dir="${dist.dir}" />
1278
        <war destfile="${dist.dir}/${authority.context}.war"
1279
             webxml="${webinf.dir}/web.xml">
1280
            <fileset dir="${lsid.build.dir}" />
1281
            <lib dir="${lsid.lib.dir}">
1282
                <patternset refid="lsid.jars"/>
1283
            </lib>
1284
            <lib dir="${lib.dir}">
1285
                <patternset refid="lib.jars"/>
1286
            </lib>
1287
            <lib dir="${lib.dir}">
1288
                <include name="xalan.jar" />
1289
                <include name="xml-apis.jar" />
1290
            </lib>
1291
            <lib dir="${build.dir}">
1292
                <include name="metacat-client.jar" />
1293
            </lib>
1294
        </war>
1295
    </target>
1296
    
1297
    <target name="deploy-lsid"
1298
            depends="war-lsid"
1299
            description="Deploy LSID war to servlet container">
1300
        <delete dir="${dev.deploy.dir}/${authority.context}" />
1301
        <delete file="${dev.deploy.dir}/${authority.context}.war" />
1302
        <mkdir dir="${dev.deploy.dir}" />
1303
        <copy todir="${dev.deploy.dir}">
1304
            <fileset dir="${dist.dir}" />
1305
        </copy>
1306
    </target>
1307
</project>
(5-5/5)