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: costa $'
10
  *    '$Date: 2004-03-24 09:21:04 -0800 (Wed, 24 Mar 2004) $'
11
  *    '$Revision: 2059 $'
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
      <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
105
        <equals arg1="${tomcatversion}" arg2="tomcat5" />
106
      </condition>
107
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
108
      <echo>*********** set jsdk to ${jsdk}</echo>
109
      <property name="xmlp"
110
                value="lib/xercesImpl.jar" />
111
      <property name="cos"
112
                value="lib/cos.jar" />
113
      <property name="morpho"
114
                value="lib/morpho.jar" />
115
      <property name="xalan"
116
                value="lib/xalan/xalan.jar" />
117
      <property name="apis"
118
                value="lib/xalan/xml-apis.jar" />
119
      <property name="httpclient"
120
                value="lib/httpclient.jar" />
121
      <property name="emlparser"
122
                value="lib/eml.jar" />
123
      <property name="configxml"
124
                value="lib/configxml.jar" />
125
      <property name="itislib"
126
                value="lib/itislib.jar" />
127
      <property name="emlparser"
128
      
129
                value="lib/eml.jar" />
130
      <property name="util"
131
                value="lib/utilities.jar" />
132
  </target>
133

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

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

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

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

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

    
258
      <property name="dist.dir" value="dist"/>
259
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
260
      <property name="ver.src" value="${ver.dir}/src"/>
261

    
262
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
263
   </target>
264

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

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

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

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

    
295
   <target name="jar" depends="compile"
296
    description="Compiles and jars metacat java code to metacat.jar in build dir">
297

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

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

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

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

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

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

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

    
348
   <target  name="geteml" depends="getemlpre2,geteml2+" 
349
            description="Calls getemlpre2 and geteml2+ targets" />
350

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

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

    
397
   <target  name="copyxsl" 
398
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
399

    
400
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
401
     
402
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
403
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style">
404
       <include name="**/*.xsl"/>
405
     </fileset>
406
     </copy>
407
     
408

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

    
414
   </target>
415
   
416
   
417
   
418
   <target name="dtdschemasql" depends="prepare"
419
   description="Registers the DTDs with the new Metacat instance">
420
     <echo/>
421
     <echo>Registering the DTDs with the new Metacat instance...</echo>
422
     <sql driver="${dbDriver}"
423
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
424
          url="${jdbc-connect}"
425
          userid="${user}"
426
          password="${password}"
427
          src="${build.src}/loaddtdschema.sql" />
428
   </target>
429

    
430
   <target name="schemasql" depends="prepare"
431
            description="Registers the Schema with the new Metacat instance">
432
     <echo/>
433
     <echo>Registering the Schema with the new Metacat instance...</echo>
434
     <sql driver="${dbDriver}"
435
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
436
          url="${jdbc-connect}"
437
          userid="${user}"
438
          password="${password}"
439
          src="${build.src}/loadschema.sql" />
440
   </target>
441
   
442
   <target name="installdb" depends="prepare"
443
            description="Installs the database tables">
444
     <echo/>
445
     <echo>Installing the database tables...</echo>
446
     <sql driver="${dbDriver}"
447
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
448
          url="${jdbc-connect}"
449
          userid="${user}"
450
          password="${password}"
451
          src="${build.src}/xmltables.sql" />
452
   </target>
453

    
454
   <target name="upgrade12" depends="prepare"
455
            description="Updates the database tables to upgrade to version 1.2">
456
     <echo/>
457
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
458
     <sql driver="${dbDriver}"
459
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
460
          url="${jdbc-connect}"
461
          userid="${user}"
462
          password="${password}"
463
          src="${build.src}/upgrade-db-to-1.2.sql" />
464
   </target>
465

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

    
478
   <target name="install" depends="war" description="* Full Install *">
479
       <mkdir dir="${datafilepath}" />
480
       <mkdir dir="${inlinedatafilepath}" />
481
       <chmod dir="${datafilepath}" perm="ug+w" />
482
       <mkdir dir="${temp-dir}"/>
483
       <chmod dir="${temp-dir}" perm="ug+w" />
484
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
485
   </target>
486
   
487
   <target name="upgrade" depends="install" 
488
          description="* Upgrade an existing metacat installation with a new version *">
489
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
490
   </target>
491

    
492
   <target name="install-registry" depends="init,getConversionXSL" 
493
            description="Install Registry">
494
            
495
      <copy file="${srcdir}/perl/register-dataset.cgi"
496
            todir="${inst.cgi.dir}" filtering="yes"/>
497
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
498
  
499
      <mkdir dir="${temp-dir}" />
500
     <copy todir="${temp-dir}" filtering="yes">
501
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
502
         <include name="*.xsl"/>
503
         <include name="*.xml"/>
504
       </fileset>
505
     </copy>
506

    
507
      <echo message="Install Registry completed." />
508
   </target>
509

    
510
   <target name="install-skin" depends="init" 
511
            description="Install a Skin">
512

    
513
      <input message="Please enter name of the skin" 
514
             addproperty="skin-name"/>
515

    
516
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
517
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
518
       <fileset dir="lib/style/skins/${skin-name}">
519
           <include name="*.*"/>
520
           <exclude name="*.png"/>
521
           <exclude name="*.gif"/>
522
       </fileset>
523
      </copy>
524
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
525
       <fileset dir="lib/style/skins/${skin-name}">
526
           <include name="*.png"/>
527
           <include name="*.gif"/>
528
       </fileset>
529
      </copy>
530

    
531
      <echo message="Install Skin completed." />
532
   </target>
533

    
534
   <target name="war" depends="warPrepare,warMSSQL"
535
            description="Create a web archive (WAR) for servlet deployment">
536
       <war destfile="${build.dir}/${context}.war" 
537
            webxml="${build.war}/web.xml">
538
         <fileset dir="${war.context}"/>
539
         <lib dir="${war.lib}"/>
540
         <webinf dir="${war.webinf}"/>
541
       </war>
542
   </target>
543

    
544
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
545
            description="Prepare files for creating a web archive (WAR)">
546

    
547
       <property name="war.lib" value="${build.war}/lib" />
548
       <property name="war.webinf" value="${build.war}/WEB-INF" />
549
       <property name="war.context" value="${build.war}/${context}" />
550
       <mkdir dir="${war.lib}" />
551
       <mkdir dir="${war.webinf}" />
552
       <mkdir dir="${war.context}" />
553

    
554
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
555
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
556
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
557
       <copy todir="${war.lib}" filtering="no">
558
         <fileset dir="lib">
559
           <include name="*.jar"/>
560
         </fileset>
561
         <fileset dir="lib/xalan">
562
           <include name="*.jar"/>
563
         </fileset>
564
       </copy>
565
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
566
       <copy file="lib/web.xml.${tomcatversion}"
567
             tofile="${build.war}/web.xml" />
568
       <copy file="lib/metacat.properties" todir="${war.webinf}"
569
             filtering="yes" />
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
       <copy todir="${war.context}" filtering="yes">
578
         <fileset dir="lib">
579
           <exclude name="*.jar"/>
580
           <exclude name="*.properties"/>
581
           <exclude name="web.xml"/>
582
           <exclude name="**/*.jpg"/>
583
           <exclude name="**/*.png"/>
584
           <exclude name="**/*.gif"/>
585
         </fileset>
586
       </copy>
587
       <copy todir="${war.context}" filtering="no">
588
         <fileset dir="lib">
589
           <include name="**/*.jpg"/>
590
           <include name="**/*.png"/>
591
           <include name="**/*.gif"/>
592
         </fileset>
593
       </copy>
594
   </target>
595

    
596
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
597
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
598
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
599
   </target>
600

    
601
   <target name="getConversionXSL" depends="prepare" 
602
            unless="styles.not.needed"
603
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
604
     <echo>Enter CVS password: </echo>
605
     <cvs cvsRoot="${cvsroot-alternate}"
606
          package="${conversion-module}"
607
          dest="${build.tmp}" />
608
   </target>
609

    
610
   <target name="testprep" depends="jar,clientjar">
611
      <mkdir dir="${build.tests}"/>
612
      <copy todir="${build.tests}" filtering="yes">
613
        <fileset dir="${testdir}">
614
          <include name="edu/**"/>
615
        </fileset>
616
      </copy>
617
      <!-- copy and compile the tests into a jar file -->
618
      <javac srcdir="${build.tests}"
619
             destdir="${build.tests}"
620
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar"
621
             debug="on"
622
       includes="**/*.java" />
623

    
624
      <jar jarfile="${build.dir}/${name}-junittests.jar"
625
        basedir="${build.tests}"
626
                includes="**/*.class" />
627
   </target>
628

    
629
   <target name="test" depends="testprep"
630
            description="Uses the ant junit task to run all JUnit tests">
631

    
632
      <!-- use the ant "junit" task to run JUnit tests. -->
633
      <junit printsummary="yes" haltonfailure="no" fork="yes"
634
             haltonerror="no">
635
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
636
        <classpath>
637
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
638
        </classpath>
639

    
640
        <formatter type="plain" />
641

    
642
        <batchtest fork="yes" todir="${build.dir}">
643
          <fileset dir="${build.tests}">
644
            <include name="**/*.class" />
645
          </fileset>
646
        </batchtest>
647
     </junit>
648
   </target>
649

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

    
653
              <echo>testtorun: ${testtorun}</echo>
654

    
655
      <!-- use the ant "junit" task to run JUnit tests. -->
656
      <junit printsummary="yes" haltonfailure="no" fork="yes"
657
             haltonerror="no">
658
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
659
        <classpath>
660
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
661
        </classpath>
662

    
663
        <formatter type="plain" />
664

    
665
        <batchtest fork="yes" todir="${build.dir}">
666
          <fileset dir="${build.tests}">
667
            <include name="**/${testtorun}.class" />
668
          </fileset>
669
        </batchtest>
670
     </junit>
671
   </target>
672

    
673
  <target name="gethttpclient" depends="prepare"
674
            description="checks out and compiles morpho httpclient code">
675
  <!--mkdir dir="${morphosourcedir}" -->
676
        <cvs cvsRoot="${cvsroot}"
677
             package="morpho"
678
             dest="." />
679
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
680
   </target>
681

    
682
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
683
   <target name="nettest" depends="install"
684
            description="compiles and runs the metacatnettest code">
685
            
686
      <echo>***********************************
687
      Please run ant gethttpclient first!
688
      ***********************************
689
      </echo>
690
      <!-- copy and compile the tests into a jar file -->
691
      <mkdir dir="${build.metacatnettest}"/>
692
      <javac srcdir="${junitnettestsdir}"
693
             destdir="${build.metacatnettest}"
694
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
695
             includes="**/*.java" />
696

    
697
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
698
                    basedir="${build.metacatnettest}"
699
                    includes="**/*.class" />
700

    
701
      <!-- use the ant "junit" task to run JUnit tests. -->
702
      <junit printsummary="yes" haltonfailure="no" fork="yes"
703
             haltonerror="no">
704
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
705
        <classpath>
706
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
707
        </classpath>
708

    
709
        <formatter type="plain" />
710

    
711
        <batchtest fork="yes" todir="${build.dir}">
712
          <fileset dir="${build.metacatnettest}">
713
            <include name="**/*.class" />
714
          </fileset>
715
        </batchtest>
716
     </junit>
717
   </target>
718

    
719
   <target name="cleanweb" depends="clean"
720
            description="deletes tomcat web context dir and all its contents">
721
     <delete dir="${installdir}" />
722
   </target>
723

    
724

    
725
   <target name="clean" depends="init"
726
            description="deletes build dir and any files copied to cvs sandbox by build process (jars, xsl) Currently *not* schema/DTDs">
727
       <delete dir="${build.dir}" />
728
       <delete file="lib/httpclient.jar" />
729
       <delete file="lib/utilities.jar" />
730
       <delete includeEmptyDirs="true" failonerror="false">
731
         <fileset dir="${style-common-cvsrelpath}">
732
           <include name="${eml-css}" />
733
           <include name="eml-*/*.xsl" />
734
           <include name="eml-*" />
735
         </fileset>
736
     </delete>
737
   </target>
738

    
739
   <target name="jdoc" depends="prepare"
740
            description="generates javadoc documentation">
741
       <javadoc packagenames="edu.ucsb.nceas.*"
742
           sourcepath="${build.src}"
743
           destdir="${build.javadocs}"
744
           author="true"
745
           version="true"
746
           use="true"
747
           windowtitle="${Name} API"
748
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
749
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
750
       />
751
   </target>
752

    
753
   <target name="dist" depends="jar,protocol,jdoc,geteml"
754
            description="prepares a full release distribution">
755
      <mkdir dir="${dist.dir}"/>
756
      <delete dir="${ver.dir}" />
757
      <mkdir dir="${ver.dir}"/>
758
      <copy todir="${ver.dir}">
759
        <fileset dir="."
760
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
761
      </copy>
762
      <copy todir="${ver.dir}" file="build.xml"/>
763
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
764
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
765

    
766
      <copy todir="${ver.dir}/docs" filtering="yes">
767
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
768
      </copy>
769
      <copy todir="${ver.dir}/docs" filtering="no">
770
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
771
      </copy>
772
      <copy todir="${ver.dir}/docs/dev">
773
        <fileset dir="${build.dir}/docs"/>
774
      </copy>
775
      <copy todir="${ver.dir}/src">
776
        <fileset dir="${build.dir}/src"/>
777
      </copy>
778

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

    
790
  <target name="distsrc" depends="dist"
791
            description="prepares a source distribution">
792
      <mkdir dir="${ver.src}"/>
793
      <copy todir="${ver.src}">
794
        <fileset dir="./src"/>
795
      </copy>
796

    
797
      <delete file="./${name}-src-${release}.zip"/>
798
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
799
      <delete file="./${name}-src-${release}.tar.gz" />
800
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
801
      <gzip zipfile="./${name}-src-${release}.tar.gz"
802
                src="./${name}-src-${release}.tar"/>
803
      <delete file="./${name}-src-${release}.tar" />
804
      <delete dir="${dist.dir}"/>
805
  </target>
806

    
807
   <target name="stylesheettest">
808
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
809
      <param name="displaymodule" expression="${displaymodule}"/>
810
      <param name="docid" expression="${input}"/>
811
      <param name="entitytype" expression="${entitytype}"/>
812
      <param name="entityindex" expression="${entityindex}"/>
813
      <outputproperty name="method" value="html"/>
814
      <outputproperty name="standalone" value="yes"/>
815
      <outputproperty name="encoding" value="iso8859_1"/>
816
      <outputproperty name="indent" value="yes"/>
817
    </xslt>
818
  </target>
819
  
820
 <target name="gridinit" depends="init">
821
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
822
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
823
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
824
   <property environment="env"/>
825
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
826
    <path id="webservicepath">
827
        <pathelement location="."/>
828
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
829
        <pathelement location="${build.dest}"/>
830
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
831
           <include name="*.jar"/>
832
        </fileset>
833
      </path>
834
</target>
835

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