Project

General

Profile

metacat / build.xml @ 2411

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: costa $'
10
  *    '$Date: 2005-03-07 14:15:36 -0800 (Mon, 07 Mar 2005) $'
11
  *    '$Revision: 2401 $'
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
    <property name="upgrade-1.5-sql"
38
               value="upgrade-db-to-1.5.sql" />
39
    <condition property="use-oracle">
40
      <equals arg1="${database}" arg2="oracle" />
41
    </condition>
42
    <condition property="use-postgresql">
43
      <equals arg1="${database}" arg2="postgresql" />
44
    </condition>
45
    <condition property="use-sqlserver">
46
      <equals arg1="${database}" arg2="sqlserver" />
47
    </condition>
48
  </target>
49

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
405
   <target name="client" depends="utilities, prepare"
406
    description="Compiles metacat-client java code to build dir">
407
       <javac srcdir="${build.src}"
408
              destdir="${build.dest}"
409
              classpath="${cpath}"
410
              includes="edu/ucsb/nceas/metacat/client/*" />
411
   </target>
412

    
413
   <target name="clientjar" depends="client"
414
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
415
       <delete file="${build.dir}/${name}-client.jar" />
416
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
417
            includes="**/metacat/client/" />
418
   </target>
419

    
420
   <target name="harvester" depends="client"
421
           description="Compiles harvester java code to build dir">
422
       <echo message="classpath is:   ${cpath}"/>
423
       <javac srcdir="${build.src}"
424
              destdir="${build.dest}"
425
              classpath="${cpath}"
426
              includes="edu/ucsb/nceas/metacat/harvesterClient/*" />
427
   </target>
428

    
429
   <target name="harvesterjar" depends="harvester"
430
           description="Compiles and jars harvester java code to harvester.jar in build dir">
431
       <delete file="${build.dir}/harvester.jar" />
432
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
433
            includes="**/metacat/harvesterClient/" />
434
   </target>
435

    
436
   <target name="harvestListEditorDist" depends="harvesterjar"
437
           description="Prepares a distribution of the Harvest List Editor tool">
438
       <mkdir dir="${dist.dir.hle}"/>
439
       <delete dir="${ver.dir.hle}" />
440
       <mkdir dir="${ver.dir.hle}"/>
441
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
442
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
443
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
444
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
445
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
446
       <delete file="./harvest-list-editor-${release}.zip"/>
447
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
448
       <delete file="./harvest-list-editor-${release}.tar.gz" />
449
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
450
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
451
             src="./harvest-list-editor-${release}.tar"/>
452
       <delete file="./harvest-list-editor-${release}.tar" />
453
   </target>
454

    
455
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
456
            description="Calls getemlpre2 and geteml2+ targets" />
457

    
458
   <target name="getemlpre2" depends="prepare" if="eml.required"
459
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
460
     <echo>Enter CVS password: </echo>
461
     <cvs cvsRoot="${cvsroot}"
462
          package="${eml-module}"
463
          tag="${eml-tag}"
464
          dest="${build.tmp}/eml_${eml-tag}" />
465
     <mkdir dir="lib/dtd" />
466
     <copy todir="lib/dtd" filtering="yes">
467
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
468
         <include name="*.dtd"/>
469
       </fileset>
470
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
471
     </copy>
472

    
473
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
474
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
475
       <include name="**/*.xsl"/>
476
     </fileset>
477
     </copy>
478
   </target>
479

    
480
   <target name="geteml2+" depends="prepare" if="eml.required"
481
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
482
     <echo>Enter CVS password: </echo>
483
     <cvs cvsRoot="${cvsroot}"
484
          package="${eml-module}"
485
          tag="${eml2_0_0-tag}"
486
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
487
     <mkdir dir="lib/schema/eml-2.0.0" />
488
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
489
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
490
         <include name="*.xsd"/>
491
       </fileset>
492

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

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

    
499
     </copy>
500
     <antcall target="copyxsl">
501
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
502
        <param name="dirname" value="eml-2.0.0" />
503
     </antcall>
504

    
505
     <echo>Enter CVS password: </echo>
506
     <cvs cvsRoot="${cvsroot}"
507
          package="${eml-module}"
508
          tag="${eml2_0_1-tag}"
509
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
510
     <mkdir dir="lib/schema/eml-2.0.1" />
511
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
512
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
513
         <include name="*.xsd"/>
514
       </fileset>
515
     </copy>
516
     <antcall target="copyxsl">
517
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
518
        <param name="dirname" value="eml-2.0.1" />
519
     </antcall>
520
   </target>
521

    
522

    
523

    
524
   <target  name="copyxsl"
525
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
526

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

    
529
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
530
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
531
       <include name="**/*.xsl"/>
532
     </fileset>
533
     </copy>
534

    
535

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

    
541
   </target>
542

    
543

    
544

    
545
   <target name="register-schemas" depends="prepare"
546
   description="Registers the Schemas with a new Metacat instance">
547
     <echo/>
548
     <echo>Registering the Schemas with the new Metacat instance...</echo>
549
     <sql driver="${dbDriver}"
550
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
551
          url="${jdbc-connect}"
552
          userid="${user}"
553
          password="${password}"
554
          src="${build.src}/loaddtdschema.sql" />
555
   </target>
556

    
557
   <target name="installdb" depends="prepare"
558
            description="Installs the database tables">
559
     <echo/>
560
     <echo>Installing the database tables...</echo>
561
     <sql driver="${dbDriver}"
562
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
563
          url="${jdbc-connect}"
564
          userid="${user}"
565
          password="${password}"
566
          src="${build.src}/${install-sql}" />
567
   </target>
568

    
569
   <target name="upgrade12" depends="prepare"
570
            description="Updates the database tables to upgrade to version 1.2">
571
     <echo/>
572
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
573
     <sql driver="${dbDriver}"
574
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
575
          url="${jdbc-connect}"
576
          userid="${user}"
577
          password="${password}"
578
          src="${build.src}/${upgrade-1.2-sql}" />
579
   </target>
580

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

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

    
605
   <target name="upgrade15" depends="sqlupgrade15"
606
           description="Updates the database tables to upgrade to version 1.5">
607
     <echo/>
608
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
609
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
610
           todir="${build.tmp}" filtering="yes"/>
611
 
612
     <javac srcdir="${build.tmp}"
613
            destdir="${build.tmp}"
614
            classpath="${cpath}"
615
            debug="${debug}"
616
            includes="upgrade_db_to_1_5.java"/>
617
 
618
     <java classname="upgrade_db_to_1_5"
619
           classpath="${cpath}:${build.tmp}"/>
620

    
621
   </target>
622
   
623
   <target name="sqlupgrade15" depends="prepare">
624
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
625
      <sql driver="${dbDriver}"
626
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
627
          url="${jdbc-connect}"
628
          userid="${user}"
629
          password="${password}"
630
          src="${build.src}/${upgrade-1.5-sql}" />
631
   </target>
632

    
633
   <target name="install" depends="war" description="* Full Install *">
634
       <mkdir dir="${datafilepath}" />
635
       <mkdir dir="${inlinedatafilepath}" />
636
       <chmod dir="${datafilepath}" perm="ug+w" />
637
       <mkdir dir="${temp-dir}"/>
638
       <chmod dir="${temp-dir}" perm="ug+w" />
639
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
640
   </target>
641

    
642
   <target name="upgrade" depends="install"
643
          description="* Upgrade an existing metacat installation with a new version *">
644
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
645
   </target>
646

    
647
   <target name="install-registry" depends="init,getConversionXSL"
648
            description="Install Registry">
649

    
650
      <copy file="${srcdir}/perl/register-dataset.cgi"
651
            todir="${inst.cgi.dir}" filtering="yes"/>
652
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
653

    
654
      <mkdir dir="${temp-dir}" />
655
      <copy todir="${temp-dir}" filtering="yes">
656
       <fileset dir="lib/style/common/emlb6toeml2">
657
         <include name="*.xsl"/>
658
         <include name="*.xml"/>
659
       </fileset>
660
      </copy>
661

    
662
      <echo message="Install Registry completed." />
663
   </target>
664

    
665
   <target name="install-ldap" depends="init">
666
      <copy file="${srcdir}/perl/ldapweb.cgi"
667
            todir="${inst.cgi.dir}" filtering="yes"/>
668
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
669
      <copy file="lib/ldapweb.cfg"
670
            todir="${inst.cgi.dir}" filtering="yes"/>
671
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
672
      <mkdir dir="${templates.dir}" />
673
      <copy todir="${templates.dir}" filtering="yes">
674
        <fileset dir="lib/style/common/templates">
675
            <include name="${defaultChangePass}"/>
676
            <include name="${defaultResetPass}"/>
677
            <include name="${changePassSuccess}"/>
678
            <include name="${resetPassSuccess}"/>
679
            <include name="${registerFailed}"/>
680
            <include name="${registerLter}"/>
681
            <include name="${registerMatch}"/>
682
            <include name="${registerSuccess}"/>
683
            <include name="${register}"/>
684
            <include name="${searchResults}"/>
685
        </fileset>
686
      </copy>
687
      <echo message="ldapweb install complete." />
688
   </target>
689

    
690

    
691
   <target name="install-skin" depends="init"
692
            description="Install a Skin">
693

    
694
      <input message="Please enter name of the skin"
695
             addproperty="skin-name"/>
696

    
697
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
698
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
699
       <fileset dir="lib/style/skins/${skin-name}">
700
           <exclude name="*.png"/>
701
           <exclude name="*.gif"/>
702
           <exclude name="*.jpg"/>
703
           <exclude name="**/CVS*"/>
704
           <exclude name="**/.#*"/>
705
       </fileset>
706
      </copy>
707
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
708
       <fileset dir="lib/style/skins/${skin-name}">
709
           <include name="*.png"/>
710
           <include name="*.gif"/>
711
           <include name="*.jpg"/>
712
           <exclude name="**/CVS*"/>
713
           <exclude name="**/.#*"/>
714
       </fileset>
715
      </copy>
716
      <!--
717
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
718
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
719
       <fileset dir="lib/style/skins/${skin-name}/images">
720
           <include name="*.png"/>
721
           <include name="*.gif"/>
722
           <include name="*.jpg"/>
723
       </fileset>
724
      </copy>
725
      -->
726

    
727
      <echo message="Install Skin completed." />
728
   </target>
729

    
730
   <target name="war" depends="warPrepare,warMSSQL"
731
            description="Create a web archive (WAR) for servlet deployment">
732
       <war destfile="${build.dir}/${context}.war"
733
            webxml="${build.war}/web.xml">
734
         <fileset dir="${war.context}"/>
735
         <lib dir="${war.lib}"/>
736
         <webinf dir="${war.webinf}"/>
737
       </war>
738
   </target>
739

    
740
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
741
            description="Prepare files for creating a web archive (WAR)">
742

    
743
       <property name="war.lib" value="${build.war}/lib" />
744
       <property name="war.webinf" value="${build.war}/WEB-INF" />
745
       <property name="war.context" value="${build.war}/${context}" />
746
       <mkdir dir="${war.lib}" />
747
       <mkdir dir="${war.webinf}" />
748
       <mkdir dir="${war.context}" />
749

    
750
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
751
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
752
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
753
       <copy todir="${war.lib}" filtering="no">
754
         <fileset dir="lib">
755
           <include name="*.jar"/>
756
         </fileset>
757
         <fileset dir="lib/xalan">
758
           <include name="*.jar"/>
759
         </fileset>
760
       </copy>
761
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
762
       <copy file="lib/web.xml.${tomcatversion}"
763
             tofile="${build.war}/web.xml" />
764
       <copy file="lib/metacat.properties" todir="${war.webinf}"
765
             filtering="yes" />
766
       <copy todir="${war.context}" filtering="no">
767
         <fileset dir="lib">
768
           <include name="**/*.jpg"/>
769
           <include name="**/*.png"/>
770
           <include name="**/*.gif"/>
771
         </fileset>
772
       </copy>
773
       <copy todir="${war.context}" filtering="yes">
774
         <fileset dir="lib">
775
           <exclude name="*.jar"/>
776
           <exclude name="*.properties"/>
777
           <exclude name="web.xml"/>
778
           <exclude name="**/*.jpg"/>
779
           <exclude name="**/*.png"/>
780
           <exclude name="**/*.gif"/>
781
         </fileset>
782
       </copy>
783
       <copy todir="${war.context}" filtering="no">
784
         <fileset dir="lib">
785
           <include name="**/*.jpg"/>
786
           <include name="**/*.png"/>
787
           <include name="**/*.gif"/>
788
         </fileset>
789
       </copy>
790
   </target>
791

    
792
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
793
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
794
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
795
   </target>
796

    
797
   <target name="getConversionXSL" depends="prepare"
798
            unless="styles.not.needed"
799
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
800
     <echo>Enter CVS password: </echo>
801
     <cvs cvsRoot="${cvsroot-alternate}"
802
          package="${conversion-module}"
803
          dest="${build.tmp}" />
804

    
805
     <mkdir dir="lib/style/common/emlb6toeml2" />
806
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
807
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
808
         <include name="*.xsl"/>
809
         <include name="*.xml"/>
810
       </fileset>
811
      </copy>
812
   </target>
813

    
814
   <target name="testprep" depends="jar,clientjar,harvesterjar">
815
      <mkdir dir="${build.tests}"/>
816
      <copy todir="${build.tests}" filtering="yes">
817
        <fileset dir="${testdir}">
818
          <include name="edu/**"/>
819
        </fileset>
820
      </copy>
821
      <!-- copy and compile the tests into a jar file -->
822
      <javac srcdir="${build.tests}"
823
             destdir="${build.tests}"
824
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
825
             debug="on"
826
       includes="**/*.java" />
827

    
828
      <jar jarfile="${build.dir}/${name}-junittests.jar"
829
        basedir="${build.tests}"
830
                includes="**/*.class" />
831
   </target>
832

    
833
   <target name="test" depends="testprep"
834
            description="Uses the ant junit task to run all JUnit tests">
835

    
836
      <!-- use the ant "junit" task to run JUnit tests. -->
837
      <junit printsummary="yes" haltonfailure="no" fork="yes"
838
             haltonerror="no">
839
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
840
        <classpath>
841
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
842
        </classpath>
843

    
844
        <formatter type="plain" />
845

    
846
        <batchtest fork="yes" todir="${build.dir}">
847
          <fileset dir="${build.tests}">
848
            <include name="**/*.class" />
849
          </fileset>
850
        </batchtest>
851
     </junit>
852
   </target>
853

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

    
857
              <echo>testtorun: ${testtorun}</echo>
858

    
859
      <!-- use the ant "junit" task to run JUnit tests. -->
860
      <junit printsummary="yes" haltonfailure="no" fork="yes"
861
             haltonerror="no">
862
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
863
        <classpath>
864
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
865
        </classpath>
866

    
867
        <formatter type="plain" />
868

    
869
        <batchtest fork="yes" todir="${build.dir}">
870
          <fileset dir="${build.tests}">
871
            <include name="**/${testtorun}.class" />
872
          </fileset>
873
        </batchtest>
874
     </junit>
875
   </target>
876

    
877
   <target name="testharvester"
878
           depends="testprep"
879
           description="Uses the ant junit task to test only the Harvester code">
880
     <junit printsummary="yes"
881
            haltonfailure="off"
882
            fork="yes"
883
            haltonerror="off">
884
       <classpath>
885
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
886
       </classpath>
887
       <formatter type="plain" />
888
       <batchtest fork="yes" todir="${build.dir}">
889
         <fileset dir="${build.tests}">
890
           <include name="**/harvesterClient/*.class" />
891
         </fileset>
892
       </batchtest>
893
     </junit>
894
   </target>
895

    
896
  <target name="gethttpclient" depends="prepare"
897
            description="checks out and compiles morpho httpclient code">
898
  <!--mkdir dir="${morphosourcedir}" -->
899
        <cvs cvsRoot="${cvsroot}"
900
             package="morpho"
901
             dest="." />
902
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
903
   </target>
904

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

    
909
      <echo>***********************************
910
      Please run ant gethttpclient first!
911
      ***********************************
912
      </echo>
913
      <!-- copy and compile the tests into a jar file -->
914
      <mkdir dir="${build.metacatnettest}"/>
915
      <javac srcdir="${junitnettestsdir}"
916
             destdir="${build.metacatnettest}"
917
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
918
             includes="**/*.java" />
919

    
920
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
921
                    basedir="${build.metacatnettest}"
922
                    includes="**/*.class" />
923

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

    
932
        <formatter type="plain" />
933

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

    
942
   <target name="cleanweb" depends="clean"
943
            description="deletes tomcat web context dir and all its contents">
944
     <delete dir="${installdir}" />
945
   </target>
946

    
947

    
948
   <target name="clean" depends="init"
949
            description="deletes build dir and files that can be regenerated form the release">
950
       <delete dir="${build.dir}" />
951
   </target>
952

    
953
   <target name="fullclean" depends="clean"
954
            description="deletes even jars that depend on external sources such as stylesheets and jars">
955
       <delete file="lib/httpclient.jar" />
956
       <delete file="lib/utilities.jar" />
957
       <delete includeEmptyDirs="true" failonerror="false">
958
         <fileset dir="${style-common-cvsrelpath}">
959
           <include name="${eml-css}" />
960
           <include name="eml-*/*.xsl" />
961
           <include name="eml-*" />
962
         </fileset>
963
       </delete>
964
   </target>
965

    
966
   <target name="jdoc" depends="prepare"
967
            description="generates javadoc documentation">
968
       <javadoc packagenames="edu.ucsb.nceas.*"
969
           sourcepath="${build.src}"
970
           destdir="${build.javadocs}"
971
           classpath="${cpath}"
972
           author="true"
973
           version="true"
974
           use="true"
975
           windowtitle="${Name} API"
976
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
977
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
978
       />
979
   </target>
980

    
981
   <target name="dist" depends="geteml,jar,protocol,jdoc"
982
            description="prepares a full release distribution">
983
      <mkdir dir="${dist.dir}"/>
984
      <delete dir="${ver.dir}" />
985
      <mkdir dir="${ver.dir}"/>
986
      <copy todir="${ver.dir}">
987
        <fileset dir="."
988
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
989
      </copy>
990
      <copy todir="${ver.dir}" file="build.xml"/>
991
      <copy todir="${ver.dir}" file="build.properties"/>
992

    
993
      <copy todir="${ver.dir}/docs" filtering="yes">
994
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
995
      </copy>
996
      <copy todir="${ver.dir}/docs" filtering="no">
997
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
998
      </copy>
999
      <copy todir="${ver.dir}/docs/dev">
1000
        <fileset dir="${build.dir}/docs"/>
1001
      </copy>
1002
      <copy todir="${ver.dir}/src">
1003
        <fileset dir="${build.dir}/src"/>
1004
      </copy>
1005
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1006
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1007
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1008
      <!--
1009
      <delete dir="./${ver.dir}/${build.dir}"/>
1010
      <delete dir="./${ver.dir}/dist"/>
1011
      -->
1012
      <delete file="./${name}-${release}.zip"/>
1013
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1014
      <delete file="./${name}-${release}.tar.gz" />
1015
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1016
      <gzip zipfile="./${name}-${release}.tar.gz"
1017
                src="./${name}-${release}.tar"/>
1018
      <delete file="./${name}-${release}.tar" />
1019
  </target>
1020

    
1021
  <target name="distsrc" depends="dist"
1022
            description="prepares a source distribution">
1023
      <mkdir dir="${ver.src}"/>
1024
      <copy todir="${ver.src}">
1025
        <fileset dir="./src"/>
1026
      </copy>
1027

    
1028
      <delete file="./${name}-src-${release}.zip"/>
1029
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1030
      <delete file="./${name}-src-${release}.tar.gz" />
1031
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1032
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1033
                src="./${name}-src-${release}.tar"/>
1034
      <delete file="./${name}-src-${release}.tar" />
1035
      <delete dir="${dist.dir}"/>
1036
  </target>
1037

    
1038
   <target name="stylesheettest">
1039
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1040
      <param name="displaymodule" expression="${displaymodule}"/>
1041
      <param name="docid" expression="${input}"/>
1042
      <param name="entitytype" expression="${entitytype}"/>
1043
      <param name="entityindex" expression="${entityindex}"/>
1044
      <outputproperty name="method" value="html"/>
1045
      <outputproperty name="standalone" value="yes"/>
1046
      <outputproperty name="encoding" value="iso8859_1"/>
1047
      <outputproperty name="indent" value="yes"/>
1048
    </xslt>
1049
  </target>
1050

    
1051
 <target name="gridinit" depends="init">
1052
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1053
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1054
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1055
   <property environment="env"/>
1056
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1057
    <path id="webservicepath">
1058
        <pathelement location="."/>
1059
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1060
        <pathelement location="${build.dest}"/>
1061
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1062
           <include name="*.jar"/>
1063
        </fileset>
1064
      </path>
1065
</target>
1066

    
1067
 <target name="gridprepare" depends="gridinit, prepare">
1068
 </target>
1069

    
1070
  <target name="compileinterface" depends="clean, gridprepare">
1071
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1072
  </target>
1073

    
1074
  <target name="generateWSDL" depends="compileinterface">
1075
    <echo message="Generating wsdl from ${interface.name} interface"/>
1076
    <java classname="${java2wsdl.tool}"
1077
          dir="${build.src}" fork="yes"
1078
          classpathref="webservicepath"  failonerror="true" >
1079
      <arg value="-P"/>
1080
      <arg value="${interface.name}PortType"/>
1081
      <arg value="-S"/>
1082
      <arg value="${interface.name}Service"/>
1083
      <arg value="-y"/>
1084
      <arg value="WRAPPED"/>
1085
      <arg value="-u"/>
1086
      <arg value="LITERAL"/>
1087
      <arg value="-l"/>
1088
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1089
      <arg value="-n"/>
1090
      <arg value="http://${services.namespace}/${interface.name}"/>
1091
      <arg value="${interface.package}.${interface.name}"/>
1092
    </java>
1093
  </target>
1094

    
1095
   <target name="decorateWSDL" depends="generateWSDL">
1096
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1097
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1098
            fork="yes"
1099
            classpathref="webservicepath" failonerror="true" >
1100
        <arg value="${binding.file}"/>
1101
        <arg value="${wsdl.file}"/>
1102
      </java>
1103
   </target>
1104

    
1105
   <target name="generatestubs" depends="decorateWSDL">
1106
      <echo message=" Generating stubs " />
1107
      <echo message="wsdl file is ${wsdl.file}"/>
1108
      <echo message="build.src is ${build.src}"/>
1109
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1110
            classpathref="webservicepath" failonerror="true" >
1111
         <arg value="${wsdl.file}"/>
1112
    </java>
1113
  </target>
1114

    
1115
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1116
     <echo message=" Compiling stubs " />
1117
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1118
     <echo message=" Compiling impl " />
1119
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1120
  </target>
1121

    
1122
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1123
     <echo message=" jar stubs classes " />
1124
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1125
     <echo message=" jar impl classes " />
1126
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1127
  </target>
1128

    
1129
  <target name="gar" depends="jarStubsAndImpl">
1130
     <echo message=" jar the gar file"/>
1131
     <mkdir dir="${build.dir}/gar"/>
1132
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1133
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1134
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1135
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1136
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1137
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1138
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1139
  </target>
1140

    
1141
  <target name="compilewebclient" depends="prepare">
1142
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1143
  </target>
1144

    
1145
  <target name="runwebclient" depends="compilewebclient">
1146
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1147
           dir="${build.dest}" fork="yes"
1148
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1149
         <arg value="${serviceUrl}"/>
1150
         <arg value="${docid}"/>
1151
     </java>
1152
  </target>
1153
</project>