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: tao $'
10
  *    '$Date: 2005-03-03 13:30:45 -0800 (Thu, 03 Mar 2005) $'
11
  *    '$Revision: 2395 $'
12
  *
13
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15
  *
16
  * usage: ant [compile|jar|install|jdoc]
17
  *
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License as published by
20
  * the Free Software Foundation; either version 2 of the License, or
21
  * (at your option) any later version.
22
  *
23
  * This program is distributed in the hope that it will be useful,
24
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
  * GNU General Public License for more details.
27
  *
28
  * You should have received a copy of the GNU General Public License
29
  * along with this program; if not, write to the Free Software
30
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir=".">
33
  <property environment="env"/>
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35

    
36
  <target name="check-db">
37
    <property name="upgrade-1.5-sql"
38
               value="upgrade-db-to-1.5.sql" />
39
    <condition property="use-oracle">
40
      <equals arg1="${database}" arg2="oracle" />
41
    </condition>
42
    <condition property="use-postgresql">
43
      <equals arg1="${database}" arg2="postgresql" />
44
    </condition>
45
    <condition property="use-sqlserver">
46
      <equals arg1="${database}" arg2="sqlserver" />
47
    </condition>
48
  </target>
49

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
330
      <property name="dist.dir" value="dist"/>
331
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
332
      <property name="ver.src" value="${ver.dir}/src"/>
333

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

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

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

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

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

    
380
   <target name="jar" depends="compile,geteml"
381
    description="Compiles and jars metacat java code to metacat.jar in build dir">
382

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

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

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

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

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

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

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

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

    
451
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
452
            description="Calls getemlpre2 and geteml2+ targets" />
453

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

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

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

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

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

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

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

    
518

    
519

    
520
   <target  name="copyxsl"
521
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
522

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

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

    
531

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

    
537
   </target>
538

    
539

    
540

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

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

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

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

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

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

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

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

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

    
643
   <target name="install-registry" depends="init,getConversionXSL"
644
            description="Install Registry">
645

    
646
      <copy file="${srcdir}/perl/register-dataset.cgi"
647
            todir="${inst.cgi.dir}" filtering="yes"/>
648
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
649

    
650
      <mkdir dir="${temp-dir}" />
651
      <copy todir="${temp-dir}" filtering="yes">
652
       <fileset dir="lib/style/common/emlb6toeml2">
653
         <include name="*.xsl"/>
654
         <include name="*.xml"/>
655
       </fileset>
656
      </copy>
657

    
658
      <echo message="Install Registry completed." />
659
   </target>
660

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

    
686

    
687
   <target name="install-skin" depends="init"
688
            description="Install a Skin">
689

    
690
      <input message="Please enter name of the skin"
691
             addproperty="skin-name"/>
692

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

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

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

    
736
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
737
            description="Prepare files for creating a web archive (WAR)">
738

    
739
       <property name="war.lib" value="${build.war}/lib" />
740
       <property name="war.webinf" value="${build.war}/WEB-INF" />
741
       <property name="war.context" value="${build.war}/${context}" />
742
       <mkdir dir="${war.lib}" />
743
       <mkdir dir="${war.webinf}" />
744
       <mkdir dir="${war.context}" />
745

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

    
788
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
789
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
790
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
791
   </target>
792

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

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

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

    
824
      <jar jarfile="${build.dir}/${name}-junittests.jar"
825
        basedir="${build.tests}"
826
                includes="**/*.class" />
827
   </target>
828

    
829
   <target name="test" depends="testprep"
830
            description="Uses the ant junit task to run all JUnit tests">
831

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

    
840
        <formatter type="plain" />
841

    
842
        <batchtest fork="yes" todir="${build.dir}">
843
          <fileset dir="${build.tests}">
844
            <include name="**/*.class" />
845
          </fileset>
846
        </batchtest>
847
     </junit>
848
   </target>
849

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

    
853
              <echo>testtorun: ${testtorun}</echo>
854

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

    
863
        <formatter type="plain" />
864

    
865
        <batchtest fork="yes" todir="${build.dir}">
866
          <fileset dir="${build.tests}">
867
            <include name="**/${testtorun}.class" />
868
          </fileset>
869
        </batchtest>
870
     </junit>
871
   </target>
872

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

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

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

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

    
916
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
917
                    basedir="${build.metacatnettest}"
918
                    includes="**/*.class" />
919

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

    
928
        <formatter type="plain" />
929

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

    
938
   <target name="cleanweb" depends="clean"
939
            description="deletes tomcat web context dir and all its contents">
940
     <delete dir="${installdir}" />
941
   </target>
942

    
943

    
944
   <target name="clean" depends="init"
945
            description="deletes build dir and files that can be regenerated form the release">
946
       <delete dir="${build.dir}" />
947
   </target>
948

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

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

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

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

    
1017
  <target name="distsrc" depends="dist"
1018
            description="prepares a source distribution">
1019
      <mkdir dir="${ver.src}"/>
1020
      <copy todir="${ver.src}">
1021
        <fileset dir="./src"/>
1022
      </copy>
1023

    
1024
      <delete file="./${name}-src-${release}.zip"/>
1025
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1026
      <delete file="./${name}-src-${release}.tar.gz" />
1027
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1028
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1029
                src="./${name}-src-${release}.tar"/>
1030
      <delete file="./${name}-src-${release}.tar" />
1031
      <delete dir="${dist.dir}"/>
1032
  </target>
1033

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

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

    
1063
 <target name="gridprepare" depends="gridinit, prepare">
1064
 </target>
1065

    
1066
  <target name="compileinterface" depends="clean, gridprepare">
1067
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1068
  </target>
1069

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

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

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

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

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

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

    
1137
  <target name="compilewebclient" depends="prepare">
1138
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1139
  </target>
1140

    
1141
  <target name="runwebclient" depends="compilewebclient">
1142
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1143
           dir="${build.dest}" fork="yes"
1144
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1145
         <arg value="${serviceUrl}"/>
1146
         <arg value="${docid}"/>
1147
     </java>
1148
  </target>
1149
</project>
(5-5/5)