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-08-26 17:43:05 -0700 (Fri, 26 Aug 2005) $'
11
  *    '$Revision: 2549 $'
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
  <target name="check-db">
37
    <condition property="use-oracle">
38
      <equals arg1="${database}" arg2="oracle" />
39
    </condition>
40
    <condition property="use-postgresql">
41
      <equals arg1="${database}" arg2="postgresql" />
42
    </condition>
43
    <condition property="use-sqlserver">
44
      <equals arg1="${database}" arg2="sqlserver" />
45
    </condition>
46
  </target>
47

    
48
  <target name="oracle" if="use-oracle">
49
     <!-- Customize these properties if you are using oracle -->
50
     <echo message="Using oracle..."/>
51
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
52
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
53
     <property name="jdbc" value="${jdbc_base}/classes111.zip" />
54
     <!-- Property to indicate is not MSSQL installation-->
55
     <property name="other" value="yes"/>
56
     <property name="install-sql"
57
               value="xmltables.sql" />
58
     <property name="upgrade-1.2-sql"
59
               value="upgrade-db-to-1.2.sql" />
60
     <property name="upgrade-1.3-sql"
61
               value="upgrade-db-to-1.3.sql" />
62
     <property name="upgrade-1.4-sql"
63
               value="upgrade-db-to-1.4.sql" />
64
     <property name="upgrade-1.5-sql"
65
               value="upgrade-db-to-1.5.sql" />
66
     <property name="upgrade-1.6-sql"
67
               value="upgrade-db-to-1.6.sql" />
68
   </target>
69

    
70
   <target name="postgresql" if="use-postgresql">
71
     <!-- Customize these properties if you are using postgres -->
72
     <echo message="Using PostgreSQL..."/>
73
     <property name="dbDriver" value="org.postgresql.Driver"/>
74
     <property name="dbAdapter"
75
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
76
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
77
     <!-- Property to indicate is not MSSQL installation-->
78
     <property name="other" value="yes"/>
79
     <property name="install-sql"
80
               value="xmltables-postgres.sql" />
81
     <property name="upgrade-1.2-sql"
82
               value="upgrade-db-to-1.2-postgres.sql" />
83
     <property name="upgrade-1.3-sql"
84
               value="upgrade-db-to-1.3-postgres.sql" />
85
     <property name="upgrade-1.4-sql"
86
               value="upgrade-db-to-1.4-postgres.sql" />
87
     <property name="upgrade-1.5-sql"
88
               value="upgrade-db-to-1.5-postgres.sql" />
89
     <property name="upgrade-1.6-sql"
90
               value="upgrade-db-to-1.6-postgres.sql" />
91
    </target>
92

    
93
   <target name="sqlserver" if="use-sqlserver">
94
     <!-- Customize these properties if you are using SQL server -->
95
     <echo message="Using SQL Server..."/>
96
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
97
     <property name="dbAdapter"
98
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
99
     <property name="jdbc" value="${jdbc_base}/msbase.jar" />
100
     <property name="jdbc-add1" value="${jdbc_base}/msutil.jar" />
101
     <property name="jdbc-add2" value="${jdbc_base}/mssqlserver.jar" />
102
     <!-- Property to indicate is a MSSQL installation-->
103
     <property name="MSSQL" value="yes"/>
104
     <property name="install-sql"
105
               value="xmltables-sqlserver.sql" />
106
   </target>
107

    
108
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
109
      <!-- usr for client testing, generally you don't need change-->
110
      <property name="mcuser" value="uid=jones,o=NCEAS,dc=ecoinformatics,dc=org"/>
111
      <property name="mcpassword" value=""/>
112
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
113
      <property name="mcanotherpassword" value=""/>
114

    
115
      <property name="debug" value="on" />
116
      <property name="debuglevel" value="55" />
117

    
118
      <property name="morphosourcedir" value="../morpho" />
119
      <property name="defaultcontenttype" value="application/octet-stream" />
120
      <property name="utilitiesdir" value="../utilities" />
121

    
122
      <!-- Make sure these paths match the location of the jar files
123
           on your system, the defaults should usually work -->
124
      <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
125
        <equals arg1="${tomcatversion}" arg2="tomcat3" />
126
      </condition>
127
      <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
128
        <equals arg1="${tomcatversion}" arg2="tomcat4" />
129
      </condition>
130
      <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
131
        <equals arg1="${tomcatversion}" arg2="tomcat5" />
132
      </condition>
133
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
134
      <echo>*********** set jsdk to ${jsdk}</echo>
135
      <property name="xmlp"
136
                value="lib/xercesImpl.jar" />
137
      <property name="cos"
138
                value="lib/cos.jar" />
139
      <property name="morpho"
140
                value="lib/morpho.jar" />
141
      <property name="xalan"
142
                value="lib/xalan/xalan.jar" />
143
      <property name="apis"
144
                value="lib/xalan/xml-apis.jar" />
145
      <property name="httpclient"
146
                value="lib/httpclient.jar" />
147
      <property name="emlparser"
148
                value="lib/eml.jar" />
149
      <property name="configxml"
150
                value="lib/configxml.jar" />
151
      <property name="itislib"
152
                value="lib/itislib.jar" />
153
      <property name="emlparser"
154

    
155
                value="lib/eml.jar" />
156
      <property name="util"
157
                value="lib/utilities.jar" />
158
  </target>
159

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

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

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

    
229
      <filter token="scope"                value="${scope}"/>
230
      <filter token="responseForm"         value="${responseForm}"/>
231
      <filter token="entryForm"            value="${entryForm}"/>
232
      <filter token="guide"                value="${guide}"/>
233
      <filter token="confirmData"          value="${confirmData}"/>
234
      <filter token="deleteData"           value="${deleteData}"/>
235
      <filter token="genericHeader"        value="${genericHeader}"/>
236
      <filter token="genericFooter"        value="${genericFooter}"/>
237
      <filter token="adminname"            value="${adminname}"/>
238
      <filter token="recipient"            value="${recipient}"/>
239

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

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

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

    
282
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
283
      <filter token="style-path" value="${style-skins-path}"/>
284
      <filter token="replication-path" value="${replication-path}"/>
285
      <filter token="harvester-registration-login-path" value="${harvester-registration-login-path}"/>
286
      <filter token="harvester-registration-path" value="${harvester-registration-path}"/>
287
      <filter token="config-dir" value="${config-dir}"/>
288
      <filter token="default-style" value="${default-style}"/>
289
      <filter token="eml-version" value="${eml-version}"/>
290
      <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}"/>
291
      <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}"/>
292
      <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}"/>
293
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
294
      <filter token="context" value="${context}"/>
295
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
296
      <filter token="debuglevel" value="${debuglevel}" />
297
      <filter token="datafilepath" value="${datafilepath}" />
298
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
299
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
300
      <filter token="debugprefix" value="${debugprefix}"/>
301
      <filter token="administrators" value="${administrators}"/>
302

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

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

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

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

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

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

    
386
       <javac srcdir="${build.src}"
387
              destdir="${build.dest}"
388
              classpath="${cpath}"
389
              debug="${debug}"
390
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
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
              classpath="${cpath}"
428
              includes="edu/ucsb/nceas/metacat/client/*" />
429
   </target>
430

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

    
438
   <target name="harvester" depends="client"
439
           description="Compiles harvester java code to build dir">
440
       <echo message="classpath is:   ${cpath}"/>
441
       <javac srcdir="${build.src}"
442
              destdir="${build.dest}"
443
              classpath="${cpath}"
444
              includes="edu/ucsb/nceas/metacat/harvesterClient/*" />
445
   </target>
446

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

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

    
473
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
474
            description="Calls getemlpre2 and geteml2+ targets" />
475

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

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

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

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

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

    
517
     </copy>
518
     <antcall target="copyxsl">
519
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
520
        <param name="dirname" value="eml-2.0.0" />
521
     </antcall>
522

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

    
540
   <target  name="copyxsl"
541
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
542

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

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

    
551

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

    
557
   </target>
558

    
559

    
560

    
561
   <target name="register-schemas" depends="prepare"
562
   description="Registers the Schemas with a new Metacat instance">
563
     <echo/>
564
     <echo>Registering the Schemas with the new Metacat instance...</echo>
565
     <sql driver="${dbDriver}"
566
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
567
          url="${jdbc-connect}"
568
          userid="${user}"
569
          password="${password}"
570
          src="${build.src}/loaddtdschema.sql" />
571
   </target>
572

    
573
   <target name="installdb" depends="prepare"
574
            description="Installs the database tables">
575
     <echo/>
576
     <echo>Installing the database tables...</echo>
577
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
578
     <sql driver="${dbDriver}"
579
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
580
          url="${jdbc-connect}"
581
          userid="${user}"
582
          password="${password}"
583
          src="${build.src}/${install-sql}" />
584
   </target>
585

    
586
   <target name="upgrade12" depends="prepare"
587
            description="Updates the database tables to upgrade to version 1.2">
588
     <echo/>
589
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
590
     <sql driver="${dbDriver}"
591
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
592
          url="${jdbc-connect}"
593
          userid="${user}"
594
          password="${password}"
595
          src="${build.src}/${upgrade-1.2-sql}" />
596
   </target>
597

    
598
   <target name="upgrade13" depends="prepare"
599
            description="Updates the database tables to upgrade to version 1.3">
600
     <echo/>
601
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
602
     <sql driver="${dbDriver}"
603
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
604
          url="${jdbc-connect}"
605
          userid="${user}"
606
          password="${password}"
607
          src="${build.src}/${upgrade-1.3-sql}" />
608
   </target>
609

    
610
   <target name="upgrade14" depends="prepare"
611
            description="Updates the database tables to upgrade to version 1.4">
612
     <echo/>
613
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
614
     <sql driver="${dbDriver}"
615
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
616
          url="${jdbc-connect}"
617
          userid="${user}"
618
          password="${password}"
619
          src="${build.src}/${upgrade-1.4-sql}" />
620
   </target>
621

    
622
   <target name="upgrade15" depends="sqlupgrade15"
623
           description="Updates the database tables to upgrade to version 1.5">
624
     <echo/>
625
     <echo>Updating the database tables to upgrade to version 1.5...</echo>
626
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
627
           todir="${build.tmp}" filtering="yes"/>
628

    
629
     <javac srcdir="${build.tmp}"
630
            destdir="${build.tmp}"
631
            classpath="${cpath}"
632
            debug="${debug}"
633
            includes="upgrade_db_to_1_5.java"/>
634

    
635
     <java classname="upgrade_db_to_1_5"
636
           classpath="${cpath}:${build.tmp}"/>
637

    
638
   </target>
639

    
640
   <target name="upgrade16" depends="prepare"
641
            description="Updates the database tables from version 1.5 to version 1.6">
642
     <echo/>
643
     <echo>Updating the database tables to upgrade to version 1.6...</echo>
644
     <sql driver="${dbDriver}"
645
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
646
          url="${jdbc-connect}"
647
          userid="${user}"
648
          password="${password}"
649
          src="${build.src}/${upgrade-1.6-sql}" />
650
   </target>
651

    
652

    
653
   <target name="sqlupgrade15" depends="prepare">
654
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
655
      <sql driver="${dbDriver}"
656
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
657
          url="${jdbc-connect}"
658
          userid="${user}"
659
          password="${password}"
660
          src="${build.src}/${upgrade-1.5-sql}" />
661
      <sql driver="${dbDriver}"
662
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
663
          url="${jdbc-connect}"
664
          userid="${user}"
665
          password="${password}"
666
          rdbms="oracle"
667
          delimiter="/">
668
        <transaction>
669
           CREATE TRIGGER xml_returnfield_before_insert
670
           BEFORE INSERT ON xml_returnfield FOR EACH ROW
671
           BEGIN
672
              SELECT xml_returnfield_id_seq.nextval
673
                 INTO :new.returnfield_id
674
                 FROM dual;
675
           END;
676
           /
677
        </transaction>
678
        <transaction>
679
           CREATE TRIGGER xml_queryresult_before_insert
680
           BEFORE INSERT ON xml_queryresult FOR EACH ROW
681
           BEGIN
682
              SELECT xml_queryresult_id_seq.nextval
683
              INTO :new.queryresult_id
684
              FROM dual;
685
           END;
686
           /
687
        </transaction>
688
      </sql>
689
   </target>
690

    
691
   <target name="install" depends="war" description="* Full Install *">
692
       <mkdir dir="${datafilepath}" />
693
       <mkdir dir="${inlinedatafilepath}" />
694
       <chmod dir="${datafilepath}" perm="ug+w" />
695
       <mkdir dir="${temp-dir}"/>
696
       <chmod dir="${temp-dir}" perm="ug+w" />
697
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
698
   </target>
699

    
700
   <target name="upgrade" depends="install"
701
          description="* Upgrade an existing metacat installation with a new version *">
702
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
703
   </target>
704

    
705
   <target name="install-registry" depends="init,getConversionXSL"
706
            description="Install Registry">
707

    
708
      <copy file="${srcdir}/perl/register-dataset.cgi"
709
            todir="${inst.cgi.dir}" filtering="yes"/>
710
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
711

    
712
      <mkdir dir="${temp-dir}" />
713
      <copy todir="${temp-dir}" filtering="yes">
714
       <fileset dir="lib/style/common/emlb6toeml2">
715
         <include name="*.xsl"/>
716
         <include name="*.xml"/>
717
       </fileset>
718
      </copy>
719

    
720
      <echo message="Install Registry completed." />
721
   </target>
722

    
723
   <target name="install-ldap" depends="init">
724
      <copy file="${srcdir}/perl/ldapweb.cgi"
725
            todir="${inst.cgi.dir}" filtering="yes"/>
726
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
727
      <copy file="lib/ldapweb.cfg"
728
            todir="${inst.cgi.dir}" filtering="yes"/>
729
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
730
      <mkdir dir="${templates.dir}" />
731
      <copy todir="${templates.dir}" filtering="yes">
732
        <fileset dir="lib/style/common/templates">
733
            <include name="${defaultChangePass}"/>
734
            <include name="${defaultResetPass}"/>
735
            <include name="${changePassSuccess}"/>
736
            <include name="${resetPassSuccess}"/>
737
            <include name="${registerFailed}"/>
738
            <include name="${registerLter}"/>
739
            <include name="${registerMatch}"/>
740
            <include name="${registerSuccess}"/>
741
            <include name="${register}"/>
742
            <include name="${searchResults}"/>
743
        </fileset>
744
      </copy>
745
      <echo message="ldapweb install complete." />
746
   </target>
747

    
748

    
749
   <target name="install-skin" depends="init"
750
            description="Install a Skin">
751

    
752
      <input message="Please enter name of the skin"
753
             addproperty="skin-name"/>
754

    
755
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
756
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
757
       <fileset dir="lib/style/skins/${skin-name}">
758
           <exclude name="*.png"/>
759
           <exclude name="*.gif"/>
760
           <exclude name="*.jpg"/>
761
           <exclude name="**/CVS*"/>
762
           <exclude name="**/.#*"/>
763
       </fileset>
764
      </copy>
765
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
766
       <fileset dir="lib/style/skins/${skin-name}">
767
           <include name="*.png"/>
768
           <include name="*.gif"/>
769
           <include name="*.jpg"/>
770
           <exclude name="**/CVS*"/>
771
           <exclude name="**/.#*"/>
772
       </fileset>
773
      </copy>
774
      <!--
775
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
776
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
777
       <fileset dir="lib/style/skins/${skin-name}/images">
778
           <include name="*.png"/>
779
           <include name="*.gif"/>
780
           <include name="*.jpg"/>
781
       </fileset>
782
      </copy>
783
      -->
784

    
785
      <echo message="Install Skin completed." />
786
   </target>
787

    
788
   <target name="war" depends="warPrepare,warMSSQL"
789
            description="Create a web archive (WAR) for servlet deployment">
790
       <war destfile="${build.dir}/${context}.war"
791
            webxml="${build.war}/web.xml">
792
         <fileset dir="${war.context}"/>
793
         <lib dir="${war.lib}"/>
794
         <webinf dir="${war.webinf}"/>
795
       </war>
796
   </target>
797

    
798
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
799
            description="Prepare files for creating a web archive (WAR)">
800

    
801
       <property name="war.lib" value="${build.war}/lib" />
802
       <property name="war.webinf" value="${build.war}/WEB-INF" />
803
       <property name="war.context" value="${build.war}/${context}" />
804
       <mkdir dir="${war.lib}" />
805
       <mkdir dir="${war.webinf}" />
806
       <mkdir dir="${war.context}" />
807

    
808
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
809
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
810
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
811
       <copy todir="${war.lib}" filtering="no">
812
         <fileset dir="lib">
813
           <include name="*.jar"/>
814
         </fileset>
815
         <fileset dir="lib/xalan">
816
           <include name="*.jar"/>
817
         </fileset>
818
       </copy>
819
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
820
       <copy file="lib/web.xml.${tomcatversion}"
821
             tofile="${build.war}/web.xml" />
822
       <copy file="lib/metacat.properties" todir="${war.webinf}"
823
             filtering="yes" />
824
       <copy todir="${war.context}" filtering="no">
825
         <fileset dir="lib">
826
           <include name="**/*.jpg"/>
827
           <include name="**/*.png"/>
828
           <include name="**/*.gif"/>
829
         </fileset>
830
       </copy>
831
       <copy todir="${war.context}" filtering="yes">
832
         <fileset dir="lib">
833
           <exclude name="*.jar"/>
834
           <exclude name="*.properties"/>
835
           <exclude name="web.xml"/>
836
           <exclude name="**/*.jpg"/>
837
           <exclude name="**/*.png"/>
838
           <exclude name="**/*.gif"/>
839
         </fileset>
840
       </copy>
841
       <copy todir="${war.context}" filtering="no">
842
         <fileset dir="lib">
843
           <include name="**/*.jpg"/>
844
           <include name="**/*.png"/>
845
           <include name="**/*.gif"/>
846
         </fileset>
847
       </copy>
848
   </target>
849

    
850
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
851
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
852
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
853
   </target>
854

    
855
   <target name="getConversionXSL" depends="prepare"
856
            unless="styles.not.needed"
857
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
858

    
859
     <echo>Enter CVS password: </echo>
860
     <cvs cvsRoot="${cvsroot}"
861
          package="${eml-module}"
862
          tag="${eml2_0_1-tag}"
863
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
864

    
865
     <mkdir dir="lib/style/common/emlb6toeml2" />
866
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
867
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
868
         <include name="*.xsl"/>
869
         <include name="*.xml"/>
870
       </fileset>
871
      </copy>
872
   </target>
873

    
874
   <target name="testprep" depends="jar,clientjar,harvesterjar">
875
      <mkdir dir="${build.tests}"/>
876
      <copy todir="${build.tests}" filtering="yes">
877
        <fileset dir="${testdir}">
878
          <include name="edu/**"/>
879
        </fileset>
880
      </copy>
881
      <!-- copy and compile the tests into a jar file -->
882
      <javac srcdir="${build.tests}"
883
             destdir="${build.tests}"
884
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
885
             debug="on"
886
       includes="**/*.java" />
887

    
888
      <jar jarfile="${build.dir}/${name}-junittests.jar"
889
        basedir="${build.tests}"
890
                includes="**/*.class" />
891
   </target>
892

    
893
   <target name="test" depends="testprep"
894
            description="Uses the ant junit task to run all JUnit tests">
895

    
896
      <!-- use the ant "junit" task to run JUnit tests. -->
897
      <junit printsummary="yes" haltonfailure="no" fork="yes"
898
             haltonerror="no">
899
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
900
        <classpath>
901
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
902
        </classpath>
903

    
904
        <formatter type="plain" />
905

    
906
        <batchtest fork="yes" todir="${build.dir}">
907
          <fileset dir="${build.tests}">
908
            <include name="**/*.class" />
909
          </fileset>
910
        </batchtest>
911
     </junit>
912
   </target>
913

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

    
917
              <echo>testtorun: ${testtorun}</echo>
918

    
919
      <!-- use the ant "junit" task to run JUnit tests. -->
920
      <junit printsummary="yes" haltonfailure="no" fork="yes"
921
             haltonerror="no">
922
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
923
        <classpath>
924
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
925
        </classpath>
926

    
927
        <formatter type="plain" />
928

    
929
        <batchtest fork="yes" todir="${build.dir}">
930
          <fileset dir="${build.tests}">
931
            <include name="**/${testtorun}.class" />
932
          </fileset>
933
        </batchtest>
934
     </junit>
935
   </target>
936

    
937
   <target name="testharvester"
938
           depends="testprep"
939
           description="Uses the ant junit task to test only the Harvester code">
940
     <junit printsummary="yes"
941
            haltonfailure="off"
942
            fork="yes"
943
            haltonerror="off">
944
       <classpath>
945
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
946
       </classpath>
947
       <formatter type="plain" />
948
       <batchtest fork="yes" todir="${build.dir}">
949
         <fileset dir="${build.tests}">
950
           <include name="**/harvesterClient/*.class" />
951
         </fileset>
952
       </batchtest>
953
     </junit>
954
   </target>
955

    
956
  <target name="gethttpclient" depends="prepare"
957
            description="checks out and compiles morpho httpclient code">
958
  <!--mkdir dir="${morphosourcedir}" -->
959
        <cvs cvsRoot="${cvsroot}"
960
             package="morpho"
961
             dest="." />
962
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
963
   </target>
964

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

    
969
      <echo>***********************************
970
      Please run ant gethttpclient first!
971
      ***********************************
972
      </echo>
973
      <!-- copy and compile the tests into a jar file -->
974
      <mkdir dir="${build.metacatnettest}"/>
975
      <javac srcdir="${junitnettestsdir}"
976
             destdir="${build.metacatnettest}"
977
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
978
             includes="**/*.java" />
979

    
980
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
981
                    basedir="${build.metacatnettest}"
982
                    includes="**/*.class" />
983

    
984
      <!-- use the ant "junit" task to run JUnit tests. -->
985
      <junit printsummary="yes" haltonfailure="no" fork="yes"
986
             haltonerror="no">
987
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
988
        <classpath>
989
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
990
        </classpath>
991

    
992
        <formatter type="plain" />
993

    
994
        <batchtest fork="yes" todir="${build.dir}">
995
          <fileset dir="${build.metacatnettest}">
996
            <include name="**/*.class" />
997
          </fileset>
998
        </batchtest>
999
     </junit>
1000
   </target>
1001

    
1002
   <target name="cleanweb" depends="clean"
1003
            description="deletes tomcat web context dir and all its contents">
1004
     <delete dir="${installdir}" />
1005
   </target>
1006

    
1007

    
1008
   <target name="clean" depends="init"
1009
            description="deletes build dir and files that can be regenerated form the release">
1010
       <delete dir="${build.dir}" />
1011
   </target>
1012

    
1013
   <target name="fullclean" depends="clean"
1014
            description="deletes even jars that depend on external sources such as stylesheets and jars">
1015
       <delete file="lib/httpclient.jar" />
1016
       <delete file="lib/utilities.jar" />
1017
       <delete includeEmptyDirs="true" failonerror="false">
1018
         <fileset dir="${style-common-cvsrelpath}">
1019
           <include name="${eml-css}" />
1020
           <include name="eml-*/*.xsl" />
1021
           <include name="eml-*" />
1022
         </fileset>
1023
       </delete>
1024
   </target>
1025

    
1026
   <target name="jdoc" depends="prepare"
1027
            description="generates javadoc documentation">
1028
       <javadoc packagenames="edu.ucsb.nceas.*"
1029
           sourcepath="${build.src}"
1030
           destdir="${build.javadocs}"
1031
           classpath="${cpath}"
1032
           author="true"
1033
           version="true"
1034
           use="true"
1035
           windowtitle="${Name} API"
1036
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1037
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
1038
       />
1039
   </target>
1040

    
1041
   <target name="dist"
1042
       depends="geteml,jar,protocol,jdoc,getConversionXSL,getutilities"
1043
            description="prepares a full release distribution">
1044
      <mkdir dir="${dist.dir}"/>
1045
      <delete dir="${ver.dir}" />
1046
      <mkdir dir="${ver.dir}"/>
1047
      <copy todir="${ver.dir}">
1048
        <fileset dir="."
1049
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1050
      </copy>
1051
      <copy todir="${ver.dir}" file="build.xml"/>
1052
      <copy todir="${ver.dir}" file="build.properties"/>
1053

    
1054
      <copy todir="${ver.dir}/docs" filtering="yes">
1055
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1056
      </copy>
1057
      <copy todir="${ver.dir}/docs" filtering="no">
1058
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1059
      </copy>
1060
      <copy todir="${ver.dir}/docs/dev">
1061
        <fileset dir="${build.dir}/docs"/>
1062
      </copy>
1063
      <copy todir="${ver.dir}/src">
1064
        <fileset dir="${build.dir}/src"/>
1065
      </copy>
1066
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1067
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1068
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1069
      <!--
1070
      <delete dir="./${ver.dir}/${build.dir}"/>
1071
      <delete dir="./${ver.dir}/dist"/>
1072
      -->
1073
      <delete file="./${name}-${release}.zip"/>
1074
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1075
      <delete file="./${name}-${release}.tar.gz" />
1076
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1077
      <gzip zipfile="./${name}-${release}.tar.gz"
1078
                src="./${name}-${release}.tar"/>
1079
      <delete file="./${name}-${release}.tar" />
1080
  </target>
1081

    
1082
  <target name="distsrc" depends="dist"
1083
            description="prepares a source distribution">
1084
      <mkdir dir="${ver.src}"/>
1085
      <copy todir="${ver.src}">
1086
        <fileset dir="./src"/>
1087
      </copy>
1088
      <mkdir dir="${util.dir}"/>
1089
      <copy todir="${util.dir}">
1090
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1091
      </copy>
1092

    
1093
      <delete file="./${name}-src-${release}.zip"/>
1094
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1095
      <delete file="./${name}-src-${release}.tar.gz" />
1096
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1097
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1098
                src="./${name}-src-${release}.tar"/>
1099
      <delete file="./${name}-src-${release}.tar" />
1100
      <delete dir="${dist.dir}"/>
1101
  </target>
1102

    
1103
   <target name="stylesheettest">
1104
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1105
      <param name="displaymodule" expression="${displaymodule}"/>
1106
      <param name="docid" expression="${input}"/>
1107
      <param name="entitytype" expression="${entitytype}"/>
1108
      <param name="entityindex" expression="${entityindex}"/>
1109
      <outputproperty name="method" value="html"/>
1110
      <outputproperty name="standalone" value="yes"/>
1111
      <outputproperty name="encoding" value="iso8859_1"/>
1112
      <outputproperty name="indent" value="yes"/>
1113
    </xslt>
1114
  </target>
1115

    
1116
 <target name="gridinit" depends="init">
1117
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1118
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1119
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1120
   <property environment="env"/>
1121
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1122
    <path id="webservicepath">
1123
        <pathelement location="."/>
1124
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1125
        <pathelement location="${build.dest}"/>
1126
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1127
           <include name="*.jar"/>
1128
        </fileset>
1129
      </path>
1130
</target>
1131

    
1132
 <target name="gridprepare" depends="gridinit, prepare">
1133
 </target>
1134

    
1135
  <target name="compileinterface" depends="clean, gridprepare">
1136
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1137
  </target>
1138

    
1139
  <target name="generateWSDL" depends="compileinterface">
1140
    <echo message="Generating wsdl from ${interface.name} interface"/>
1141
    <java classname="${java2wsdl.tool}"
1142
          dir="${build.src}" fork="yes"
1143
          classpathref="webservicepath"  failonerror="true" >
1144
      <arg value="-P"/>
1145
      <arg value="${interface.name}PortType"/>
1146
      <arg value="-S"/>
1147
      <arg value="${interface.name}Service"/>
1148
      <arg value="-y"/>
1149
      <arg value="WRAPPED"/>
1150
      <arg value="-u"/>
1151
      <arg value="LITERAL"/>
1152
      <arg value="-l"/>
1153
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1154
      <arg value="-n"/>
1155
      <arg value="http://${services.namespace}/${interface.name}"/>
1156
      <arg value="${interface.package}.${interface.name}"/>
1157
    </java>
1158
  </target>
1159

    
1160
   <target name="decorateWSDL" depends="generateWSDL">
1161
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1162
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1163
            fork="yes"
1164
            classpathref="webservicepath" failonerror="true" >
1165
        <arg value="${binding.file}"/>
1166
        <arg value="${wsdl.file}"/>
1167
      </java>
1168
   </target>
1169

    
1170
   <target name="generatestubs" depends="decorateWSDL">
1171
      <echo message=" Generating stubs " />
1172
      <echo message="wsdl file is ${wsdl.file}"/>
1173
      <echo message="build.src is ${build.src}"/>
1174
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1175
            classpathref="webservicepath" failonerror="true" >
1176
         <arg value="${wsdl.file}"/>
1177
    </java>
1178
  </target>
1179

    
1180
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1181
     <echo message=" Compiling stubs " />
1182
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1183
     <echo message=" Compiling impl " />
1184
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1185
  </target>
1186

    
1187
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1188
     <echo message=" jar stubs classes " />
1189
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1190
     <echo message=" jar impl classes " />
1191
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1192
  </target>
1193

    
1194
  <target name="gar" depends="jarStubsAndImpl">
1195
     <echo message=" jar the gar file"/>
1196
     <mkdir dir="${build.dir}/gar"/>
1197
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1198
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1199
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1200
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1201
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1202
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1203
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1204
  </target>
1205

    
1206
  <target name="compilewebclient" depends="prepare">
1207
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1208
  </target>
1209

    
1210
  <target name="runwebclient" depends="compilewebclient">
1211
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1212
           dir="${build.dest}" fork="yes"
1213
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1214
         <arg value="${serviceUrl}"/>
1215
         <arg value="${docid}"/>
1216
     </java>
1217
  </target>
1218
</project>
(5-5/5)