Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: tao $'
10
  *    '$Date: 2005-09-30 14:07:22 -0700 (Fri, 30 Sep 2005) $'
11
  *    '$Revision: 2610 $'
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
  <path id="compile.classpath">
48
    <pathelement location="${jsdk}"/>
49
    <pathelement location="lib" />
50
    <fileset dir="lib">
51
      <include name="*.jar"/>
52
    </fileset>
53
    <fileset dir="lib/lsid_lib">
54
      <include name="*.jar"/>
55
    </fileset>
56
    <fileset dir="${jdbc_base}">
57
      <include name="classes111.zip"/>
58
      <include name="msbase.jar"/>
59
      <include name="msutil.jar"/>
60
      <include name="mssqlserver.jar"/>
61
    </fileset>
62
  </path>
63

    
64
  <target name="check-db">
65
    <condition property="use-oracle">
66
      <equals arg1="${database}" arg2="oracle" />
67
    </condition>
68
    <condition property="use-postgresql">
69
      <equals arg1="${database}" arg2="postgresql" />
70
    </condition>
71
    <condition property="use-sqlserver">
72
      <equals arg1="${database}" arg2="sqlserver" />
73
    </condition>
74
  </target>
75

    
76
  <target name="oracle" if="use-oracle">
77
     <!-- Customize these properties if you are using oracle -->
78
     <echo message="Using oracle..."/>
79
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
80
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
81
     <property name="jdbc" value="${jdbc_base}/classes111.zip" />
82
     <!-- Property to indicate is not MSSQL installation-->
83
     <property name="other" value="yes"/>
84
     <property name="install-sql"
85
               value="xmltables.sql" />
86
     <property name="upgrade-1.2-sql"
87
               value="upgrade-db-to-1.2.sql" />
88
     <property name="upgrade-1.3-sql"
89
               value="upgrade-db-to-1.3.sql" />
90
     <property name="upgrade-1.4-sql"
91
               value="upgrade-db-to-1.4.sql" />
92
     <property name="upgrade-1.5-sql"
93
               value="upgrade-db-to-1.5.sql" />
94
     <property name="upgrade-1.6-sql"
95
               value="upgrade-db-to-1.6.sql" />
96
   </target>
97

    
98
   <target name="postgresql" if="use-postgresql">
99
     <!-- Customize these properties if you are using postgres -->
100
     <echo message="Using PostgreSQL..."/>
101
     <property name="dbDriver" value="org.postgresql.Driver"/>
102
     <property name="dbAdapter"
103
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
104
     <property name="jdbc-jar-name" value="postgresql-8.0-312.jdbc3.jar" />
105
     <property name="jdbc" value="lib/${jdbc-jar-name}" />
106
     <!-- Property to indicate is not MSSQL installation-->
107
     <property name="other" value="yes"/>
108
     <property name="install-sql"
109
               value="xmltables-postgres.sql" />
110
     <property name="upgrade-1.2-sql"
111
               value="upgrade-db-to-1.2-postgres.sql" />
112
     <property name="upgrade-1.3-sql"
113
               value="upgrade-db-to-1.3-postgres.sql" />
114
     <property name="upgrade-1.4-sql"
115
               value="upgrade-db-to-1.4-postgres.sql" />
116
     <property name="upgrade-1.5-sql"
117
               value="upgrade-db-to-1.5-postgres.sql" />
118
     <property name="upgrade-1.6-sql"
119
               value="upgrade-db-to-1.6-postgres.sql" />
120
    </target>
121

    
122
   <target name="sqlserver" if="use-sqlserver">
123
     <!-- Customize these properties if you are using SQL server -->
124
     <echo message="Using SQL Server..."/>
125
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
126
     <property name="dbAdapter"
127
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
128
     <property name="jdbc" value="${jdbc_base}/msbase.jar" />
129
     <property name="jdbc-add1" value="${jdbc_base}/msutil.jar" />
130
     <property name="jdbc-add2" value="${jdbc_base}/mssqlserver.jar" />
131
     <!-- Property to indicate is a MSSQL installation-->
132
     <property name="MSSQL" value="yes"/>
133
     <property name="install-sql"
134
               value="xmltables-sqlserver.sql" />
135
   </target>
136

    
137
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
138
      <!-- usr for client testing, generally you don't need change-->
139
      <property name="mcuser" value="uid=jones,o=NCEAS,dc=ecoinformatics,dc=org"/>
140
      <property name="mcpassword" value=""/>
141
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
142
      <property name="mcanotherpassword" value=""/>
143

    
144
      <property name="debug" value="on" />
145
      <property name="debuglevel" value="55" />
146

    
147
      <property name="morphosourcedir" value="../morpho" />
148
      <property name="defaultcontenttype" value="application/octet-stream" />
149
      <property name="utilitiesdir" value="../utilities" />
150

    
151
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
152
      <echo>*********** set jsdk to ${jsdk}</echo>
153
  </target>
154

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

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

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

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

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

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

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

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

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

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

    
358
   </target>
359

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

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

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

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

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

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

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

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

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

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

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

    
441
   <target name="harvester" depends="client"
442
           description="Compiles harvester java code to build dir">
443
       <javac srcdir="${build.src}"
444
              destdir="${build.dest}"
445
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
446
          <classpath>
447
            <path refid="compile.classpath"/>
448
          </classpath>
449
        </javac>
450
   </target>
451

    
452
   <target name="harvesterjar" depends="harvester"
453
           description="Compiles and jars harvester java code to harvester.jar in build dir">
454
       <delete file="${build.dir}/harvester.jar" />
455
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
456
            includes="**/metacat/harvesterClient/" />
457
   </target>
458

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

    
478
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
479
            description="Calls getemlpre2 and geteml2+ targets" />
480

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

    
496
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
497
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
498
       <include name="**/*.xsl"/>
499
     </fileset>
500
     </copy>
501
   </target>
502

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

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

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

    
522
     </copy>
523
     <antcall target="copyxsl">
524
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
525
        <param name="dirname" value="eml-2.0.0" />
526
     </antcall>
527

    
528
     <echo>Enter CVS password: </echo>
529
     <cvs cvsRoot="${cvsroot}"
530
          package="${eml-module}"
531
          tag="${eml2_0_1-tag}"
532
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
533
     <mkdir dir="lib/schema/eml-2.0.1" />
534
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
535
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
536
         <include name="*.xsd"/>
537
       </fileset>
538
     </copy>
539
     <antcall target="copyxsl">
540
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
541
        <param name="dirname" value="eml-2.0.1" />
542
     </antcall>
543
   </target>
544

    
545
   <target  name="copyxsl"
546
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
547

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

    
550
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
551
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
552
       <include name="**/*.xsl"/>
553
     </fileset>
554
     </copy>
555

    
556

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

    
562
   </target>
563

    
564

    
565

    
566
   <target name="register-schemas" depends="prepare"
567
   description="Registers the Schemas with a new Metacat instance">
568
     <echo/>
569
     <echo>Registering the Schemas with the new Metacat instance...</echo>
570
     <sql driver="${dbDriver}"
571
          url="${jdbc-connect}"
572
          userid="${user}"
573
          password="${password}"
574
          src="${build.src}/loaddtdschema.sql">
575
       <classpath>
576
         <path refid="compile.classpath"/>
577
       </classpath>
578
     </sql>
579
   </target>
580

    
581
   <target name="installdb" depends="prepare"
582
            description="Installs the database tables">
583
     <echo/>
584
     <echo>Installing the database tables...</echo>
585
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
586
     <echo/>
587
     <sql driver="${dbDriver}"
588
          url="${jdbc-connect}"
589
          userid="${user}"
590
          password="${password}"
591
          src="${build.src}/${install-sql}">
592
       <classpath>
593
         <path refid="compile.classpath"/>
594
       </classpath>
595
     </sql>
596
   </target>
597

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

    
615
   <target name="upgrade12" depends="prepare"
616
            description="Updates the database tables to upgrade to version 1.2">
617
     <echo/>
618
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
619
     <sql driver="${dbDriver}"
620
          url="${jdbc-connect}"
621
          userid="${user}"
622
          password="${password}"
623
          src="${build.src}/${upgrade-1.2-sql}">
624
       <classpath>
625
         <path refid="compile.classpath"/>
626
       </classpath>
627
     </sql>
628
   </target>
629

    
630
   <target name="upgrade13" depends="prepare"
631
            description="Updates the database tables to upgrade to version 1.3">
632
     <echo/>
633
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
634
     <sql driver="${dbDriver}"
635
          url="${jdbc-connect}"
636
          userid="${user}"
637
          password="${password}"
638
          src="${build.src}/${upgrade-1.3-sql}">
639
       <classpath>
640
         <path refid="compile.classpath"/>
641
       </classpath>
642
     </sql>
643
   </target>
644

    
645
   <target name="upgrade14" depends="prepare"
646
            description="Updates the database tables to upgrade to version 1.4">
647
     <echo/>
648
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
649
     <sql driver="${dbDriver}"
650
          url="${jdbc-connect}"
651
          userid="${user}"
652
          password="${password}"
653
          src="${build.src}/${upgrade-1.4-sql}">
654
       <classpath>
655
         <path refid="compile.classpath"/>
656
       </classpath>
657
     </sql>
658
   </target>
659

    
660
   <target name="upgrade15" depends="sqlupgrade15"
661
           description="Updates the database tables to upgrade to version 1.5">
662
     <echo/>
663
     <echo>Updating the database tables to upgrade to version 1.5...</echo>
664
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
665
           todir="${build.tmp}" filtering="yes"/>
666

    
667
     <javac srcdir="${build.tmp}"
668
            destdir="${build.tmp}"
669
            debug="${debug}"
670
            includes="upgrade_db_to_1_5.java">
671
       <classpath>
672
         <path refid="compile.classpath"/>
673
       </classpath>
674
     </javac>
675

    
676
     <java classname="upgrade_db_to_1_5">
677
       <classpath>
678
         <path refid="compile.classpath"/>
679
         <fileset dir="${build.tmp}"/>
680
       </classpath>
681
     </java>
682

    
683
   </target>
684

    
685
   <target name="upgrade16" depends="prepare"
686
            description="Updates the database tables from version 1.5 to version 1.6">
687
     <echo/>
688
     <echo>Updating the database tables to upgrade to version 1.6...</echo>
689
     <sql driver="${dbDriver}"
690
          url="${jdbc-connect}"
691
          userid="${user}"
692
          password="${password}"
693
          src="${build.src}/${upgrade-1.6-sql}">
694
       <classpath>
695
         <path refid="compile.classpath"/>
696
       </classpath>
697
     </sql>
698
   </target>
699

    
700

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

    
739
   <target name="install" depends="war" description="* Full Install *">
740
       <mkdir dir="${datafilepath}" />
741
       <mkdir dir="${inlinedatafilepath}" />
742
       <chmod dir="${datafilepath}" perm="ug+w" />
743
       <mkdir dir="${temp-dir}"/>
744
       <chmod dir="${temp-dir}" perm="ug+w" />
745
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
746
   </target>
747

    
748
   <target name="upgrade" depends="install"
749
          description="* Upgrade an existing metacat installation with a new version *">
750
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
751
   </target>
752

    
753
   <target name="install-registry" depends="init,getConversionXSL"
754
            description="Install Registry">
755

    
756
      <copy file="${srcdir}/perl/register-dataset.cgi"
757
            todir="${inst.cgi.dir}" filtering="yes"/>
758
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
759

    
760
      <mkdir dir="${temp-dir}" />
761
      <copy todir="${temp-dir}" filtering="yes">
762
       <fileset dir="lib/style/common/emlb6toeml2">
763
         <include name="*.xsl"/>
764
         <include name="*.xml"/>
765
       </fileset>
766
      </copy>
767

    
768
      <echo message="Install Registry completed." />
769
   </target>
770

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

    
796

    
797
   <target name="install-skin" depends="init"
798
            description="Install a Skin">
799

    
800
      <input message="Please enter name of the skin"
801
             addproperty="skin-name"/>
802

    
803
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
804
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
805
       <fileset dir="lib/style/skins/${skin-name}">
806
           <exclude name="*.png"/>
807
           <exclude name="*.gif"/>
808
           <exclude name="*.jpg"/>
809
           <exclude name="**/CVS*"/>
810
           <exclude name="**/.#*"/>
811
       </fileset>
812
      </copy>
813
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
814
       <fileset dir="lib/style/skins/${skin-name}">
815
           <include name="*.png"/>
816
           <include name="*.gif"/>
817
           <include name="*.jpg"/>
818
           <exclude name="**/CVS*"/>
819
           <exclude name="**/.#*"/>
820
       </fileset>
821
      </copy>
822
      <!--
823
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
824
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
825
       <fileset dir="lib/style/skins/${skin-name}/images">
826
           <include name="*.png"/>
827
           <include name="*.gif"/>
828
           <include name="*.jpg"/>
829
       </fileset>
830
      </copy>
831
      -->
832

    
833
      <echo message="Install Skin completed." />
834
   </target>
835

    
836
   <target name="war" depends="warPrepare,warMSSQL"
837
            description="Create a web archive (WAR) for servlet deployment">
838
       <war destfile="${build.dir}/${context}.war"
839
            webxml="${build.war}/web.xml">
840
         <fileset dir="${war.context}"/>
841
         <lib dir="${war.lib}"/>
842
         <webinf dir="${war.webinf}"/>
843
       </war>
844
   </target>
845

    
846
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
847
            description="Prepare files for creating a web archive (WAR)">
848

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

    
903
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
904
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
905
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
906
   </target>
907

    
908
   <target name="getConversionXSL" depends="prepare"
909
            unless="styles.not.needed"
910
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
911

    
912
     <echo>Enter CVS password: </echo>
913
     <cvs cvsRoot="${cvsroot}"
914
          package="${eml-module}"
915
          tag="${eml2_0_1-tag}"
916
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
917

    
918
     <mkdir dir="lib/style/common/emlb6toeml2" />
919
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
920
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
921
         <include name="*.xsl"/>
922
         <include name="*.xml"/>
923
       </fileset>
924
      </copy>
925
   </target>
926

    
927
   <target name="testprep" depends="jar,clientjar,harvesterjar">
928
      <mkdir dir="${build.tests}"/>
929
      <copy todir="${build.tests}" filtering="yes">
930
        <fileset dir="${testdir}">
931
          <include name="edu/**"/>
932
        </fileset>
933
      </copy>
934
      <!-- copy and compile the tests into a jar file -->
935
      <javac srcdir="${build.tests}"
936
             destdir="${build.tests}"
937
             debug="on"
938
       includes="**/*.java">
939
        <classpath>
940
          <path refid="compile.classpath"/>
941
          <fileset dir="${build.dir}">
942
            <includes name="${name}.jar"/>
943
            <includes name="${name}-client.jar"/>
944
            <includes name="harvester.jar"/>
945
          </fileset>
946
        </classpath>
947
      </javac>
948

    
949
      <jar jarfile="${build.dir}/${name}-junittests.jar"
950
        basedir="${build.tests}"
951
                includes="**/*.class" />
952
   </target>
953

    
954
   <target name="test" depends="testprep"
955
            description="Uses the ant junit task to run all JUnit tests">
956

    
957
      <!-- use the ant "junit" task to run JUnit tests. -->
958
      <junit printsummary="yes" haltonfailure="no" fork="yes"
959
             haltonerror="no">
960
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
961
        <classpath>
962
          <path refid="compile.classpath"/>
963
          <fileset dir="${build.dir}">
964
            <includes name="${name}.jar"/>
965
            <includes name="${name}-client.jar"/>
966
            <includes name="harvester.jar"/>
967
            <includes name="${name}-junittests.jar"/>
968
          </fileset>
969
        </classpath>
970

    
971
        <formatter type="plain" />
972

    
973
        <batchtest fork="yes" todir="${build.dir}">
974
          <fileset dir="${build.tests}">
975
            <include name="**/*.class" />
976
          </fileset>
977
        </batchtest>
978
     </junit>
979
   </target>
980

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

    
984
              <echo>testtorun: ${testtorun}</echo>
985

    
986
      <!-- use the ant "junit" task to run JUnit tests. -->
987
      <junit printsummary="yes" haltonfailure="no" fork="yes"
988
             haltonerror="no">
989
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
990
        <classpath>
991
          <path refid="compile.classpath"/>
992
          <fileset dir="${build.dir}">
993
            <includes name="${name}.jar"/>
994
            <includes name="${name}-client.jar"/>
995
            <includes name="harvester.jar"/>
996
            <includes name="${name}-junittests.jar"/>
997
          </fileset>
998
        </classpath>
999

    
1000
        <formatter type="plain" />
1001

    
1002
        <batchtest fork="yes" todir="${build.dir}">
1003
          <fileset dir="${build.tests}">
1004
            <include name="**/${testtorun}.class" />
1005
          </fileset>
1006
        </batchtest>
1007
     </junit>
1008
   </target>
1009

    
1010
   <target name="testharvester"
1011
           depends="testprep"
1012
           description="Uses the ant junit task to test only the Harvester code">
1013
     <junit printsummary="yes"
1014
            haltonfailure="off"
1015
            fork="yes"
1016
            haltonerror="off">
1017
        <classpath>
1018
          <path refid="compile.classpath"/>
1019
          <fileset dir="${build.dir}">
1020
            <includes name="${name}.jar"/>
1021
            <includes name="${name}-client.jar"/>
1022
            <includes name="harvester.jar"/>
1023
            <includes name="${name}-junittests.jar"/>
1024
          </fileset>
1025
        </classpath>
1026
       <formatter type="plain" />
1027
       <batchtest fork="yes" todir="${build.dir}">
1028
         <fileset dir="${build.tests}">
1029
           <include name="**/harvesterClient/*.class" />
1030
         </fileset>
1031
       </batchtest>
1032
     </junit>
1033
   </target>
1034

    
1035
  <target name="gethttpclient" depends="prepare"
1036
            description="checks out and compiles morpho httpclient code">
1037
  <!--mkdir dir="${morphosourcedir}" -->
1038
        <cvs cvsRoot="${cvsroot}"
1039
             package="morpho"
1040
             dest="." />
1041
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1042
   </target>
1043

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

    
1048
      <echo>***********************************
1049
      Please run ant gethttpclient first!
1050
      ***********************************
1051
      </echo>
1052
      <!-- copy and compile the tests into a jar file -->
1053
      <mkdir dir="${build.metacatnettest}"/>
1054
      <javac srcdir="${junitnettestsdir}"
1055
             destdir="${build.metacatnettest}"
1056
             includes="**/*.java">
1057
        <classpath>
1058
          <path refid="compile.classpath"/>
1059
          <fileset dir="${build.dir}">
1060
            <includes name="${name}.jar"/>
1061
          </fileset>
1062
        </classpath>
1063
      </javac>
1064

    
1065
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1066
                    basedir="${build.metacatnettest}"
1067
                    includes="**/*.class" />
1068

    
1069
      <!-- use the ant "junit" task to run JUnit tests. -->
1070
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1071
             haltonerror="no">
1072
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1073
        <classpath>
1074
          <path refid="compile.classpath"/>
1075
          <fileset dir="${build.dir}">
1076
            <includes name="${name}.jar"/>
1077
            <includes name="${name}-junitnettests.jar"/>
1078
          </fileset>
1079
        </classpath>
1080

    
1081
        <formatter type="plain" />
1082

    
1083
        <batchtest fork="yes" todir="${build.dir}">
1084
          <fileset dir="${build.metacatnettest}">
1085
            <include name="**/*.class" />
1086
          </fileset>
1087
        </batchtest>
1088
     </junit>
1089
   </target>
1090

    
1091
   <target name="cleanweb" depends="clean"
1092
            description="deletes tomcat web context dir and all its contents">
1093
     <delete dir="${installdir}" />
1094
   </target>
1095

    
1096

    
1097
   <target name="clean" depends="init"
1098
            description="deletes build dir and files that can be regenerated form the release">
1099
       <delete dir="${build.dir}" />
1100
   </target>
1101

    
1102
   <target name="fullclean" depends="clean"
1103
            description="deletes even jars that depend on external sources such as stylesheets and jars">
1104
       <delete file="lib/httpclient.jar" />
1105
       <delete file="lib/utilities.jar" />
1106
       <delete includeEmptyDirs="true" failonerror="false">
1107
         <fileset dir="${style-common-cvsrelpath}">
1108
           <include name="${eml-css}" />
1109
           <include name="eml-*/*.xsl" />
1110
           <include name="eml-*" />
1111
         </fileset>
1112
       </delete>
1113
   </target>
1114

    
1115
   <target name="jdoc" depends="prepare"
1116
            description="generates javadoc documentation">
1117
       <javadoc packagenames="edu.ucsb.nceas.*"
1118
           sourcepath="${build.src}"
1119
           destdir="${build.javadocs}"
1120
           author="true"
1121
           version="true"
1122
           use="true"
1123
           windowtitle="${Name} API"
1124
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1125
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1126
         <classpath>
1127
           <path refid="compile.classpath"/>
1128
         </classpath>
1129
       </javadoc>
1130
   </target>
1131

    
1132
   <target name="dist"
1133
       depends="geteml,jar,protocol,jdoc,getConversionXSL,getutilities"
1134
            description="prepares a full release distribution">
1135
      <mkdir dir="${dist.dir}"/>
1136
      <delete dir="${ver.dir}" />
1137
      <mkdir dir="${ver.dir}"/>
1138
      <copy todir="${ver.dir}">
1139
        <fileset dir="."
1140
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1141
      </copy>
1142
      <copy todir="${ver.dir}" file="build.xml"/>
1143
      <copy todir="${ver.dir}" file="build.properties"/>
1144

    
1145
      <copy todir="${ver.dir}/docs" filtering="yes">
1146
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1147
      </copy>
1148
      <copy todir="${ver.dir}/docs" filtering="no">
1149
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1150
      </copy>
1151
      <copy todir="${ver.dir}/docs/dev">
1152
        <fileset dir="${build.dir}/docs"/>
1153
      </copy>
1154
      <copy todir="${ver.dir}/src">
1155
        <fileset dir="${build.dir}/src"/>
1156
      </copy>
1157
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1158
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1159
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1160
      <!--
1161
      <delete dir="./${ver.dir}/${build.dir}"/>
1162
      <delete dir="./${ver.dir}/dist"/>
1163
      -->
1164
      <delete file="./${name}-${release}.zip"/>
1165
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1166
      <delete file="./${name}-${release}.tar.gz" />
1167
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1168
      <gzip zipfile="./${name}-${release}.tar.gz"
1169
                src="./${name}-${release}.tar"/>
1170
      <delete file="./${name}-${release}.tar" />
1171
  </target>
1172

    
1173
  <target name="distsrc" depends="dist"
1174
            description="prepares a source distribution">
1175
      <mkdir dir="${ver.src}"/>
1176
      <copy todir="${ver.src}">
1177
        <fileset dir="./src"/>
1178
      </copy>
1179
      <mkdir dir="${util.dir}"/>
1180
      <copy todir="${util.dir}">
1181
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1182
      </copy>
1183

    
1184
      <delete file="./${name}-src-${release}.zip"/>
1185
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1186
      <delete file="./${name}-src-${release}.tar.gz" />
1187
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1188
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1189
                src="./${name}-src-${release}.tar"/>
1190
      <delete file="./${name}-src-${release}.tar" />
1191
      <delete dir="${dist.dir}"/>
1192
  </target>
1193

    
1194
   <target name="stylesheettest">
1195
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1196
      <param name="displaymodule" expression="${displaymodule}"/>
1197
      <param name="docid" expression="${input}"/>
1198
      <param name="entitytype" expression="${entitytype}"/>
1199
      <param name="entityindex" expression="${entityindex}"/>
1200
      <outputproperty name="method" value="html"/>
1201
      <outputproperty name="standalone" value="yes"/>
1202
      <outputproperty name="encoding" value="iso8859_1"/>
1203
      <outputproperty name="indent" value="yes"/>
1204
    </xslt>
1205
  </target>
1206

    
1207
 <target name="gridinit" depends="init">
1208
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1209
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1210
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1211
   <property environment="env"/>
1212
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1213
    <path id="webservicepath">
1214
        <pathelement location="."/>
1215
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1216
        <pathelement location="${build.dest}"/>
1217
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1218
           <include name="*.jar"/>
1219
        </fileset>
1220
      </path>
1221
</target>
1222

    
1223
 <target name="gridprepare" depends="gridinit, prepare">
1224
 </target>
1225

    
1226
  <target name="compileinterface" depends="clean, gridprepare">
1227
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1228
  </target>
1229

    
1230
  <target name="generateWSDL" depends="compileinterface">
1231
    <echo message="Generating wsdl from ${interface.name} interface"/>
1232
    <java classname="${java2wsdl.tool}"
1233
          dir="${build.src}" fork="yes"
1234
          classpathref="webservicepath"  failonerror="true" >
1235
      <arg value="-P"/>
1236
      <arg value="${interface.name}PortType"/>
1237
      <arg value="-S"/>
1238
      <arg value="${interface.name}Service"/>
1239
      <arg value="-y"/>
1240
      <arg value="WRAPPED"/>
1241
      <arg value="-u"/>
1242
      <arg value="LITERAL"/>
1243
      <arg value="-l"/>
1244
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1245
      <arg value="-n"/>
1246
      <arg value="http://${services.namespace}/${interface.name}"/>
1247
      <arg value="${interface.package}.${interface.name}"/>
1248
    </java>
1249
  </target>
1250

    
1251
   <target name="decorateWSDL" depends="generateWSDL">
1252
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1253
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1254
            fork="yes"
1255
            classpathref="webservicepath" failonerror="true" >
1256
        <arg value="${binding.file}"/>
1257
        <arg value="${wsdl.file}"/>
1258
      </java>
1259
   </target>
1260

    
1261
   <target name="generatestubs" depends="decorateWSDL">
1262
      <echo message=" Generating stubs " />
1263
      <echo message="wsdl file is ${wsdl.file}"/>
1264
      <echo message="build.src is ${build.src}"/>
1265
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1266
            classpathref="webservicepath" failonerror="true" >
1267
         <arg value="${wsdl.file}"/>
1268
    </java>
1269
  </target>
1270

    
1271
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1272
     <echo message=" Compiling stubs " />
1273
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1274
     <echo message=" Compiling impl " />
1275
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1276
  </target>
1277

    
1278
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1279
     <echo message=" jar stubs classes " />
1280
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1281
     <echo message=" jar impl classes " />
1282
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1283
  </target>
1284

    
1285
  <target name="gar" depends="jarStubsAndImpl">
1286
     <echo message=" jar the gar file"/>
1287
     <mkdir dir="${build.dir}/gar"/>
1288
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1289
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1290
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1291
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1292
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1293
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1294
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1295
  </target>
1296

    
1297
  <target name="compilewebclient" depends="prepare">
1298
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1299
  </target>
1300

    
1301
  <target name="runwebclient" depends="compilewebclient">
1302
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1303
           dir="${build.dest}" fork="yes"
1304
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1305
         <arg value="${serviceUrl}"/>
1306
         <arg value="${docid}"/>
1307
     </java>
1308
  </target>
1309
  
1310
  <target name="spatial_option" depends="init" description=" -- compiles code for the spatial option">
1311

    
1312
    <echo message="Compiling the metatcat shapefile creator"/>
1313
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1314
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1315
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1316
    </exec>
1317
  
1318
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1319
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/libshp.a -o bin/test.out" />
1320
    </exec>
1321
  </target>
1322

    
1323
</project>
(5-5/5)