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: 2004-01-06 18:42:40 -0800 (Tue, 06 Jan 2004) $'
11
  *    '$Revision: 1990 $'
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

    
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35

    
36
  <target name="check-db">
37
    <condition property="use-oracle">
38
      <equals arg1="${database}" arg2="oracle" />
39
    </condition>
40
    <condition property="use-postgresql">
41
      <equals arg1="${database}" arg2="postgresql" />
42
    </condition>
43
    <condition property="use-sqlserver">
44
      <equals arg1="${database}" arg2="sqlserver" />
45
    </condition>
46
  </target>
47

    
48
  <target name="oracle" if="use-oracle">
49
     <!-- Customize these properties if you are using oracle -->
50
     <echo message="Using oracle..."/>
51
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
52
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
53
     <property name="jdbc" value="${jdbc_base}/classes111.zip" />
54
     <!-- Property to indicate is not MSSQL installation-->
55
     <property name="other" value="yes"/>
56
   </target>
57

    
58
   <target name="postgresql" if="use-postgresql">
59
     <!-- Customize these properties if you are using postgres -->
60
     <echo message="Using PostgreSQL..."/>
61
     <property name="dbDriver" value="org.postgresql.Driver"/>
62
     <property name="dbAdapter"
63
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
64
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
65
     <!-- Property to indicate is not MSSQL installation-->
66
     <property name="other" value="yes"/>
67
    </target>
68
   
69
   <target name="sqlserver" if="use-sqlserver">
70
     <!-- Customize these properties if you are using SQL server -->
71
     <echo message="Using SQL Server..."/>
72
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
73
     <property name="dbAdapter"
74
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
75
     <property name="jdbc" value="${jdbc-base}/msbase.jar" />
76
     <property name="jdbc-add1" value="${jdbc-base}/msutil.jar" />
77
     <property name="jdbc-add2" value="${jdbc-base}/mssqlserver.jar" />
78
     <!-- Property to indicate is a MSSQL installation-->
79
     <property name="MSSQL" value="yes"/>
80
   </target>
81

    
82
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
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
      <property name="debug" value="on" />
90
      <property name="debuglevel" value="55" />
91

    
92
      <property name="morphosourcedir" value="../morpho" />
93
      <property name="defaultcontenttype" value="application/octet-stream" />
94
      <property name="utilitiesdir" value="../utilities" />
95
    
96
      <!-- Make sure these paths match the location of the jar files
97
           on your system, the defaults should usually work -->
98
      <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
99
        <equals arg1="${tomcatversion}" arg2="tomcat3" />
100
      </condition>
101
      <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
102
        <equals arg1="${tomcatversion}" arg2="tomcat4" />
103
      </condition>
104
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
105
      <echo>*********** set jsdk to ${jsdk}</echo>
106
      <property name="xmlp"
107
                value="lib/xercesImpl.jar" />
108
      <property name="cos"
109
                value="lib/cos.jar" />
110
      <property name="morpho"
111
                value="lib/morpho.jar" />
112
      <property name="xalan"
113
                value="lib/xalan/xalan.jar" />
114
      <property name="apis"
115
                value="lib/xalan/xml-apis.jar" />
116
      <property name="httpclient"
117
                value="lib/httpclient.jar" />
118
      <property name="emlparser"
119
                value="lib/eml.jar" />
120
      <property name="configxml"
121
                value="lib/configxml.jar" />
122
      <property name="itislib"
123
                value="lib/itislib.jar" />
124
      <property name="emlparser"
125
      
126
                value="lib/eml.jar" />
127
      <property name="util"
128
                value="lib/utilities.jar" />
129
  </target>
130

    
131
   <target name="init" depends="config">
132
      <!-- It is less likely you'll need to make any changes from here down,
133
           but customization is possible -->
134
      <property name="installdir"          value="${webapps}/${context}" />
135
      <property name="temp-dir"            value="/tmp/${context}" />
136
      <property name="name"                value="metacat"/>
137
      <property name="Name"                value="MetaCat"/>
138
      <property name="debugprefix"         value="${Name}:"/>
139
      <property name="release"             value="1.4.0"/>
140
      <property name="replication-path"    value="/${context}/servlet/replication"/>
141
      <property name="servlet-path"        value="/${context}/metacat"/>
142
      <property name="html-path"           value="/${context}"/>
143
      <property name="systemidserver"      value="http://${server}"/>
144
      <property name="style-common-relpath" 
145
                                           value="/style/common"/>
146
      <property name="style-common-cvsrelpath" 
147
                                           value="lib${style-common-relpath}"/>
148
      <property name="style-common-fullpath" 
149
                                           value="/${installdir}${style-common-relpath}"/>
150
      <property name="style-common-path" 
151
                                           value="/${context}${style-common-relpath}"/>
152
      <property name="style-skins-relpath" value="/style/skins"/>
153
      <property name="style-skins-path"    value="/${context}${style-skins-relpath}"/>
154
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
155
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
156
      <property name="config-dir"          value="${webapps}/${style-skins-path}" />
157
      <property name="eml-module"          value="eml" />
158
      <property name="eml-version"         value="2.0.0beta6" />
159
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
160
      <property name="eml2-tag"            value="EML_2_0_0_FOR_METACAT" />
161
      <property name="eml2namespace"       value="eml://ecoinformatics.org/eml-2.0.0" />
162
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
163
      <property name="eml-css"             value="eml_xsl.css"/>
164
      <property name="eml-module.default.css"
165
                                           value="default.css"/>
166
      <property name="conversion-module"   value="webmdentry" />
167

    
168
      <!-- Config for registry variables -->
169
      <property name="scope"               value="obfs"/>
170
      <property name="responseForm"        value="genericResponse.tmpl"/>
171
      <property name="entryForm"           value="entryForm.tmpl"/>
172
      <property name="guide"               value="genericGuide.tmpl"/>
173
      <property name="confirmData" value="confirmData.tmpl"/>
174
      <property name="deleteData" value="deleteData.tmpl"/>
175
      <property name="genericHeader" value="genericHeader.tmpl"/>
176
      <property name="genericFooter" value="genericFooter.tmpl"/>
177
      <property name="adminname" value="KNB Support"/>
178
      <property name="recipient" value="knb-software\@nceas.ucsb.edu"/>
179
      <filter token="scope" value="${scope}"/>
180
      <filter token="responseForm" value="${responseForm}"/>
181
      <filter token="entryForm" value="${entryForm}"/>
182
      <filter token="guide" value="${guide}"/>      
183
      <filter token="confirmData" value="${confirmData}"/>
184
      <filter token="deleteData" value="${deleteData}"/>
185
      <filter token="genericHeader" value="${genericHeader}"/>
186
      <filter token="genericFooter" value="${genericFooter}"/>
187
      <filter token="adminname" value="${adminname}"/>
188
      <filter token="recipient" value="${recipient}"/>
189

    
190
      <property name="cpath"
191
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${cos}:${morpho}:${emlparser}:${jdbc-add1}:${jdbc-add2}:${util}:${httpclient}"/>
192

    
193
      <filter token="docrooturl" value="./" />
194
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
195
      <filter token="dbDriver" value="${dbDriver}"/>
196
      <filter token="dbAdapter" value="${dbAdapter}"/>
197
      <filter token="install-dir" value="${installdir}"/>
198
      <filter token="temp-dir" value="${temp-dir}"/>
199
      <filter token="server" value="${server}"/>
200
      <filter token="systemidserver" value="${systemidserver}"/>
201
      <filter token="cgi-prefix" value="${cgi-prefix}"/>
202
      <filter token="ldapUrl" value="${ldapUrl}"/>
203
      <filter token="replication-log" value="${replication-log}"/>
204
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
205
      <filter token="release" value="${release}"/>
206
      <filter token="servlet-path" value="${servlet-path}"/>
207
      <filter token="html-path" value="${html-path}"/>
208
      <filter token="user" value="${user}"/>
209
      <filter token="password" value="${password}"/>
210
      <filter token="mcuser" value="${mcuser}"/>
211
      <filter token="mcpassword" value="${mcpassword}"/>
212
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
213
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
214
      <filter token="knb-site-url" value="${knb-site-url}"/>
215
      <filter token="eml-css" value="${eml-css}"/>
216
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
217
      <filter token="style-skins-path" value="${style-skins-path}"/>
218
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
219
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
220
      <filter token="style-common-path" value="${style-common-path}"/>
221
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
222
      <filter token="style-path" value="${style-skins-path}"/>
223
      <filter token="replication-path" value="${replication-path}"/>
224
      <filter token="config-dir" value="${config-dir}"/>
225
      <filter token="default-style" value="${default-style}"/>
226
      <filter token="eml-version" value="${eml-version}"/>
227
      <filter token="eml2namespace" value="${eml2namespace}"/>
228
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
229
      <filter token="context" value="${context}"/>
230
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
231
      <filter token="debuglevel" value="${debuglevel}" />
232
      <filter token="datafilepath" value="${datafilepath}" />
233
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
234
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
235
      <filter token="debugprefix" value="${debugprefix}"/>
236

    
237
      <property name="srcdir" value="./src" />
238
      <property name="testdir" value="./test" />
239
      <property name="testtorun" value="MetacatClientTest" />
240
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
241
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
242
      <property name="build.dir" value="./build"/>
243
      <property name="build.src" value="${build.dir}/src"/>
244
      <property name="build.dest" value="${build.dir}/classes"/>
245
      <property name="build.docs" value="${build.dir}/docs"/>
246
      <property name="build.samples" value="${build.dir}/samples"/>
247
      <property name="build.tests" value="${build.dir}/tests"/>
248
      <property name="build.tmp" value="${build.dir}/tmp"/>
249
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
250
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
251
      <property name="build.data" value="${build.dir}/data"/>
252
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
253
      <property name="build.war" value="${build.dir}/war"/>
254

    
255
      <property name="dist.dir" value="dist"/>
256
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
257
      <property name="ver.src" value="${ver.dir}/src"/>
258

    
259
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
260
   </target>
261

    
262
   <target name="prepare" depends="init">
263
      <mkdir dir="${build.dir}"/>
264
      <mkdir dir="${build.src}"/>
265
      <mkdir dir="${build.dest}"/>
266
      <mkdir dir="${build.javadocs}"/>
267
      <mkdir dir="${build.tmp}"/>
268

    
269
      <copy todir="${build.src}" filtering="yes">
270
        <fileset dir="${srcdir}">
271
          <include name="edu/**"/>
272
          <include name="com/**"/>
273
          <include name="**/*.sql"/>
274
          <exclude name="**/CVS*"/>
275
          <exclude name="**/.#*"/>
276
        </fileset>
277
      </copy>
278
      <available file="build/tmp/${conversion-module}" type="dir" 
279
                 property="styles.not.needed"/>
280
   </target>
281

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

    
285
       <javac srcdir="${build.src}"
286
              destdir="${build.dest}"
287
              classpath="${cpath}"
288
              debug="${debug}"
289
              excludes="**/*.sql **/stringclient/** **/client/*.java"/>
290
   </target>
291

    
292
   <target name="jar" depends="compile"
293
    description="Compiles and jars metacat java code to metacat.jar in build dir">
294

    
295
       <delete file="${build.dir}/${name}.jar" />
296
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
297
            excludes="**/protocols/" />
298
   </target>
299

    
300
   <target name="protocol" depends="compile"
301
    description="Compiles and jars protocol java code to protocol.jar in build dir">
302
       <delete file="${build.dir}/protocol.jar" />
303
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
304
            includes="**/protocols/" />
305
   </target>
306

    
307
   <target name="utilities" depends="config">
308
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
309
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
310
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
311
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
312
   </target>
313

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

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

    
329
   <target name="harvester" depends="clientjar"
330
           description="Compiles harvester java code to build dir">
331
       <echo message="classpath is:   ${cpath}"/>
332
       <javac srcdir="${build.src}"
333
              destdir="${build.dest}"
334
              classpath="${cpath}"
335
              includes="edu/ucsb/nceas/metacat/harvesterClient/*" />
336
   </target>
337

    
338
   <target name="harvesterjar" depends="harvester"
339
           description="Compiles and jars harvester java code to harvester-client.jar in build dir">
340
       <delete file="${build.dir}/harvester-client.jar" />
341
       <jar jarfile="${build.dir}/harvester-client.jar" basedir="${build.dest}"
342
            includes="**/metacat/harvesterClient/" />
343
   </target>
344

    
345
   <target name="installharvester" depends="harvesterjar,install"
346
           description="Installs harvester web-server files">
347
      <mkdir dir="${installdir}/WEB-INF/lib" />
348
      <copy file="lib/style/skins/dev/harvesterLogin.html"
349
            tofile="${installdir}/harvesterLogin.html" />
350
      <copy file="lib/style/skins/dev/harvesterUpload.html"
351
            tofile="${installdir}/harvesterUpload.html" />
352
      <copy file="${build.dir}/harvester-client.jar"
353
            tofile="${installdir}/WEB-INF/lib/harvester-client.jar" />
354
   </target>
355
   
356
   <target  name="geteml" depends="getemlpre2,geteml2+" 
357
            description="Calls getemlpre2 and geteml2+ targets" />
358

    
359
   <target name="getemlpre2" depends="prepare"
360
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
361
     <echo>Enter CVS password: </echo>
362
     <cvs cvsRoot="${cvsroot}"
363
          package="${eml-module}"
364
          tag="${eml-tag}"
365
          dest="${build.tmp}/eml_${eml-tag}" />
366
     <mkdir dir="lib/dtd" />
367
     <copy todir="lib/dtd" filtering="yes">
368
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
369
         <include name="*.dtd"/>
370
       </fileset>
371
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
372
     </copy>
373
     <antcall target="copyxsl">
374
        <param name="cvs.tagname" value="${eml-tag}" />
375
     </antcall>
376
   </target>
377

    
378
   <target name="geteml2+" depends="prepare"
379
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
380
     <echo>Enter CVS password: </echo>
381
     <cvs cvsRoot="${cvsroot}"
382
          package="${eml-module}"
383
          tag="${eml2-tag}"
384
          dest="${build.tmp}/eml_${eml2-tag}" />
385
     <mkdir dir="lib/schema" />
386
     <copy todir="lib/schema" filtering="yes">
387
       <fileset dir="${build.tmp}/eml_${eml2-tag}/${eml-module}">
388
         <include name="*.xsd"/>
389
       </fileset>
390
       
391
       <!-- shouldn't we have a mapper here like this??
392
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
393
       
394
       Jing's code didn't nave one - does it need to be added? 
395
       NOTE that eml-version is set to beta 6, so this would need changing -->
396
     
397
     </copy>
398
     <antcall target="copyxsl">
399
        <param name="cvs.tagname" value="${eml2-tag}" />
400
     </antcall>
401
   </target>
402
   
403
   
404

    
405
   <target  name="copyxsl" 
406
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
407

    
408
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
409
     
410
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
411
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style">
412
       <include name="**/*.xsl"/>
413
     </fileset>
414
     </copy>
415
     
416

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

    
422
   </target>
423
   
424
   
425
   
426
   <target name="dtdschemasql" depends="prepare"
427
   description="Registers the DTDs with the new Metacat instance">
428
     <echo/>
429
     <echo>Registering the DTDs with the new Metacat instance...</echo>
430
     <sql driver="${dbDriver}"
431
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
432
          url="${jdbc-connect}"
433
          userid="${user}"
434
          password="${password}"
435
          src="${build.src}/loaddtdschema.sql" />
436
   </target>
437

    
438
   <target name="schemasql" depends="prepare"
439
            description="Registers the Schema with the new Metacat instance">
440
     <echo/>
441
     <echo>Registering the Schema with the new Metacat instance...</echo>
442
     <sql driver="${dbDriver}"
443
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
444
          url="${jdbc-connect}"
445
          userid="${user}"
446
          password="${password}"
447
          src="${build.src}/loadschema.sql" />
448
   </target>
449
   
450
   <target name="installdb" depends="prepare"
451
            description="Installs the database tables">
452
     <echo/>
453
     <echo>Installing the database tables...</echo>
454
     <sql driver="${dbDriver}"
455
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
456
          url="${jdbc-connect}"
457
          userid="${user}"
458
          password="${password}"
459
          src="${build.src}/xmltables.sql" />
460
   </target>
461

    
462
   <target name="upgrade12" depends="prepare"
463
            description="Updates the database tables to upgrade to version 1.2">
464
     <echo/>
465
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
466
     <sql driver="${dbDriver}"
467
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
468
          url="${jdbc-connect}"
469
          userid="${user}"
470
          password="${password}"
471
          src="${build.src}/upgrade-db-to-1.2.sql" />
472
   </target>
473

    
474
   <target name="upgrade13" depends="prepare"
475
            description="Updates the database tables to upgrade to version 1.3">
476
     <echo/>
477
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
478
     <sql driver="${dbDriver}"
479
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
480
          url="${jdbc-connect}"
481
          userid="${user}"
482
          password="${password}"
483
          src="${build.src}/upgrade-db-to-1.3.sql" />
484
   </target>
485

    
486
   <target name="install" depends="war" description="* Full Install *">
487
       <mkdir dir="${datafilepath}" />
488
       <mkdir dir="${inlinedatafilepath}" />
489
       <chmod dir="${datafilepath}" perm="ug+w" />
490
       <mkdir dir="${temp-dir}"/>
491
       <chmod dir="${temp-dir}" perm="ug+w" />
492
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
493
   </target>
494
   
495
   <target name="upgrade" depends="install" 
496
          description="* Upgrade an existing metacat installation with a new version *">
497
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
498
   </target>
499

    
500
   <target name="install-registry" depends="init,getConversionXSL" 
501
            description="Install Registry">
502
            
503
      <copy file="${srcdir}/perl/register-dataset.cgi"
504
            todir="${inst.cgi.dir}" filtering="yes"/>
505
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
506
  
507
      <mkdir dir="${temp-dir}" />
508
     <copy todir="${temp-dir}" filtering="yes">
509
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
510
         <include name="*.xsl"/>
511
         <include name="*.xml"/>
512
       </fileset>
513
     </copy>
514

    
515
      <echo message="Install Registry completed." />
516
   </target>
517

    
518
   <target name="war" depends="warPrepare,warMSSQL"
519
            description="Create a web archive (WAR) for servlet deployment">
520
       <war destfile="${build.dir}/${context}.war" 
521
            webxml="${build.war}/web.xml">
522
         <fileset dir="${war.context}"/>
523
         <lib dir="${war.lib}"/>
524
         <webinf dir="${war.webinf}"/>
525
       </war>
526
   </target>
527

    
528
   <target name="warPrepare" depends="jar,clientjar"
529
            description="Prepare files for creating a web archive (WAR)">
530

    
531
       <property name="war.lib" value="${build.war}/lib" />
532
       <property name="war.webinf" value="${build.war}/WEB-INF" />
533
       <property name="war.context" value="${build.war}/${context}" />
534
       <mkdir dir="${war.lib}" />
535
       <mkdir dir="${war.webinf}" />
536
       <mkdir dir="${war.context}" />
537

    
538
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
539
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
540
       <copy todir="${war.lib}" filtering="no">
541
         <fileset dir="lib">
542
           <include name="*.jar"/>
543
         </fileset>
544
         <fileset dir="lib/xalan">
545
           <include name="*.jar"/>
546
         </fileset>
547
       </copy>
548
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
549
       <copy file="lib/web.xml.${tomcatversion}"
550
             tofile="${build.war}/web.xml" />
551
       <copy file="lib/metacat.properties" todir="${war.webinf}"
552
             filtering="yes" />
553
       <copy todir="${war.context}" filtering="no">
554
         <fileset dir="lib">
555
           <include name="**/*.jpg"/>
556
           <include name="**/*.png"/>
557
           <include name="**/*.gif"/>
558
         </fileset>
559
       </copy>
560
       <copy todir="${war.context}" filtering="yes">
561
         <fileset dir="lib">
562
           <exclude name="*.jar"/>
563
           <exclude name="*.properties"/>
564
           <exclude name="web.xml"/>
565
           <exclude name="**/*.jpg"/>
566
           <exclude name="**/*.png"/>
567
           <exclude name="**/*.gif"/>
568
         </fileset>
569
       </copy>
570
       <copy todir="${war.context}" filtering="no">
571
         <fileset dir="lib">
572
           <include name="**/*.jpg"/>
573
           <include name="**/*.png"/>
574
           <include name="**/*.gif"/>
575
         </fileset>
576
       </copy>
577
   </target>
578

    
579
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
580
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
581
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
582
   </target>
583

    
584
   <target name="getConversionXSL" depends="prepare" 
585
            unless="styles.not.needed"
586
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
587
     <echo>Enter CVS password: </echo>
588
     <cvs cvsRoot="${cvsroot-alternate}"
589
          package="${conversion-module}"
590
          dest="${build.tmp}" />
591
   </target>
592

    
593
   <target name="testprep" depends="jar,clientjar">
594
      <mkdir dir="${build.tests}"/>
595
      <copy todir="${build.tests}" filtering="yes">
596
        <fileset dir="${testdir}">
597
          <include name="edu/**"/>
598
        </fileset>
599
      </copy>
600
      <!-- copy and compile the tests into a jar file -->
601
      <javac srcdir="${build.tests}"
602
             destdir="${build.tests}"
603
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar"
604
             debug="on"
605
       includes="**/*.java" />
606

    
607
      <jar jarfile="${build.dir}/${name}-junittests.jar"
608
        basedir="${build.tests}"
609
                includes="**/*.class" />
610
   </target>
611

    
612
   <target name="test" depends="testprep"
613
            description="Uses the ant junit task to run all JUnit tests">
614

    
615
      <!-- use the ant "junit" task to run JUnit tests. -->
616
      <junit printsummary="yes" haltonfailure="no" fork="yes"
617
             haltonerror="no">
618
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
619
        <classpath>
620
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
621
        </classpath>
622

    
623
        <formatter type="plain" />
624

    
625
        <batchtest fork="yes" todir="${build.dir}">
626
          <fileset dir="${build.tests}">
627
            <include name="**/*.class" />
628
          </fileset>
629
        </batchtest>
630
     </junit>
631
   </target>
632

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

    
636
              <echo>testtorun: ${testtorun}</echo>
637

    
638
      <!-- use the ant "junit" task to run JUnit tests. -->
639
      <junit printsummary="yes" haltonfailure="no" fork="yes"
640
             haltonerror="no">
641
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
642
        <classpath>
643
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
644
        </classpath>
645

    
646
        <formatter type="plain" />
647

    
648
        <batchtest fork="yes" todir="${build.dir}">
649
          <fileset dir="${build.tests}">
650
            <include name="**/${testtorun}.class" />
651
          </fileset>
652
        </batchtest>
653
     </junit>
654
   </target>
655

    
656
  <target name="gethttpclient" depends="prepare"
657
            description="checks out and compiles morpho httpclient code">
658
  <!--mkdir dir="${morphosourcedir}" -->
659
        <cvs cvsRoot="${cvsroot}"
660
             package="morpho"
661
             dest="." />
662
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
663
   </target>
664

    
665
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
666
   <target name="nettest" depends="install"
667
            description="compiles and runs the metacatnettest code">
668
            
669
      <echo>***********************************
670
      Please run ant gethttpclient first!
671
      ***********************************
672
      </echo>
673
      <!-- copy and compile the tests into a jar file -->
674
      <mkdir dir="${build.metacatnettest}"/>
675
      <javac srcdir="${junitnettestsdir}"
676
             destdir="${build.metacatnettest}"
677
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
678
             includes="**/*.java" />
679

    
680
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
681
                    basedir="${build.metacatnettest}"
682
                    includes="**/*.class" />
683

    
684
      <!-- use the ant "junit" task to run JUnit tests. -->
685
      <junit printsummary="yes" haltonfailure="no" fork="yes"
686
             haltonerror="no">
687
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
688
        <classpath>
689
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
690
        </classpath>
691

    
692
        <formatter type="plain" />
693

    
694
        <batchtest fork="yes" todir="${build.dir}">
695
          <fileset dir="${build.metacatnettest}">
696
            <include name="**/*.class" />
697
          </fileset>
698
        </batchtest>
699
     </junit>
700
   </target>
701

    
702
   <target name="cleanweb" depends="clean"
703
            description="deletes tomcat web context dir and all its contents">
704
     <delete dir="${installdir}" />
705
   </target>
706

    
707

    
708
   <target name="clean" depends="init"
709
            description="deletes build dir and any files copied to cvs sandbox by build process (jars, xsl) Currently *not* schema/DTDs">
710
       <delete dir="${build.dir}" />
711
       <delete file="lib/httpclient.jar" />
712
       <delete file="lib/utilities.jar" />
713
       <delete includeEmptyDirs="true" failonerror="false">
714
         <fileset dir="${style-common-cvsrelpath}">
715
           <include name="${eml-css}" />
716
           <include name="eml-*/*.xsl" />
717
           <include name="eml-*" />
718
         </fileset>
719
     </delete>
720
   </target>
721

    
722
   <target name="jdoc" depends="prepare"
723
            description="generates javadoc documentation">
724
       <javadoc packagenames="edu.ucsb.nceas.*"
725
           sourcepath="${build.src}"
726
           destdir="${build.javadocs}"
727
           author="true"
728
           version="true"
729
           use="true"
730
           windowtitle="${Name} API"
731
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
732
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
733
       />
734
   </target>
735

    
736
   <target name="dist" depends="jar,protocol,jdoc,geteml"
737
            description="prepares a full release distribution">
738
      <mkdir dir="${dist.dir}"/>
739
      <delete dir="${ver.dir}" />
740
      <mkdir dir="${ver.dir}"/>
741
      <copy todir="${ver.dir}">
742
        <fileset dir="."
743
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
744
      </copy>
745
      <copy todir="${ver.dir}" file="build.xml"/>
746
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
747
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
748

    
749
      <copy todir="${ver.dir}/docs" filtering="yes">
750
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
751
      </copy>
752
      <copy todir="${ver.dir}/docs" filtering="no">
753
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
754
      </copy>
755
      <copy todir="${ver.dir}/docs/dev">
756
        <fileset dir="${build.dir}/docs"/>
757
      </copy>
758
      <copy todir="${ver.dir}/src">
759
        <fileset dir="${build.dir}/src"/>
760
      </copy>
761

    
762
      <delete dir="./${ver.dir}/${build.dir}"/>
763
      <delete dir="./${ver.dir}/dist"/>
764
      <delete file="./${name}-${release}.zip"/>
765
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
766
      <delete file="./${name}-${release}.tar.gz" />
767
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
768
      <gzip zipfile="./${name}-${release}.tar.gz"
769
                src="./${name}-${release}.tar"/>
770
      <delete file="./${name}-${release}.tar" />
771
  </target>
772

    
773
  <target name="distsrc" depends="dist"
774
            description="prepares a source distribution">
775
      <mkdir dir="${ver.src}"/>
776
      <copy todir="${ver.src}">
777
        <fileset dir="./src"/>
778
      </copy>
779

    
780
      <delete file="./${name}-src-${release}.zip"/>
781
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
782
      <delete file="./${name}-src-${release}.tar.gz" />
783
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
784
      <gzip zipfile="./${name}-src-${release}.tar.gz"
785
                src="./${name}-src-${release}.tar"/>
786
      <delete file="./${name}-src-${release}.tar" />
787
      <delete dir="${dist.dir}"/>
788
  </target>
789

    
790
   <target name="stylesheettest">
791
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
792
      <param name="displaymodule" expression="${displaymodule}"/>
793
      <param name="docid" expression="${input}"/>
794
      <param name="entitytype" expression="${entitytype}"/>
795
      <param name="entityindex" expression="${entityindex}"/>
796
      <outputproperty name="method" value="html"/>
797
      <outputproperty name="standalone" value="yes"/>
798
      <outputproperty name="encoding" value="iso8859_1"/>
799
      <outputproperty name="indent" value="yes"/>
800
    </xslt>
801
  </target>
802
  
803
 <target name="gridinit" depends="init">
804
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
805
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
806
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
807
   <property environment="env"/>
808
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
809
    <path id="webservicepath">
810
        <pathelement location="."/>
811
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
812
        <pathelement location="${build.dest}"/>
813
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
814
           <include name="*.jar"/>
815
        </fileset>
816
      </path>
817
</target>
818

    
819
 <target name="gridprepare" depends="gridinit, prepare">
820
 </target> 
821
  
822
  <target name="compileinterface" depends="clean, gridprepare">
823
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
824
  </target>
825
  
826
  <target name="generateWSDL" depends="compileinterface">
827
    <echo message="Generating wsdl from ${interface.name} interface"/>
828
    <java classname="${java2wsdl.tool}"
829
          dir="${build.src}" fork="yes"
830
          classpathref="webservicepath"  failonerror="true" >
831
      <arg value="-P"/>
832
      <arg value="${interface.name}PortType"/>
833
      <arg value="-S"/>
834
      <arg value="${interface.name}Service"/>
835
      <arg value="-y"/>
836
      <arg value="WRAPPED"/>
837
      <arg value="-u"/>
838
      <arg value="LITERAL"/>
839
      <arg value="-l"/>
840
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
841
      <arg value="-n"/>
842
      <arg value="http://${services.namespace}/${interface.name}"/>
843
      <arg value="${interface.package}.${interface.name}"/>
844
    </java>
845
  </target>
846
  
847
   <target name="decorateWSDL" depends="generateWSDL">
848
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
849
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
850
            fork="yes"
851
            classpathref="webservicepath" failonerror="true" >
852
        <arg value="${binding.file}"/>
853
        <arg value="${wsdl.file}"/>
854
      </java>
855
   </target>
856
   
857
   <target name="generatestubs" depends="decorateWSDL">
858
      <echo message=" Generating stubs " />
859
      <echo message="wsdl file is ${wsdl.file}"/>
860
      <echo message="build.src is ${build.src}"/>
861
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
862
            classpathref="webservicepath" failonerror="true" >
863
         <arg value="${wsdl.file}"/>
864
    </java>
865
  </target>
866
  
867
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
868
     <echo message=" Compiling stubs " />
869
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
870
     <echo message=" Compiling impl " />
871
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
872
  </target>
873
  
874
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
875
     <echo message=" jar stubs classes " />
876
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
877
     <echo message=" jar impl classes " />
878
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
879
  </target>
880
  
881
  <target name="gar" depends="jarStubsAndImpl">
882
     <echo message=" jar the gar file"/>
883
     <mkdir dir="${build.dir}/gar"/>
884
     <mkdir dir="${build.dir}/gar/schema/edu"/>
885
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
886
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
887
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
888
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
889
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
890
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
891
  </target>
892
  
893
  <target name="compilewebclient" depends="prepare">
894
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
895
  </target>
896
  
897
  <target name="runwebclient" depends="compilewebclient">
898
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication" 
899
           dir="${build.dest}" fork="yes"
900
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
901
         <arg value="${serviceUrl}"/>
902
         <arg value="${docid}"/>
903
     </java>
904
  </target>
905
</project>
(5-5/5)