Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: costa $'
10
  *    '$Date: 2005-01-13 16:58:36 -0800 (Thu, 13 Jan 2005) $'
11
  *    '$Revision: 2369 $'
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
   </target>
65

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

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

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

    
107
      <property name="debug" value="on" />
108
      <property name="debuglevel" value="55" />
109

    
110
      <property name="morphosourcedir" value="../morpho" />
111
      <property name="defaultcontenttype" value="application/octet-stream" />
112
      <property name="utilitiesdir" value="../utilities" />
113

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

    
147
                value="lib/eml.jar" />
148
      <property name="util"
149
                value="lib/utilities.jar" />
150
  </target>
151

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

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

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

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

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

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

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

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

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

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

    
327
      <property name="dist.dir" value="dist"/>
328
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
329
      <property name="ver.src" value="${ver.dir}/src"/>
330

    
331
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
332
      <condition property="utilities.required">
333
        <or>
334
          <not><available file="lib/httpclient.jar"/></not>
335
          <not><available file="lib/utilities.jar"/></not>
336
        </or>
337
      </condition>
338
      <condition property="eml.required">
339
        <or>
340
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
341
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
342
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
343
        </or>
344
      </condition>
345
   </target>
346

    
347
   <target name="prepare" depends="init">
348
      <mkdir dir="${build.dir}"/>
349
      <mkdir dir="${build.src}"/>
350
      <mkdir dir="${build.dest}"/>
351
      <mkdir dir="${build.javadocs}"/>
352
      <mkdir dir="${build.tmp}"/>
353

    
354
      <copy todir="${build.src}" filtering="yes">
355
        <fileset dir="${srcdir}">
356
          <include name="edu/**"/>
357
          <include name="com/**"/>
358
          <include name="**/*.sql"/>
359
          <exclude name="**/CVS*"/>
360
          <exclude name="**/.#*"/>
361
        </fileset>
362
      </copy>
363
      <available file="lib/style/common/emlb6toeml2" type="dir"
364
                 property="styles.not.needed"/>
365
   </target>
366

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

    
370
       <javac srcdir="${build.src}"
371
              destdir="${build.dest}"
372
              classpath="${cpath}"
373
              debug="${debug}"
374
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
375
   </target>
376

    
377
   <target name="jar" depends="compile,geteml"
378
    description="Compiles and jars metacat java code to metacat.jar in build dir">
379

    
380
       <delete file="${build.dir}/${name}.jar" />
381
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
382
            excludes="**/protocols/ **/harvesterClient/" />
383
   </target>
384

    
385
   <target name="protocol" depends="compile"
386
    description="Compiles and jars protocol java code to protocol.jar in build dir">
387
       <delete file="${build.dir}/protocol.jar" />
388
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
389
            includes="**/protocols/" />
390
   </target>
391

    
392
   <target name="utilities" depends="config" if="utilities.required">
393
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
394
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
395
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
396
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
397
   </target>
398

    
399
   <target name="client" depends="utilities, prepare"
400
    description="Compiles metacat-client java code to build dir">
401
       <javac srcdir="${build.src}"
402
              destdir="${build.dest}"
403
              classpath="${cpath}"
404
              includes="edu/ucsb/nceas/metacat/client/*" />
405
   </target>
406

    
407
   <target name="clientjar" depends="client"
408
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
409
       <delete file="${build.dir}/${name}-client.jar" />
410
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
411
            includes="**/metacat/client/" />
412
   </target>
413

    
414
   <target name="harvester" depends="client"
415
           description="Compiles harvester java code to build dir">
416
       <echo message="classpath is:   ${cpath}"/>
417
       <javac srcdir="${build.src}"
418
              destdir="${build.dest}"
419
              classpath="${cpath}"
420
              includes="edu/ucsb/nceas/metacat/harvesterClient/*" />
421
   </target>
422

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

    
430
   <target name="harvestListEditorDist" depends="harvesterjar"
431
           description="Prepares a distribution of the Harvest List Editor tool">
432
       <delete dir="${build.tmp}/HLE"/>
433
       <mkdir dir="${build.tmp}/HLE"/>
434
       <copy todir="${build.tmp}/HLE" file="${build.dir}/harvester.jar"/>
435
       <copy todir="${build.tmp}/HLE" file="lib/xercesImpl.jar"/>
436
       <copy todir="${build.tmp}/HLE" file="lib/harvester/harvestList.xsd"/>
437
       <copy todir="${build.tmp}/HLE" file="lib/harvester/harvestListEditor.bat"/>
438
       <copy todir="${build.tmp}/HLE" file="lib/harvester/harvestListEditor.sh"/>
439
       <delete file="./harvestListEditor.zip"/>
440
       <zip zipfile="./harvestListEditor.zip" basedir="${build.tmp}/HLE" />
441
       <delete file="./harvestListEditor.tar.gz" />
442
       <tar tarfile="./harvestListEditor.tar" basedir="${build.tmp}/HLE" />
443
       <gzip zipfile="./harvestListEditor.tar.gz"
444
             src="./harvestListEditor.tar"/>
445
       <delete file="./harvestListEditor.tar" />
446
   </target>
447

    
448
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
449
            description="Calls getemlpre2 and geteml2+ targets" />
450

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

    
466
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
467
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
468
       <include name="**/*.xsl"/>
469
     </fileset>
470
     </copy>
471
   </target>
472

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

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

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

    
492
     </copy>
493
     <antcall target="copyxsl">
494
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
495
        <param name="dirname" value="eml-2.0.0" />
496
     </antcall>
497

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

    
515

    
516

    
517
   <target  name="copyxsl"
518
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
519

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

    
522
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
523
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
524
       <include name="**/*.xsl"/>
525
     </fileset>
526
     </copy>
527

    
528

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

    
534
   </target>
535

    
536

    
537

    
538
   <target name="register-schemas" depends="prepare"
539
   description="Registers the Schemas with a new Metacat instance">
540
     <echo/>
541
     <echo>Registering the Schemas with the new Metacat instance...</echo>
542
     <sql driver="${dbDriver}"
543
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
544
          url="${jdbc-connect}"
545
          userid="${user}"
546
          password="${password}"
547
          src="${build.src}/loaddtdschema.sql" />
548
   </target>
549

    
550
   <target name="installdb" depends="prepare"
551
            description="Installs the database tables">
552
     <echo/>
553
     <echo>Installing the database tables...</echo>
554
     <sql driver="${dbDriver}"
555
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
556
          url="${jdbc-connect}"
557
          userid="${user}"
558
          password="${password}"
559
          src="${build.src}/${install-sql}" />
560
   </target>
561

    
562
   <target name="upgrade12" depends="prepare"
563
            description="Updates the database tables to upgrade to version 1.2">
564
     <echo/>
565
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
566
     <sql driver="${dbDriver}"
567
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
568
          url="${jdbc-connect}"
569
          userid="${user}"
570
          password="${password}"
571
          src="${build.src}/${upgrade-1.2-sql}" />
572
   </target>
573

    
574
   <target name="upgrade13" depends="prepare"
575
            description="Updates the database tables to upgrade to version 1.3">
576
     <echo/>
577
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
578
     <sql driver="${dbDriver}"
579
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
580
          url="${jdbc-connect}"
581
          userid="${user}"
582
          password="${password}"
583
          src="${build.src}/${upgrade-1.3-sql}" />
584
   </target>
585

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

    
598
   <target name="upgrade15" depends="prepare"
599
	   description="Updates the database tables to upgrade to version 1.5">
600
     <echo/>
601
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
602
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
603
	   todir="${build.tmp}" filtering="yes"/>
604
 
605
     <javac srcdir="${build.tmp}"
606
            destdir="${build.tmp}"
607
            classpath="${cpath}"
608
            debug="${debug}"
609
            includes="upgrade_db_to_1_5.java"/>
610
 
611
     <java classname="upgrade_db_to_1_5"
612
           classpath="${cpath}:${build.tmp}"/>
613

    
614
   </target>     	
615

    
616
   <target name="install" depends="war" description="* Full Install *">
617
       <mkdir dir="${datafilepath}" />
618
       <mkdir dir="${inlinedatafilepath}" />
619
       <chmod dir="${datafilepath}" perm="ug+w" />
620
       <mkdir dir="${temp-dir}"/>
621
       <chmod dir="${temp-dir}" perm="ug+w" />
622
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
623
   </target>
624

    
625
   <target name="upgrade" depends="install"
626
          description="* Upgrade an existing metacat installation with a new version *">
627
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
628
   </target>
629

    
630
   <target name="install-registry" depends="init,getConversionXSL"
631
            description="Install Registry">
632

    
633
      <copy file="${srcdir}/perl/register-dataset.cgi"
634
            todir="${inst.cgi.dir}" filtering="yes"/>
635
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
636

    
637
      <mkdir dir="${temp-dir}" />
638
      <copy todir="${temp-dir}" filtering="yes">
639
       <fileset dir="lib/style/common/emlb6toeml2">
640
         <include name="*.xsl"/>
641
         <include name="*.xml"/>
642
       </fileset>
643
      </copy>
644

    
645
      <echo message="Install Registry completed." />
646
   </target>
647

    
648
   <target name="install-ldap" depends="init">
649
      <copy file="${srcdir}/perl/ldapweb.cgi"
650
            todir="${inst.cgi.dir}" filtering="yes"/>
651
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
652
      <copy file="lib/ldapweb.cfg"
653
            todir="${inst.cgi.dir}" filtering="yes"/>
654
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
655
      <mkdir dir="${templates.dir}" />
656
      <copy todir="${templates.dir}" filtering="yes">
657
        <fileset dir="lib/style/common/templates">
658
            <include name="${defaultChangePass}"/>
659
            <include name="${defaultResetPass}"/>
660
            <include name="${changePassSuccess}"/>
661
            <include name="${resetPassSuccess}"/>
662
            <include name="${registerFailed}"/>
663
            <include name="${registerLter}"/>
664
            <include name="${registerMatch}"/>
665
            <include name="${registerSuccess}"/>
666
            <include name="${register}"/>
667
            <include name="${searchResults}"/>
668
        </fileset>
669
      </copy>
670
      <echo message="ldapweb install complete." />
671
   </target>
672

    
673

    
674
   <target name="install-skin" depends="init"
675
            description="Install a Skin">
676

    
677
      <input message="Please enter name of the skin"
678
             addproperty="skin-name"/>
679

    
680
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
681
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
682
       <fileset dir="lib/style/skins/${skin-name}">
683
           <exclude name="*.png"/>
684
           <exclude name="*.gif"/>
685
           <exclude name="*.jpg"/>
686
           <exclude name="**/CVS*"/>
687
           <exclude name="**/.#*"/>
688
       </fileset>
689
      </copy>
690
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
691
       <fileset dir="lib/style/skins/${skin-name}">
692
           <include name="*.png"/>
693
           <include name="*.gif"/>
694
           <include name="*.jpg"/>
695
           <exclude name="**/CVS*"/>
696
           <exclude name="**/.#*"/>
697
       </fileset>
698
      </copy>
699
      <!--
700
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
701
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
702
       <fileset dir="lib/style/skins/${skin-name}/images">
703
           <include name="*.png"/>
704
           <include name="*.gif"/>
705
           <include name="*.jpg"/>
706
       </fileset>
707
      </copy>
708
      -->
709

    
710
      <echo message="Install Skin completed." />
711
   </target>
712

    
713
   <target name="war" depends="warPrepare,warMSSQL"
714
            description="Create a web archive (WAR) for servlet deployment">
715
       <war destfile="${build.dir}/${context}.war"
716
            webxml="${build.war}/web.xml">
717
         <fileset dir="${war.context}"/>
718
         <lib dir="${war.lib}"/>
719
         <webinf dir="${war.webinf}"/>
720
       </war>
721
   </target>
722

    
723
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
724
            description="Prepare files for creating a web archive (WAR)">
725

    
726
       <property name="war.lib" value="${build.war}/lib" />
727
       <property name="war.webinf" value="${build.war}/WEB-INF" />
728
       <property name="war.context" value="${build.war}/${context}" />
729
       <mkdir dir="${war.lib}" />
730
       <mkdir dir="${war.webinf}" />
731
       <mkdir dir="${war.context}" />
732

    
733
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
734
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
735
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
736
       <copy todir="${war.lib}" filtering="no">
737
         <fileset dir="lib">
738
           <include name="*.jar"/>
739
         </fileset>
740
         <fileset dir="lib/xalan">
741
           <include name="*.jar"/>
742
         </fileset>
743
       </copy>
744
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
745
       <copy file="lib/web.xml.${tomcatversion}"
746
             tofile="${build.war}/web.xml" />
747
       <copy file="lib/metacat.properties" todir="${war.webinf}"
748
             filtering="yes" />
749
       <copy todir="${war.context}" filtering="no">
750
         <fileset dir="lib">
751
           <include name="**/*.jpg"/>
752
           <include name="**/*.png"/>
753
           <include name="**/*.gif"/>
754
         </fileset>
755
       </copy>
756
       <copy todir="${war.context}" filtering="yes">
757
         <fileset dir="lib">
758
           <exclude name="*.jar"/>
759
           <exclude name="*.properties"/>
760
           <exclude name="web.xml"/>
761
           <exclude name="**/*.jpg"/>
762
           <exclude name="**/*.png"/>
763
           <exclude name="**/*.gif"/>
764
         </fileset>
765
       </copy>
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
   </target>
774

    
775
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
776
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
777
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
778
   </target>
779

    
780
   <target name="getConversionXSL" depends="prepare"
781
            unless="styles.not.needed"
782
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
783
     <echo>Enter CVS password: </echo>
784
     <cvs cvsRoot="${cvsroot-alternate}"
785
          package="${conversion-module}"
786
          dest="${build.tmp}" />
787

    
788
     <mkdir dir="lib/style/common/emlb6toeml2" />
789
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
790
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
791
         <include name="*.xsl"/>
792
         <include name="*.xml"/>
793
       </fileset>
794
      </copy>
795
   </target>
796

    
797
   <target name="testprep" depends="jar,clientjar,harvesterjar">
798
      <mkdir dir="${build.tests}"/>
799
      <copy todir="${build.tests}" filtering="yes">
800
        <fileset dir="${testdir}">
801
          <include name="edu/**"/>
802
        </fileset>
803
      </copy>
804
      <!-- copy and compile the tests into a jar file -->
805
      <javac srcdir="${build.tests}"
806
             destdir="${build.tests}"
807
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
808
             debug="on"
809
       includes="**/*.java" />
810

    
811
      <jar jarfile="${build.dir}/${name}-junittests.jar"
812
        basedir="${build.tests}"
813
                includes="**/*.class" />
814
   </target>
815

    
816
   <target name="test" depends="testprep"
817
            description="Uses the ant junit task to run all JUnit tests">
818

    
819
      <!-- use the ant "junit" task to run JUnit tests. -->
820
      <junit printsummary="yes" haltonfailure="no" fork="yes"
821
             haltonerror="no">
822
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
823
        <classpath>
824
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
825
        </classpath>
826

    
827
        <formatter type="plain" />
828

    
829
        <batchtest fork="yes" todir="${build.dir}">
830
          <fileset dir="${build.tests}">
831
            <include name="**/*.class" />
832
          </fileset>
833
        </batchtest>
834
     </junit>
835
   </target>
836

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

    
840
              <echo>testtorun: ${testtorun}</echo>
841

    
842
      <!-- use the ant "junit" task to run JUnit tests. -->
843
      <junit printsummary="yes" haltonfailure="no" fork="yes"
844
             haltonerror="no">
845
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
846
        <classpath>
847
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
848
        </classpath>
849

    
850
        <formatter type="plain" />
851

    
852
        <batchtest fork="yes" todir="${build.dir}">
853
          <fileset dir="${build.tests}">
854
            <include name="**/${testtorun}.class" />
855
          </fileset>
856
        </batchtest>
857
     </junit>
858
   </target>
859

    
860
   <target name="testharvester"
861
           depends="testprep"
862
           description="Uses the ant junit task to test only the Harvester code">
863
     <junit printsummary="yes"
864
            haltonfailure="off"
865
            fork="yes"
866
            haltonerror="off">
867
       <classpath>
868
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
869
       </classpath>
870
       <formatter type="plain" />
871
       <batchtest fork="yes" todir="${build.dir}">
872
         <fileset dir="${build.tests}">
873
           <include name="**/harvesterClient/*.class" />
874
         </fileset>
875
       </batchtest>
876
     </junit>
877
   </target>
878

    
879
  <target name="gethttpclient" depends="prepare"
880
            description="checks out and compiles morpho httpclient code">
881
  <!--mkdir dir="${morphosourcedir}" -->
882
        <cvs cvsRoot="${cvsroot}"
883
             package="morpho"
884
             dest="." />
885
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
886
   </target>
887

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

    
892
      <echo>***********************************
893
      Please run ant gethttpclient first!
894
      ***********************************
895
      </echo>
896
      <!-- copy and compile the tests into a jar file -->
897
      <mkdir dir="${build.metacatnettest}"/>
898
      <javac srcdir="${junitnettestsdir}"
899
             destdir="${build.metacatnettest}"
900
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
901
             includes="**/*.java" />
902

    
903
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
904
                    basedir="${build.metacatnettest}"
905
                    includes="**/*.class" />
906

    
907
      <!-- use the ant "junit" task to run JUnit tests. -->
908
      <junit printsummary="yes" haltonfailure="no" fork="yes"
909
             haltonerror="no">
910
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
911
        <classpath>
912
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
913
        </classpath>
914

    
915
        <formatter type="plain" />
916

    
917
        <batchtest fork="yes" todir="${build.dir}">
918
          <fileset dir="${build.metacatnettest}">
919
            <include name="**/*.class" />
920
          </fileset>
921
        </batchtest>
922
     </junit>
923
   </target>
924

    
925
   <target name="cleanweb" depends="clean"
926
            description="deletes tomcat web context dir and all its contents">
927
     <delete dir="${installdir}" />
928
   </target>
929

    
930

    
931
   <target name="clean" depends="init"
932
            description="deletes build dir and files that can be regenerated form the release">
933
       <delete dir="${build.dir}" />
934
   </target>
935

    
936
   <target name="fullclean" depends="clean"
937
            description="deletes even jars that depend on external sources such as stylesheets and jars">
938
       <delete file="lib/httpclient.jar" />
939
       <delete file="lib/utilities.jar" />
940
       <delete includeEmptyDirs="true" failonerror="false">
941
         <fileset dir="${style-common-cvsrelpath}">
942
           <include name="${eml-css}" />
943
           <include name="eml-*/*.xsl" />
944
           <include name="eml-*" />
945
         </fileset>
946
       </delete>
947
   </target>
948

    
949
   <target name="jdoc" depends="prepare"
950
            description="generates javadoc documentation">
951
       <javadoc packagenames="edu.ucsb.nceas.*"
952
           sourcepath="${build.src}"
953
           destdir="${build.javadocs}"
954
           classpath="${cpath}"
955
           author="true"
956
           version="true"
957
           use="true"
958
           windowtitle="${Name} API"
959
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
960
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
961
       />
962
   </target>
963

    
964
   <target name="dist" depends="geteml,jar,protocol,jdoc"
965
            description="prepares a full release distribution">
966
      <mkdir dir="${dist.dir}"/>
967
      <delete dir="${ver.dir}" />
968
      <mkdir dir="${ver.dir}"/>
969
      <copy todir="${ver.dir}">
970
        <fileset dir="."
971
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/**"/>
972
      </copy>
973
      <copy todir="${ver.dir}" file="build.xml"/>
974
      <copy todir="${ver.dir}" file="build.properties"/>
975

    
976
      <copy todir="${ver.dir}/docs" filtering="yes">
977
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
978
      </copy>
979
      <copy todir="${ver.dir}/docs" filtering="no">
980
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
981
      </copy>
982
      <copy todir="${ver.dir}/docs/dev">
983
        <fileset dir="${build.dir}/docs"/>
984
      </copy>
985
      <copy todir="${ver.dir}/src">
986
        <fileset dir="${build.dir}/src"/>
987
      </copy>
988

    
989
      <!--
990
      <delete dir="./${ver.dir}/${build.dir}"/>
991
      <delete dir="./${ver.dir}/dist"/>
992
      -->
993
      <delete file="./${name}-${release}.zip"/>
994
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
995
      <delete file="./${name}-${release}.tar.gz" />
996
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
997
      <gzip zipfile="./${name}-${release}.tar.gz"
998
                src="./${name}-${release}.tar"/>
999
      <delete file="./${name}-${release}.tar" />
1000
  </target>
1001

    
1002
  <target name="distsrc" depends="dist"
1003
            description="prepares a source distribution">
1004
      <mkdir dir="${ver.src}"/>
1005
      <copy todir="${ver.src}">
1006
        <fileset dir="./src"/>
1007
      </copy>
1008

    
1009
      <delete file="./${name}-src-${release}.zip"/>
1010
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1011
      <delete file="./${name}-src-${release}.tar.gz" />
1012
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1013
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1014
                src="./${name}-src-${release}.tar"/>
1015
      <delete file="./${name}-src-${release}.tar" />
1016
      <delete dir="${dist.dir}"/>
1017
  </target>
1018

    
1019
   <target name="stylesheettest">
1020
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1021
      <param name="displaymodule" expression="${displaymodule}"/>
1022
      <param name="docid" expression="${input}"/>
1023
      <param name="entitytype" expression="${entitytype}"/>
1024
      <param name="entityindex" expression="${entityindex}"/>
1025
      <outputproperty name="method" value="html"/>
1026
      <outputproperty name="standalone" value="yes"/>
1027
      <outputproperty name="encoding" value="iso8859_1"/>
1028
      <outputproperty name="indent" value="yes"/>
1029
    </xslt>
1030
  </target>
1031

    
1032
 <target name="gridinit" depends="init">
1033
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1034
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1035
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1036
   <property environment="env"/>
1037
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1038
    <path id="webservicepath">
1039
        <pathelement location="."/>
1040
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1041
        <pathelement location="${build.dest}"/>
1042
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1043
           <include name="*.jar"/>
1044
        </fileset>
1045
      </path>
1046
</target>
1047

    
1048
 <target name="gridprepare" depends="gridinit, prepare">
1049
 </target>
1050

    
1051
  <target name="compileinterface" depends="clean, gridprepare">
1052
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1053
  </target>
1054

    
1055
  <target name="generateWSDL" depends="compileinterface">
1056
    <echo message="Generating wsdl from ${interface.name} interface"/>
1057
    <java classname="${java2wsdl.tool}"
1058
          dir="${build.src}" fork="yes"
1059
          classpathref="webservicepath"  failonerror="true" >
1060
      <arg value="-P"/>
1061
      <arg value="${interface.name}PortType"/>
1062
      <arg value="-S"/>
1063
      <arg value="${interface.name}Service"/>
1064
      <arg value="-y"/>
1065
      <arg value="WRAPPED"/>
1066
      <arg value="-u"/>
1067
      <arg value="LITERAL"/>
1068
      <arg value="-l"/>
1069
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1070
      <arg value="-n"/>
1071
      <arg value="http://${services.namespace}/${interface.name}"/>
1072
      <arg value="${interface.package}.${interface.name}"/>
1073
    </java>
1074
  </target>
1075

    
1076
   <target name="decorateWSDL" depends="generateWSDL">
1077
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1078
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1079
            fork="yes"
1080
            classpathref="webservicepath" failonerror="true" >
1081
        <arg value="${binding.file}"/>
1082
        <arg value="${wsdl.file}"/>
1083
      </java>
1084
   </target>
1085

    
1086
   <target name="generatestubs" depends="decorateWSDL">
1087
      <echo message=" Generating stubs " />
1088
      <echo message="wsdl file is ${wsdl.file}"/>
1089
      <echo message="build.src is ${build.src}"/>
1090
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1091
            classpathref="webservicepath" failonerror="true" >
1092
         <arg value="${wsdl.file}"/>
1093
    </java>
1094
  </target>
1095

    
1096
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1097
     <echo message=" Compiling stubs " />
1098
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1099
     <echo message=" Compiling impl " />
1100
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1101
  </target>
1102

    
1103
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1104
     <echo message=" jar stubs classes " />
1105
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1106
     <echo message=" jar impl classes " />
1107
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1108
  </target>
1109

    
1110
  <target name="gar" depends="jarStubsAndImpl">
1111
     <echo message=" jar the gar file"/>
1112
     <mkdir dir="${build.dir}/gar"/>
1113
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1114
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1115
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1116
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1117
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1118
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1119
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1120
  </target>
1121

    
1122
  <target name="compilewebclient" depends="prepare">
1123
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1124
  </target>
1125

    
1126
  <target name="runwebclient" depends="compilewebclient">
1127
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1128
           dir="${build.dest}" fork="yes"
1129
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1130
         <arg value="${serviceUrl}"/>
1131
         <arg value="${docid}"/>
1132
     </java>
1133
  </target>
1134
</project>
(5-5/5)