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-09-27 16:48:07 -0700 (Tue, 27 Sep 2005) $'
11
  *    '$Revision: 2599 $'
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" value="lib/jdbc7.1-1.2.jar" />
105
     <!-- Property to indicate is not MSSQL installation-->
106
     <property name="other" value="yes"/>
107
     <property name="install-sql"
108
               value="xmltables-postgres.sql" />
109
     <property name="upgrade-1.2-sql"
110
               value="upgrade-db-to-1.2-postgres.sql" />
111
     <property name="upgrade-1.3-sql"
112
               value="upgrade-db-to-1.3-postgres.sql" />
113
     <property name="upgrade-1.4-sql"
114
               value="upgrade-db-to-1.4-postgres.sql" />
115
     <property name="upgrade-1.5-sql"
116
               value="upgrade-db-to-1.5-postgres.sql" />
117
     <property name="upgrade-1.6-sql"
118
               value="upgrade-db-to-1.6-postgres.sql" />
119
    </target>
120

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
357
   </target>
358

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
555

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

    
561
   </target>
562

    
563

    
564

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

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

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

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

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

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

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

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

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

    
682
   </target>
683

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

    
699

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

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

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

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

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

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

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

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

    
795

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

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

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

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

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

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

    
848
       <property name="war.lib" value="${build.war}/lib" />
849
       <property name="war.webinf" value="${build.war}/WEB-INF" />
850
       <property name="war.context" value="${build.war}/${context}" />
851
       <mkdir dir="${war.lib}" />
852
       <mkdir dir="${war.webinf}" />
853
       <mkdir dir="${war.context}" />
854

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

    
898
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
899
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
900
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
901
   </target>
902

    
903
   <target name="getConversionXSL" depends="prepare"
904
            unless="styles.not.needed"
905
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
906

    
907
     <echo>Enter CVS password: </echo>
908
     <cvs cvsRoot="${cvsroot}"
909
          package="${eml-module}"
910
          tag="${eml2_0_1-tag}"
911
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
912

    
913
     <mkdir dir="lib/style/common/emlb6toeml2" />
914
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
915
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
916
         <include name="*.xsl"/>
917
         <include name="*.xml"/>
918
       </fileset>
919
      </copy>
920
   </target>
921

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

    
944
      <jar jarfile="${build.dir}/${name}-junittests.jar"
945
        basedir="${build.tests}"
946
                includes="**/*.class" />
947
   </target>
948

    
949
   <target name="test" depends="testprep"
950
            description="Uses the ant junit task to run all JUnit tests">
951

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

    
966
        <formatter type="plain" />
967

    
968
        <batchtest fork="yes" todir="${build.dir}">
969
          <fileset dir="${build.tests}">
970
            <include name="**/*.class" />
971
          </fileset>
972
        </batchtest>
973
     </junit>
974
   </target>
975

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

    
979
              <echo>testtorun: ${testtorun}</echo>
980

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

    
995
        <formatter type="plain" />
996

    
997
        <batchtest fork="yes" todir="${build.dir}">
998
          <fileset dir="${build.tests}">
999
            <include name="**/${testtorun}.class" />
1000
          </fileset>
1001
        </batchtest>
1002
     </junit>
1003
   </target>
1004

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

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

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

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

    
1060
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1061
                    basedir="${build.metacatnettest}"
1062
                    includes="**/*.class" />
1063

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

    
1076
        <formatter type="plain" />
1077

    
1078
        <batchtest fork="yes" todir="${build.dir}">
1079
          <fileset dir="${build.metacatnettest}">
1080
            <include name="**/*.class" />
1081
          </fileset>
1082
        </batchtest>
1083
     </junit>
1084
   </target>
1085

    
1086
   <target name="cleanweb" depends="clean"
1087
            description="deletes tomcat web context dir and all its contents">
1088
     <delete dir="${installdir}" />
1089
   </target>
1090

    
1091

    
1092
   <target name="clean" depends="init"
1093
            description="deletes build dir and files that can be regenerated form the release">
1094
       <delete dir="${build.dir}" />
1095
   </target>
1096

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

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

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

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

    
1168
  <target name="distsrc" depends="dist"
1169
            description="prepares a source distribution">
1170
      <mkdir dir="${ver.src}"/>
1171
      <copy todir="${ver.src}">
1172
        <fileset dir="./src"/>
1173
      </copy>
1174
      <mkdir dir="${util.dir}"/>
1175
      <copy todir="${util.dir}">
1176
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1177
      </copy>
1178

    
1179
      <delete file="./${name}-src-${release}.zip"/>
1180
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1181
      <delete file="./${name}-src-${release}.tar.gz" />
1182
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1183
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1184
                src="./${name}-src-${release}.tar"/>
1185
      <delete file="./${name}-src-${release}.tar" />
1186
      <delete dir="${dist.dir}"/>
1187
  </target>
1188

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

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

    
1218
 <target name="gridprepare" depends="gridinit, prepare">
1219
 </target>
1220

    
1221
  <target name="compileinterface" depends="clean, gridprepare">
1222
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1223
  </target>
1224

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

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

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

    
1266
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1267
     <echo message=" Compiling stubs " />
1268
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1269
     <echo message=" Compiling impl " />
1270
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1271
  </target>
1272

    
1273
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1274
     <echo message=" jar stubs classes " />
1275
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1276
     <echo message=" jar impl classes " />
1277
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1278
  </target>
1279

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

    
1292
  <target name="compilewebclient" depends="prepare">
1293
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1294
  </target>
1295

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

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

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