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: tao $'
10
  *    '$Date: 2003-09-17 15:54:40 -0700 (Wed, 17 Sep 2003) $'
11
  *    '$Revision: 1824 $'
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
  <target name="oracle">
34
     <!-- Customize these properties if you are using oracle -->
35
     <property name="jdbc-connect"
36
               value="jdbc:oracle:thin:@pine.nceas.ucsb.edu:1521:knb"/>
37
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
38
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
39
     <property name="oracle_home" value="/usr/local/oracle/8.1.6" />
40
     <property name="jdbc" value="${oracle_home}/jdbc/lib/classes111.zip" />
41
     <!-- Property to indicate is not MSSQL installation-->
42
     <property name="other" value="yes"/>
43
   </target>
44

    
45
   <target name="postgresql">
46
     <!-- Customize these properties if you are using postgres -->
47
     <property name="jdbc-connect"
48
               value="jdbc:postgresql://localhost/exp"/>
49
     <property name="dbDriver" value="org.postgresql.Driver"/>
50
     <property name="dbAdapter"
51
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
52
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
53
     <!-- Property to indicate is not MSSQL installation-->
54
     <property name="other" value="yes"/>
55
    </target>
56
   
57
   <target name="sqlserver">
58
     <!-- Customize these properties if you are using SQL server -->
59
     <property name="jdbc-connect"
60
               value="jdbc:microsoft:sqlserver://fatali.nceas.ucsb.edu:1433"/>
61
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
62
     <property name="dbAdapter"
63
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
64
     <property name="jdbc-base" value="F:\\Program Files\\Microsoft SQL Server 2000 Driver for JDBC\\lib" />
65
     <property name="jdbc" value="${jdbc-base}/msbase.jar" />
66
     <property name="jdbc-add1" value="${jdbc-base}/msutil.jar" />
67
     <property name="jdbc-add2" value="${jdbc-base}/mssqlserver.jar" />
68
     <!-- Property to indicate is a MSSQL installation-->
69
     <property name="MSSQL" value="yes"/>
70
   </target>
71

    
72
   <target name="config" depends="oracle">
73
      <!-- Change the 'depends' attribute above to 'postgresql' to install
74
           metacat with postgres instead of oracle -->
75

    
76
      <!-- Customize these properties for your system -->
77
      <property name="tomcat" value="/usr/local/devtools/jakarta-tomcat" />
78
      <property name="webapps" value="/usr/local/devtools/jakarta-tomcat/webapps" />
79
      <property name="context" value="tao" />
80
      <property name="user" value="knb"/>
81
      <property name="password" value="tdataint"/>
82
     
83
      <!-- usr for client testing, generally you don't need change-->
84
      <property name="mcuser" value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org"/>
85
      <property name="mcpassword" value=""/>
86
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
87
      <property name="mcanotherpassword" value=""/>
88

    
89
      <!-- Tomcat version, if you use tomcat 3, please fill it "tomcat3". If you using tomcat4, please fill it "tomcat4"-->
90
      <property name="tomcatversion" value="tomcat4"/>
91

    
92
      <property name="server" value="pine.nceas.ucsb.edu:8080"/>
93
      <property name="systemidserver" value="http://pine.nceas.ucsb.edu:8080" />
94
      <property name="datafilepath" value="/usr/local/devtools/jakarta-tomcat/data/tao/data" />
95
      <property name="inlinedatafilepath" value="/usr/local/devtools/jakarta-tomcat/data/tao/inlinedata" />
96
      <property name="debuglevel" value="55" />
97

    
98
      <property name="forcereplicationwaitingtime" value="30000"/>
99
      <property name="cvsroot"
100
                value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
101
      <property name="web-base-url"
102
                value="http://knb.ecoinformatics.org"/>
103
      <property name="default-style" value="knb" />
104
      <property name="morphosourcedir" value="../morpho" />
105
      <property name="defaultcontenttype" value="application/octet-stream" />
106
      <property name="utilitiesdir" value="../utilities" />
107
    
108
      <!-- Make sure these paths match the location of the jar files
109
           on your system, the defaults should usually work -->
110
      <property name="jsdk"
111
                value="${tomcat}/common/lib/servlet.jar" />
112
      <property name="xmlp"
113
                value="lib/xercesImpl.jar" />
114
      <property name="cos"
115
                value="lib/cos.jar" />
116
      <property name="morpho"
117
                value="lib/morpho.jar" />
118
      <property name="xalan"
119
                value="lib/xalan/xalan.jar" />
120
      <property name="apis"
121
                value="lib/xalan/xml-apis.jar" />
122
      <property name="httpclient"
123
                value="lib/httpclient.jar" />
124
      <property name="emlparser"
125
                value="lib/eml.jar" />
126
      <property name="configxml"
127
                value="lib/configxml.jar" />
128
      <property name="itislib"
129
                value="lib/itislib.jar" />
130
      <property name="emlparser"
131
                value="lib/eml.jar" />
132
      <property name="util"
133
                value="lib/utilities.jar" />
134
      <property name="srb"
135
                value="lib/srbrmi" />
136
  </target>
137

    
138
   <target name="init" depends="config">
139
      <!-- It is less likely you'll need to make any changes from here down,
140
           but customization is possible -->
141
      <property name="installdir" value="${webapps}/${context}" />
142
      <property name="name" value="metacat"/>
143
      <property name="Name" value="MetaCat"/>
144
      <property name="debugprefix" value="${Name}:"/>
145
      <property name="release" value="1.2.1"/>
146
      <property name="replication-path"
147
                value="/${context}/servlet/replication"/>
148
      <property name="servlet-path" value="/${context}/servlet/metacat"/>
149
      <property name="html-path" value="/${context}"/>
150
      <property name="image-path" value="/${context}" />
151
      <property name="style-path" value="/${context}/style"/>
152
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
153
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
154
      <property name="config-dir" value="${installdir}" />
155
      <property name="eml-module" value="eml" />
156
      <property name="eml-version" value="2.0.0beta6" />
157
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6_REV1" />
158
      <property name="eml2-tag" value="STMML_SCHEMA_UPDATE" />
159
      <property name="eml2namespace" value="eml://ecoinformatics.org/eml-2.0.0" />
160
      <property name="stmmlnamespace" value="http://www.xml-cml.org/schema/stmml" />
161

    
162
      <property name="cpath"
163
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}:${emlparser}:${jdbc-add1}:${jdbc-add2}:${util}:${httpclient}"/>
164

    
165
      <filter token="docrooturl" value="./" />
166
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
167
      <filter token="dbDriver" value="${dbDriver}"/>
168
      <filter token="dbAdapter" value="${dbAdapter}"/>
169
      <filter token="install-dir" value="${installdir}"/>
170
      <filter token="server" value="${server}"/>
171
      <filter token="systemidserver" value="${systemidserver}"/>
172
      <filter token="replication-log" value="${replication-log}"/>
173
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
174
      <filter token="release" value="${release}"/>
175
      <filter token="servlet-path" value="${servlet-path}"/>
176
      <filter token="html-path" value="${html-path}"/>
177
      <filter token="user" value="${user}"/>
178
      <filter token="password" value="${password}"/>
179
      <filter token="mcuser" value="${mcuser}"/>
180
      <filter token="mcpassword" value="${mcpassword}"/>
181
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
182
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
183
      <filter token="image-path" value="${image-path}"/>
184
      <filter token="style-path" value="${style-path}"/>
185
      <filter token="web-base-url" value="${web-base-url}"/>
186
      <filter token="replication-path" value="${replication-path}"/>
187
      <filter token="config-dir" value="${config-dir}"/>
188
      <filter token="default-style" value="${default-style}"/>
189
      <filter token="eml-version" value="${eml-version}"/>
190
      <filter token="eml2namespace" value="${eml2namespace}"/>
191
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
192
      <filter token="context" value="${context}"/>
193
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
194
      <filter token="debuglevel" value="${debuglevel}" />
195
      <filter token="datafilepath" value="${datafilepath}" />
196
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
197
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
198
      <filter token="debugprefix" value="${debugprefix}"/>
199

    
200
      <property name="srcdir" value="./src" />
201
      <property name="testdir" value="./test" />
202
      <property name="testtorun" value="MetacatClientTest" />
203
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
204
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
205
      <property name="build.dir" value="./build"/>
206
      <property name="build.src" value="${build.dir}/src"/>
207
      <property name="build.dest" value="${build.dir}/classes"/>
208
      <property name="build.docs" value="${build.dir}/docs"/>
209
      <property name="build.samples" value="${build.dir}/samples"/>
210
      <property name="build.tests" value="${build.dir}/tests"/>
211
      <property name="build.tmp" value="${build.dir}/tmp"/>
212
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
213
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
214
      <property name="build.data" value="${build.dir}/data"/>
215
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
216
      <property name="build.img" value="${installdir}"/>
217

    
218
      <property name="dist.dir" value="dist"/>
219
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
220
      <property name="ver.src" value="${ver.dir}/src"/>
221

    
222
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
223
   </target>
224

    
225
   <target name="prepare" depends="init">
226
      <mkdir dir="${build.dir}"/>
227
      <mkdir dir="${build.src}"/>
228
      <mkdir dir="${build.dest}"/>
229
      <mkdir dir="${build.javadocs}"/>
230
      <mkdir dir="${build.tmp}"/>
231

    
232
      <copy todir="${build.src}" filtering="yes">
233
        <fileset dir="${srcdir}">
234
          <include name="edu/**"/>
235
          <include name="com/**"/>
236
          <include name="**/*.sql"/>
237
          <exclude name="**/CVS*"/>
238
          <exclude name="**/.#*"/>
239
          <exclude name="edu/ucsb/nceas/metacat/harvesterClient/*.*"/>
240
        </fileset>
241
      </copy>
242
   </target>
243

    
244
   <target name="compile" depends="prepare,utilities">
245
       <javac srcdir="${build.src}"
246
              destdir="${build.dest}"
247
              classpath="${cpath}"
248
              excludes="**/*.sql **/stringclient/** **/client/*.java"/>
249
       <copy file="lib/metacat.properties"
250
             tofile="${build.dest}/${package.home}/metacat.properties"
251
             filtering="yes" />
252
       <copy file="lib/srbProps.properties"
253
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
254
   </target>
255

    
256
   <target name="jar" depends="compile">
257
       <delete file="${build.dir}/${name}.jar" />
258
       <copy todir="${build.dest}">
259
         <fileset dir="lib/srbrmi"/>
260
       </copy>
261
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
262
            excludes="**/protocols/" />
263
   </target>
264

    
265
   <target name="protocol" depends="compile">
266
       <delete file="${build.dir}/protocol.jar" />
267
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
268
            includes="**/protocols/" />
269
   </target>
270

    
271
   <target name="utilities" depends="config">
272
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
273
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
274
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
275
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
276
   </target>
277

    
278
   <target name="client" depends="utilities, prepare">
279
       <javac srcdir="${build.src}"
280
              destdir="${build.dest}"
281
              classpath="${cpath}"
282
              includes="edu/ucsb/nceas/metacat/client/*" />
283
   </target>
284

    
285
   <target name="clientjar" depends="client">
286
       <delete file="${build.dir}/${name}-client.jar" />
287
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
288
            includes="**/metacat/client/" />
289
   </target>
290

    
291
   <target name="getdtdschema" depends="prepare">
292
     <echo>Enter CVS password: </echo>
293
     <cvs cvsRoot="${cvsroot}"
294
          package="${eml-module}"
295
          tag="${eml-tag}"
296
          dest="${build.tmp}" />
297
     <mkdir dir="lib/dtd" />
298
     <copy todir="lib/dtd" filtering="yes">
299
       <fileset dir="${build.tmp}/${eml-module}">
300
         <include name="*.dtd"/>
301
       </fileset>
302
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
303
     </copy>
304
     <echo>Enter CVS password: </echo>
305
     <cvs cvsRoot="${cvsroot}"
306
          package="${eml-module}"
307
          tag="${eml2-tag}"
308
          dest="${build.tmp}" />
309
     <mkdir dir="lib/schema" />
310
     <copy todir="lib/schema" filtering="yes">
311
       <fileset dir="${build.tmp}/${eml-module}">
312
         <include name="*.xsd"/>
313
       </fileset>
314
     </copy>
315
     <copy todir="lib/style">
316
       <fileset dir="${build.tmp}/${eml-module}/style">
317
       <include name="*.xsl"/>
318
     </fileset>
319
     </copy>
320
   </target>
321

    
322
   <target name="getdtd" depends="prepare">
323
     <echo>Enter CVS password: </echo>
324
     <cvs cvsRoot="${cvsroot}"
325
          package="${eml-module}"
326
          tag="${eml-tag}"
327
          dest="${build.tmp}" />
328
     <mkdir dir="lib/dtd" />
329
     <copy todir="lib/dtd" filtering="yes">
330
       <fileset dir="${build.tmp}/${eml-module}">
331
         <include name="*.dtd"/>
332
       </fileset>
333
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
334
     </copy>
335
   </target>
336

    
337
   <target name="getschema" depends="prepare">
338
     <echo>Enter CVS password: </echo>
339
     <cvs cvsRoot="${cvsroot}"
340
          package="${eml-module}"
341
          tag="${eml2-tag}"
342
          dest="${build.tmp}" />
343
     <mkdir dir="lib/schema" />
344
     <copy todir="lib/schema" filtering="yes">
345
       <fileset dir="${build.tmp}/${eml-module}">
346
         <include name="*.xsd"/>
347
       </fileset>
348
     </copy>
349
     <copy todir="lib/style">
350
       <fileset dir="${build.tmp}/${eml-module}/style">
351
       <include name="*.xsl"/>
352
     </fileset>
353
     </copy>
354
   </target>
355

    
356
   <target name="dtdschemasql" depends="prepare">
357
     <echo/>
358
     <echo>Registering the DTDs with the new Metacat instance...</echo>
359
     <sql driver="${dbDriver}"
360
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
361
          url="${jdbc-connect}"
362
          userid="${user}"
363
          password="${password}"
364
          src="${build.src}/loaddtdschema.sql" />
365
   </target>
366

    
367
   <target name="schemasql" depends="prepare">
368
     <echo/>
369
     <echo>Registering the DTDs with the new Metacat instance...</echo>
370
     <sql driver="${dbDriver}"
371
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
372
          url="${jdbc-connect}"
373
          userid="${user}"
374
          password="${password}"
375
          src="${build.src}/loadschema.sql" />
376
   </target>
377
   
378
   <target name="installCommon" depends="jar">
379
       <mkdir dir="${datafilepath}" />
380
       <mkdir dir="${inlinedatafilepath}" />
381
       <chmod dir="${datafilepath}" perm="ug+w" />
382
       <mkdir dir="${installdir}/WEB-INF/lib" />
383
       <copy file="${build.dir}/${name}.jar"
384
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
385
       <copy todir="${installdir}/WEB-INF/lib" filtering="no">
386
         <fileset dir="lib">
387
           <include name="*.jar"/>
388
         </fileset>
389
         <fileset dir="lib/xalan">
390
           <include name="*.jar"/>
391
         </fileset>
392
       </copy>
393
       <copy file="${jdbc}" tofile="${installdir}/WEB-INF/lib/jdbc.jar" />
394
       <copy file="lib/web.xml.${tomcatversion}"
395
             tofile="${installdir}/WEB-INF/web.xml" />
396
       <copy todir="${build.img}" filtering="no">
397
         <fileset dir="lib">
398
           <include name="**/*.jpg"/>
399
           <include name="**/*.png"/>
400
           <include name="**/*.gif"/>
401
         </fileset>
402
       </copy>
403
       <copy todir="${installdir}" filtering="yes">
404
         <fileset dir="lib">
405
           <exclude name="*.jar"/>
406
           <exclude name="*.properties"/>
407
           <exclude name="web.xml"/>
408
           <exclude name="**/srbrmi*"/>
409
           <exclude name="**/*.jpg"/>
410
           <exclude name="**/*.png"/>
411
           <exclude name="**/*.gif"/>
412
         </fileset>
413
       </copy>
414
       <echo>
415
             ***********************************************************
416
              Remember to register the default DTDs by running the
417
              "${build.src}/loaddtd.sql script". This is most easily
418
              done by using the "ant dtdsql" which will run it for you.
419
             ***********************************************************
420
       </echo>
421
   </target>
422
   
423
   <target name="installMSSQL" if="MSSQL" depends="installCommon">
424
      <echo> Install MSSQL</echo>
425
      <copy file="${jdbc-add1}"
426
             tofile="${installdir}/WEB-INF/lib/msutil.jar" />
427
       <copy file="${jdbc-add2}"
428
             tofile="${installdir}/WEB-INF/lib/mssqlserver.jar" />
429
   </target>
430
   
431
    <target name="installother" if="other" depends="installCommon">
432
        <echo> Install Other Database</echo>
433
   </target>
434
   
435
   <target name="install" depends="installMSSQL, installother">
436
     
437
   </target>
438
   
439
   <target name="testprep" depends="jar,clientjar">
440
      <mkdir dir="${build.tests}"/>
441
      <copy todir="${build.tests}" filtering="yes">
442
        <fileset dir="${testdir}">
443
          <include name="edu/**"/>
444
        </fileset>
445
      </copy>
446
      <!-- copy and compile the tests into a jar file -->
447
      <javac srcdir="${build.tests}"
448
             destdir="${build.tests}"
449
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar"
450
             debug="on"
451
       includes="**/*.java" />
452

    
453
      <jar jarfile="${build.dir}/${name}-junittests.jar"
454
        basedir="${build.tests}"
455
                includes="**/*.class" />
456
   </target>
457

    
458
   <target name="test" depends="testprep">
459

    
460
      <!-- use the ant "junit" task to run JUnit tests. -->
461
      <junit printsummary="yes" haltonfailure="no" fork="yes"
462
             haltonerror="no">
463
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
464
        <classpath>
465
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
466
        </classpath>
467

    
468
        <formatter type="plain" />
469

    
470
        <batchtest fork="yes" todir="${build.dir}">
471
          <fileset dir="${build.tests}">
472
            <include name="**/*.class" />
473
          </fileset>
474
        </batchtest>
475
     </junit>
476
   </target>
477

    
478
    <target name="runonetest" depends="testprep">
479
      <echo>testtorun: ${testtorun}</echo>
480

    
481
      <!-- use the ant "junit" task to run JUnit tests. -->
482
      <junit printsummary="yes" haltonfailure="no" fork="yes"
483
             haltonerror="no">
484
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
485
        <classpath>
486
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
487
        </classpath>
488

    
489
        <formatter type="plain" />
490

    
491
        <batchtest fork="yes" todir="${build.dir}">
492
          <fileset dir="${build.tests}">
493
            <include name="**/${testtorun}.class" />
494
          </fileset>
495
        </batchtest>
496
     </junit>
497
   </target>
498

    
499
  <target name="gethttpclient" depends="prepare">
500
  <!--mkdir dir="${morphosourcedir}" -->
501
        <cvs cvsRoot="${cvsroot}"
502
             package="morpho"
503
             dest="." />
504
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
505
   </target>
506

    
507
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
508
   <target name="nettest" depends="install">
509
      <echo>***********************************
510
      Please run ant gethttpclient first!
511
      ***********************************
512
      </echo>
513
      <!-- copy and compile the tests into a jar file -->
514
      <mkdir dir="${build.metacatnettest}"/>
515
      <javac srcdir="${junitnettestsdir}"
516
             destdir="${build.metacatnettest}"
517
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
518
             includes="**/*.java" />
519

    
520
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
521
                    basedir="${build.metacatnettest}"
522
                    includes="**/*.class" />
523

    
524
      <!-- use the ant "junit" task to run JUnit tests. -->
525
      <junit printsummary="yes" haltonfailure="no" fork="yes"
526
             haltonerror="no">
527
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
528
        <classpath>
529
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
530
        </classpath>
531

    
532
        <formatter type="plain" />
533

    
534
        <batchtest fork="yes" todir="${build.dir}">
535
          <fileset dir="${build.metacatnettest}">
536
            <include name="**/*.class" />
537
          </fileset>
538
        </batchtest>
539
     </junit>
540
   </target>
541

    
542
   <target name="servletclean" depends="clean">
543
     <delete dir="${installdir}" />
544
   </target>
545

    
546

    
547
   <target name="clean" depends="init">
548
       <delete dir="${build.dir}" />
549
       <delete file="lib/httpclient.jar" />
550
       <delete file="lib/utilities.jar" />
551
   </target>
552

    
553
   <target name="jdoc" depends="prepare">
554
       <javadoc packagenames="edu.ucsb.nceas.*"
555
           sourcepath="${build.src}"
556
           destdir="${build.javadocs}"
557
           author="true"
558
           version="true"
559
           use="true"
560
           windowtitle="${Name} API"
561
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
562
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
563
       />
564
   </target>
565

    
566
   <target name="dist" depends="jar,protocol,jdoc,getdtd,getschema">
567
      <mkdir dir="${dist.dir}"/>
568
      <delete dir="${ver.dir}" />
569
      <mkdir dir="${ver.dir}"/>
570
      <copy todir="${ver.dir}">
571
        <fileset dir="."
572
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
573
      </copy>
574
      <copy todir="${ver.dir}" file="build.xml"/>
575
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
576
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
577

    
578
      <copy todir="${ver.dir}/docs" filtering="yes">
579
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
580
      </copy>
581
      <copy todir="${ver.dir}/docs" filtering="no">
582
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
583
      </copy>
584
      <copy todir="${ver.dir}/docs/dev">
585
        <fileset dir="${build.dir}/docs"/>
586
      </copy>
587
      <copy todir="${ver.dir}/src">
588
        <fileset dir="${build.dir}/src"/>
589
      </copy>
590

    
591
      <delete dir="./${ver.dir}/${build.dir}"/>
592
      <delete dir="./${ver.dir}/dist"/>
593
      <delete file="./${name}-${release}.zip"/>
594
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
595
      <delete file="./${name}-${release}.tar.gz" />
596
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
597
      <gzip zipfile="./${name}-${release}.tar.gz"
598
                src="./${name}-${release}.tar"/>
599
      <delete file="./${name}-${release}.tar" />
600
  </target>
601

    
602
  <target name="distsrc" depends="dist">
603
      <mkdir dir="${ver.src}"/>
604
      <copy todir="${ver.src}">
605
        <fileset dir="./src"/>
606
      </copy>
607

    
608
      <delete file="./${name}-src-${release}.zip"/>
609
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
610
      <delete file="./${name}-src-${release}.tar.gz" />
611
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
612
      <gzip zipfile="./${name}-src-${release}.tar.gz"
613
                src="./${name}-src-${release}.tar"/>
614
      <delete file="./${name}-src-${release}.tar" />
615
      <delete dir="${dist.dir}"/>
616
  </target>
617

    
618
   <target name="stylesheettest">
619
     <xslt in="${input}" out="eml.html" style="lib/style/eml2/eml-2.0.0.xsl">
620
      <param name="displaymodule" expression="${displaymodule}"/>
621
      <param name="docid" expression="${input}"/>
622
      <param name="entitytype" expression="${entitytype}"/>
623
      <param name="entityindex" expression="${entityindex}"/>
624
      <outputproperty name="method" value="html"/>
625
      <outputproperty name="standalone" value="yes"/>
626
      <outputproperty name="encoding" value="iso8859_1"/>
627
      <outputproperty name="indent" value="yes"/>
628
    </xslt>
629
  </target>
630
  
631
 <target name="gridinit" depends="init">
632
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
633
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
634
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
635
   <property environment="env"/>
636
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
637
    <path id="webservicepath">
638
        <pathelement location="."/>
639
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
640
        <pathelement location="${build.dest}"/>
641
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
642
           <include name="*.jar"/>
643
        </fileset>
644
      </path>
645
</target>
646

    
647
 <target name="gridprepare" depends="gridinit, prepare">
648
 </target> 
649
  
650
  <target name="compileinterface" depends="clean, gridprepare">
651
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
652
  </target>
653
  
654
  <target name="generateWSDL" depends="compileinterface">
655
    <echo message="Generating wsdl from ${interface.name} interface"/>
656
    <java classname="${java2wsdl.tool}"
657
          dir="${build.src}" fork="yes"
658
          classpathref="webservicepath"  failonerror="true" >
659
      <arg value="-P"/>
660
      <arg value="${interface.name}PortType"/>
661
      <arg value="-S"/>
662
      <arg value="${interface.name}Service"/>
663
      <arg value="-y"/>
664
      <arg value="WRAPPED"/>
665
      <arg value="-u"/>
666
      <arg value="LITERAL"/>
667
      <arg value="-l"/>
668
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
669
      <arg value="-n"/>
670
      <arg value="http://${services.namespace}/${interface.name}"/>
671
      <arg value="${interface.package}.${interface.name}"/>
672
    </java>
673
  </target>
674
  
675
   <target name="decorateWSDL" depends="generateWSDL">
676
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
677
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
678
            fork="yes"
679
            classpathref="webservicepath" failonerror="true" >
680
        <arg value="${binding.file}"/>
681
        <arg value="${wsdl.file}"/>
682
      </java>
683
   </target>
684
   
685
   <target name="generatestubs" depends="decorateWSDL">
686
      <echo message=" Generating stubs " />
687
      <echo message="wsdl file is ${wsdl.file}"/>
688
      <echo message="build.src is ${build.src}"/>
689
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
690
            classpathref="webservicepath" failonerror="true" >
691
         <arg value="${wsdl.file}"/>
692
    </java>
693
  </target>
694
  
695
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
696
     <echo message=" Compiling stubs " />
697
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
698
     <echo message=" Compiling impl " />
699
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
700
  </target>
701
  
702
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
703
     <echo message=" jar stubs classes " />
704
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
705
     <echo message=" jar impl classes " />
706
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
707
  </target>
708
  
709
  <target name="gar" depends="jarStubsAndImpl">
710
     <echo message=" jar the gar file"/>
711
     <mkdir dir="${build.dir}/gar"/>
712
     <mkdir dir="${build.dir}/gar/schema/edu"/>
713
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
714
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
715
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
716
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
717
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
718
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
719
  </target>
720
  
721
  <target name="compilewebclient" depends="prepare">
722
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
723
  </target>
724
  
725
  <target name="runwebclient" depends="compilewebclient">
726
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication" 
727
           dir="${build.dest}" fork="yes"
728
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
729
         <arg value="${serviceUrl}"/>
730
         <arg value="${docid}"/>
731
     </java>
732
  </target>
733
</project>
(4-4/4)