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: leinfelder $'
10
  *    '$Date: 2008-08-14 17:39:12 -0700 (Thu, 14 Aug 2008) $'
11
  *    '$Revision: 4250 $'
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

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

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

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

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

    
874
        <formatter type="plain" />
875

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

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

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

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

    
905
        <formatter type="plain" />
906

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

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

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

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

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

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

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

    
986
        <formatter type="plain" />
987

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

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

    
1001

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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