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-09 17:33:41 -0700 (Tue, 09 Sep 2003) $'
11
  *    '$Revision: 1820 $'
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:8443"/>
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="srb"
115
                value="lib/srbrmi" />
116
      <property name="cos"
117
                value="lib/cos.jar" />
118
      <property name="morpho"
119
                value="lib/morpho.jar" />
120
      <property name="xalan"
121
                value="lib/xalan/xalan.jar" />
122
      <property name="apis"
123
                value="lib/xalan/xml-apis.jar" />
124
      <property name="httpclient"
125
                value="lib/httpclient.jar" />
126
      <property name="emlparser"
127
                value="lib/eml.jar" />
128
      <property name="configxml"
129
                value="lib/configxml.jar" />
130
      <property name="itislib"
131
                value="lib/itislib.jar" />
132
      <property name="emlparser"
133
                value="lib/eml.jar" />
134
      <property name="util"
135
                value="lib/utilities.jar" />
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">
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 file="${xmlp}"
386
             tofile="${installdir}/WEB-INF/lib/xercesImpl.jar" />
387
       <copy file="${xalan}"
388
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
389
       <copy file="${apis}"
390
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
391
       <copy file="${jdbc}"
392
             tofile="${installdir}/WEB-INF/lib/jdbc.jar" />
393
       <copy file="${cos}"
394
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
395
       <copy file="${morpho}"
396
             tofile="${installdir}/WEB-INF/lib/morpho.jar" />
397
       <copy file="${emlparser}"
398
             tofile="${installdir}/WEB-INF/lib/eml.jar" />
399
       <copy file="${configxml}"
400
             tofile="${installdir}/WEB-INF/lib/configxml.jar" />
401
       <copy file="${itislib}"
402
             tofile="${installdir}/WEB-INF/lib/itislib.jar" />
403
       <copy file="lib/web.xml.${tomcatversion}"
404
             tofile="${installdir}/WEB-INF/web.xml" />
405
       <copy todir="${build.img}" filtering="no">
406
         <fileset dir="lib">
407
           <include name="**/*.jpg"/>
408
           <include name="**/*.png"/>
409
           <include name="**/*.gif"/>
410
         </fileset>
411
       </copy>
412
       <copy todir="${installdir}" filtering="yes">
413
         <fileset dir="lib">
414
           <exclude name="*.jar"/>
415
           <exclude name="*.properties"/>
416
           <exclude name="web.xml"/>
417
           <exclude name="**/srbrmi*"/>
418
           <exclude name="**/*.jpg"/>
419
           <exclude name="**/*.png"/>
420
           <exclude name="**/*.gif"/>
421
         </fileset>
422
       </copy>
423
       <echo>
424
             ***********************************************************
425
              Remember to register the default DTDs by running the
426
              "${build.src}/loaddtd.sql script". This is most easily
427
              done by using the "ant dtdsql" which will run it for you.
428
             ***********************************************************
429
       </echo>
430
   </target>
431
   
432
   <target name="installMSSQL" if="MSSQL" depends="installCommon">
433
      <echo> Install MSSQL</echo>
434
      <copy file="${jdbc-add1}"
435
             tofile="${installdir}/WEB-INF/lib/msutil.jar" />
436
       <copy file="${jdbc-add2}"
437
             tofile="${installdir}/WEB-INF/lib/mssqlserver.jar" />
438
   </target>
439
   
440
    <target name="installother" if="other" depends="installCommon">
441
        <echo> Install Other Database</echo>
442
   </target>
443
   
444
   <target name="install" depends="installMSSQL, installother">
445
     
446
   </target>
447
   
448
   <target name="testprep" depends="install">
449
      <mkdir dir="${build.tests}"/>
450
      <copy todir="${build.tests}" filtering="yes">
451
        <fileset dir="${testdir}">
452
          <include name="edu/**"/>
453
        </fileset>
454
      </copy>
455
   </target>
456

    
457
   <target name="test" depends="testprep">
458
      <!-- copy and compile the tests into a jar file -->
459
      <javac srcdir="${build.tests}"
460
             destdir="${build.tests}"
461
             classpath="${cpath}:${build.dir}/${name}.jar"
462
             debug="on"
463
       includes="**/*.java" />
464

    
465
      <jar jarfile="${build.dir}/${name}-junittests.jar"
466
        basedir="${build.tests}"
467
                includes="**/*.class" />
468

    
469
      <!-- use the ant "junit" task to run JUnit tests. -->
470
      <junit printsummary="yes" haltonfailure="no" fork="yes"
471
             haltonerror="no">
472
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
473
        <classpath>
474
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
475
        </classpath>
476

    
477
        <formatter type="plain" />
478

    
479
        <batchtest fork="yes" todir="${build.dir}">
480
          <fileset dir="${build.tests}">
481
            <include name="**/*.class" />
482
          </fileset>
483
        </batchtest>
484
     </junit>
485
   </target>
486

    
487
    <target name="runonetest" depends="testprep">
488
      <!-- copy and compile the tests into a jar file -->
489
      <!--<property name="testtorun" value="SubTreeTest"/> -->
490
      <echo>testtorun: ${testtorun}</echo>
491
      <javac srcdir="${build.tests}"
492
             destdir="${build.tests}"
493
             classpath="${cpath}:${build.dir}/${name}.jar"
494
             debug="on"
495
       includes="**/*.java" />
496

    
497
      <jar jarfile="${build.dir}/${name}-junittests.jar"
498
        basedir="${build.tests}"
499
                includes="**/*.class" />
500

    
501
      <!-- use the ant "junit" task to run JUnit tests. -->
502
      <junit printsummary="yes" haltonfailure="no" fork="yes"
503
             haltonerror="no">
504
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
505
        <classpath>
506
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
507
        </classpath>
508

    
509
        <formatter type="plain" />
510

    
511
        <batchtest fork="yes" todir="${build.dir}">
512
          <fileset dir="${build.tests}">
513
            <include name="**/${testtorun}.class" />
514
          </fileset>
515
        </batchtest>
516
     </junit>
517
   </target>
518

    
519
  <target name="gethttpclient" depends="prepare">
520
  <!--mkdir dir="${morphosourcedir}" -->
521
        <cvs cvsRoot="${cvsroot}"
522
             package="morpho"
523
             dest="." />
524
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
525
   </target>
526

    
527
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
528
   <target name="nettest" depends="install">
529
      <echo>***********************************
530
      Please run ant gethttpclient first!
531
      ***********************************
532
      </echo>
533
      <!-- copy and compile the tests into a jar file -->
534
      <mkdir dir="${build.metacatnettest}"/>
535
      <javac srcdir="${junitnettestsdir}"
536
             destdir="${build.metacatnettest}"
537
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
538
             includes="**/*.java" />
539

    
540
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
541
                    basedir="${build.metacatnettest}"
542
                    includes="**/*.class" />
543

    
544
      <!-- use the ant "junit" task to run JUnit tests. -->
545
      <junit printsummary="yes" haltonfailure="no" fork="yes"
546
             haltonerror="no">
547
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
548
        <classpath>
549
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
550
        </classpath>
551

    
552
        <formatter type="plain" />
553

    
554
        <batchtest fork="yes" todir="${build.dir}">
555
          <fileset dir="${build.metacatnettest}">
556
            <include name="**/*.class" />
557
          </fileset>
558
        </batchtest>
559
     </junit>
560
   </target>
561

    
562
   <target name="servletclean" depends="clean">
563
     <delete dir="${installdir}" />
564
   </target>
565

    
566

    
567
   <target name="clean" depends="init">
568
       <delete dir="${build.dir}" />
569
   </target>
570

    
571
   <target name="jdoc" depends="prepare">
572
       <javadoc packagenames="edu.ucsb.nceas.*"
573
           sourcepath="${build.src}"
574
           destdir="${build.javadocs}"
575
           author="true"
576
           version="true"
577
           use="true"
578
           windowtitle="${Name} API"
579
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
580
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
581
       />
582
   </target>
583

    
584
   <target name="dist" depends="jar,protocol,jdoc,getdtd,getschema">
585
      <mkdir dir="${dist.dir}"/>
586
      <delete dir="${ver.dir}" />
587
      <mkdir dir="${ver.dir}"/>
588
      <copy todir="${ver.dir}">
589
        <fileset dir="."
590
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
591
      </copy>
592
      <copy todir="${ver.dir}" file="build.xml"/>
593
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
594
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
595

    
596
      <copy todir="${ver.dir}/docs" filtering="yes">
597
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
598
      </copy>
599
      <copy todir="${ver.dir}/docs" filtering="no">
600
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
601
      </copy>
602
      <copy todir="${ver.dir}/docs/dev">
603
        <fileset dir="${build.dir}/docs"/>
604
      </copy>
605
      <copy todir="${ver.dir}/src">
606
        <fileset dir="${build.dir}/src"/>
607
      </copy>
608

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

    
620
  <target name="distsrc" depends="dist">
621
      <mkdir dir="${ver.src}"/>
622
      <copy todir="${ver.src}">
623
        <fileset dir="./src"/>
624
      </copy>
625

    
626
      <delete file="./${name}-src-${release}.zip"/>
627
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
628
      <delete file="./${name}-src-${release}.tar.gz" />
629
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
630
      <gzip zipfile="./${name}-src-${release}.tar.gz"
631
                src="./${name}-src-${release}.tar"/>
632
      <delete file="./${name}-src-${release}.tar" />
633
      <delete dir="${dist.dir}"/>
634
  </target>
635

    
636
   <target name="stylesheettest">
637
     <xslt in="${input}" out="eml.html" style="lib/style/eml2/eml-2.0.0.xsl">
638
      <param name="displaymodule" expression="${displaymodule}"/>
639
      <param name="docid" expression="${input}"/>
640
      <param name="entitytype" expression="${entitytype}"/>
641
      <param name="entityindex" expression="${entityindex}"/>
642
      <outputproperty name="method" value="html"/>
643
      <outputproperty name="standalone" value="yes"/>
644
      <outputproperty name="encoding" value="iso8859_1"/>
645
      <outputproperty name="indent" value="yes"/>
646
    </xslt>
647
  </target>
648
  
649
 <target name="gridinit" depends="init">
650
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
651
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
652
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
653
   <property environment="env"/>
654
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
655
    <path id="webservicepath">
656
        <pathelement location="."/>
657
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
658
        <pathelement location="${build.dest}"/>
659
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
660
           <include name="*.jar"/>
661
        </fileset>
662
      </path>
663
</target>
664

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