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: 2005-11-23 13:32:04 -0800 (Wed, 23 Nov 2005) $'
11
  *    '$Revision: 2778 $'
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
  <property environment="env"/>
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35

    
36
  <!-- Determine which tomcat we are using and tomcat-specific settings -->
37
  <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
38
    <equals arg1="${tomcatversion}" arg2="tomcat3" />
39
  </condition>
40
  <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
41
    <equals arg1="${tomcatversion}" arg2="tomcat4" />
42
  </condition>
43
  <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
44
    <equals arg1="${tomcatversion}" arg2="tomcat5" />
45
  </condition>
46

    
47
  <target name="check-db">
48
    <condition property="use-oracle">
49
      <equals arg1="${database}" arg2="oracle" />
50
    </condition>
51
    <condition property="use-postgresql">
52
      <equals arg1="${database}" arg2="postgresql" />
53
    </condition>
54
    <condition property="use-sqlserver">
55
      <equals arg1="${database}" arg2="sqlserver" />
56
    </condition>
57
  </target>
58

    
59
  <target name="oracle" if="use-oracle">
60
     <!-- Customize these properties if you are using oracle -->
61
     <echo message="Using oracle..."/>
62
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
63
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
64
     <property name="jdbc-jar-name" value="classes111.zip" />
65
     <property name="jdbc" value="${jdbc_base}/${jdbc-jar-name}" />
66
     <!-- Property to indicate is not MSSQL installation-->
67
     <property name="other" value="yes"/>
68
     <property name="install-sql"
69
               value="xmltables.sql" />
70
     <property name="upgrade-1.2-sql"
71
               value="upgrade-db-to-1.2.sql" />
72
     <property name="upgrade-1.3-sql"
73
               value="upgrade-db-to-1.3.sql" />
74
     <property name="upgrade-1.4-sql"
75
               value="upgrade-db-to-1.4.sql" />
76
     <property name="upgrade-1.5-sql"
77
               value="upgrade-db-to-1.5.sql" />
78
     <property name="upgrade-1.6-sql"
79
               value="upgrade-db-to-1.6.sql" />
80
   </target>
81

    
82
   <target name="postgresql" if="use-postgresql">
83
     <!-- Customize these properties if you are using postgres -->
84
     <echo message="Using PostgreSQL..."/>
85
     <property name="dbDriver" value="org.postgresql.Driver"/>
86
     <property name="dbAdapter"
87
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
88
     <property name="jdbc-jar-name" value="postgresql-8.0-312.jdbc3.jar" />
89
     <property name="jdbc" value="lib/${jdbc-jar-name}" />
90
     <!-- Property to indicate is not MSSQL installation-->
91
     <property name="other" value="yes"/>
92
     <property name="install-sql"
93
               value="xmltables-postgres.sql" />
94
     <property name="upgrade-1.2-sql"
95
               value="upgrade-db-to-1.2-postgres.sql" />
96
     <property name="upgrade-1.3-sql"
97
               value="upgrade-db-to-1.3-postgres.sql" />
98
     <property name="upgrade-1.4-sql"
99
               value="upgrade-db-to-1.4-postgres.sql" />
100
     <property name="upgrade-1.5-sql"
101
               value="upgrade-db-to-1.5-postgres.sql" />
102
     <property name="upgrade-1.6-sql"
103
               value="upgrade-db-to-1.6-postgres.sql" />
104
    </target>
105

    
106
   <target name="sqlserver" if="use-sqlserver">
107
     <!-- Customize these properties if you are using SQL server -->
108
     <echo message="Using SQL Server..."/>
109
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
110
     <property name="dbAdapter"
111
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
112
     <property name="jdbc" value="${jdbc_base}/msbase.jar" />
113
     <property name="jdbc-add1" value="${jdbc_base}/msutil.jar" />
114
     <property name="jdbc-add2" value="${jdbc_base}/mssqlserver.jar" />
115
     <!-- Property to indicate is a MSSQL installation-->
116
     <property name="MSSQL" value="yes"/>
117
     <property name="install-sql"
118
               value="xmltables-sqlserver.sql" />
119
   </target>
120

    
121
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
122
      <!-- usr for client testing, generally you don't need change-->
123
      <property name="mcuser" value="uid=jones,o=NCEAS,dc=ecoinformatics,dc=org"/>
124
      <property name="mcpassword" value=""/>
125
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
126
      <property name="mcanotherpassword" value=""/>
127

    
128
      <property name="debug" value="on" />
129
      <property name="debuglevel" value="55" />
130

    
131
      <property name="morphosourcedir" value="../morpho" />
132
      <property name="defaultcontenttype" value="application/octet-stream" />
133
      <property name="utilitiesdir" value="../utilities" />
134

    
135
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
136
      <echo>*********** set jsdk to ${jsdk}</echo>
137
  </target>
138

    
139
   <target name="init" depends="config">
140
      <path id="compile.classpath">
141
        <pathelement location="${jsdk}"/>
142
        <pathelement location="lib" />
143
        <fileset dir="lib">
144
          <include name="*.jar"/>
145
        </fileset>
146
       <fileset dir="lib/lsid_lib">
147
         <include name="*.jar"/>
148
       </fileset>
149
       <fileset dir="${jdbc_base}">
150
         <include name="${jdbc-jar-name}"/>
151
          <include name="msbase.jar"/>
152
          <include name="msutil.jar"/>
153
          <include name="mssqlserver.jar"/>
154
        </fileset>
155
       </path>
156
      
157
      <!-- It is less likely you'll need to make any changes from here down,
158
           but customization is possible -->
159
      <property name="installdir"          value="${deploy.dir}/${metacat.context}" />
160
      <property name="temp-dir"            value="/tmp/${metacat.context}" />
161
      <property name="name"                value="metacat"/>
162
      <property name="Name"                value="MetaCat"/>
163
      <property name="debugprefix"         value="${Name}:"/>
164
      <property name="release"             value="1.6.0"/>
165
      <property name="replication-path"    value="/${metacat.context}/servlet/replication"/>
166
      <property name="harvester-registration-login-path" value="/${metacat.context}/harvesterRegistrationLogin"/>
167
      <property name="harvester-registration-path"       value="/${metacat.context}/harvesterRegistration"/>
168
      <property name="servlet-path"        value="/${metacat.context}/metacat"/>
169
      <property name="html-path"           value="/${metacat.context}"/>
170
      <property name="systemidserver"      value="http://${httpserver}"/>
171
      <property name="style-common-relpath"
172
                                           value="/style/common"/>
173
      <property name="style-common-cvsrelpath"
174
                                           value="lib${style-common-relpath}"/>
175
      <property name="style-common-fullpath"
176
                                           value="/${installdir}${style-common-relpath}"/>
177
      <property name="templates.dir"       value="${style-common-fullpath}/templates"/>
178
      <property name="style-common-path"
179
                                           value="/${metacat.context}${style-common-relpath}"/>
180
      <property name="style-skins-relpath" value="/style/skins"/>
181
      <property name="style-skins-path"    value="/${metacat.context}${style-skins-relpath}"/>
182
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
183
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
184
      <property name="config-dir"          value="${deploy.dir}/${style-skins-path}" />
185
      <property name="util-module"         value="utilities" />
186
      <property name="eml-module"          value="eml" />
187
      <property name="eml-version"         value="2.0.0beta6" />
188
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
189
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
190
      <property name="eml2_0_1-tag"        value="RELEASE_EML_2_0_1_UPDATE_1" />
191
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
192
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
193
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
194
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
195
      <property name="eml-css"             value="eml_xsl.css"/>
196
      <property name="eml-module.default.css"
197
                                           value="default.css"/>
198

    
199
      <!-- Config for registry variables -->
200
      <property name="scope"               value="obfs"/>
201
      <property name="responseForm"        value="genericResponse.tmpl"/>
202
      <property name="entryForm"           value="entryForm.tmpl"/>
203
      <property name="guide"               value="genericGuide.tmpl"/>
204
      <property name="confirmData"         value="confirmData.tmpl"/>
205
      <property name="deleteData"          value="deleteData.tmpl"/>
206
      <property name="genericHeader"       value="genericHeader.tmpl"/>
207
      <property name="genericFooter"       value="genericFooter.tmpl"/>
208
      <property name="adminname"           value="KNB Support"/>
209
      <property name="recipient"           value="knb-software\@nceas.ucsb.edu"/>
210

    
211
      <property name="defaultStage"        value="initregister"/>
212
      <property name="defaultHeader"       value="genericHeader.tmpl"/>
213
      <property name="defaultFooter"       value="genericFooter.tmpl"/>
214
      <property name="defaultChangePass"   value="ldapChangePass.tmpl"/>
215
      <property name="defaultResetPass"    value="ldapResetPass.tmpl"/>
216
      <property name="changePassSuccess"   value="ldapChangePassSuccess.tmpl"/>
217
      <property name="resetPassSuccess"    value="ldapResetPassSuccess.tmpl"/>
218
      <property name="registerFailed"      value="ldapRegisterFailed.tmpl"/>
219
      <property name="registerLter"        value="ldapRegisterLter.tmpl"/>
220
      <property name="registerMatch"       value="ldapRegisterMatch.tmpl"/>
221
      <property name="registerSuccess"     value="ldapRegisterSuccess.tmpl"/>
222
      <property name="register"            value="ldapRegister.tmpl"/>
223
      <property name="searchResults"       value="searchResults.tmpl"/>
224

    
225
      <filter token="scope"                value="${scope}"/>
226
      <filter token="responseForm"         value="${responseForm}"/>
227
      <filter token="entryForm"            value="${entryForm}"/>
228
      <filter token="guide"                value="${guide}"/>
229
      <filter token="confirmData"          value="${confirmData}"/>
230
      <filter token="deleteData"           value="${deleteData}"/>
231
      <filter token="genericHeader"        value="${genericHeader}"/>
232
      <filter token="genericFooter"        value="${genericFooter}"/>
233
      <filter token="adminname"            value="${adminname}"/>
234
      <filter token="recipient"            value="${recipient}"/>
235

    
236
      <filter token="ldapurl"              value="ldap.ecoinformatics.org"/>
237
      <filter token="ldapSearchBase"       value="dc=ecoinformatics,dc=org"/>
238
      <filter token="ldap_user"            value="cn=Manager,dc=ecoinformatics,dc=org"/>
239
      <filter token="ldap_password"        value="ldap_password"/>
240
      <filter token="mailhost"             value="smtp.ecoinformatics.org"/>
241
      <filter token="sender"               value="knb-software\@nceas.ucsb.edu"/>
242
      <filter token="cgiurl"               value="http://${server}/cgi-bin/ldapweb.cgi"/>
243

    
244
      <filter token="docrooturl" value="./" />
245
      <filter token="database" value="${database}" />
246
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
247
      <filter token="dbDriver" value="${dbDriver}"/>
248
      <filter token="dbAdapter" value="${dbAdapter}"/>
249
      <filter token="install-dir" value="${installdir}"/>
250
      <filter token="temp-dir" value="${temp-dir}"/>
251
      <filter token="server" value="${server}"/>
252
      <filter token="systemidserver" value="${systemidserver}"/>
253
      <filter token="cgi-prefix" value="${cgi-prefix}"/>
254
      <filter token="ldapUrl" value="${ldapUrl}"/>
255
      <filter token="replication-log" value="${replication-log}"/>
256
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
257
      <filter token="release" value="${release}"/>
258
      <filter token="servlet-path" value="${servlet-path}"/>
259
      <filter token="html-path" value="${html-path}"/>
260
      <filter token="user" value="${user}"/>
261
      <filter token="password" value="${password}"/>
262
      <filter token="mcuser" value="${mcuser}"/>
263
      <filter token="mcpassword" value="${mcpassword}"/>
264
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
265
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
266
      <filter token="knb-site-url" value="${knb-site-url}"/>
267
      <filter token="eml-css" value="${eml-css}"/>
268
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
269
      <filter token="style-skins-path" value="${style-skins-path}"/>
270
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
271
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
272
      <filter token="style-common-path" value="${style-common-path}"/>
273
      <filter token="templates.dir" value="${templates.dir}"/>
274

    
275
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
276
      <filter token="style-path" value="${style-skins-path}"/>
277
      <filter token="replication-path" value="${replication-path}"/>
278
      <filter token="harvester-registration-login-path" value="${harvester-registration-login-path}"/>
279
      <filter token="harvester-registration-path" value="${harvester-registration-path}"/>
280
      <filter token="config-dir" value="${config-dir}"/>
281
      <filter token="default-style" value="${default-style}"/>
282
      <filter token="eml-version" value="${eml-version}"/>
283
      <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}"/>
284
      <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}"/>
285
      <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}"/>
286
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
287
      <filter token="context" value="${metacat.context}"/>
288
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
289
      <filter token="debuglevel" value="${debuglevel}" />
290
      <filter token="datafilepath" value="${datafilepath}" />
291
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
292
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
293
      <filter token="debugprefix" value="${debugprefix}"/>
294
      <filter token="administrators" value="${administrators}"/>
295
      <filter token="moderators" value="${moderators}"/>
296
      <filter token="allowedSubmitters" value="${allowedSubmitters}"/>
297
      <filter token="deniedSubmitters" value="${deniedSubmitters}"/>
298

    
299
      <filter token="defaultStage" value="${defaultStage}"/>
300
      <filter token="defaultHeader" value="${defaultHeader}"/>
301
      <filter token="defaultFooter" value="${defaultFooter}"/>
302
      <filter token="defaultChangePass" value="${defaultChangePass}"/>
303
      <filter token="defaultResetPass" value="${defaultResetPass}"/>
304
      <filter token="changePassSuccess" value="${changePassSuccess}"/>
305
      <filter token="resetPassSuccess" value="${resetPassSuccess}"/>
306
      <filter token="registerFailed" value="${registerFailed}"/>
307
      <filter token="registerLter" value="${registerLter}"/>
308
      <filter token="registerMatch" value="${registerMatch}"/>
309
      <filter token="registerSuccess" value="${registerSuccess}"/>
310
      <filter token="register" value="${register}"/>
311
      <filter token="searchResults" value="${searchResults}"/>
312
       
313
   	  <filter token="timedreplication" value="${timedreplication}" />
314
   	  <filter token="firsttimedreplication" value="${firsttimedreplication}" />
315
   	  <filter token="timedreplicationinterval" value="${timedreplicationinterval}" />
316
      
317
   	  <property name="srcdir" value="./src" />
318
   	  <property name="lib.dir" value="./lib" />
319
      <property name="testdir" value="./test" />
320
      <property name="testtorun" value="BuildIndexTest" />
321
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
322
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
323
      <property name="build.dir" value="./build"/>
324
      <property name="build.src" value="${build.dir}/src"/>
325
      <property name="build.dest" value="${build.dir}/classes"/>
326
      <property name="build.docs" value="${build.dir}/docs"/>
327
      <property name="build.samples" value="${build.dir}/samples"/>
328
      <property name="build.tests" value="${build.dir}/tests"/>
329
      <property name="build.tmp" value="${build.dir}/tmp"/>
330
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
331
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
332
      <property name="build.data" value="${build.dir}/data"/>
333
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
334
      <property name="build.war" value="${build.dir}/war"/>
335

    
336
      <property name="dist.dir" value="dist"/>
337
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
338
      <property name="ver.src" value="${ver.dir}/src"/>
339
      <property name="util.dir" value="${dist.dir}/${util-module}"/>
340
	  <!-- directories for creating a Harvest List Editor distribution -->
341
      <property name="dist.dir.hle" value="disthle"/>
342
      <property name="ver.dir.hle" value="${dist.dir.hle}/harvest-list-editor-${release}"/>
343

    
344
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
345
      <condition property="utilities.required">
346
        <or>
347
          <not><available file="lib/httpclient.jar"/></not>
348
          <not><available file="lib/utilities.jar"/></not>
349
        </or>
350
      </condition>
351
      <condition property="eml.required">
352
        <or>
353
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
354
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
355
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
356
        </or>
357
      </condition>
358

    
359
   </target>
360

    
361
   <target name="prepare" depends="init">
362
      <mkdir dir="${build.dir}"/>
363
      <mkdir dir="${build.src}"/>
364
      <mkdir dir="${build.dest}"/>
365
      <mkdir dir="${build.javadocs}"/>
366
      <mkdir dir="${build.tmp}"/>
367

    
368
      <copy todir="${build.src}" filtering="yes">
369
        <fileset dir="${srcdir}">
370
          <include name="edu/**"/>
371
          <include name="com/**"/>
372
          <include name="**/*.sql"/>
373
          <exclude name="**/CVS*"/>
374
          <exclude name="**/.#*"/>
375
        </fileset>
376
      </copy>
377
      <available file="lib/style/common/emlb6toeml2" type="dir"
378
                 property="styles.not.needed"/>
379
   </target>
380

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

    
384
       <javac srcdir="${build.src}"
385
              destdir="${build.dest}"
386
              debug="${debug}"
387
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
388
        <classpath>
389
          <path refid="compile.classpath"/>
390
        </classpath>
391
      </javac>
392
   </target>
393

    
394
   <target name="jar" depends="compile,geteml"
395
    description="Compiles and jars metacat java code to metacat.jar in build dir">
396

    
397
       <delete file="${build.dir}/${name}.jar" />
398
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
399
            excludes="**/protocols/ **/harvesterClient/" />
400
   </target>
401

    
402
   <target name="protocol" depends="compile"
403
    description="Compiles and jars protocol java code to protocol.jar in build dir">
404
       <delete file="${build.dir}/protocol.jar" />
405
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
406
            includes="**/protocols/" />
407
   </target>
408

    
409
   <target name="utilities" depends="config" if="utilities.required">
410
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
411
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
412
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
413
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
414
   </target>
415

    
416
   <target name="getutilities" depends="prepare"
417
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
418
     <echo>Enter CVS password: </echo>
419
     <cvs cvsRoot="${cvsroot}"
420
          package="${util-module}"
421
          dest="${build.tmp}" />
422
   </target>
423

    
424
   <target name="client" depends="utilities, prepare"
425
    description="Compiles metacat-client java code to build dir">
426
       <javac srcdir="${build.src}"
427
              destdir="${build.dest}"
428
              includes="edu/ucsb/nceas/metacat/client/*">
429
          <classpath>
430
            <path refid="compile.classpath"/>
431
          </classpath>
432
        </javac>
433
   </target>
434

    
435
   <target name="clientjar" depends="client"
436
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
437
       <delete file="${build.dir}/${name}-client.jar" />
438
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
439
            includes="**/metacat/client/" />
440
   </target>
441

    
442
    <target name="advancedsearchjar" depends="compile"
443
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
444
        <delete file="${build.dir}/advancedsearch.jar" />
445
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
446
             includes="**/metacat/advancedsearch/" />
447
    </target>
448

    
449
   <target name="harvester" depends="client"
450
           description="Compiles harvester java code to build dir">
451
       <javac srcdir="${build.src}"
452
              destdir="${build.dest}"
453
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
454
          <classpath>
455
            <path refid="compile.classpath"/>
456
          </classpath>
457
        </javac>
458
   </target>
459

    
460
   <target name="harvesterjar" depends="harvester"
461
           description="Compiles and jars harvester java code to harvester.jar in build dir">
462
       <delete file="${build.dir}/harvester.jar" />
463
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
464
            includes="**/metacat/harvesterClient/" />
465
   </target>
466

    
467
   <target name="harvestListEditorDist" depends="harvesterjar"
468
           description="Prepares a distribution of the Harvest List Editor tool">
469
       <mkdir dir="${dist.dir.hle}"/>
470
       <delete dir="${ver.dir.hle}" />
471
       <mkdir dir="${ver.dir.hle}"/>
472
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
473
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
474
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
475
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
476
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
477
       <delete file="./harvest-list-editor-${release}.zip"/>
478
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
479
       <delete file="./harvest-list-editor-${release}.tar.gz" />
480
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
481
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
482
             src="./harvest-list-editor-${release}.tar"/>
483
       <delete file="./harvest-list-editor-${release}.tar" />
484
   </target>
485

    
486
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
487
            description="Calls getemlpre2 and geteml2+ targets" />
488

    
489
   <target name="getemlpre2" depends="prepare" if="eml.required"
490
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
491
     <echo>Enter CVS password: </echo>
492
     <cvs cvsRoot="${cvsroot}"
493
          package="${eml-module}"
494
          tag="${eml-tag}"
495
          dest="${build.tmp}/eml_${eml-tag}" />
496
     <mkdir dir="lib/dtd" />
497
     <copy todir="lib/dtd" filtering="yes">
498
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
499
         <include name="*.dtd"/>
500
       </fileset>
501
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
502
     </copy>
503

    
504
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
505
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
506
       <include name="**/*.xsl"/>
507
     </fileset>
508
     </copy>
509
   </target>
510

    
511
   <target name="geteml2+" depends="prepare" if="eml.required"
512
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
513
     <echo>Enter CVS password: </echo>
514
     <cvs cvsRoot="${cvsroot}"
515
          package="${eml-module}"
516
          tag="${eml2_0_0-tag}"
517
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
518
     <mkdir dir="lib/schema/eml-2.0.0" />
519
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
520
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
521
         <include name="*.xsd"/>
522
       </fileset>
523

    
524
       <!-- shouldn't we have a mapper here like this??
525
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
526

    
527
       Jing's code didn't nave one - does it need to be added?
528
       NOTE that eml-version is set to beta 6, so this would need changing -->
529

    
530
     </copy>
531
     <antcall target="copyxsl">
532
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
533
        <param name="dirname" value="eml-2.0.0" />
534
     </antcall>
535

    
536
     <echo>Enter CVS password: </echo>
537
     <cvs cvsRoot="${cvsroot}"
538
          package="${eml-module}"
539
          tag="${eml2_0_1-tag}"
540
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
541
     <mkdir dir="lib/schema/eml-2.0.1" />
542
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
543
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
544
         <include name="*.xsd"/>
545
       </fileset>
546
     </copy>
547
     <antcall target="copyxsl">
548
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
549
        <param name="dirname" value="eml-2.0.1" />
550
     </antcall>
551
   </target>
552

    
553
   <target  name="copyxsl"
554
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
555

    
556
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
557

    
558
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
559
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
560
       <include name="**/*.xsl"/>
561
     </fileset>
562
     </copy>
563

    
564

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

    
570
   </target>
571

    
572

    
573

    
574
   <target name="register-schemas" depends="prepare"
575
   description="Registers the Schemas with a new Metacat instance">
576
     <echo/>
577
     <echo>Registering the Schemas with the new Metacat instance...</echo>
578
     <sql driver="${dbDriver}"
579
          url="${jdbc-connect}"
580
          userid="${user}"
581
          password="${password}"
582
          src="${build.src}/loaddtdschema.sql">
583
       <classpath>
584
         <path refid="compile.classpath"/>
585
       </classpath>
586
     </sql>
587
   </target>
588

    
589
   <target name="installdb" depends="prepare"
590
            description="Installs the database tables">
591
     <echo/>
592
     <echo>Installing the database tables...</echo>
593
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
594
     <echo/>
595
     <sql driver="${dbDriver}"
596
          url="${jdbc-connect}"
597
          userid="${user}"
598
          password="${password}"
599
          src="${build.src}/${install-sql}">
600
       <classpath>
601
         <path refid="compile.classpath"/>
602
       </classpath>
603
     </sql>
604
   </target>
605

    
606
   <target name="dropdb" depends="prepare"
607
            description="WARNING: Drops the database tables">
608
     <echo/>
609
     <echo>Dropping the database tables...</echo>
610
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
611
     <echo/>
612
     <sql driver="${dbDriver}"
613
          url="${jdbc-connect}"
614
          userid="${user}"
615
          password="${password}"
616
          src="${build.src}/drop-postgres.sql">
617
       <classpath>
618
         <path refid="compile.classpath"/>
619
       </classpath>
620
     </sql>
621
   </target>
622

    
623
   <target name="upgrade12" depends="prepare"
624
            description="Updates the database tables to upgrade to version 1.2">
625
     <echo/>
626
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
627
     <sql driver="${dbDriver}"
628
          url="${jdbc-connect}"
629
          userid="${user}"
630
          password="${password}"
631
          src="${build.src}/${upgrade-1.2-sql}">
632
       <classpath>
633
         <path refid="compile.classpath"/>
634
       </classpath>
635
     </sql>
636
   </target>
637

    
638
   <target name="upgrade13" depends="prepare"
639
            description="Updates the database tables to upgrade to version 1.3">
640
     <echo/>
641
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
642
     <sql driver="${dbDriver}"
643
          url="${jdbc-connect}"
644
          userid="${user}"
645
          password="${password}"
646
          src="${build.src}/${upgrade-1.3-sql}">
647
       <classpath>
648
         <path refid="compile.classpath"/>
649
       </classpath>
650
     </sql>
651
   </target>
652

    
653
   <target name="upgrade14" depends="prepare"
654
            description="Updates the database tables to upgrade to version 1.4">
655
     <echo/>
656
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
657
     <sql driver="${dbDriver}"
658
          url="${jdbc-connect}"
659
          userid="${user}"
660
          password="${password}"
661
          src="${build.src}/${upgrade-1.4-sql}">
662
       <classpath>
663
         <path refid="compile.classpath"/>
664
       </classpath>
665
     </sql>
666
   </target>
667

    
668
   <target name="upgrade15" depends="sqlupgrade15"
669
           description="Updates the database tables to upgrade to version 1.5">
670
     <echo/>
671
     <echo>Updating the database tables to upgrade to version 1.5...</echo>
672
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
673
           todir="${build.tmp}" filtering="yes"/>
674

    
675
     <javac srcdir="${build.tmp}"
676
            destdir="${build.tmp}"
677
            debug="${debug}"
678
            includes="upgrade_db_to_1_5.java">
679
       <classpath>
680
         <path refid="compile.classpath"/>
681
       </classpath>
682
     </javac>
683

    
684
     <java classname="upgrade_db_to_1_5">
685
       <classpath>
686
         <path refid="compile.classpath"/>
687
         <fileset dir="${build.tmp}"/>
688
       </classpath>
689
     </java>
690

    
691
   </target>
692

    
693
   <target name="upgrade16" depends="prepare"
694
            description="Updates the database tables from version 1.5 to version 1.6">
695
     <echo/>
696
     <echo>Updating the database tables to upgrade to version 1.6...</echo>
697
     <sql driver="${dbDriver}"
698
          url="${jdbc-connect}"
699
          userid="${user}"
700
          password="${password}"
701
          src="${build.src}/${upgrade-1.6-sql}">
702
       <classpath>
703
         <path refid="compile.classpath"/>
704
       </classpath>
705
     </sql>
706
   </target>
707

    
708

    
709
   <target name="sqlupgrade15" depends="prepare">
710
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
711
      <sql driver="${dbDriver}"
712
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
713
          url="${jdbc-connect}"
714
          userid="${user}"
715
          password="${password}"
716
          src="${build.src}/${upgrade-1.5-sql}" />
717
      <sql driver="${dbDriver}"
718
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
719
          url="${jdbc-connect}"
720
          userid="${user}"
721
          password="${password}"
722
          rdbms="oracle"
723
          delimiter="/">
724
        <transaction>
725
           CREATE TRIGGER xml_returnfield_before_insert
726
           BEFORE INSERT ON xml_returnfield FOR EACH ROW
727
           BEGIN
728
              SELECT xml_returnfield_id_seq.nextval
729
                 INTO :new.returnfield_id
730
                 FROM dual;
731
           END;
732
           /
733
        </transaction>
734
        <transaction>
735
           CREATE TRIGGER xml_queryresult_before_insert
736
           BEFORE INSERT ON xml_queryresult FOR EACH ROW
737
           BEGIN
738
              SELECT xml_queryresult_id_seq.nextval
739
              INTO :new.queryresult_id
740
              FROM dual;
741
           END;
742
           /
743
        </transaction>
744
      </sql>
745
   </target>
746

    
747
   <target name="install" depends="war" description="* Full Install *">
748
       <mkdir dir="${datafilepath}" />
749
       <mkdir dir="${inlinedatafilepath}" />
750
       <chmod dir="${datafilepath}" perm="ug+w" />
751
       <mkdir dir="${temp-dir}"/>
752
       <chmod dir="${temp-dir}" perm="ug+w" />
753
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
754
   </target>
755

    
756
   <target name="upgrade" depends="install"
757
          description="* Upgrade an existing metacat installation with a new version *">
758
       <unwar src="${deploy.dir}/${metacat.context}.war" dest="${deploy.dir}/${metacat.context}" />
759
   </target>
760

    
761
   <target name="install-registry" depends="init,getConversionXSL"
762
            description="Install Registry">
763

    
764
      <copy file="${srcdir}/perl/register-dataset.cgi"
765
            todir="${inst.cgi.dir}" filtering="yes"/>
766
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
767

    
768
      <mkdir dir="${temp-dir}" />
769
      <copy todir="${temp-dir}" filtering="yes">
770
       <fileset dir="lib/style/common/emlb6toeml2">
771
         <include name="*.xsl"/>
772
         <include name="*.xml"/>
773
       </fileset>
774
      </copy>
775

    
776
      <echo message="Install Registry completed." />
777
   </target>
778

    
779
   <target name="install-ldap" depends="init">
780
      <copy file="${srcdir}/perl/ldapweb.cgi"
781
            todir="${inst.cgi.dir}" filtering="yes"/>
782
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
783
      <copy file="lib/ldapweb.cfg"
784
            todir="${inst.cgi.dir}" filtering="yes"/>
785
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
786
      <mkdir dir="${templates.dir}" />
787
      <copy todir="${templates.dir}" filtering="yes">
788
        <fileset dir="lib/style/common/templates">
789
            <include name="${defaultChangePass}"/>
790
            <include name="${defaultResetPass}"/>
791
            <include name="${changePassSuccess}"/>
792
            <include name="${resetPassSuccess}"/>
793
            <include name="${registerFailed}"/>
794
            <include name="${registerLter}"/>
795
            <include name="${registerMatch}"/>
796
            <include name="${registerSuccess}"/>
797
            <include name="${register}"/>
798
            <include name="${searchResults}"/>
799
        </fileset>
800
      </copy>
801
      <echo message="ldapweb install complete." />
802
   </target>
803

    
804

    
805
   <target name="install-skin" depends="init"
806
            description="Install a Skin">
807

    
808
      <input message="Please enter name of the skin"
809
             addproperty="skin-name"/>
810

    
811
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
812
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
813
       <fileset dir="lib/style/skins/${skin-name}">
814
           <exclude name="*.png"/>
815
           <exclude name="*.gif"/>
816
           <exclude name="*.jpg"/>
817
           <exclude name="**/CVS*"/>
818
           <exclude name="**/.#*"/>
819
       </fileset>
820
      </copy>
821
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
822
       <fileset dir="lib/style/skins/${skin-name}">
823
           <include name="*.png"/>
824
           <include name="*.gif"/>
825
           <include name="*.jpg"/>
826
           <exclude name="**/CVS*"/>
827
           <exclude name="**/.#*"/>
828
       </fileset>
829
      </copy>
830
      <!--
831
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
832
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
833
       <fileset dir="lib/style/skins/${skin-name}/images">
834
           <include name="*.png"/>
835
           <include name="*.gif"/>
836
           <include name="*.jpg"/>
837
       </fileset>
838
      </copy>
839
      -->
840

    
841
      <echo message="Install Skin completed." />
842
   </target>
843

    
844
   <target name="war" depends="warPrepare,warMSSQL"
845
            description="Create a web archive (WAR) for servlet deployment">
846
       <mkdir dir="${dist.dir}" />
847
       <war destfile="${dist.dir}/${metacat.context}.war"
848
            webxml="${build.war}/web.xml">
849
         <fileset dir="${war.context}"/>
850
         <lib dir="${war.lib}"/>
851
         <webinf dir="${war.webinf}"/>
852
       </war>
853
   </target>
854

    
855
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
856
            description="Prepare files for creating a web archive (WAR)">
857

    
858
       <property name="war.lib" value="${build.war}/lib" />
859
       <property name="war.webinf" value="${build.war}/WEB-INF" />
860
       <property name="war.context" value="${build.war}/${metacat.context}" />
861
       <mkdir dir="${war.lib}" />
862
       <mkdir dir="${war.webinf}" />
863
       <mkdir dir="${war.context}" />
864
       
865
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
866
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
867
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
868
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
869
       <copy todir="${war.lib}" filtering="no">
870
         <fileset dir="lib">
871
            <not>
872
               <filename name="${jdbc-jar-name}"/>
873
            </not>
874
            <include name="*.jar"/>
875
         </fileset>
876
         <fileset dir="lib/xalan">
877
           <include name="*.jar"/>
878
         </fileset>
879
       </copy>
880
       <copy file="lib/web.xml.${tomcatversion}"
881
             tofile="${build.war}/web.xml" />
882
       <copy file="lib/metacat.properties" todir="${war.webinf}"
883
             filtering="yes" />
884
       <copy file="lib/log4j.properties" todir="${war.webinf}"
885
             filtering="yes" />
886
       <copy todir="${war.context}" filtering="no">
887
         <fileset dir="lib">
888
           <include name="**/*.jpg"/>
889
           <include name="**/*.png"/>
890
           <include name="**/*.gif"/>
891
         </fileset>
892
       </copy>
893
       <copy todir="${war.context}" filtering="yes">
894
         <fileset dir="lib">
895
           <exclude name="*.jar"/>
896
           <exclude name="*.properties"/>
897
           <exclude name="web.xml"/>
898
           <exclude name="**/*.jpg"/>
899
           <exclude name="**/*.png"/>
900
           <exclude name="**/*.gif"/>
901
           <exclude name="lsid_lib/**"/>
902
           <exclude name="lsid_conf/**"/>
903
         </fileset>
904
       </copy>
905
       <copy todir="${war.context}" filtering="no">
906
         <fileset dir="lib">
907
           <include name="**/*.jpg"/>
908
           <include name="**/*.png"/>
909
           <include name="**/*.gif"/>
910
         </fileset>
911
       </copy>
912
   </target>
913

    
914
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
915
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
916
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
917
   </target>
918

    
919
   <target name="getConversionXSL" depends="prepare"
920
            unless="styles.not.needed"
921
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
922

    
923
     <echo>Enter CVS password: </echo>
924
     <cvs cvsRoot="${cvsroot}"
925
          package="${eml-module}"
926
          tag="${eml2_0_1-tag}"
927
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
928

    
929
     <mkdir dir="lib/style/common/emlb6toeml2" />
930
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
931
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
932
         <include name="*.xsl"/>
933
         <include name="*.xml"/>
934
       </fileset>
935
      </copy>
936
   </target>
937

    
938
   <target name="testprep" depends="jar,clientjar,harvesterjar">
939
      <mkdir dir="${build.tests}"/>
940
      <copy todir="${build.tests}" filtering="yes">
941
        <fileset dir="${testdir}">
942
          <include name="edu/**"/>
943
        </fileset>
944
      </copy>
945
      <!-- copy and compile the tests into a jar file -->
946
      <javac srcdir="${build.tests}"
947
             destdir="${build.tests}"
948
             debug="on"
949
       includes="**/*.java">
950
        <classpath>
951
          <path refid="compile.classpath"/>
952
          <fileset dir="${build.dir}">
953
            <includes name="${name}.jar"/>
954
            <includes name="${name}-client.jar"/>
955
            <includes name="harvester.jar"/>
956
          </fileset>
957
        </classpath>
958
      </javac>
959

    
960
      <jar jarfile="${build.dir}/${name}-junittests.jar"
961
        basedir="${build.tests}"
962
                includes="**/*.class" />
963
   </target>
964

    
965
   <target name="test" depends="testprep"
966
            description="Uses the ant junit task to run all JUnit tests">
967

    
968
      <!-- use the ant "junit" task to run JUnit tests. -->
969
      <junit printsummary="yes" haltonfailure="no" fork="yes"
970
             haltonerror="no">
971
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
972
        <classpath>
973
          <path refid="compile.classpath"/>
974
          <fileset dir="${build.dir}">
975
            <includes name="${name}.jar"/>
976
            <includes name="${name}-client.jar"/>
977
            <includes name="harvester.jar"/>
978
            <includes name="${name}-junittests.jar"/>
979
          </fileset>
980
        </classpath>
981

    
982
        <formatter type="plain" />
983

    
984
        <batchtest fork="yes" todir="${build.dir}">
985
          <fileset dir="${build.tests}">
986
            <include name="**/*.class" />
987
          </fileset>
988
        </batchtest>
989
     </junit>
990
   </target>
991

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

    
995
              <echo>testtorun: ${testtorun}</echo>
996

    
997
      <!-- use the ant "junit" task to run JUnit tests. -->
998
      <junit printsummary="yes" haltonfailure="no" fork="yes"
999
             haltonerror="no">
1000
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1001
        <classpath>
1002
          <path refid="compile.classpath"/>
1003
          <fileset dir="${build.dir}">
1004
            <includes name="${name}.jar"/>
1005
            <includes name="${name}-client.jar"/>
1006
            <includes name="harvester.jar"/>
1007
            <includes name="${name}-junittests.jar"/>
1008
          </fileset>
1009
        </classpath>
1010

    
1011
        <formatter type="plain" />
1012

    
1013
        <batchtest fork="yes" todir="${build.dir}">
1014
          <fileset dir="${build.tests}">
1015
            <include name="**/${testtorun}.class" />
1016
          </fileset>
1017
        </batchtest>
1018
     </junit>
1019
   </target>
1020

    
1021
   <target name="testharvester"
1022
           depends="testprep"
1023
           description="Uses the ant junit task to test only the Harvester code">
1024
     <junit printsummary="yes"
1025
            haltonfailure="off"
1026
            fork="yes"
1027
            haltonerror="off">
1028
        <classpath>
1029
          <path refid="compile.classpath"/>
1030
          <fileset dir="${build.dir}">
1031
            <includes name="${name}.jar"/>
1032
            <includes name="${name}-client.jar"/>
1033
            <includes name="harvester.jar"/>
1034
            <includes name="${name}-junittests.jar"/>
1035
          </fileset>
1036
        </classpath>
1037
       <formatter type="plain" />
1038
       <batchtest fork="yes" todir="${build.dir}">
1039
         <fileset dir="${build.tests}">
1040
           <include name="**/harvesterClient/*.class" />
1041
         </fileset>
1042
       </batchtest>
1043
     </junit>
1044
   </target>
1045

    
1046
  <target name="gethttpclient" depends="prepare"
1047
            description="checks out and compiles morpho httpclient code">
1048
  <!--mkdir dir="${morphosourcedir}" -->
1049
        <cvs cvsRoot="${cvsroot}"
1050
             package="morpho"
1051
             dest="." />
1052
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1053
   </target>
1054

    
1055
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1056
   <target name="nettest" depends="install"
1057
            description="compiles and runs the metacatnettest code">
1058

    
1059
      <echo>***********************************
1060
      Please run ant gethttpclient first!
1061
      ***********************************
1062
      </echo>
1063
      <!-- copy and compile the tests into a jar file -->
1064
      <mkdir dir="${build.metacatnettest}"/>
1065
      <javac srcdir="${junitnettestsdir}"
1066
             destdir="${build.metacatnettest}"
1067
             includes="**/*.java">
1068
        <classpath>
1069
          <path refid="compile.classpath"/>
1070
          <fileset dir="${build.dir}">
1071
            <includes name="${name}.jar"/>
1072
          </fileset>
1073
        </classpath>
1074
      </javac>
1075

    
1076
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1077
                    basedir="${build.metacatnettest}"
1078
                    includes="**/*.class" />
1079

    
1080
      <!-- use the ant "junit" task to run JUnit tests. -->
1081
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1082
             haltonerror="no">
1083
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1084
        <classpath>
1085
          <path refid="compile.classpath"/>
1086
          <fileset dir="${build.dir}">
1087
            <includes name="${name}.jar"/>
1088
            <includes name="${name}-junitnettests.jar"/>
1089
          </fileset>
1090
        </classpath>
1091

    
1092
        <formatter type="plain" />
1093

    
1094
        <batchtest fork="yes" todir="${build.dir}">
1095
          <fileset dir="${build.metacatnettest}">
1096
            <include name="**/*.class" />
1097
          </fileset>
1098
        </batchtest>
1099
     </junit>
1100
   </target>
1101

    
1102
   <target name="cleanweb" depends="clean"
1103
            description="deletes tomcat web context dir and all its contents">
1104
     <delete dir="${installdir}" />
1105
   </target>
1106

    
1107

    
1108
   <target name="clean" depends="init"
1109
            description="deletes build dir and files that can be regenerated form the release">
1110
       <delete dir="${build.dir}" />
1111
       <delete dir="${dist.dir}" />
1112
   </target>
1113

    
1114
   <target name="fullclean" depends="clean"
1115
            description="deletes even jars that depend on external sources such as stylesheets and jars">
1116
       <delete file="lib/httpclient.jar" />
1117
       <delete file="lib/utilities.jar" />
1118
       <delete includeEmptyDirs="true" failonerror="false">
1119
         <fileset dir="${style-common-cvsrelpath}">
1120
           <include name="${eml-css}" />
1121
           <include name="eml-*/*.xsl" />
1122
           <include name="eml-*" />
1123
         </fileset>
1124
       </delete>
1125
   </target>
1126

    
1127
   <target name="jdoc" depends="prepare"
1128
            description="generates javadoc documentation">
1129
       <javadoc packagenames="edu.ucsb.nceas.*"
1130
           sourcepath="${build.src}"
1131
           destdir="${build.javadocs}"
1132
           author="true"
1133
           version="true"
1134
           use="true"
1135
           windowtitle="${Name} API"
1136
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1137
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1138
         <classpath>
1139
           <path refid="compile.classpath"/>
1140
         </classpath>
1141
       </javadoc>
1142
   </target>
1143

    
1144
   <target name="dist"
1145
       depends="geteml,jar,protocol,jdoc,getConversionXSL,getutilities"
1146
            description="prepares a full release distribution">
1147
      <mkdir dir="${dist.dir}"/>
1148
      <delete dir="${ver.dir}" />
1149
      <mkdir dir="${ver.dir}"/>
1150
      <copy todir="${ver.dir}">
1151
        <fileset dir="."
1152
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1153
      </copy>
1154
      <copy todir="${ver.dir}" file="build.xml"/>
1155
      <copy todir="${ver.dir}" file="build.properties"/>
1156

    
1157
      <copy todir="${ver.dir}/docs" filtering="yes">
1158
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1159
      </copy>
1160
      <copy todir="${ver.dir}/docs" filtering="no">
1161
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1162
      </copy>
1163
      <copy todir="${ver.dir}/docs/dev">
1164
        <fileset dir="${build.dir}/docs"/>
1165
      </copy>
1166
      <copy todir="${ver.dir}/src">
1167
        <fileset dir="${build.dir}/src"/>
1168
      </copy>
1169
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1170
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1171
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1172
      <!--
1173
      <delete dir="./${ver.dir}/${build.dir}"/>
1174
      <delete dir="./${ver.dir}/dist"/>
1175
      -->
1176
      <delete file="./${name}-${release}.zip"/>
1177
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1178
      <delete file="./${name}-${release}.tar.gz" />
1179
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1180
      <gzip zipfile="./${name}-${release}.tar.gz"
1181
                src="./${name}-${release}.tar"/>
1182
      <delete file="./${name}-${release}.tar" />
1183
  </target>
1184

    
1185
  <target name="distsrc" depends="dist"
1186
            description="prepares a source distribution">
1187
      <mkdir dir="${ver.src}"/>
1188
      <copy todir="${ver.src}">
1189
        <fileset dir="./src"/>
1190
      </copy>
1191
      <mkdir dir="${util.dir}"/>
1192
      <copy todir="${util.dir}">
1193
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1194
      </copy>
1195

    
1196
      <delete file="./${name}-src-${release}.zip"/>
1197
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1198
      <delete file="./${name}-src-${release}.tar.gz" />
1199
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1200
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1201
                src="./${name}-src-${release}.tar"/>
1202
      <delete file="./${name}-src-${release}.tar" />
1203
      <delete dir="${dist.dir}"/>
1204
  </target>
1205

    
1206
   <target name="stylesheettest">
1207
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1208
      <param name="displaymodule" expression="${displaymodule}"/>
1209
      <param name="docid" expression="${input}"/>
1210
      <param name="entitytype" expression="${entitytype}"/>
1211
      <param name="entityindex" expression="${entityindex}"/>
1212
      <outputproperty name="method" value="html"/>
1213
      <outputproperty name="standalone" value="yes"/>
1214
      <outputproperty name="encoding" value="iso8859_1"/>
1215
      <outputproperty name="indent" value="yes"/>
1216
    </xslt>
1217
  </target>
1218

    
1219
 <target name="gridinit" depends="init">
1220
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1221
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1222
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1223
   <property environment="env"/>
1224
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1225
    <path id="webservicepath">
1226
        <pathelement location="."/>
1227
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1228
        <pathelement location="${build.dest}"/>
1229
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1230
           <include name="*.jar"/>
1231
        </fileset>
1232
      </path>
1233
</target>
1234

    
1235
 <target name="gridprepare" depends="gridinit, prepare">
1236
 </target>
1237

    
1238
  <target name="compileinterface" depends="clean, gridprepare">
1239
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1240
  </target>
1241

    
1242
  <target name="generateWSDL" depends="compileinterface">
1243
    <echo message="Generating wsdl from ${interface.name} interface"/>
1244
    <java classname="${java2wsdl.tool}"
1245
          dir="${build.src}" fork="yes"
1246
          classpathref="webservicepath"  failonerror="true" >
1247
      <arg value="-P"/>
1248
      <arg value="${interface.name}PortType"/>
1249
      <arg value="-S"/>
1250
      <arg value="${interface.name}Service"/>
1251
      <arg value="-y"/>
1252
      <arg value="WRAPPED"/>
1253
      <arg value="-u"/>
1254
      <arg value="LITERAL"/>
1255
      <arg value="-l"/>
1256
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1257
      <arg value="-n"/>
1258
      <arg value="http://${services.namespace}/${interface.name}"/>
1259
      <arg value="${interface.package}.${interface.name}"/>
1260
    </java>
1261
  </target>
1262

    
1263
   <target name="decorateWSDL" depends="generateWSDL">
1264
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1265
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1266
            fork="yes"
1267
            classpathref="webservicepath" failonerror="true" >
1268
        <arg value="${binding.file}"/>
1269
        <arg value="${wsdl.file}"/>
1270
      </java>
1271
   </target>
1272

    
1273
   <target name="generatestubs" depends="decorateWSDL">
1274
      <echo message=" Generating stubs " />
1275
      <echo message="wsdl file is ${wsdl.file}"/>
1276
      <echo message="build.src is ${build.src}"/>
1277
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1278
            classpathref="webservicepath" failonerror="true" >
1279
         <arg value="${wsdl.file}"/>
1280
    </java>
1281
  </target>
1282

    
1283
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1284
     <echo message=" Compiling stubs " />
1285
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1286
     <echo message=" Compiling impl " />
1287
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1288
  </target>
1289

    
1290
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1291
     <echo message=" jar stubs classes " />
1292
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1293
     <echo message=" jar impl classes " />
1294
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1295
  </target>
1296

    
1297
  <target name="gar" depends="jarStubsAndImpl">
1298
     <echo message=" jar the gar file"/>
1299
     <mkdir dir="${build.dir}/gar"/>
1300
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1301
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1302
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1303
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1304
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1305
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1306
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1307
  </target>
1308

    
1309
  <target name="compilewebclient" depends="prepare">
1310
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1311
  </target>
1312

    
1313
  <target name="runwebclient" depends="compilewebclient">
1314
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1315
           dir="${build.dest}" fork="yes"
1316
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1317
         <arg value="${serviceUrl}"/>
1318
         <arg value="${docid}"/>
1319
     </java>
1320
  </target>
1321
  
1322
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1323

    
1324
    <echo message="Compiling the metatcat shapefile creator"/>
1325
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1326
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1327
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1328
    </exec>
1329
  
1330
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1331
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1332
    </exec>
1333
  </target>
1334

    
1335
    <!-- LSID Authority support -->
1336
    <patternset id="lsid.jars">
1337
        <include name="axis.jar" />
1338
        <include name="commons-discovery-0.2.jar" />
1339
        <include name="jaxrpc.jar" />
1340
        <include name="lsid-client-1.1.1.jar" />
1341
        <include name="lsid-server-1.1.1.jar" />
1342
        <include name="saaj.jar" />
1343
        <include name="wsdl4j-1.5.1.jar" />
1344
        <include name="activation.jar" />
1345
        <include name="castor-0.9.5.jar" />
1346
        <include name="dnsjava-1.3.2.jar" />
1347
        <include name="mail.jar" />
1348
        <include name="commons-logging-1.0.4.jar" />
1349
        <!-- These jars may be needed but seem to not actually be,
1350
             so leaving them out for now
1351
        <include name="axis-ant.jar" />
1352
        -->
1353
        <!--<include name="GenCastor.class" />-->
1354
    </patternset>
1355
    <patternset id="lib.jars">
1356
        <include name="httpclient.jar" />
1357
        <include name="log4j-1.2.12.jar" />
1358
        <include name="utilities.jar" />
1359
        <include name="xercesImpl.jar" />
1360
        <include name="xalan.jar" />
1361
        <include name="xml-apis.jar" />
1362
    </patternset>
1363

    
1364
    <path id="lsid.classpath">
1365
        <fileset dir="${lsid.lib.dir}">
1366
            <patternset refid="lsid.jars"/>
1367
        </fileset>
1368
        <fileset dir="${lib.dir}">
1369
            <patternset refid="lsid.jars"/>
1370
        </fileset>
1371
        <fileset dir="${lib.dir}/xalan">
1372
            <include name="xalan.jar" />
1373
            <include name="xml-apis.jar" />
1374
        </fileset>
1375
        <fileset dir="${build.dir}">
1376
            <include name="metacat-client.jar" />
1377
        </fileset>
1378
    </path>
1379

    
1380
    <filterset id="configFilters">
1381
        <filter token="LSID_AUTHORITY_HOSTNAME"
1382
                value="${config.hostname}" />
1383
        <filter token="LSID_AUTHORITY_PORT"
1384
                value="${config.port}" />
1385
        <filter token="METADATA_LABELS"
1386
                value="${config.metadataLabelLsid}" />
1387
        <filter token="METACAT_SERVER"
1388
                value="${config.metacatserver}" />
1389
        <filter token="LSID_AUTHORITY_STRING"
1390
                value="${config.lsidauthority}" />
1391
    </filterset>
1392
    
1393
    <target name="prepare-lsid"
1394
            depends="prepare,utilities,clientjar"
1395
            description="Configure files prior to compilation">
1396
        <mkdir dir="${lsid.build.dir}" />
1397
        <!-- Copy the properties file into the build -->
1398
        <copy file="${conf.dir}/metacat-lsid.properties"
1399
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1400
              overwrite="true">
1401
            <filterset refid="configFilters" />
1402
        </copy>
1403
        <!-- Copy config files into the build -->
1404
        <copy todir="${lsid.build.dir}/WEB-INF">
1405
            <fileset dir="${webinf.dir}"
1406
                     includes="**/*.wsdd" />
1407
        </copy>
1408
        <!-- Copy the metadata configuration files into the build -->
1409
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1410
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1411
            <fileset dir="${conf.dir}"
1412
                     includes="**/*.xml" />
1413
            <fileset dir="${conf.dir}"
1414
                     includes="**/*.xslt" />
1415
            <filterset refid="configFilters" />
1416
        </copy>
1417
        <!-- Copy services files into the build -->
1418
        <mkdir dir="${lsid.build.dir}/services" />
1419
        <copy todir="${lsid.build.dir}/services">
1420
            <fileset dir="${services.dir}" />
1421
            <filterset refid="configFilters" />
1422
        </copy>
1423
        <!-- Copy axis files into the build -->
1424
        <mkdir dir="${lsid.build.dir}" />
1425
        <copy todir="${lsid.build.dir}">
1426
            <fileset dir="${conf.dir}/axis"
1427
                     excludes="*.properties"/>
1428
        </copy>
1429
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1430
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1431
            <fileset dir="${conf.dir}/axis"
1432
                     includes="*.properties"/>
1433
        </copy>
1434
    </target>
1435
    
1436
    <target name="compile-lsid"
1437
            depends="prepare-lsid"
1438
            description="Compile Java sources">
1439
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1440
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1441
               destdir="${lsid.build.dir}/WEB-INF/classes"
1442
               debug="${compile.debug}"
1443
               deprecation="${compile.deprecation}"
1444
               optimize="${compile.optimize}">
1445
            <classpath refid="lsid.classpath" />
1446
        </javac>
1447
    </target>
1448
    
1449
    <target name="war-lsid"
1450
            depends="compile-lsid"
1451
            description="Create a war file for the application">
1452
        <mkdir dir="${dist.dir}" />
1453
        <war destfile="${dist.dir}/${authority.context}.war"
1454
             webxml="${webinf.dir}/web.xml">
1455
            <fileset dir="${lsid.build.dir}" />
1456
            <lib dir="${lsid.lib.dir}">
1457
                <patternset refid="lsid.jars"/>
1458
            </lib>
1459
            <lib dir="${lib.dir}">
1460
                <patternset refid="lib.jars"/>
1461
            </lib>
1462
            <lib dir="${lib.dir}/xalan">
1463
                <include name="xalan.jar" />
1464
                <include name="xml-apis.jar" />
1465
            </lib>
1466
            <lib dir="${build.dir}">
1467
                <include name="metacat-client.jar" />
1468
            </lib>
1469
        </war>
1470
    </target>
1471
    
1472
    <target name="deploy-lsid"
1473
            depends="war-lsid"
1474
            description="Deploy LSID war to servlet container">
1475
        <delete dir="${deploy.dir}/${authority.context}" />
1476
        <delete file="${deploy.dir}/${authority.context}.war" />
1477
        <mkdir dir="${deploy.dir}" />
1478
        <copy todir="${deploy.dir}">
1479
            <fileset dir="${dist.dir}" />
1480
        </copy>
1481
    </target>
1482
</project>
(5-5/5)