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-09-23 09:39:42 -0700 (Tue, 23 Sep 2008) $'
11
  *    '$Revision: 4369 $'
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_1_0-schema-tag" value="RELEASE_EML_2_1_0_RC_3" / -->
108
      <!-- property name="eml2_1_0-style-tag"  value="RELEASE_EML_2_1_0_RC_3" / -->  	
109
 	  <property name="eml2_1_0-schema-tag" value="" />
110
      <property name="eml2_1_0-style-tag"  value="" />
111
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
112
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
113
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
114
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
115
      <property name="eml-css"             value="eml_xsl.css"/>
116
      <property name="eml-module.default.css"
117
                                           value="default.css"/>
118
   	  
119
      <!-- Config for registry variables -->
120
      <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties --> 
121
      <property name="scope"               value="obfs"/>
122
      <property name="responseForm"        value="genericResponse.tmpl"/>
123
      <property name="entryForm"           value="entryForm.tmpl"/>
124
      <property name="guide"               value="genericGuide.tmpl"/>
125
      <property name="loginForm"           value="loginForm.tmpl"/>
126
      <property name="confirmData"         value="confirmData.tmpl"/>
127
      <property name="deleteData"          value="deleteData.tmpl"/>
128
      <property name="genericHeader"       value="genericHeader.tmpl"/>
129
      <property name="genericFooter"       value="genericFooter.tmpl"/>
130

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

    
144
      <filter token="docrooturl"           value="./" />
145
      <filter token="mcuser"               value="${mcuser}"/>
146
      <filter token="mcpassword"           value="${mcpassword}"/>
147
      <filter token="mcanotheruser"        value="${mcanotheruser}"/>
148
      <filter token="mcanotherpassword"    value="${mcanotherpassword}"/>
149
      <filter token="eml-css"              value="${eml-css}"/>
150
      <filter token="style-skins-relpath"  value="${style-skins-relpath}"/>
151
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
152

    
153
      <filter token="eml-version"          value="${eml-version}"/>
154
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
155
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
156
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
157
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
158
      <!-- MCD BYE filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" / -->
159
      <!-- MCD BYE filter filter token="debuglevel"           value="${debuglevel}" / -->
160
      <!-- MCD BYE filter token="defaultcontenttype"   value="${defaultcontenttype}" / -->
161
      <filter token="debugprefix"          value="${debugprefix}"/>
162
      <filter token="indexPaths"           value="${indexPaths}"/>
163

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

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

    
244
   </target>
245

    
246
   <target name="prepare" depends="init">
247
      <mkdir dir="${build.dir}"/>
248
      <mkdir dir="${build.src}"/>
249
      <mkdir dir="${build.dest}"/>
250
      <mkdir dir="${build.javadocs}"/>
251
      <mkdir dir="${build.tmp}"/>
252

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

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

    
270
       <javac srcdir="${build.src}"
271
              destdir="${build.dest}"
272
              debug="${debug}"
273
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
274
        <classpath>
275
          <path refid="compile.classpath"/>
276
        </classpath>
277
      </javac>
278
   </target>
279

    
280
   <target name="jar" depends="compile,geteml"
281
    description="Compiles and jars metacat java code to metacat.jar in build dir">
282

    
283
       <delete file="${build.dir}/${name}.jar" />
284
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
285
            excludes="**/protocols/ **/harvesterClient/" />
286
   </target>
287

    
288
   <target name="protocol" depends="compile"
289
    description="Compiles and jars protocol java code to protocol.jar in build dir">
290
       <delete file="${build.dir}/protocol.jar" />
291
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
292
            includes="**/protocols/" />
293
   </target>
294

    
295
   <target name="utilities" depends="config" if="utilities.required">
296
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
297
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
298
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
299
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
300
   </target>
301

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

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

    
321
   <target name="clientjar" depends="client"
322
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
323
       <delete file="${build.dir}/${name}-client.jar" />
324
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
325
            includes="**/metacat/client/" />
326
   </target>
327

    
328
    <target name="advancedsearchjar" depends="compile"
329
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
330
        <delete file="${build.dir}/advancedsearch.jar" />
331
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
332
             includes="**/metacat/advancedsearch/" />
333
    </target>
334

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

    
346
   <target name="harvesterjar" depends="harvester"
347
           description="Compiles and jars harvester java code to harvester.jar in build dir">
348
       <delete file="${build.dir}/harvester.jar" />
349
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
350
            includes="**/metacat/harvesterClient/" />
351
   </target>
352

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

    
372
   <target  name="geteml" depends="getemlpre2,geteml2+,getConversionXSL" if="eml.required"
373
            description="Calls getemlpre2 and geteml2+ targets" />
374

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

    
390
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
391
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
392
       <include name="**/*.xsl"/>
393
     </fileset>
394
     </copy>
395
   </target>
396

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

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

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

    
416
     </copy>
417
     <!-- <antcall target="copyxsl">
418
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
419
        <param name="dirname" value="eml-2.0.0" />
420
     </antcall> -->
421
   	
422
   	<!-- Checkout eml201 for given schema tag-->
423
     <echo>Enter CVS password: </echo>
424
     <cvs cvsRoot="${cvsroot}"
425
          package="${eml-module}"
426
          tag="${eml2_0_1-schema-tag}"
427
          dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
428
     <mkdir dir="lib/schema/eml-2.0.1" />
429
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
430
       <fileset dir="${build.tmp}/eml_${eml2_0_1-schema-tag}/${eml-module}">
431
         <include name="*.xsd"/>
432
       </fileset>
433
     </copy>
434
   	
435
   	<!-- Checkout eml201 again for given style sheet tag-->
436
   	<echo>Enter CVS password: </echo>
437
   	     <cvs cvsRoot="${cvsroot}"
438
   	          package="${eml-module}"
439
   	          tag="${eml2_0_1-style-tag}"
440
   	          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
441
     <antcall target="copyxsl">
442
        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
443
        <param name="dirname" value="eml-2.0.1" />
444
     </antcall>
445
	
446
   	<!-- Checkout eml210 for given schema tag-->
447
     <echo>Enter CVS password: </echo>
448
     <cvs cvsRoot="${cvsroot}"
449
          package="${eml-module}"
450
          tag="${eml2_1_0-schema-tag}"
451
          dest="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
452
     <mkdir dir="lib/schema/eml-2.1.0" />
453
     <copy todir="lib/schema/eml-2.1.0" filtering="yes">
454
       <fileset dir="${build.tmp}/eml_${eml2_1_0-schema-tag}/${eml-module}">
455
         <include name="*.xsd"/>
456
       </fileset>
457
     </copy>
458
	
459
   	<!-- Checkout eml210 for given style sheet tag-->
460
   	<echo>Enter CVS password: </echo>
461
   	     <cvs cvsRoot="${cvsroot}"
462
   	          package="${eml-module}"
463
   	          tag="${eml2_1_0-style-tag}"
464
   	          dest="${build.tmp}/eml_${eml2_1_0-style-tag}" />
465
     <antcall target="copyxsl">
466
        <param name="cvs.tagname" value="${eml2_1_0-style-tag}" />
467
        <param name="dirname" value="eml-2.1.0" />
468
     </antcall>
469
   </target>
470

    
471
   <target  name="copyxsl"
472
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
473

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

    
476
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
477
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
478
       <include name="**/*.xsl"/>
479
     </fileset>
480
     </copy>
481

    
482

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

    
488
   </target>
489
	
490
   <target name="correctEML201Docs" depends="jar"
491
		            description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
492
	   	<copy todir="${build.dir}" file="lib/metacat.properties" filtering="yes"/>    
493
	   	 <java classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector" >
494
		         <classpath>
495
		          <path refid="compile.classpath"/>
496
		          <fileset dir="${build.dir}">
497
		            <include name="${name}.jar"/>
498
		          </fileset>
499
		        </classpath>
500
		      </java>
501
   </target>
502

    
503
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
504
           description="Installs spatial option for metacat">
505

    
506
      <property name="spatial.dir" value="./lib/spatial"/>
507
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
508
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
509

    
510
      <!-- Copy geoserver libs into ${war.lib} -->
511
      <copy todir="${war.lib}" filtering="no">
512
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
513
          <include name="**"/>
514
        </fileset>
515
      </copy>
516

    
517
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
518
      <copy todir="${war.webinf}" filtering="no">
519
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
520
          <exclude name="lib/**"/>
521
          <exclude name="web.xml"/>
522
        </fileset>
523
      </copy>
524

    
525
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
526
      <copy todir="${war.context}" filtering="no">
527
        <fileset dir="${spatial.geoserver.dir}">
528
          <exclude name="WEB-INF/**"/>
529
          <exclude name="index.jsp"/>
530
        </fileset>
531
      </copy>
532

    
533
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
534
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
535
          tofile="${war.context}/geoserver.jsp"
536
          overwrite="true"
537
          filtering="no"/>
538

    
539
      <!-- Copy the rest of the modified geoserver web-inf files
540
      <copy todir="${war.webinf}" filtering="no">
541
        <fileset dir="${spatial.webinf-mods}">
542
          <exclude name="web.xml.combined"/>
543
        </fileset>
544
      </copy> -->
545

    
546
    </target>
547

    
548
   <target name="dev-install" depends="clean, install-ecogrid" description="* Full Install For Development *">
549
     <copy file="${dist.dir}/${metacat.context}.war" todir="${dev.deploy.dir}"/>
550
   	 <delete dir="${dev.deploy.dir}/${metacat.context}" />
551
   	   <tstamp>
552
   	   	 <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa"/>
553
   	   </tstamp>
554
   	 <echo>Dev install completed at ${NOW}</echo> 	   	
555
   </target>
556

    
557
<!--
558
   <target name="install" depends="install-ecogrid" description="* Full Install *">
559
       <mkdir dir="${datafilepath}" />
560
       <mkdir dir="${inlinedatafilepath}" />
561
       <chmod dir="${datafilepath}" perm="ug+w" />
562
       <mkdir dir="${temp-dir}"/>
563
       <chmod dir="${temp-dir}" perm="ug+w" />
564
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
565
   	   <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
566
   </target>
567
-->
568
	
569
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
570
			    description="Install Ecogrid Compentent">
571
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
572
   	         <property name="context" value="${metacat.context}"/>
573
   	   	     <property name="target" value="${ecogrid-target-name}"/>
574
   	   	     <property name="metacat.dir" value="${metacat.dir}"/>
575
   	  </ant>
576
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
577
   	     <property name="context" value="${metacat.context}"/>
578
   	     <property name="target" value="${ecogrid-target-name}"/>
579
   	     <property name="metacat.dir" value="${metacat.dir}"/>
580
   	  </ant>
581
   	  <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
582
  	      <webinf dir="${ecogrid-dir}/lib">
583
   	        <include name="server-config.wsdd"/>
584
   	      </webinf>
585
   	  </war>
586
   	  <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
587
   	  
588
   
589
   </target>
590
   
591
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
592
	<echo>Enter CVS password: </echo>
593
	     <cvs cvsRoot="${cvsroot}"
594
	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
595
   </target>  
596
	
597
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
598
   	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
599
   	   	 <property name="context" value="${metacat.context}"/>
600
   	   	 <property name="target" value="${ecogrid-target-name}"/>
601
   	     <property name="metacat.dir" value="${metacat.dir}"/>
602
   	     <property name="hostname" value="localhost"/>
603
   	     <property name="port" value="${config.port}"/>
604
   	 </ant>
605
   </target>
606
	
607
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
608
      <delete file="${dev.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
609
   </target>
610

    
611
   <!-- target name="install-registry" depends="init,getConversionXSL"
612
            description="Install Registry">
613

    
614
      <mkdir dir="${inst.cgi.dir}" />
615
      <copy file="${srcdir}/perl/register-dataset.cgi"
616
            todir="${inst.cgi.dir}"/>
617
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
618

    
619
      <! - - TODO SCW: set the permissions on this folder to be writable by the apache user - - >
620
      <mkdir dir="${temp-dir}" />
621
      <! - - TODO SCW: use relative paths to grab these instead of copying to tmp,
622
                     used in readDocumentFromMetacat - - >
623
      <copy todir="${temp-dir}" filtering="yes">
624
       <fileset dir="lib/style/common/emlb6toeml2">
625
         <include name="*.xsl"/>
626
         <include name="*.xml"/>
627
       </fileset>
628
      </copy>
629

    
630
      <echo message="Install Registry completed." />
631
   </target -->
632

    
633
   <!-- target name="install-ldap" depends="init"
634
            description="Install Metacat LDAP Access">
635

    
636
      <mkdir dir="${inst.cgi.dir}" />
637
      <copy file="${srcdir}/perl/ldapweb.cgi"
638
            todir="${inst.cgi.dir}" />
639
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
640
      <mkdir dir="${templates.dir}" />
641
      <copy todir="${templates.dir}">
642
        <fileset dir="lib/style/common/templates">
643
			< ! - - SCW: Copy all files - - >
644
        </fileset>
645
      </copy>
646
      <echo message="ldapweb install complete." />
647
   </target -->
648

    
649

    
650
   <target name="install-skin" depends="init"
651
            description="Install a Skin">
652

    
653
      <input message="Please enter name of the skin"
654
             addproperty="skin-name"/>
655

    
656
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
657
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
658
       <fileset dir="lib/style/skins/${skin-name}">
659
           <exclude name="**/*.png"/>
660
           <exclude name="**/*.gif"/>
661
           <exclude name="**/*.jpg"/>
662
           <exclude name="**/CVS*"/>
663
           <exclude name="**/.#*"/>
664
       </fileset>
665
      </copy>
666
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
667
       <fileset dir="lib/style/skins/${skin-name}">
668
           <include name="**/*.png"/>
669
           <include name="**/*.gif"/>
670
           <include name="**/*.jpg"/>
671
           <exclude name="**/CVS*"/>
672
           <exclude name="**/.#*"/>
673
       </fileset>
674
      </copy>
675
      <copy todir="${installdir}/style/common" filtering="yes">
676
       <fileset dir="lib/style/common">
677
           <include name="*.js"/>
678
           <include name="*.jsp"/>
679
           <include name="*.css"/>
680
           <exclude name="*.png"/>
681
           <exclude name="*.gif"/>
682
           <exclude name="*.jpg"/>
683
           <exclude name="**/CVS*"/>
684
           <exclude name="**/.#*"/>
685
       </fileset>
686
      </copy>
687
      <!--
688
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
689
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
690
       <fileset dir="lib/style/skins/${skin-name}/images">
691
           <include name="*.png"/>
692
           <include name="*.gif"/>
693
           <include name="*.jpg"/>
694
       </fileset>
695
      </copy>
696
      -->
697

    
698
      <echo message="Install Skin completed." />
699
   </target>
700

    
701
   <target name="war" depends="warPrepare,install-spatial"
702
            description="Create a web archive (WAR) for servlet deployment">
703
       <mkdir dir="${dist.dir}" />
704
       <war destfile="${dist.dir}/${metacat.context}.war"
705
            webxml="${build.war}/web.xml">
706
         <fileset dir="${war.context}"/>
707
         <lib dir="${war.lib}"/>
708
         <webinf dir="${war.webinf}"/>
709
       </war>
710
   </target>
711
	
712
   <target name="warPrepare" depends="cgiPrepare,jar,clientjar,harvesterjar"
713
            description="Prepare files for creating a web archive (WAR)">
714

    
715
       <property name="war.lib" value="${build.war}/lib" />
716
       <property name="war.webinf" value="${build.war}/WEB-INF" />
717
       <property name="war.context" value="${build.war}/${metacat.context}" />
718
   	   <property name="war.webinf.sql" value="${war.webinf}/sql" />
719
	   <property name="war.context.cgi" value="${war.context}/cgi-bin" />
720
   	   <property name="war.context.docs" value="${war.context}/docs" />
721
   	   <property name="war.context.temp" value="${war.context}/temp" />
722
   	   <property name="war.context.templates" value="${war.context}${style-common-relpath}/templates" />
723
       <mkdir dir="${war.lib}" />
724
       <mkdir dir="${war.webinf}" />
725
       <mkdir dir="${war.context}" />
726
   	   <mkdir dir="${war.webinf.sql}" />
727
	   <mkdir dir="${war.context.cgi}" />
728
   	   <mkdir dir="${war.context.docs}" />
729
   	   <mkdir dir="${war.context.temp}" />
730
       <mkdir dir="${war.context.templates}" />
731
       
732
   	   <!--copy file="${lib.dir}/${jdbc.lib.oracle}" todir="${war.lib}" / -->
733
	   <!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
734
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
735
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
736
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
737
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
738
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
739
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
740
       <copy todir="${war.lib}" filtering="no">
741
         <fileset dir="lib">
742
<!--
743
         	<not>
744
               <filename name="${jdbc-jar-name}"/>
745
            </not>
746
-->
747
            <include name="*.jar"/>
748
         </fileset>
749
         <fileset dir="lib">
750
           <include name="xalan.jar"/>
751
           <include name="gwt*.jar"/>
752
         </fileset>
753
       </copy>
754
       <!-- MCD copy file="lib/web.xml.${tomcatversion}"
755
             tofile="${build.war}/web.xml" / -->
756
       <!-- MCD added next - Remove the tomcat5 reference-->
757
   	   <copy file="lib/web.xml.tomcat5"
758
   	             tofile="${build.war}/web.xml"/>
759
       <copy file="lib/metacat.properties" todir="${war.webinf}"
760
             filtering="yes" />
761
   	   <copy file="lib/metacat.properties.metadata.xml" todir="${war.webinf}"
762
   	             filtering="no" />
763
	   <copy file="lib/org.properties.metadata.xml" todir="${war.webinf}"
764
	             filtering="no" />
765
	   <copy file="lib/ldap.properties.metadata.xml" todir="${war.webinf}"
766
	             filtering="no" />
767
       <copy todir="${war.webinf}" filtering="yes">
768
	   	  <fileset dir="lib">
769
           <include name="skin.configs/**"/>
770
		  </fileset>
771
	   </copy>
772
       <copy file="lib/log4j.properties" todir="${war.webinf}"
773
             filtering="yes" />
774
       <copy todir="${war.context}" filtering="no">
775
         <fileset dir="lib">
776
           <include name="**/*.jpg"/>
777
           <include name="**/*.png"/>
778
           <include name="**/*.gif"/>
779
           <include name="LiveMap_30/**"/>
780
         </fileset>
781
       </copy>
782
       <copy todir="${war.context}" filtering="yes">
783
         <fileset dir="lib">
784
           <exclude name="*.jar"/>
785
           <exclude name="*.properties"/>
786
         	<exclude name="*.metadata.xml"/>
787
           <exclude name="web.xml"/>
788
           <exclude name="**/*.jpg"/>
789
           <exclude name="**/*.png"/>
790
           <exclude name="**/*.gif"/>
791
           <exclude name="lsid_lib/**"/>
792
           <exclude name="lsid_conf/**"/>
793
           <exclude name="LiveMap_30/**"/>
794
           <exclude name="skin.configs/**"/>
795
           <exclude name="spatial/geoserver/**"/>
796
           <exclude name="spatial/WEB-INF/**"/>
797
         </fileset>
798
       </copy>
799
       <copy todir="${war.context.docs}" filtering="yes">
800
          <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
801
       </copy>
802
       <copy todir="${war.context.docs}" filtering="no">
803
          <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
804
       </copy>
805
	   <copy todir="${war.webinf.sql}" filtering="yes">
806
	         <fileset dir="src">
807
	           <include name="**/*.sql"/>
808
	         </fileset>
809
	   </copy>
810
   	
811
   	   <copy file="src/perl/register-dataset.cgi" todir="${war.context.cgi}"/>
812
	   <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
813
	   <copy file="src/perl/Metacat/blib/lib/Metacat.pm" todir="${war.lib}" />
814
   	
815
	   <!-- registry cgi section -->
816
	   <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
817
                   used in readDocumentFromMetacat -->
818
	   <!-- TODO MCD copy temp files to actual location using config util?? -->
819
	   <copy todir="${war.context.temp}" filtering="yes">
820
		  <fileset dir="lib/style/common/emlb6toeml2">
821
 		    <include name="*.xsl"/>
822
			<include name="*.xml"/>
823
		  </fileset>
824
	    </copy>
825
	    <available file="lib/style/common/emlb6toeml2" type="dir"
826
                 property="styles.not.needed"/>
827
	
828
	    <!-- ldap cgi section -->
829
	    <copy todir="${war.context.templates}">
830
		    <fileset dir="lib/style/common/templates">
831
			    <!-- SCW: Copy all files -->
832
		    </fileset>
833
	    </copy>
834
    </target>
835
	
836
	<target name="cgiPrepare">		
837
		<exec dir="src/perl/Metacat/" command="perl" >
838
			<arg value="Makefile.PL" />
839
		</exec>
840
		<exec dir="src/perl/Metacat/" command="make" />
841
	</target>
842

    
843
   <target name="getConversionXSL" depends="prepare"
844
            unless="styles.not.needed"
845
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
846

    
847
     <echo>Enter CVS password: </echo>
848
     <cvs cvsRoot="${cvsroot}"
849
          package="${eml-module}"
850
          tag="${eml2_0_1-style-tag}"
851
          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
852

    
853
     <mkdir dir="lib/style/common/emlb6toeml2" />
854
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
855
       <fileset dir="${build.tmp}/eml_${eml2_0_1-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
856
         <include name="*.xsl"/>
857
         <include name="*.xml"/>
858
       </fileset>
859
      </copy>
860
   </target>
861

    
862
   <target name="testprep" depends="jar,clientjar,harvesterjar">
863
      <mkdir dir="${build.tests}"/>
864
      <copy todir="${build.tests}" filtering="yes">
865
        <fileset dir="${testdir}">
866
          <include name="edu/**"/>
867
        </fileset>
868
      </copy>
869
   	  <copy todir="${build.tests}" file="lib/metacat.properties" filtering="yes"/>
870
   	  <copy todir="${build.tests}" file="lib/metacat.properties.metadata.xml" filtering="yes"/>
871
   	  <copy todir="${build.tests}" file="lib/org.properties.metadata.xml" filtering="yes"/>
872
 	  <copy todir="${build.tests}" file="lib/ldap.properties.metadata.xml" filtering="yes"/>
873

    
874
      <!-- copy and compile the tests into a jar file -->
875
      <javac srcdir="${build.tests}"
876
             destdir="${build.tests}"
877
             debug="on"
878
             includes="**/*.java">
879
        <classpath>
880
          <path refid="compile.classpath"/>
881
          <fileset dir="${build.dir}">
882
            <include name="${name}.jar"/>
883
            <include name="${name}-client.jar"/>
884
            <include name="harvester.jar"/>
885
          </fileset>
886
        </classpath>
887
      </javac>
888

    
889
      <jar jarfile="${build.dir}/${name}-junittests.jar"
890
        basedir="${build.tests}"
891
                includes="**/*.class" />
892
   </target>
893

    
894
   <target name="test" depends="testprep"
895
            description="Uses the ant junit task to run all JUnit tests">
896

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

    
911
        <formatter type="plain" />
912

    
913
        <batchtest fork="yes" todir="${build.dir}">
914
          <fileset dir="${build.tests}">
915
            <include name="**/*.class"/>
916
          	<exclude name="**/MCTestCase.class" />
917
          	<exclude name="**/ClientViewHelperTest.class" />
918
          </fileset>
919
        </batchtest>
920
     </junit>
921
   </target>
922

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

    
926
              <echo>testtorun: ${testtorun}</echo>
927

    
928
      <!-- use the ant "junit" task to run JUnit tests. -->
929
      <junit printsummary="yes" haltonfailure="no" fork="yes"
930
             haltonerror="no" showoutput="yes">
931
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
932
        <classpath>
933
          <path refid="compile.classpath"/>
934
          <fileset dir="${build.dir}">
935
            <include name="${name}.jar"/>
936
            <include name="${name}-client.jar"/>
937
            <include name="harvester.jar"/>
938
            <include name="${name}-junittests.jar"/>
939
          </fileset>
940
        </classpath>
941

    
942
        <formatter type="plain" />
943

    
944
        <batchtest fork="yes" todir="${build.dir}">
945
          <fileset dir="${build.tests}">
946
            <include name="**/${testtorun}.class" />
947
          </fileset>
948
        </batchtest>
949
     </junit>
950
   </target>
951

    
952
   <target name="testharvester"
953
           depends="testprep"
954
           description="Uses the ant junit task to test only the Harvester code">
955
     <junit printsummary="yes"
956
            haltonfailure="off"
957
            fork="yes"
958
            haltonerror="off">
959
        <classpath>
960
          <path refid="compile.classpath"/>
961
          <fileset dir="${build.dir}">
962
            <include name="${name}.jar"/>
963
            <include name="${name}-client.jar"/>
964
            <include name="harvester.jar"/>
965
            <include name="${name}-junittests.jar"/>
966
          </fileset>
967
        </classpath>
968
       <formatter type="plain" />
969
       <batchtest fork="yes" todir="${build.dir}">
970
         <fileset dir="${build.tests}">
971
           <include name="**/harvesterClient/*.class" />
972
         </fileset>
973
       </batchtest>
974
     </junit>
975
   </target>
976

    
977
  <target name="gethttpclient" depends="prepare"
978
            description="checks out and compiles morpho httpclient code">
979
  <!--mkdir dir="${morphosourcedir}" -->
980
        <cvs cvsRoot="${cvsroot}"
981
             package="morpho"
982
             dest="." />
983
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
984
   </target>
985

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

    
990
      <echo>***********************************
991
      Please run ant gethttpclient first!
992
      ***********************************
993
      </echo>
994
      <!-- copy and compile the tests into a jar file -->
995
      <mkdir dir="${build.metacatnettest}"/>
996
      <javac srcdir="${junitnettestsdir}"
997
             destdir="${build.metacatnettest}"
998
             includes="**/*.java">
999
        <classpath>
1000
          <path refid="compile.classpath"/>
1001
          <fileset dir="${build.dir}">
1002
            <include name="${name}.jar"/>
1003
          </fileset>
1004
        </classpath>
1005
      </javac>
1006

    
1007
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1008
                    basedir="${build.metacatnettest}"
1009
                    includes="**/*.class" />
1010

    
1011
      <!-- use the ant "junit" task to run JUnit tests. -->
1012
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1013
             haltonerror="no">
1014
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1015
        <classpath>
1016
          <path refid="compile.classpath"/>
1017
          <fileset dir="${build.dir}">
1018
            <include name="${name}.jar"/>
1019
            <include name="${name}-junitnettests.jar"/>
1020
          </fileset>
1021
        </classpath>
1022

    
1023
        <formatter type="plain" />
1024

    
1025
        <batchtest fork="yes" todir="${build.dir}">
1026
          <fileset dir="${build.metacatnettest}">
1027
            <include name="**/*.class" />
1028
          </fileset>
1029
        </batchtest>
1030
     </junit>
1031
   </target>
1032

    
1033
   <target name="cleanweb" depends="clean"
1034
            description="deletes tomcat web context dir and all its contents">
1035
     <delete dir="${installdir}" />
1036
   </target>
1037

    
1038

    
1039
   <target name="clean" depends="init"
1040
            description="deletes build dir and files that can be regenerated form the release">
1041
       <delete dir="${build.dir}" />
1042
       <delete dir="${dist.dir}" />
1043
   </target>
1044

    
1045
	<target name="localclean" depends="clean"
1046
	            description="deletes even jars that depend on external sources such as stylesheets and jars">
1047
	       <delete file="lib/httpclient.jar" />
1048
	       <delete file="lib/utilities.jar" />
1049
	</target>	
1050
	
1051
   <target name="fullclean" depends="localclean"
1052
            description="deletes code and eml">
1053
       <delete includeEmptyDirs="true" failonerror="false">
1054
         <fileset dir="${style-common-cvsrelpath}">
1055
           <include name="${eml-css}" />
1056
           <include name="eml-*/*.xsl" />
1057
           <include name="eml-*" />
1058
         </fileset>
1059
       	 <fileset dir="${schema-cvsrelpath}">
1060
       	   <include name="eml-*/*.xsd" />
1061
       	 </fileset>
1062
       	 <fileset dir="${ecogrid-dir}">
1063
       		<include name="build.properties" />
1064
       		<include name="buildfiles/metacatImpl.xml" />
1065
         </fileset>
1066
       </delete>
1067
   </target>
1068

    
1069
   <target name="jdoc" depends="prepare"
1070
            description="generates javadoc documentation">
1071
       <javadoc packagenames="edu.ucsb.nceas.*"
1072
           sourcepath="${build.src}"
1073
           destdir="${build.javadocs}"
1074
           author="true"
1075
           version="true"
1076
           use="true"
1077
           windowtitle="${Name} API"
1078
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1079
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1080
         <classpath>
1081
           <path refid="compile.classpath"/>
1082
         </classpath>
1083
       </javadoc>
1084
   </target>
1085

    
1086
   <target name="dist"
1087
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1088
            description="prepares a full release distribution">
1089
      <mkdir dir="${dist.dir}"/>
1090
      <delete dir="${ver.dir}" />
1091
      <mkdir dir="${ver.dir}"/>
1092
      <copy todir="${ver.dir}">
1093
        <fileset dir="."
1094
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1095
      </copy>
1096
      <copy todir="${ver.dir}" file="build.xml"/>
1097
      <copy todir="${ver.dir}" file="build.properties"/>
1098

    
1099
      <copy todir="${ver.dir}/docs" filtering="yes">
1100
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1101
      </copy>
1102
      <copy todir="${ver.dir}/docs" filtering="no">
1103
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1104
      </copy>
1105
      <copy todir="${ver.dir}/docs/dev">
1106
        <fileset dir="${build.dir}/docs"/>
1107
      </copy>
1108
      <copy todir="${ver.dir}/src">
1109
        <fileset dir="${build.dir}/src"/>
1110
      </copy>
1111
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1112
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/ -->
1113
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/ -->
1114
      <!--
1115
      <delete dir="./${ver.dir}/${build.dir}"/>
1116
      <delete dir="./${ver.dir}/dist"/>
1117
      -->
1118
      <delete file="./${name}-${release}.zip"/>
1119
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1120
      <delete file="./${name}-${release}.tar.gz" />
1121
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1122
      <gzip zipfile="./${name}-${release}.tar.gz"
1123
                src="./${name}-${release}.tar"/>
1124
      <delete file="./${name}-${release}.tar" />
1125
  </target>
1126

    
1127
  <target name="distsrc" depends="dist"
1128
            description="prepares a source distribution">
1129
      <mkdir dir="${ver.src}"/>
1130
      <copy todir="${ver.src}">
1131
        <fileset dir="./src"/>
1132
      </copy>
1133
      <mkdir dir="${util.dir}"/>
1134
      <copy todir="${util.dir}">
1135
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1136
      </copy>
1137
  	  
1138
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1139
  	  <copy todir="${ecogrid-dist-dir}">
1140
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1141
  	  </copy>
1142

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

    
1145
      <delete file="./${name}-src-${release}.zip"/>
1146
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1147
      <delete file="./${name}-src-${release}.tar.gz" />
1148
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1149
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1150
                src="./${name}-src-${release}.tar"/>
1151
      <delete file="./${name}-src-${release}.tar" />
1152
      <delete dir="${dist.dir}"/> 
1153
  </target>
1154

    
1155
   <target name="stylesheettest">
1156
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1157
      <param name="displaymodule" expression="${displaymodule}"/>
1158
      <param name="docid" expression="${input}"/>
1159
      <param name="entitytype" expression="${entitytype}"/>
1160
      <param name="entityindex" expression="${entityindex}"/>
1161
      <outputproperty name="method" value="html"/>
1162
      <outputproperty name="standalone" value="yes"/>
1163
      <outputproperty name="encoding" value="iso8859_1"/>
1164
      <outputproperty name="indent" value="yes"/>
1165
    </xslt>
1166
  </target>
1167

    
1168
 
1169
  <target name="compilewebclient" depends="prepare">
1170
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1171
  </target>
1172

    
1173
  <target name="runwebclient" depends="compilewebclient">
1174
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1175
           dir="${build.dest}" fork="yes"
1176
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1177
         <arg value="${serviceUrl}"/>
1178
         <arg value="${docid}"/>
1179
     </java>
1180
  </target>
1181
  
1182
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1183

    
1184
    <echo message="Compiling the metatcat shapefile creator"/>
1185
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1186
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1187
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1188
    </exec>
1189
  
1190
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1191
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1192
    </exec>
1193
  </target>
1194

    
1195
    <!-- LSID Authority support -->
1196
    <patternset id="lsid.jars">
1197
        <include name="axis.jar" />
1198
        <include name="commons-discovery-0.2.jar" />
1199
        <include name="jaxrpc.jar" />
1200
        <include name="lsid-client-1.1.1.jar" />
1201
        <include name="lsid-server-1.1.1.jar" />
1202
        <include name="saaj.jar" />
1203
        <include name="wsdl4j-1.5.1.jar" />
1204
        <include name="activation.jar" />
1205
        <include name="castor-0.9.5.jar" />
1206
        <include name="dnsjava-1.3.2.jar" />
1207
        <include name="mail.jar" />
1208
        <include name="commons-logging-1.0.4.jar" />
1209
        <!-- These jars may be needed but seem to not actually be,
1210
             so leaving them out for now
1211
        <include name="axis-ant.jar" />
1212
        -->
1213
        <!--<include name="GenCastor.class" />-->
1214
    </patternset>
1215
    <patternset id="lib.jars">
1216
        <include name="httpclient.jar" />
1217
        <include name="log4j-1.2.12.jar" />
1218
        <include name="utilities.jar" />
1219
        <include name="xercesImpl.jar" />
1220
        <include name="xalan.jar" />
1221
        <include name="xml-apis.jar" />
1222
    </patternset>
1223

    
1224
    <path id="lsid.classpath">
1225
        <fileset dir="${lsid.lib.dir}">
1226
            <patternset refid="lsid.jars"/>
1227
        </fileset>
1228
        <fileset dir="${lib.dir}">
1229
            <patternset refid="lsid.jars"/>
1230
        </fileset>
1231
        <fileset dir="${lib.dir}">
1232
            <include name="xalan.jar" />
1233
            <include name="xml-apis.jar" />
1234
        </fileset>
1235
        <fileset dir="${build.dir}">
1236
            <include name="metacat-client.jar" />
1237
        </fileset>
1238
    </path>
1239

    
1240
    <filterset id="configFilters">
1241
        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1242
                value="${config.hostname}" / -->
1243
        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1244
                value="${config.port}" / -->
1245
        <!-- MCD BYE filter token="METADATA_LABELS"
1246
                value="${config.metadataLabelLsid}" / -->
1247
        <!-- MCD BYE filter token="METACAT_SERVER"
1248
                value="${config.metacatserver}" / -->
1249
        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1250
                value="${config.lsidauthority}" / -->
1251
    </filterset>
1252
    
1253
    <target name="prepare-lsid"
1254
            depends="prepare,utilities,clientjar"
1255
            description="Configure files prior to compilation">
1256
        <mkdir dir="${lsid.build.dir}" />
1257
        <!-- Copy the properties file into the build -->
1258
        <copy file="${conf.dir}/metacat-lsid.properties"
1259
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1260
              overwrite="true">
1261
            <filterset refid="configFilters" />
1262
        </copy>
1263
        <copy file="${conf.dir}/log4j.properties"
1264
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1265
              overwrite="true">
1266
            <filterset refid="configFilters" />
1267
        </copy>
1268
        <!-- Copy config files into the build -->
1269
        <copy todir="${lsid.build.dir}/WEB-INF">
1270
            <fileset dir="${webinf.dir}"
1271
                     includes="**/*.wsdd" />
1272
        </copy>
1273
        <!-- Copy the metadata configuration files into the build -->
1274
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1275
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1276
            <fileset dir="${conf.dir}"
1277
                     includes="**/*.xml" />
1278
            <fileset dir="${conf.dir}"
1279
                     includes="**/*.xslt" />
1280
            <filterset refid="configFilters" />
1281
        </copy>
1282
        <!-- Copy services files into the build -->
1283
        <mkdir dir="${lsid.build.dir}/services" />
1284
        <copy todir="${lsid.build.dir}/services">
1285
            <fileset dir="${services.dir}" />
1286
            <filterset refid="configFilters" />
1287
        </copy>
1288
        <!-- Copy axis files into the build -->
1289
        <mkdir dir="${lsid.build.dir}" />
1290
        <copy todir="${lsid.build.dir}">
1291
            <fileset dir="${conf.dir}/axis"
1292
                     excludes="*.properties"/>
1293
        </copy>
1294
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1295
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1296
            <fileset dir="${conf.dir}/axis"
1297
                     includes="*.properties"/>
1298
        </copy>
1299
    </target>
1300
    
1301
    <target name="compile-lsid"
1302
            depends="prepare-lsid"
1303
            description="Compile Java sources">
1304
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1305
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1306
               destdir="${lsid.build.dir}/WEB-INF/classes"
1307
               debug="${compile.debug}"
1308
               deprecation="${compile.deprecation}"
1309
               optimize="${compile.optimize}">
1310
            <classpath refid="lsid.classpath" />
1311
        </javac>
1312
    </target>
1313
    
1314
    <target name="war-lsid"
1315
            depends="compile-lsid"
1316
            description="Create a war file for the application">
1317
        <mkdir dir="${dist.dir}" />
1318
        <war destfile="${dist.dir}/${authority.context}.war"
1319
             webxml="${webinf.dir}/web.xml">
1320
            <fileset dir="${lsid.build.dir}" />
1321
            <lib dir="${lsid.lib.dir}">
1322
                <patternset refid="lsid.jars"/>
1323
            </lib>
1324
            <lib dir="${lib.dir}">
1325
                <patternset refid="lib.jars"/>
1326
            </lib>
1327
            <lib dir="${lib.dir}">
1328
                <include name="xalan.jar" />
1329
                <include name="xml-apis.jar" />
1330
            </lib>
1331
            <lib dir="${build.dir}">
1332
                <include name="metacat-client.jar" />
1333
            </lib>
1334
        </war>
1335
    </target>
1336
    
1337
    <target name="deploy-lsid"
1338
            depends="war-lsid"
1339
            description="Deploy LSID war to servlet container">
1340
        <delete dir="${dev.deploy.dir}/${authority.context}" />
1341
        <delete file="${dev.deploy.dir}/${authority.context}.war" />
1342
        <mkdir dir="${dev.deploy.dir}" />
1343
        <copy todir="${dev.deploy.dir}">
1344
            <fileset dir="${dist.dir}" />
1345
        </copy>
1346
    </target>
1347
</project>
(5-5/5)