Project

General

Profile

metacat / build.xml @ 2497

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-04-19 11:37:52 -0700 (Tue, 19 Apr 2005) $'
11
  *    '$Revision: 2497 $'
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
   </target>
67

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

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

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

    
111
      <property name="debug" value="on" />
112
      <property name="debuglevel" value="55" />
113

    
114
      <property name="morphosourcedir" value="../morpho" />
115
      <property name="defaultcontenttype" value="application/octet-stream" />
116
      <property name="utilitiesdir" value="../utilities" />
117

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

    
151
                value="lib/eml.jar" />
152
      <property name="util"
153
                value="lib/utilities.jar" />
154
  </target>
155

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

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

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

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

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

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

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

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

    
299
      <filter token="defaultStage" value="${defaultStage}"/>
300
      <filter token="defaultHeader" value="${defaultHeader}"/>
301
      <filter token="defaultFooter" value="${defaultFooter}"/>
302
      <filter token="defaultChangePass" value="${defaultChangePass}"/>
303
      <filter token="defaultResetPass" value="${defaultResetPass}"/>
304
      <filter token="changePassSuccess" value="${changePassSuccess}"/>
305
      <filter token="resetPassSuccess" value="${resetPassSuccess}"/>
306
      <filter token="registerFailed" value="${registerFailed}"/>
307
      <filter token="registerLter" value="${registerLter}"/>
308
      <filter token="registerMatch" value="${registerMatch}"/>
309
      <filter token="registerSuccess" value="${registerSuccess}"/>
310
      <filter token="register" value="${register}"/>
311
      <filter token="searchResults" value="${searchResults}"/>
312

    
313
      <property name="srcdir" value="./src" />
314
      <property name="testdir" value="./test" />
315
      <property name="testtorun" value="BuildIndexTest" />
316
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
317
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
318
      <property name="build.dir" value="./build"/>
319
      <property name="build.src" value="${build.dir}/src"/>
320
      <property name="build.dest" value="${build.dir}/classes"/>
321
      <property name="build.docs" value="${build.dir}/docs"/>
322
      <property name="build.samples" value="${build.dir}/samples"/>
323
      <property name="build.tests" value="${build.dir}/tests"/>
324
      <property name="build.tmp" value="${build.dir}/tmp"/>
325
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
326
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
327
      <property name="build.data" value="${build.dir}/data"/>
328
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
329
      <property name="build.war" value="${build.dir}/war"/>
330

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

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

    
355
   <target name="prepare" depends="init">
356
      <mkdir dir="${build.dir}"/>
357
      <mkdir dir="${build.src}"/>
358
      <mkdir dir="${build.dest}"/>
359
      <mkdir dir="${build.javadocs}"/>
360
      <mkdir dir="${build.tmp}"/>
361

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

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

    
378
       <javac srcdir="${build.src}"
379
              destdir="${build.dest}"
380
              classpath="${cpath}"
381
              debug="${debug}"
382
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
383
   </target>
384

    
385
   <target name="jar" depends="compile,geteml"
386
    description="Compiles and jars metacat java code to metacat.jar in build dir">
387

    
388
       <delete file="${build.dir}/${name}.jar" />
389
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
390
            excludes="**/protocols/ **/harvesterClient/" />
391
   </target>
392

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

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

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

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

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

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

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

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

    
465
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
466
            description="Calls getemlpre2 and geteml2+ targets" />
467

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

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

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

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

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

    
509
     </copy>
510
     <antcall target="copyxsl">
511
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
512
        <param name="dirname" value="eml-2.0.0" />
513
     </antcall>
514

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

    
532
   <target  name="copyxsl"
533
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
534

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

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

    
543

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

    
549
   </target>
550

    
551

    
552

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

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

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

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

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

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

    
621
     <javac srcdir="${build.tmp}"
622
            destdir="${build.tmp}"
623
            classpath="${cpath}"
624
            debug="${debug}"
625
            includes="upgrade_db_to_1_5.java"/>
626

    
627
     <java classname="upgrade_db_to_1_5"
628
           classpath="${cpath}:${build.tmp}"/>
629

    
630
   </target>
631

    
632
   <target name="sqlupgrade15" depends="prepare">
633
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
634
      <sql driver="${dbDriver}"
635
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
636
          url="${jdbc-connect}"
637
          userid="${user}"
638
          password="${password}"
639
          src="${build.src}/${upgrade-1.5-sql}" />
640
      <sql driver="${dbDriver}"
641
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
642
          url="${jdbc-connect}"
643
          userid="${user}"
644
          password="${password}"
645
          rdbms="oracle"
646
          delimiter="/">
647
        <transaction>
648
           CREATE TRIGGER xml_returnfield_before_insert
649
           BEFORE INSERT ON xml_returnfield FOR EACH ROW
650
           BEGIN
651
              SELECT xml_returnfield_id_seq.nextval
652
                 INTO :new.returnfield_id
653
                 FROM dual;
654
           END;
655
           /
656
        </transaction>
657
        <transaction>
658
           CREATE TRIGGER xml_queryresult_before_insert
659
           BEFORE INSERT ON xml_queryresult FOR EACH ROW
660
           BEGIN
661
              SELECT xml_queryresult_id_seq.nextval
662
              INTO :new.queryresult_id
663
              FROM dual;
664
           END;
665
           /
666
        </transaction>
667
      </sql>
668
   </target>
669

    
670
   <target name="install" depends="war" description="* Full Install *">
671
       <mkdir dir="${datafilepath}" />
672
       <mkdir dir="${inlinedatafilepath}" />
673
       <chmod dir="${datafilepath}" perm="ug+w" />
674
       <mkdir dir="${temp-dir}"/>
675
       <chmod dir="${temp-dir}" perm="ug+w" />
676
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
677
   </target>
678

    
679
   <target name="upgrade" depends="install"
680
          description="* Upgrade an existing metacat installation with a new version *">
681
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
682
   </target>
683

    
684
   <target name="install-registry" depends="init,getConversionXSL"
685
            description="Install Registry">
686

    
687
      <copy file="${srcdir}/perl/register-dataset.cgi"
688
            todir="${inst.cgi.dir}" filtering="yes"/>
689
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
690

    
691
      <mkdir dir="${temp-dir}" />
692
      <copy todir="${temp-dir}" filtering="yes">
693
       <fileset dir="lib/style/common/emlb6toeml2">
694
         <include name="*.xsl"/>
695
         <include name="*.xml"/>
696
       </fileset>
697
      </copy>
698

    
699
      <echo message="Install Registry completed." />
700
   </target>
701

    
702
   <target name="install-ldap" depends="init">
703
      <copy file="${srcdir}/perl/ldapweb.cgi"
704
            todir="${inst.cgi.dir}" filtering="yes"/>
705
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
706
      <copy file="lib/ldapweb.cfg"
707
            todir="${inst.cgi.dir}" filtering="yes"/>
708
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
709
      <mkdir dir="${templates.dir}" />
710
      <copy todir="${templates.dir}" filtering="yes">
711
        <fileset dir="lib/style/common/templates">
712
            <include name="${defaultChangePass}"/>
713
            <include name="${defaultResetPass}"/>
714
            <include name="${changePassSuccess}"/>
715
            <include name="${resetPassSuccess}"/>
716
            <include name="${registerFailed}"/>
717
            <include name="${registerLter}"/>
718
            <include name="${registerMatch}"/>
719
            <include name="${registerSuccess}"/>
720
            <include name="${register}"/>
721
            <include name="${searchResults}"/>
722
        </fileset>
723
      </copy>
724
      <echo message="ldapweb install complete." />
725
   </target>
726

    
727

    
728
   <target name="install-skin" depends="init"
729
            description="Install a Skin">
730

    
731
      <input message="Please enter name of the skin"
732
             addproperty="skin-name"/>
733

    
734
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
735
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
736
       <fileset dir="lib/style/skins/${skin-name}">
737
           <exclude name="*.png"/>
738
           <exclude name="*.gif"/>
739
           <exclude name="*.jpg"/>
740
           <exclude name="**/CVS*"/>
741
           <exclude name="**/.#*"/>
742
       </fileset>
743
      </copy>
744
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
745
       <fileset dir="lib/style/skins/${skin-name}">
746
           <include name="*.png"/>
747
           <include name="*.gif"/>
748
           <include name="*.jpg"/>
749
           <exclude name="**/CVS*"/>
750
           <exclude name="**/.#*"/>
751
       </fileset>
752
      </copy>
753
      <!--
754
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
755
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
756
       <fileset dir="lib/style/skins/${skin-name}/images">
757
           <include name="*.png"/>
758
           <include name="*.gif"/>
759
           <include name="*.jpg"/>
760
       </fileset>
761
      </copy>
762
      -->
763

    
764
      <echo message="Install Skin completed." />
765
   </target>
766

    
767
   <target name="war" depends="warPrepare,warMSSQL"
768
            description="Create a web archive (WAR) for servlet deployment">
769
       <war destfile="${build.dir}/${context}.war"
770
            webxml="${build.war}/web.xml">
771
         <fileset dir="${war.context}"/>
772
         <lib dir="${war.lib}"/>
773
         <webinf dir="${war.webinf}"/>
774
       </war>
775
   </target>
776

    
777
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
778
            description="Prepare files for creating a web archive (WAR)">
779

    
780
       <property name="war.lib" value="${build.war}/lib" />
781
       <property name="war.webinf" value="${build.war}/WEB-INF" />
782
       <property name="war.context" value="${build.war}/${context}" />
783
       <mkdir dir="${war.lib}" />
784
       <mkdir dir="${war.webinf}" />
785
       <mkdir dir="${war.context}" />
786

    
787
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
788
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
789
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
790
       <copy todir="${war.lib}" filtering="no">
791
         <fileset dir="lib">
792
           <include name="*.jar"/>
793
         </fileset>
794
         <fileset dir="lib/xalan">
795
           <include name="*.jar"/>
796
         </fileset>
797
       </copy>
798
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
799
       <copy file="lib/web.xml.${tomcatversion}"
800
             tofile="${build.war}/web.xml" />
801
       <copy file="lib/metacat.properties" todir="${war.webinf}"
802
             filtering="yes" />
803
       <copy todir="${war.context}" filtering="no">
804
         <fileset dir="lib">
805
           <include name="**/*.jpg"/>
806
           <include name="**/*.png"/>
807
           <include name="**/*.gif"/>
808
         </fileset>
809
       </copy>
810
       <copy todir="${war.context}" filtering="yes">
811
         <fileset dir="lib">
812
           <exclude name="*.jar"/>
813
           <exclude name="*.properties"/>
814
           <exclude name="web.xml"/>
815
           <exclude name="**/*.jpg"/>
816
           <exclude name="**/*.png"/>
817
           <exclude name="**/*.gif"/>
818
         </fileset>
819
       </copy>
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
   </target>
828

    
829
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
830
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
831
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
832
   </target>
833

    
834
   <target name="getConversionXSL" depends="prepare"
835
            unless="styles.not.needed"
836
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
837

    
838
     <echo>Enter CVS password: </echo>
839
     <cvs cvsRoot="${cvsroot}"
840
          package="${eml-module}"
841
          tag="${eml2_0_1-tag}"
842
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
843

    
844
     <mkdir dir="lib/style/common/emlb6toeml2" />
845
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
846
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
847
         <include name="*.xsl"/>
848
         <include name="*.xml"/>
849
       </fileset>
850
      </copy>
851
   </target>
852

    
853
   <target name="testprep" depends="jar,clientjar,harvesterjar">
854
      <mkdir dir="${build.tests}"/>
855
      <copy todir="${build.tests}" filtering="yes">
856
        <fileset dir="${testdir}">
857
          <include name="edu/**"/>
858
        </fileset>
859
      </copy>
860
      <!-- copy and compile the tests into a jar file -->
861
      <javac srcdir="${build.tests}"
862
             destdir="${build.tests}"
863
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
864
             debug="on"
865
       includes="**/*.java" />
866

    
867
      <jar jarfile="${build.dir}/${name}-junittests.jar"
868
        basedir="${build.tests}"
869
                includes="**/*.class" />
870
   </target>
871

    
872
   <target name="test" depends="testprep"
873
            description="Uses the ant junit task to run all JUnit tests">
874

    
875
      <!-- use the ant "junit" task to run JUnit tests. -->
876
      <junit printsummary="yes" haltonfailure="no" fork="yes"
877
             haltonerror="no">
878
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
879
        <classpath>
880
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
881
        </classpath>
882

    
883
        <formatter type="plain" />
884

    
885
        <batchtest fork="yes" todir="${build.dir}">
886
          <fileset dir="${build.tests}">
887
            <include name="**/*.class" />
888
          </fileset>
889
        </batchtest>
890
     </junit>
891
   </target>
892

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

    
896
              <echo>testtorun: ${testtorun}</echo>
897

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

    
906
        <formatter type="plain" />
907

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

    
916
   <target name="testharvester"
917
           depends="testprep"
918
           description="Uses the ant junit task to test only the Harvester code">
919
     <junit printsummary="yes"
920
            haltonfailure="off"
921
            fork="yes"
922
            haltonerror="off">
923
       <classpath>
924
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
925
       </classpath>
926
       <formatter type="plain" />
927
       <batchtest fork="yes" todir="${build.dir}">
928
         <fileset dir="${build.tests}">
929
           <include name="**/harvesterClient/*.class" />
930
         </fileset>
931
       </batchtest>
932
     </junit>
933
   </target>
934

    
935
  <target name="gethttpclient" depends="prepare"
936
            description="checks out and compiles morpho httpclient code">
937
  <!--mkdir dir="${morphosourcedir}" -->
938
        <cvs cvsRoot="${cvsroot}"
939
             package="morpho"
940
             dest="." />
941
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
942
   </target>
943

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

    
948
      <echo>***********************************
949
      Please run ant gethttpclient first!
950
      ***********************************
951
      </echo>
952
      <!-- copy and compile the tests into a jar file -->
953
      <mkdir dir="${build.metacatnettest}"/>
954
      <javac srcdir="${junitnettestsdir}"
955
             destdir="${build.metacatnettest}"
956
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
957
             includes="**/*.java" />
958

    
959
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
960
                    basedir="${build.metacatnettest}"
961
                    includes="**/*.class" />
962

    
963
      <!-- use the ant "junit" task to run JUnit tests. -->
964
      <junit printsummary="yes" haltonfailure="no" fork="yes"
965
             haltonerror="no">
966
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
967
        <classpath>
968
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
969
        </classpath>
970

    
971
        <formatter type="plain" />
972

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

    
981
   <target name="cleanweb" depends="clean"
982
            description="deletes tomcat web context dir and all its contents">
983
     <delete dir="${installdir}" />
984
   </target>
985

    
986

    
987
   <target name="clean" depends="init"
988
            description="deletes build dir and files that can be regenerated form the release">
989
       <delete dir="${build.dir}" />
990
   </target>
991

    
992
   <target name="fullclean" depends="clean"
993
            description="deletes even jars that depend on external sources such as stylesheets and jars">
994
       <delete file="lib/httpclient.jar" />
995
       <delete file="lib/utilities.jar" />
996
       <delete includeEmptyDirs="true" failonerror="false">
997
         <fileset dir="${style-common-cvsrelpath}">
998
           <include name="${eml-css}" />
999
           <include name="eml-*/*.xsl" />
1000
           <include name="eml-*" />
1001
         </fileset>
1002
       </delete>
1003
   </target>
1004

    
1005
   <target name="jdoc" depends="prepare"
1006
            description="generates javadoc documentation">
1007
       <javadoc packagenames="edu.ucsb.nceas.*"
1008
           sourcepath="${build.src}"
1009
           destdir="${build.javadocs}"
1010
           classpath="${cpath}"
1011
           author="true"
1012
           version="true"
1013
           use="true"
1014
           windowtitle="${Name} API"
1015
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1016
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
1017
       />
1018
   </target>
1019

    
1020
   <target name="dist"
1021
       depends="geteml,jar,protocol,jdoc,getConversionXSL,getutilities"
1022
            description="prepares a full release distribution">
1023
      <mkdir dir="${dist.dir}"/>
1024
      <delete dir="${ver.dir}" />
1025
      <mkdir dir="${ver.dir}"/>
1026
      <copy todir="${ver.dir}">
1027
        <fileset dir="."
1028
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1029
      </copy>
1030
      <copy todir="${ver.dir}" file="build.xml"/>
1031
      <copy todir="${ver.dir}" file="build.properties"/>
1032

    
1033
      <copy todir="${ver.dir}/docs" filtering="yes">
1034
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1035
      </copy>
1036
      <copy todir="${ver.dir}/docs" filtering="no">
1037
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1038
      </copy>
1039
      <copy todir="${ver.dir}/docs/dev">
1040
        <fileset dir="${build.dir}/docs"/>
1041
      </copy>
1042
      <copy todir="${ver.dir}/src">
1043
        <fileset dir="${build.dir}/src"/>
1044
      </copy>
1045
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1046
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1047
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1048
      <!--
1049
      <delete dir="./${ver.dir}/${build.dir}"/>
1050
      <delete dir="./${ver.dir}/dist"/>
1051
      -->
1052
      <delete file="./${name}-${release}.zip"/>
1053
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1054
      <delete file="./${name}-${release}.tar.gz" />
1055
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1056
      <gzip zipfile="./${name}-${release}.tar.gz"
1057
                src="./${name}-${release}.tar"/>
1058
      <delete file="./${name}-${release}.tar" />
1059
  </target>
1060

    
1061
  <target name="distsrc" depends="dist"
1062
            description="prepares a source distribution">
1063
      <mkdir dir="${ver.src}"/>
1064
      <copy todir="${ver.src}">
1065
        <fileset dir="./src"/>
1066
      </copy>
1067
      <mkdir dir="${util.dir}"/>
1068
      <copy todir="${util.dir}">
1069
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1070
      </copy>
1071

    
1072
      <delete file="./${name}-src-${release}.zip"/>
1073
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1074
      <delete file="./${name}-src-${release}.tar.gz" />
1075
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1076
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1077
                src="./${name}-src-${release}.tar"/>
1078
      <delete file="./${name}-src-${release}.tar" />
1079
      <delete dir="${dist.dir}"/>
1080
  </target>
1081

    
1082
   <target name="stylesheettest">
1083
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1084
      <param name="displaymodule" expression="${displaymodule}"/>
1085
      <param name="docid" expression="${input}"/>
1086
      <param name="entitytype" expression="${entitytype}"/>
1087
      <param name="entityindex" expression="${entityindex}"/>
1088
      <outputproperty name="method" value="html"/>
1089
      <outputproperty name="standalone" value="yes"/>
1090
      <outputproperty name="encoding" value="iso8859_1"/>
1091
      <outputproperty name="indent" value="yes"/>
1092
    </xslt>
1093
  </target>
1094

    
1095
 <target name="gridinit" depends="init">
1096
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1097
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1098
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1099
   <property environment="env"/>
1100
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1101
    <path id="webservicepath">
1102
        <pathelement location="."/>
1103
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1104
        <pathelement location="${build.dest}"/>
1105
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1106
           <include name="*.jar"/>
1107
        </fileset>
1108
      </path>
1109
</target>
1110

    
1111
 <target name="gridprepare" depends="gridinit, prepare">
1112
 </target>
1113

    
1114
  <target name="compileinterface" depends="clean, gridprepare">
1115
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1116
  </target>
1117

    
1118
  <target name="generateWSDL" depends="compileinterface">
1119
    <echo message="Generating wsdl from ${interface.name} interface"/>
1120
    <java classname="${java2wsdl.tool}"
1121
          dir="${build.src}" fork="yes"
1122
          classpathref="webservicepath"  failonerror="true" >
1123
      <arg value="-P"/>
1124
      <arg value="${interface.name}PortType"/>
1125
      <arg value="-S"/>
1126
      <arg value="${interface.name}Service"/>
1127
      <arg value="-y"/>
1128
      <arg value="WRAPPED"/>
1129
      <arg value="-u"/>
1130
      <arg value="LITERAL"/>
1131
      <arg value="-l"/>
1132
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1133
      <arg value="-n"/>
1134
      <arg value="http://${services.namespace}/${interface.name}"/>
1135
      <arg value="${interface.package}.${interface.name}"/>
1136
    </java>
1137
  </target>
1138

    
1139
   <target name="decorateWSDL" depends="generateWSDL">
1140
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1141
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1142
            fork="yes"
1143
            classpathref="webservicepath" failonerror="true" >
1144
        <arg value="${binding.file}"/>
1145
        <arg value="${wsdl.file}"/>
1146
      </java>
1147
   </target>
1148

    
1149
   <target name="generatestubs" depends="decorateWSDL">
1150
      <echo message=" Generating stubs " />
1151
      <echo message="wsdl file is ${wsdl.file}"/>
1152
      <echo message="build.src is ${build.src}"/>
1153
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1154
            classpathref="webservicepath" failonerror="true" >
1155
         <arg value="${wsdl.file}"/>
1156
    </java>
1157
  </target>
1158

    
1159
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1160
     <echo message=" Compiling stubs " />
1161
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1162
     <echo message=" Compiling impl " />
1163
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1164
  </target>
1165

    
1166
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1167
     <echo message=" jar stubs classes " />
1168
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1169
     <echo message=" jar impl classes " />
1170
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1171
  </target>
1172

    
1173
  <target name="gar" depends="jarStubsAndImpl">
1174
     <echo message=" jar the gar file"/>
1175
     <mkdir dir="${build.dir}/gar"/>
1176
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1177
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1178
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1179
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1180
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1181
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1182
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1183
  </target>
1184

    
1185
  <target name="compilewebclient" depends="prepare">
1186
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1187
  </target>
1188

    
1189
  <target name="runwebclient" depends="compilewebclient">
1190
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1191
           dir="${build.dest}" fork="yes"
1192
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1193
         <arg value="${serviceUrl}"/>
1194
         <arg value="${docid}"/>
1195
     </java>
1196
  </target>
1197
</project>