Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: sgarg $'
10
  *    '$Date: 2004-12-30 14:34:01 -0800 (Thu, 30 Dec 2004) $'
11
  *    '$Revision: 2356 $'
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="geteml" depends="getemlpre2,geteml2+" if="eml.required"
431
            description="Calls getemlpre2 and geteml2+ targets" />
432

    
433
   <target name="getemlpre2" depends="prepare" if="eml.required"
434
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
435
     <echo>Enter CVS password: </echo>
436
     <cvs cvsRoot="${cvsroot}"
437
          package="${eml-module}"
438
          tag="${eml-tag}"
439
          dest="${build.tmp}/eml_${eml-tag}" />
440
     <mkdir dir="lib/dtd" />
441
     <copy todir="lib/dtd" filtering="yes">
442
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
443
         <include name="*.dtd"/>
444
       </fileset>
445
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
446
     </copy>
447

    
448
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
449
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
450
       <include name="**/*.xsl"/>
451
     </fileset>
452
     </copy>
453
   </target>
454

    
455
   <target name="geteml2+" depends="prepare" if="eml.required"
456
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
457
     <echo>Enter CVS password: </echo>
458
     <cvs cvsRoot="${cvsroot}"
459
          package="${eml-module}"
460
          tag="${eml2_0_0-tag}"
461
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
462
     <mkdir dir="lib/schema/eml-2.0.0" />
463
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
464
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
465
         <include name="*.xsd"/>
466
       </fileset>
467

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

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

    
474
     </copy>
475
     <antcall target="copyxsl">
476
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
477
        <param name="dirname" value="eml-2.0.0" />
478
     </antcall>
479

    
480
     <echo>Enter CVS password: </echo>
481
     <cvs cvsRoot="${cvsroot}"
482
          package="${eml-module}"
483
          tag="${eml2_0_1-tag}"
484
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
485
     <mkdir dir="lib/schema/eml-2.0.1" />
486
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
487
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
488
         <include name="*.xsd"/>
489
       </fileset>
490
     </copy>
491
     <antcall target="copyxsl">
492
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
493
        <param name="dirname" value="eml-2.0.1" />
494
     </antcall>
495
   </target>
496

    
497

    
498

    
499
   <target  name="copyxsl"
500
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
501

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

    
504
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
505
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
506
       <include name="**/*.xsl"/>
507
     </fileset>
508
     </copy>
509

    
510

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

    
516
   </target>
517

    
518

    
519

    
520
   <target name="register-schemas" depends="prepare"
521
   description="Registers the Schemas with a new Metacat instance">
522
     <echo/>
523
     <echo>Registering the Schemas with the new Metacat instance...</echo>
524
     <sql driver="${dbDriver}"
525
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
526
          url="${jdbc-connect}"
527
          userid="${user}"
528
          password="${password}"
529
          src="${build.src}/loaddtdschema.sql" />
530
   </target>
531

    
532
   <target name="installdb" depends="prepare"
533
            description="Installs the database tables">
534
     <echo/>
535
     <echo>Installing the database tables...</echo>
536
     <sql driver="${dbDriver}"
537
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
538
          url="${jdbc-connect}"
539
          userid="${user}"
540
          password="${password}"
541
          src="${build.src}/${install-sql}" />
542
   </target>
543

    
544
   <target name="upgrade12" depends="prepare"
545
            description="Updates the database tables to upgrade to version 1.2">
546
     <echo/>
547
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
548
     <sql driver="${dbDriver}"
549
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
550
          url="${jdbc-connect}"
551
          userid="${user}"
552
          password="${password}"
553
          src="${build.src}/${upgrade-1.2-sql}" />
554
   </target>
555

    
556
   <target name="upgrade13" depends="prepare"
557
            description="Updates the database tables to upgrade to version 1.3">
558
     <echo/>
559
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
560
     <sql driver="${dbDriver}"
561
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
562
          url="${jdbc-connect}"
563
          userid="${user}"
564
          password="${password}"
565
          src="${build.src}/${upgrade-1.3-sql}" />
566
   </target>
567

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

    
580
   <target name="upgrade15" depends="prepare"
581
	   description="Updates the database tables to upgrade to version 1.5">
582
     <echo/>
583
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
584
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
585
	   todir="${build.tmp}" filtering="yes"/>
586
 
587
     <javac srcdir="${build.tmp}"
588
            destdir="${build.tmp}"
589
            classpath="${cpath}"
590
            debug="${debug}"
591
            includes="upgrade_db_to_1_5.java"/>
592
 
593
     <java classname="upgrade_db_to_1_5"
594
           classpath="${cpath}:${build.tmp}"/>
595

    
596
   </target>     	
597

    
598
   <target name="install" depends="war" description="* Full Install *">
599
       <mkdir dir="${datafilepath}" />
600
       <mkdir dir="${inlinedatafilepath}" />
601
       <chmod dir="${datafilepath}" perm="ug+w" />
602
       <mkdir dir="${temp-dir}"/>
603
       <chmod dir="${temp-dir}" perm="ug+w" />
604
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
605
   </target>
606

    
607
   <target name="upgrade" depends="install"
608
          description="* Upgrade an existing metacat installation with a new version *">
609
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
610
   </target>
611

    
612
   <target name="install-registry" depends="init,getConversionXSL"
613
            description="Install Registry">
614

    
615
      <copy file="${srcdir}/perl/register-dataset.cgi"
616
            todir="${inst.cgi.dir}" filtering="yes"/>
617
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
618

    
619
      <mkdir dir="${temp-dir}" />
620
      <copy todir="${temp-dir}" filtering="yes">
621
       <fileset dir="lib/style/common/emlb6toeml2">
622
         <include name="*.xsl"/>
623
         <include name="*.xml"/>
624
       </fileset>
625
      </copy>
626

    
627
      <echo message="Install Registry completed." />
628
   </target>
629

    
630
   <target name="install-ldap" depends="init">
631
      <copy file="${srcdir}/perl/ldapweb.cgi"
632
            todir="${inst.cgi.dir}" filtering="yes"/>
633
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
634
      <copy file="lib/ldapweb.cfg"
635
            todir="${inst.cgi.dir}" filtering="yes"/>
636
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
637
      <mkdir dir="${templates.dir}" />
638
      <copy todir="${templates.dir}" filtering="yes">
639
        <fileset dir="lib/style/common/templates">
640
            <include name="${defaultChangePass}"/>
641
            <include name="${defaultResetPass}"/>
642
            <include name="${changePassSuccess}"/>
643
            <include name="${resetPassSuccess}"/>
644
            <include name="${registerFailed}"/>
645
            <include name="${registerLter}"/>
646
            <include name="${registerMatch}"/>
647
            <include name="${registerSuccess}"/>
648
            <include name="${register}"/>
649
            <include name="${searchResults}"/>
650
        </fileset>
651
      </copy>
652
      <echo message="ldapweb install complete." />
653
   </target>
654

    
655

    
656
   <target name="install-skin" depends="init"
657
            description="Install a Skin">
658

    
659
      <input message="Please enter name of the skin"
660
             addproperty="skin-name"/>
661

    
662
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
663
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
664
       <fileset dir="lib/style/skins/${skin-name}">
665
           <exclude name="*.png"/>
666
           <exclude name="*.gif"/>
667
           <exclude name="*.jpg"/>
668
           <exclude name="**/CVS*"/>
669
           <exclude name="**/.#*"/>
670
       </fileset>
671
      </copy>
672
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
673
       <fileset dir="lib/style/skins/${skin-name}">
674
           <include name="*.png"/>
675
           <include name="*.gif"/>
676
           <include name="*.jpg"/>
677
           <exclude name="**/CVS*"/>
678
           <exclude name="**/.#*"/>
679
       </fileset>
680
      </copy>
681
      <!--
682
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
683
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
684
       <fileset dir="lib/style/skins/${skin-name}/images">
685
           <include name="*.png"/>
686
           <include name="*.gif"/>
687
           <include name="*.jpg"/>
688
       </fileset>
689
      </copy>
690
      -->
691

    
692
      <echo message="Install Skin completed." />
693
   </target>
694

    
695
   <target name="war" depends="warPrepare,warMSSQL"
696
            description="Create a web archive (WAR) for servlet deployment">
697
       <war destfile="${build.dir}/${context}.war"
698
            webxml="${build.war}/web.xml">
699
         <fileset dir="${war.context}"/>
700
         <lib dir="${war.lib}"/>
701
         <webinf dir="${war.webinf}"/>
702
       </war>
703
   </target>
704

    
705
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
706
            description="Prepare files for creating a web archive (WAR)">
707

    
708
       <property name="war.lib" value="${build.war}/lib" />
709
       <property name="war.webinf" value="${build.war}/WEB-INF" />
710
       <property name="war.context" value="${build.war}/${context}" />
711
       <mkdir dir="${war.lib}" />
712
       <mkdir dir="${war.webinf}" />
713
       <mkdir dir="${war.context}" />
714

    
715
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
716
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
717
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
718
       <copy todir="${war.lib}" filtering="no">
719
         <fileset dir="lib">
720
           <include name="*.jar"/>
721
         </fileset>
722
         <fileset dir="lib/xalan">
723
           <include name="*.jar"/>
724
         </fileset>
725
       </copy>
726
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
727
       <copy file="lib/web.xml.${tomcatversion}"
728
             tofile="${build.war}/web.xml" />
729
       <copy file="lib/metacat.properties" todir="${war.webinf}"
730
             filtering="yes" />
731
       <copy todir="${war.context}" filtering="no">
732
         <fileset dir="lib">
733
           <include name="**/*.jpg"/>
734
           <include name="**/*.png"/>
735
           <include name="**/*.gif"/>
736
         </fileset>
737
       </copy>
738
       <copy todir="${war.context}" filtering="yes">
739
         <fileset dir="lib">
740
           <exclude name="*.jar"/>
741
           <exclude name="*.properties"/>
742
           <exclude name="web.xml"/>
743
           <exclude name="**/*.jpg"/>
744
           <exclude name="**/*.png"/>
745
           <exclude name="**/*.gif"/>
746
         </fileset>
747
       </copy>
748
       <copy todir="${war.context}" filtering="no">
749
         <fileset dir="lib">
750
           <include name="**/*.jpg"/>
751
           <include name="**/*.png"/>
752
           <include name="**/*.gif"/>
753
         </fileset>
754
       </copy>
755
   </target>
756

    
757
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
758
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
759
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
760
   </target>
761

    
762
   <target name="getConversionXSL" depends="prepare"
763
            unless="styles.not.needed"
764
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
765
     <echo>Enter CVS password: </echo>
766
     <cvs cvsRoot="${cvsroot-alternate}"
767
          package="${conversion-module}"
768
          dest="${build.tmp}" />
769

    
770
     <mkdir dir="lib/style/common/emlb6toeml2" />
771
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
772
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
773
         <include name="*.xsl"/>
774
         <include name="*.xml"/>
775
       </fileset>
776
      </copy>
777
   </target>
778

    
779
   <target name="testprep" depends="jar,clientjar,harvesterjar">
780
      <mkdir dir="${build.tests}"/>
781
      <copy todir="${build.tests}" filtering="yes">
782
        <fileset dir="${testdir}">
783
          <include name="edu/**"/>
784
        </fileset>
785
      </copy>
786
      <!-- copy and compile the tests into a jar file -->
787
      <javac srcdir="${build.tests}"
788
             destdir="${build.tests}"
789
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
790
             debug="on"
791
       includes="**/*.java" />
792

    
793
      <jar jarfile="${build.dir}/${name}-junittests.jar"
794
        basedir="${build.tests}"
795
                includes="**/*.class" />
796
   </target>
797

    
798
   <target name="test" depends="testprep"
799
            description="Uses the ant junit task to run all JUnit tests">
800

    
801
      <!-- use the ant "junit" task to run JUnit tests. -->
802
      <junit printsummary="yes" haltonfailure="no" fork="yes"
803
             haltonerror="no">
804
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
805
        <classpath>
806
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
807
        </classpath>
808

    
809
        <formatter type="plain" />
810

    
811
        <batchtest fork="yes" todir="${build.dir}">
812
          <fileset dir="${build.tests}">
813
            <include name="**/*.class" />
814
          </fileset>
815
        </batchtest>
816
     </junit>
817
   </target>
818

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

    
822
              <echo>testtorun: ${testtorun}</echo>
823

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

    
832
        <formatter type="plain" />
833

    
834
        <batchtest fork="yes" todir="${build.dir}">
835
          <fileset dir="${build.tests}">
836
            <include name="**/${testtorun}.class" />
837
          </fileset>
838
        </batchtest>
839
     </junit>
840
   </target>
841

    
842
   <target name="testharvester"
843
           depends="testprep"
844
           description="Uses the ant junit task to test only the Harvester code">
845
     <junit printsummary="yes"
846
            haltonfailure="off"
847
            fork="yes"
848
            haltonerror="off">
849
       <classpath>
850
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
851
       </classpath>
852
       <formatter type="plain" />
853
       <batchtest fork="yes" todir="${build.dir}">
854
         <fileset dir="${build.tests}">
855
           <include name="**/harvesterClient/*.class" />
856
         </fileset>
857
       </batchtest>
858
     </junit>
859
   </target>
860

    
861
  <target name="gethttpclient" depends="prepare"
862
            description="checks out and compiles morpho httpclient code">
863
  <!--mkdir dir="${morphosourcedir}" -->
864
        <cvs cvsRoot="${cvsroot}"
865
             package="morpho"
866
             dest="." />
867
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
868
   </target>
869

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

    
874
      <echo>***********************************
875
      Please run ant gethttpclient first!
876
      ***********************************
877
      </echo>
878
      <!-- copy and compile the tests into a jar file -->
879
      <mkdir dir="${build.metacatnettest}"/>
880
      <javac srcdir="${junitnettestsdir}"
881
             destdir="${build.metacatnettest}"
882
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
883
             includes="**/*.java" />
884

    
885
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
886
                    basedir="${build.metacatnettest}"
887
                    includes="**/*.class" />
888

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

    
897
        <formatter type="plain" />
898

    
899
        <batchtest fork="yes" todir="${build.dir}">
900
          <fileset dir="${build.metacatnettest}">
901
            <include name="**/*.class" />
902
          </fileset>
903
        </batchtest>
904
     </junit>
905
   </target>
906

    
907
   <target name="cleanweb" depends="clean"
908
            description="deletes tomcat web context dir and all its contents">
909
     <delete dir="${installdir}" />
910
   </target>
911

    
912

    
913
   <target name="clean" depends="init"
914
            description="deletes build dir and files that can be regenerated form the release">
915
       <delete dir="${build.dir}" />
916
   </target>
917

    
918
   <target name="fullclean" depends="clean"
919
            description="deletes even jars that depend on external sources such as stylesheets and jars">
920
       <delete file="lib/httpclient.jar" />
921
       <delete file="lib/utilities.jar" />
922
       <delete includeEmptyDirs="true" failonerror="false">
923
         <fileset dir="${style-common-cvsrelpath}">
924
           <include name="${eml-css}" />
925
           <include name="eml-*/*.xsl" />
926
           <include name="eml-*" />
927
         </fileset>
928
       </delete>
929
   </target>
930

    
931
   <target name="jdoc" depends="prepare"
932
            description="generates javadoc documentation">
933
       <javadoc packagenames="edu.ucsb.nceas.*"
934
           sourcepath="${build.src}"
935
           destdir="${build.javadocs}"
936
           classpath="${cpath}"
937
           author="true"
938
           version="true"
939
           use="true"
940
           windowtitle="${Name} API"
941
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
942
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
943
       />
944
   </target>
945

    
946
   <target name="dist" depends="geteml,jar,protocol,jdoc"
947
            description="prepares a full release distribution">
948
      <mkdir dir="${dist.dir}"/>
949
      <delete dir="${ver.dir}" />
950
      <mkdir dir="${ver.dir}"/>
951
      <copy todir="${ver.dir}">
952
        <fileset dir="."
953
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/**"/>
954
      </copy>
955
      <copy todir="${ver.dir}" file="build.xml"/>
956
      <copy todir="${ver.dir}" file="build.properties"/>
957

    
958
      <copy todir="${ver.dir}/docs" filtering="yes">
959
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
960
      </copy>
961
      <copy todir="${ver.dir}/docs" filtering="no">
962
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
963
      </copy>
964
      <copy todir="${ver.dir}/docs/dev">
965
        <fileset dir="${build.dir}/docs"/>
966
      </copy>
967
      <copy todir="${ver.dir}/src">
968
        <fileset dir="${build.dir}/src"/>
969
      </copy>
970

    
971
      <!--
972
      <delete dir="./${ver.dir}/${build.dir}"/>
973
      <delete dir="./${ver.dir}/dist"/>
974
      -->
975
      <delete file="./${name}-${release}.zip"/>
976
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
977
      <delete file="./${name}-${release}.tar.gz" />
978
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
979
      <gzip zipfile="./${name}-${release}.tar.gz"
980
                src="./${name}-${release}.tar"/>
981
      <delete file="./${name}-${release}.tar" />
982
  </target>
983

    
984
  <target name="distsrc" depends="dist"
985
            description="prepares a source distribution">
986
      <mkdir dir="${ver.src}"/>
987
      <copy todir="${ver.src}">
988
        <fileset dir="./src"/>
989
      </copy>
990

    
991
      <delete file="./${name}-src-${release}.zip"/>
992
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
993
      <delete file="./${name}-src-${release}.tar.gz" />
994
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
995
      <gzip zipfile="./${name}-src-${release}.tar.gz"
996
                src="./${name}-src-${release}.tar"/>
997
      <delete file="./${name}-src-${release}.tar" />
998
      <delete dir="${dist.dir}"/>
999
  </target>
1000

    
1001
   <target name="stylesheettest">
1002
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1003
      <param name="displaymodule" expression="${displaymodule}"/>
1004
      <param name="docid" expression="${input}"/>
1005
      <param name="entitytype" expression="${entitytype}"/>
1006
      <param name="entityindex" expression="${entityindex}"/>
1007
      <outputproperty name="method" value="html"/>
1008
      <outputproperty name="standalone" value="yes"/>
1009
      <outputproperty name="encoding" value="iso8859_1"/>
1010
      <outputproperty name="indent" value="yes"/>
1011
    </xslt>
1012
  </target>
1013

    
1014
 <target name="gridinit" depends="init">
1015
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1016
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1017
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1018
   <property environment="env"/>
1019
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1020
    <path id="webservicepath">
1021
        <pathelement location="."/>
1022
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1023
        <pathelement location="${build.dest}"/>
1024
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1025
           <include name="*.jar"/>
1026
        </fileset>
1027
      </path>
1028
</target>
1029

    
1030
 <target name="gridprepare" depends="gridinit, prepare">
1031
 </target>
1032

    
1033
  <target name="compileinterface" depends="clean, gridprepare">
1034
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1035
  </target>
1036

    
1037
  <target name="generateWSDL" depends="compileinterface">
1038
    <echo message="Generating wsdl from ${interface.name} interface"/>
1039
    <java classname="${java2wsdl.tool}"
1040
          dir="${build.src}" fork="yes"
1041
          classpathref="webservicepath"  failonerror="true" >
1042
      <arg value="-P"/>
1043
      <arg value="${interface.name}PortType"/>
1044
      <arg value="-S"/>
1045
      <arg value="${interface.name}Service"/>
1046
      <arg value="-y"/>
1047
      <arg value="WRAPPED"/>
1048
      <arg value="-u"/>
1049
      <arg value="LITERAL"/>
1050
      <arg value="-l"/>
1051
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1052
      <arg value="-n"/>
1053
      <arg value="http://${services.namespace}/${interface.name}"/>
1054
      <arg value="${interface.package}.${interface.name}"/>
1055
    </java>
1056
  </target>
1057

    
1058
   <target name="decorateWSDL" depends="generateWSDL">
1059
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1060
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1061
            fork="yes"
1062
            classpathref="webservicepath" failonerror="true" >
1063
        <arg value="${binding.file}"/>
1064
        <arg value="${wsdl.file}"/>
1065
      </java>
1066
   </target>
1067

    
1068
   <target name="generatestubs" depends="decorateWSDL">
1069
      <echo message=" Generating stubs " />
1070
      <echo message="wsdl file is ${wsdl.file}"/>
1071
      <echo message="build.src is ${build.src}"/>
1072
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1073
            classpathref="webservicepath" failonerror="true" >
1074
         <arg value="${wsdl.file}"/>
1075
    </java>
1076
  </target>
1077

    
1078
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1079
     <echo message=" Compiling stubs " />
1080
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1081
     <echo message=" Compiling impl " />
1082
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1083
  </target>
1084

    
1085
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1086
     <echo message=" jar stubs classes " />
1087
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1088
     <echo message=" jar impl classes " />
1089
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1090
  </target>
1091

    
1092
  <target name="gar" depends="jarStubsAndImpl">
1093
     <echo message=" jar the gar file"/>
1094
     <mkdir dir="${build.dir}/gar"/>
1095
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1096
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1097
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1098
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1099
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1100
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1101
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1102
  </target>
1103

    
1104
  <target name="compilewebclient" depends="prepare">
1105
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1106
  </target>
1107

    
1108
  <target name="runwebclient" depends="compilewebclient">
1109
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1110
           dir="${build.dest}" fork="yes"
1111
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1112
         <arg value="${serviceUrl}"/>
1113
         <arg value="${docid}"/>
1114
     </java>
1115
  </target>
1116
</project>
(5-5/5)