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: sgarg $'
10
  *    '$Date: 2005-07-21 16:59:15 -0700 (Thu, 21 Jul 2005) $'
11
  *    '$Revision: 2518 $'
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
      <property name="srcdir" value="./src" />
318
      <property name="testdir" value="./test" />
319
      <property name="testtorun" value="BuildIndexTest" />
320
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
321
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
322
      <property name="build.dir" value="./build"/>
323
      <property name="build.src" value="${build.dir}/src"/>
324
      <property name="build.dest" value="${build.dir}/classes"/>
325
      <property name="build.docs" value="${build.dir}/docs"/>
326
      <property name="build.samples" value="${build.dir}/samples"/>
327
      <property name="build.tests" value="${build.dir}/tests"/>
328
      <property name="build.tmp" value="${build.dir}/tmp"/>
329
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
330
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
331
      <property name="build.data" value="${build.dir}/data"/>
332
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
333
      <property name="build.war" value="${build.dir}/war"/>
334

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

    
343
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
344
      <condition property="utilities.required">
345
        <or>
346
          <not><available file="lib/httpclient.jar"/></not>
347
          <not><available file="lib/utilities.jar"/></not>
348
        </or>
349
      </condition>
350
      <condition property="eml.required">
351
        <or>
352
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
353
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
354
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
355
        </or>
356
      </condition>
357
   </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
              classpath="${cpath}"
385
              debug="${debug}"
386
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
387
   </target>
388

    
389
   <target name="jar" depends="compile,geteml"
390
    description="Compiles and jars metacat java code to metacat.jar in build dir">
391

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

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

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

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

    
419
   <target name="client" depends="utilities, prepare"
420
    description="Compiles metacat-client java code to build dir">
421
       <javac srcdir="${build.src}"
422
              destdir="${build.dest}"
423
              classpath="${cpath}"
424
              includes="edu/ucsb/nceas/metacat/client/*" />
425
   </target>
426

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

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

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

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

    
469
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
470
            description="Calls getemlpre2 and geteml2+ targets" />
471

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

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

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

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

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

    
513
     </copy>
514
     <antcall target="copyxsl">
515
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
516
        <param name="dirname" value="eml-2.0.0" />
517
     </antcall>
518

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

    
536
   <target  name="copyxsl"
537
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
538

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

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

    
547

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

    
553
   </target>
554

    
555

    
556

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

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

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

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

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

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

    
625
     <javac srcdir="${build.tmp}"
626
            destdir="${build.tmp}"
627
            classpath="${cpath}"
628
            debug="${debug}"
629
            includes="upgrade_db_to_1_5.java"/>
630

    
631
     <java classname="upgrade_db_to_1_5"
632
           classpath="${cpath}:${build.tmp}"/>
633

    
634
   </target>
635

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

    
648

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

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

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

    
701
   <target name="install-registry" depends="init,getConversionXSL"
702
            description="Install Registry">
703

    
704
      <copy file="${srcdir}/perl/register-dataset.cgi"
705
            todir="${inst.cgi.dir}" filtering="yes"/>
706
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
707

    
708
      <mkdir dir="${temp-dir}" />
709
      <copy todir="${temp-dir}" filtering="yes">
710
       <fileset dir="lib/style/common/emlb6toeml2">
711
         <include name="*.xsl"/>
712
         <include name="*.xml"/>
713
       </fileset>
714
      </copy>
715

    
716
      <echo message="Install Registry completed." />
717
   </target>
718

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

    
744

    
745
   <target name="install-skin" depends="init"
746
            description="Install a Skin">
747

    
748
      <input message="Please enter name of the skin"
749
             addproperty="skin-name"/>
750

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

    
781
      <echo message="Install Skin completed." />
782
   </target>
783

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

    
794
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
795
            description="Prepare files for creating a web archive (WAR)">
796

    
797
       <property name="war.lib" value="${build.war}/lib" />
798
       <property name="war.webinf" value="${build.war}/WEB-INF" />
799
       <property name="war.context" value="${build.war}/${context}" />
800
       <mkdir dir="${war.lib}" />
801
       <mkdir dir="${war.webinf}" />
802
       <mkdir dir="${war.context}" />
803

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

    
846
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
847
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
848
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
849
   </target>
850

    
851
   <target name="getConversionXSL" depends="prepare"
852
            unless="styles.not.needed"
853
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
854

    
855
     <echo>Enter CVS password: </echo>
856
     <cvs cvsRoot="${cvsroot}"
857
          package="${eml-module}"
858
          tag="${eml2_0_1-tag}"
859
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
860

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

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

    
884
      <jar jarfile="${build.dir}/${name}-junittests.jar"
885
        basedir="${build.tests}"
886
                includes="**/*.class" />
887
   </target>
888

    
889
   <target name="test" depends="testprep"
890
            description="Uses the ant junit task to run all JUnit tests">
891

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

    
900
        <formatter type="plain" />
901

    
902
        <batchtest fork="yes" todir="${build.dir}">
903
          <fileset dir="${build.tests}">
904
            <include name="**/*.class" />
905
          </fileset>
906
        </batchtest>
907
     </junit>
908
   </target>
909

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

    
913
              <echo>testtorun: ${testtorun}</echo>
914

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

    
923
        <formatter type="plain" />
924

    
925
        <batchtest fork="yes" todir="${build.dir}">
926
          <fileset dir="${build.tests}">
927
            <include name="**/${testtorun}.class" />
928
          </fileset>
929
        </batchtest>
930
     </junit>
931
   </target>
932

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

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

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

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

    
976
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
977
                    basedir="${build.metacatnettest}"
978
                    includes="**/*.class" />
979

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

    
988
        <formatter type="plain" />
989

    
990
        <batchtest fork="yes" todir="${build.dir}">
991
          <fileset dir="${build.metacatnettest}">
992
            <include name="**/*.class" />
993
          </fileset>
994
        </batchtest>
995
     </junit>
996
   </target>
997

    
998
   <target name="cleanweb" depends="clean"
999
            description="deletes tomcat web context dir and all its contents">
1000
     <delete dir="${installdir}" />
1001
   </target>
1002

    
1003

    
1004
   <target name="clean" depends="init"
1005
            description="deletes build dir and files that can be regenerated form the release">
1006
       <delete dir="${build.dir}" />
1007
   </target>
1008

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

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

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

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

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

    
1089
      <delete file="./${name}-src-${release}.zip"/>
1090
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1091
      <delete file="./${name}-src-${release}.tar.gz" />
1092
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1093
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1094
                src="./${name}-src-${release}.tar"/>
1095
      <delete file="./${name}-src-${release}.tar" />
1096
      <delete dir="${dist.dir}"/>
1097
  </target>
1098

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

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

    
1128
 <target name="gridprepare" depends="gridinit, prepare">
1129
 </target>
1130

    
1131
  <target name="compileinterface" depends="clean, gridprepare">
1132
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1133
  </target>
1134

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

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

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

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

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

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

    
1202
  <target name="compilewebclient" depends="prepare">
1203
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1204
  </target>
1205

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