Project

General

Profile

metacat / build.xml @ 4405

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

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

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

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

    
861
   <target name="testprep" depends="jar,clientjar,harvesterjar">
862
      <mkdir dir="${build.tests}"/>
863
      <copy todir="${build.tests}" filtering="yes">
864
        <fileset dir="${testdir}">
865
          <include name="edu/**"/>
866
        </fileset>
867
      </copy>
868
             <copy todir="${build.tests}" file="${testdir}/test.properties" filtering="yes"/>
869

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

    
885
      <jar jarfile="${build.dir}/${name}-junittests.jar"
886
        basedir="${build.tests}"
887
                includes="**/*.class" />
888
   </target>
889

    
890
   <target name="test" depends="testprep"
891
            description="Uses the ant junit task to run all JUnit tests">
892

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

    
907
        <formatter type="plain" />
908

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

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

    
922
              <echo>testtorun: ${testtorun}</echo>
923

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

    
938
        <formatter type="plain" />
939

    
940
        <batchtest fork="yes" todir="${build.dir}">
941
          <fileset dir="${build.tests}">
942
            <include name="**/${testtorun}.class" />
943
          </fileset>
944
        </batchtest>
945
     </junit>
946
   </target>
947

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

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

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

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

    
1003
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1004
                    basedir="${build.metacatnettest}"
1005
                    includes="**/*.class" />
1006

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

    
1019
        <formatter type="plain" />
1020

    
1021
        <batchtest fork="yes" todir="${build.dir}">
1022
          <fileset dir="${build.metacatnettest}">
1023
            <include name="**/*.class" />
1024
          </fileset>
1025
        </batchtest>
1026
     </junit>
1027
   </target>
1028

    
1029
   <target name="cleanweb" depends="clean"
1030
            description="deletes tomcat web context dir and all its contents">
1031
     <delete dir="${installdir}" />
1032
   </target>
1033

    
1034

    
1035
   <target name="clean" depends="init"
1036
            description="deletes build dir and files that can be regenerated form the release">
1037
       <delete dir="${build.dir}" />
1038
       <delete dir="${dist.dir}" />
1039
   </target>
1040

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

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

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

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

    
1123
        <target name="distbin" depends="war" description="prepares a binary distribution">
1124
                <copy todir="${dist.dir}">
1125
                        <fileset dir="./bin/install"  />
1126
                </copy>        
1127
                <delete file="./${name}-bin-${release}.zip" />
1128
                <zip zipfile="./${name}-bin-${release}.zip" 
1129
                        basedir="${dist.dir}"
1130
                        excludes="metacat-*/**"/>        
1131
                <delete file="./${name}-bin-${release}.tar.gz" />
1132
                <tar tarfile="./${name}-bin-${release}.tar" 
1133
                        basedir="${dist.dir}" 
1134
                        excludes="metacat-*/**"/>
1135
                <gzip zipfile="./${name}-bin-${release}.tar.gz" src="./${name}-bin-${release}.tar" />
1136
                <delete file="./${name}-bin-${release}.tar" />
1137
                <delete dir="${dist.dir}" />
1138
        </target>
1139
        
1140
  <target name="distsrc" depends="dist"
1141
            description="prepares a source distribution">
1142
      <mkdir dir="${ver.src}"/>
1143
      <copy todir="${ver.src}">
1144
        <fileset dir="./src"/>
1145
      </copy>
1146
      <mkdir dir="${util.dir}"/>
1147
      <copy todir="${util.dir}">
1148
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1149
      </copy>
1150
            
1151
            <mkdir dir="${ecogrid-dist-dir}"/>
1152
            <copy todir="${ecogrid-dist-dir}">
1153
                  <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1154
            </copy>
1155

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

    
1158
      <delete file="./${name}-src-${release}.zip"/>
1159
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1160
      <delete file="./${name}-src-${release}.tar.gz" />
1161
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1162
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1163
                src="./${name}-src-${release}.tar"/>
1164
      <delete file="./${name}-src-${release}.tar" />
1165
      <delete dir="${dist.dir}"/> 
1166
  </target>
1167

    
1168
   <target name="stylesheettest">
1169
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1170
      <param name="displaymodule" expression="${displaymodule}"/>
1171
      <param name="docid" expression="${input}"/>
1172
      <param name="entitytype" expression="${entitytype}"/>
1173
      <param name="entityindex" expression="${entityindex}"/>
1174
      <outputproperty name="method" value="html"/>
1175
      <outputproperty name="standalone" value="yes"/>
1176
      <outputproperty name="encoding" value="iso8859_1"/>
1177
      <outputproperty name="indent" value="yes"/>
1178
    </xslt>
1179
  </target>
1180

    
1181
 
1182
  <target name="compilewebclient" depends="prepare">
1183
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1184
  </target>
1185

    
1186
  <target name="runwebclient" depends="compilewebclient">
1187
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1188
           dir="${build.dest}" fork="yes"
1189
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1190
         <arg value="${serviceUrl}"/>
1191
         <arg value="${docid}"/>
1192
     </java>
1193
  </target>
1194
  
1195
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1196

    
1197
    <echo message="Compiling the metatcat shapefile creator"/>
1198
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1199
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1200
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1201
    </exec>
1202
  
1203
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1204
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1205
    </exec>
1206
  </target>
1207

    
1208
    <!-- LSID Authority support -->
1209
    <patternset id="lsid.jars">
1210
        <include name="axis.jar" />
1211
        <include name="commons-discovery-0.2.jar" />
1212
        <include name="jaxrpc.jar" />
1213
        <include name="lsid-client-1.1.1.jar" />
1214
        <include name="lsid-server-1.1.1.jar" />
1215
        <include name="saaj.jar" />
1216
        <include name="wsdl4j-1.5.1.jar" />
1217
        <include name="activation.jar" />
1218
        <include name="castor-0.9.5.jar" />
1219
        <include name="dnsjava-1.3.2.jar" />
1220
        <include name="mail.jar" />
1221
        <include name="commons-logging-1.0.4.jar" />
1222
        <!-- These jars may be needed but seem to not actually be,
1223
             so leaving them out for now
1224
        <include name="axis-ant.jar" />
1225
        -->
1226
        <!--<include name="GenCastor.class" />-->
1227
    </patternset>
1228
    <patternset id="lib.jars">
1229
        <include name="httpclient.jar" />
1230
        <include name="log4j-1.2.12.jar" />
1231
        <include name="utilities.jar" />
1232
        <include name="xercesImpl.jar" />
1233
        <include name="xalan.jar" />
1234
        <include name="xml-apis.jar" />
1235
    </patternset>
1236

    
1237
    <path id="lsid.classpath">
1238
        <fileset dir="${lsid.lib.dir}">
1239
            <patternset refid="lsid.jars"/>
1240
        </fileset>
1241
        <fileset dir="${lib.dir}">
1242
            <patternset refid="lsid.jars"/>
1243
        </fileset>
1244
        <fileset dir="${lib.dir}">
1245
            <include name="xalan.jar" />
1246
            <include name="xml-apis.jar" />
1247
        </fileset>
1248
        <fileset dir="${build.dir}">
1249
            <include name="metacat-client.jar" />
1250
        </fileset>
1251
    </path>
1252

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