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-09-08 13:48:59 -0700 (Thu, 08 Sep 2005) $'
11
  *    '$Revision: 2577 $'
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.6.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
      <filter token="moderators" value="${moderators}"/>
303
      <filter token="allowedSubmitters" value="${allowedSubmitters}"/>
304
      <filter token="deniedSubmitters" value="${deniedSubmitters}"/>
305

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

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

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

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

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

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

    
389
       <javac srcdir="${build.src}"
390
              destdir="${build.dest}"
391
              classpath="${cpath}"
392
              debug="${debug}"
393
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
394
   </target>
395

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
554

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

    
560
   </target>
561

    
562

    
563

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

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

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

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

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

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

    
632
     <javac srcdir="${build.tmp}"
633
            destdir="${build.tmp}"
634
            classpath="${cpath}"
635
            debug="${debug}"
636
            includes="upgrade_db_to_1_5.java"/>
637

    
638
     <java classname="upgrade_db_to_1_5"
639
           classpath="${cpath}:${build.tmp}"/>
640

    
641
   </target>
642

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

    
655

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

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

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

    
708
   <target name="install-registry" depends="init,getConversionXSL"
709
            description="Install Registry">
710

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

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

    
723
      <echo message="Install Registry completed." />
724
   </target>
725

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

    
751

    
752
   <target name="install-skin" depends="init"
753
            description="Install a Skin">
754

    
755
      <input message="Please enter name of the skin"
756
             addproperty="skin-name"/>
757

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

    
788
      <echo message="Install Skin completed." />
789
   </target>
790

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

    
801
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
802
            description="Prepare files for creating a web archive (WAR)">
803

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

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

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

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

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

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

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

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

    
896
   <target name="test" depends="testprep"
897
            description="Uses the ant junit task to run all JUnit tests">
898

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

    
907
        <formatter type="plain" />
908

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

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

    
920
              <echo>testtorun: ${testtorun}</echo>
921

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

    
930
        <formatter type="plain" />
931

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

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

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

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

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

    
983
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
984
                    basedir="${build.metacatnettest}"
985
                    includes="**/*.class" />
986

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

    
995
        <formatter type="plain" />
996

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

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

    
1010

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

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

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

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

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

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

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

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

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

    
1135
 <target name="gridprepare" depends="gridinit, prepare">
1136
 </target>
1137

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

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

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

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

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

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

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

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

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