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: jones $'
10
  *    '$Date: 2003-09-19 17:05:01 -0700 (Fri, 19 Sep 2003) $'
11
  *    '$Revision: 1827 $'
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="${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://${server}" />
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="debug" value="on" />
97
      <property name="debuglevel" value="55" />
98

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
369
   <target name="schemasql" depends="prepare">
370
     <echo/>
371
     <echo>Registering the DTDs with the new Metacat instance...</echo>
372
     <sql driver="${dbDriver}"
373
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
374
          url="${jdbc-connect}"
375
          userid="${user}"
376
          password="${password}"
377
          src="${build.src}/loadschema.sql" />
378
   </target>
379
   
380
   <target name="installdb" depends="prepare">
381
     <echo/>
382
     <echo>Installing the database tables...</echo>
383
     <sql driver="${dbDriver}"
384
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
385
          url="${jdbc-connect}"
386
          userid="${user}"
387
          password="${password}"
388
          src="${build.src}/xmltables.sql" />
389
   </target>
390

    
391
   <target name="upgrade12" depends="prepare">
392
     <echo/>
393
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
394
     <sql driver="${dbDriver}"
395
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
396
          url="${jdbc-connect}"
397
          userid="${user}"
398
          password="${password}"
399
          src="${build.src}/upgrade-db-to-1.2.sql" />
400
   </target>
401

    
402
   <target name="upgrade13" depends="prepare">
403
     <echo/>
404
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
405
     <sql driver="${dbDriver}"
406
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
407
          url="${jdbc-connect}"
408
          userid="${user}"
409
          password="${password}"
410
          src="${build.src}/upgrade-db-to-1.3.sql" />
411
   </target>
412

    
413
   <target name="installCommon" depends="jar">
414
       <mkdir dir="${datafilepath}" />
415
       <mkdir dir="${inlinedatafilepath}" />
416
       <chmod dir="${datafilepath}" perm="ug+w" />
417
       <mkdir dir="${installdir}/WEB-INF/lib" />
418
       <copy file="${build.dir}/${name}.jar"
419
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
420
       <copy todir="${installdir}/WEB-INF/lib" filtering="no">
421
         <fileset dir="lib">
422
           <include name="*.jar"/>
423
         </fileset>
424
         <fileset dir="lib/xalan">
425
           <include name="*.jar"/>
426
         </fileset>
427
       </copy>
428
       <copy file="${jdbc}" tofile="${installdir}/WEB-INF/lib/jdbc.jar" />
429
       <copy file="lib/web.xml.${tomcatversion}"
430
             tofile="${installdir}/WEB-INF/web.xml" />
431
       <copy todir="${build.img}" filtering="no">
432
         <fileset dir="lib">
433
           <include name="**/*.jpg"/>
434
           <include name="**/*.png"/>
435
           <include name="**/*.gif"/>
436
         </fileset>
437
       </copy>
438
       <copy todir="${installdir}" filtering="yes">
439
         <fileset dir="lib">
440
           <exclude name="*.jar"/>
441
           <exclude name="*.properties"/>
442
           <exclude name="web.xml"/>
443
           <exclude name="**/srbrmi*"/>
444
           <exclude name="**/*.jpg"/>
445
           <exclude name="**/*.png"/>
446
           <exclude name="**/*.gif"/>
447
         </fileset>
448
       </copy>
449
       <echo>
450
             ***********************************************************
451
              Remember to register the default DTDs by running the
452
              "${build.src}/loaddtd.sql script". This is most easily
453
              done by using the "ant dtdsql" which will run it for you.
454
             ***********************************************************
455
       </echo>
456
   </target>
457
   
458
   <target name="installMSSQL" if="MSSQL" depends="installCommon">
459
      <echo> Install MSSQL</echo>
460
      <copy file="${jdbc-add1}"
461
             tofile="${installdir}/WEB-INF/lib/msutil.jar" />
462
       <copy file="${jdbc-add2}"
463
             tofile="${installdir}/WEB-INF/lib/mssqlserver.jar" />
464
   </target>
465
   
466
    <target name="installother" if="other" depends="installCommon">
467
        <echo> Install Other Database</echo>
468
   </target>
469
   
470
   <target name="install" depends="installMSSQL, installother">
471
     
472
   </target>
473
   
474
   <target name="testprep" depends="jar,clientjar">
475
      <mkdir dir="${build.tests}"/>
476
      <copy todir="${build.tests}" filtering="yes">
477
        <fileset dir="${testdir}">
478
          <include name="edu/**"/>
479
        </fileset>
480
      </copy>
481
      <!-- copy and compile the tests into a jar file -->
482
      <javac srcdir="${build.tests}"
483
             destdir="${build.tests}"
484
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar"
485
             debug="on"
486
       includes="**/*.java" />
487

    
488
      <jar jarfile="${build.dir}/${name}-junittests.jar"
489
        basedir="${build.tests}"
490
                includes="**/*.class" />
491
   </target>
492

    
493
   <target name="test" depends="testprep">
494

    
495
      <!-- use the ant "junit" task to run JUnit tests. -->
496
      <junit printsummary="yes" haltonfailure="no" fork="yes"
497
             haltonerror="no">
498
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
499
        <classpath>
500
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
501
        </classpath>
502

    
503
        <formatter type="plain" />
504

    
505
        <batchtest fork="yes" todir="${build.dir}">
506
          <fileset dir="${build.tests}">
507
            <include name="**/*.class" />
508
          </fileset>
509
        </batchtest>
510
     </junit>
511
   </target>
512

    
513
    <target name="runonetest" depends="testprep">
514
      <echo>testtorun: ${testtorun}</echo>
515

    
516
      <!-- use the ant "junit" task to run JUnit tests. -->
517
      <junit printsummary="yes" haltonfailure="no" fork="yes"
518
             haltonerror="no">
519
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
520
        <classpath>
521
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
522
        </classpath>
523

    
524
        <formatter type="plain" />
525

    
526
        <batchtest fork="yes" todir="${build.dir}">
527
          <fileset dir="${build.tests}">
528
            <include name="**/${testtorun}.class" />
529
          </fileset>
530
        </batchtest>
531
     </junit>
532
   </target>
533

    
534
  <target name="gethttpclient" depends="prepare">
535
  <!--mkdir dir="${morphosourcedir}" -->
536
        <cvs cvsRoot="${cvsroot}"
537
             package="morpho"
538
             dest="." />
539
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
540
   </target>
541

    
542
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
543
   <target name="nettest" depends="install">
544
      <echo>***********************************
545
      Please run ant gethttpclient first!
546
      ***********************************
547
      </echo>
548
      <!-- copy and compile the tests into a jar file -->
549
      <mkdir dir="${build.metacatnettest}"/>
550
      <javac srcdir="${junitnettestsdir}"
551
             destdir="${build.metacatnettest}"
552
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
553
             includes="**/*.java" />
554

    
555
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
556
                    basedir="${build.metacatnettest}"
557
                    includes="**/*.class" />
558

    
559
      <!-- use the ant "junit" task to run JUnit tests. -->
560
      <junit printsummary="yes" haltonfailure="no" fork="yes"
561
             haltonerror="no">
562
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
563
        <classpath>
564
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
565
        </classpath>
566

    
567
        <formatter type="plain" />
568

    
569
        <batchtest fork="yes" todir="${build.dir}">
570
          <fileset dir="${build.metacatnettest}">
571
            <include name="**/*.class" />
572
          </fileset>
573
        </batchtest>
574
     </junit>
575
   </target>
576

    
577
   <target name="servletclean" depends="clean">
578
     <delete dir="${installdir}" />
579
   </target>
580

    
581

    
582
   <target name="clean" depends="init">
583
       <delete dir="${build.dir}" />
584
       <delete file="lib/httpclient.jar" />
585
       <delete file="lib/utilities.jar" />
586
   </target>
587

    
588
   <target name="jdoc" depends="prepare">
589
       <javadoc packagenames="edu.ucsb.nceas.*"
590
           sourcepath="${build.src}"
591
           destdir="${build.javadocs}"
592
           author="true"
593
           version="true"
594
           use="true"
595
           windowtitle="${Name} API"
596
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
597
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
598
       />
599
   </target>
600

    
601
   <target name="dist" depends="jar,protocol,jdoc,getdtd,getschema">
602
      <mkdir dir="${dist.dir}"/>
603
      <delete dir="${ver.dir}" />
604
      <mkdir dir="${ver.dir}"/>
605
      <copy todir="${ver.dir}">
606
        <fileset dir="."
607
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
608
      </copy>
609
      <copy todir="${ver.dir}" file="build.xml"/>
610
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
611
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
612

    
613
      <copy todir="${ver.dir}/docs" filtering="yes">
614
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
615
      </copy>
616
      <copy todir="${ver.dir}/docs" filtering="no">
617
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
618
      </copy>
619
      <copy todir="${ver.dir}/docs/dev">
620
        <fileset dir="${build.dir}/docs"/>
621
      </copy>
622
      <copy todir="${ver.dir}/src">
623
        <fileset dir="${build.dir}/src"/>
624
      </copy>
625

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

    
637
  <target name="distsrc" depends="dist">
638
      <mkdir dir="${ver.src}"/>
639
      <copy todir="${ver.src}">
640
        <fileset dir="./src"/>
641
      </copy>
642

    
643
      <delete file="./${name}-src-${release}.zip"/>
644
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
645
      <delete file="./${name}-src-${release}.tar.gz" />
646
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
647
      <gzip zipfile="./${name}-src-${release}.tar.gz"
648
                src="./${name}-src-${release}.tar"/>
649
      <delete file="./${name}-src-${release}.tar" />
650
      <delete dir="${dist.dir}"/>
651
  </target>
652

    
653
   <target name="stylesheettest">
654
     <xslt in="${input}" out="eml.html" style="lib/style/eml2/eml-2.0.0.xsl">
655
      <param name="displaymodule" expression="${displaymodule}"/>
656
      <param name="docid" expression="${input}"/>
657
      <param name="entitytype" expression="${entitytype}"/>
658
      <param name="entityindex" expression="${entityindex}"/>
659
      <outputproperty name="method" value="html"/>
660
      <outputproperty name="standalone" value="yes"/>
661
      <outputproperty name="encoding" value="iso8859_1"/>
662
      <outputproperty name="indent" value="yes"/>
663
    </xslt>
664
  </target>
665
  
666
 <target name="gridinit" depends="init">
667
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
668
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
669
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
670
   <property environment="env"/>
671
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
672
    <path id="webservicepath">
673
        <pathelement location="."/>
674
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
675
        <pathelement location="${build.dest}"/>
676
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
677
           <include name="*.jar"/>
678
        </fileset>
679
      </path>
680
</target>
681

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