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-10-02 16:23:13 -0700 (Sun, 02 Oct 2005) $'
11
  *    '$Revision: 2631 $'
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
  <!-- Determine which tomcat we are using and tomcat-specific settings -->
37
  <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
38
    <equals arg1="${tomcatversion}" arg2="tomcat3" />
39
  </condition>
40
  <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
41
    <equals arg1="${tomcatversion}" arg2="tomcat4" />
42
  </condition>
43
  <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
44
    <equals arg1="${tomcatversion}" arg2="tomcat5" />
45
  </condition>
46

    
47
  <target name="check-db">
48
    <condition property="use-oracle">
49
      <equals arg1="${database}" arg2="oracle" />
50
    </condition>
51
    <condition property="use-postgresql">
52
      <equals arg1="${database}" arg2="postgresql" />
53
    </condition>
54
    <condition property="use-sqlserver">
55
      <equals arg1="${database}" arg2="sqlserver" />
56
    </condition>
57
  </target>
58

    
59
  <target name="oracle" if="use-oracle">
60
     <!-- Customize these properties if you are using oracle -->
61
     <echo message="Using oracle..."/>
62
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
63
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
64
     <property name="jdbc-jar-name" value="classes111.zip" />
65
     <property name="jdbc" value="${jdbc_base}/${jdbc-jar-name}" />
66
     <!-- Property to indicate is not MSSQL installation-->
67
     <property name="other" value="yes"/>
68
     <property name="install-sql"
69
               value="xmltables.sql" />
70
     <property name="upgrade-1.2-sql"
71
               value="upgrade-db-to-1.2.sql" />
72
     <property name="upgrade-1.3-sql"
73
               value="upgrade-db-to-1.3.sql" />
74
     <property name="upgrade-1.4-sql"
75
               value="upgrade-db-to-1.4.sql" />
76
     <property name="upgrade-1.5-sql"
77
               value="upgrade-db-to-1.5.sql" />
78
     <property name="upgrade-1.6-sql"
79
               value="upgrade-db-to-1.6.sql" />
80
   </target>
81

    
82
   <target name="postgresql" if="use-postgresql">
83
     <!-- Customize these properties if you are using postgres -->
84
     <echo message="Using PostgreSQL..."/>
85
     <property name="dbDriver" value="org.postgresql.Driver"/>
86
     <property name="dbAdapter"
87
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
88
     <property name="jdbc-jar-name" value="postgresql-8.0-312.jdbc3.jar" />
89
     <property name="jdbc" value="lib/${jdbc-jar-name}" />
90
     <!-- Property to indicate is not MSSQL installation-->
91
     <property name="other" value="yes"/>
92
     <property name="install-sql"
93
               value="xmltables-postgres.sql" />
94
     <property name="upgrade-1.2-sql"
95
               value="upgrade-db-to-1.2-postgres.sql" />
96
     <property name="upgrade-1.3-sql"
97
               value="upgrade-db-to-1.3-postgres.sql" />
98
     <property name="upgrade-1.4-sql"
99
               value="upgrade-db-to-1.4-postgres.sql" />
100
     <property name="upgrade-1.5-sql"
101
               value="upgrade-db-to-1.5-postgres.sql" />
102
     <property name="upgrade-1.6-sql"
103
               value="upgrade-db-to-1.6-postgres.sql" />
104
    </target>
105

    
106
   <target name="sqlserver" if="use-sqlserver">
107
     <!-- Customize these properties if you are using SQL server -->
108
     <echo message="Using SQL Server..."/>
109
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
110
     <property name="dbAdapter"
111
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
112
     <property name="jdbc" value="${jdbc_base}/msbase.jar" />
113
     <property name="jdbc-add1" value="${jdbc_base}/msutil.jar" />
114
     <property name="jdbc-add2" value="${jdbc_base}/mssqlserver.jar" />
115
     <!-- Property to indicate is a MSSQL installation-->
116
     <property name="MSSQL" value="yes"/>
117
     <property name="install-sql"
118
               value="xmltables-sqlserver.sql" />
119
   </target>
120

    
121
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
122
      <!-- usr for client testing, generally you don't need change-->
123
      <property name="mcuser" value="uid=jones,o=NCEAS,dc=ecoinformatics,dc=org"/>
124
      <property name="mcpassword" value=""/>
125
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
126
      <property name="mcanotherpassword" value=""/>
127

    
128
      <property name="debug" value="on" />
129
      <property name="debuglevel" value="55" />
130

    
131
      <property name="morphosourcedir" value="../morpho" />
132
      <property name="defaultcontenttype" value="application/octet-stream" />
133
      <property name="utilitiesdir" value="../utilities" />
134

    
135
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
136
      <echo>*********** set jsdk to ${jsdk}</echo>
137
  </target>
138

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

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

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

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

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

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

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

    
299
      <filter token="defaultStage" value="${defaultStage}"/>
300
      <filter token="defaultHeader" value="${defaultHeader}"/>
301
      <filter token="defaultFooter" value="${defaultFooter}"/>
302
      <filter token="defaultChangePass" value="${defaultChangePass}"/>
303
      <filter token="defaultResetPass" value="${defaultResetPass}"/>
304
      <filter token="changePassSuccess" value="${changePassSuccess}"/>
305
      <filter token="resetPassSuccess" value="${resetPassSuccess}"/>
306
      <filter token="registerFailed" value="${registerFailed}"/>
307
      <filter token="registerLter" value="${registerLter}"/>
308
      <filter token="registerMatch" value="${registerMatch}"/>
309
      <filter token="registerSuccess" value="${registerSuccess}"/>
310
      <filter token="register" value="${register}"/>
311
      <filter token="searchResults" value="${searchResults}"/>
312
       
313
   	  <filter token="timedreplication" value="${timedreplication}" />
314
   	  <filter token="firsttimedreplication" value="${firsttimedreplication}" />
315
   	  <filter token="timedreplicationinterval" value="${timedreplicationinterval}" />
316
      
317
   	  <property name="srcdir" value="./src" />
318
   	  <property name="lib.dir" value="./lib" />
319
      <property name="testdir" value="./test" />
320
      <property name="testtorun" value="BuildIndexTest" />
321
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
322
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
323
      <property name="build.dir" value="./build"/>
324
      <property name="build.src" value="${build.dir}/src"/>
325
      <property name="build.dest" value="${build.dir}/classes"/>
326
      <property name="build.docs" value="${build.dir}/docs"/>
327
      <property name="build.samples" value="${build.dir}/samples"/>
328
      <property name="build.tests" value="${build.dir}/tests"/>
329
      <property name="build.tmp" value="${build.dir}/tmp"/>
330
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
331
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
332
      <property name="build.data" value="${build.dir}/data"/>
333
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
334
      <property name="build.war" value="${build.dir}/war"/>
335

    
336
      <property name="dist.dir" value="dist"/>
337
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
338
      <property name="ver.src" value="${ver.dir}/src"/>
339
      <property name="util.dir" value="${dist.dir}/${util-module}"/>
340
	  <!-- directories for creating a Harvest List Editor distribution -->
341
      <property name="dist.dir.hle" value="disthle"/>
342
      <property name="ver.dir.hle" value="${dist.dir.hle}/harvest-list-editor-${release}"/>
343

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

    
359
   </target>
360

    
361
   <target name="prepare" depends="init">
362
      <mkdir dir="${build.dir}"/>
363
      <mkdir dir="${build.src}"/>
364
      <mkdir dir="${build.dest}"/>
365
      <mkdir dir="${build.javadocs}"/>
366
      <mkdir dir="${build.tmp}"/>
367

    
368
      <copy todir="${build.src}" filtering="yes">
369
        <fileset dir="${srcdir}">
370
          <include name="edu/**"/>
371
          <include name="com/**"/>
372
          <include name="**/*.sql"/>
373
          <exclude name="**/CVS*"/>
374
          <exclude name="**/.#*"/>
375
        </fileset>
376
      </copy>
377
      <available file="lib/style/common/emlb6toeml2" type="dir"
378
                 property="styles.not.needed"/>
379
   </target>
380

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

    
384
       <javac srcdir="${build.src}"
385
              destdir="${build.dest}"
386
              debug="${debug}"
387
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
388
        <classpath>
389
          <path refid="compile.classpath"/>
390
        </classpath>
391
      </javac>
392
   </target>
393

    
394
   <target name="jar" depends="compile,geteml"
395
    description="Compiles and jars metacat java code to metacat.jar in build dir">
396

    
397
       <delete file="${build.dir}/${name}.jar" />
398
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
399
            excludes="**/protocols/ **/harvesterClient/" />
400
   </target>
401

    
402
   <target name="protocol" depends="compile"
403
    description="Compiles and jars protocol java code to protocol.jar in build dir">
404
       <delete file="${build.dir}/protocol.jar" />
405
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
406
            includes="**/protocols/" />
407
   </target>
408

    
409
   <target name="utilities" depends="config" if="utilities.required">
410
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
411
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
412
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
413
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
414
   </target>
415

    
416
   <target name="getutilities" depends="prepare"
417
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
418
     <echo>Enter CVS password: </echo>
419
     <cvs cvsRoot="${cvsroot}"
420
          package="${util-module}"
421
          dest="${build.tmp}" />
422
   </target>
423

    
424
   <target name="client" depends="utilities, prepare"
425
    description="Compiles metacat-client java code to build dir">
426
       <javac srcdir="${build.src}"
427
              destdir="${build.dest}"
428
              includes="edu/ucsb/nceas/metacat/client/*">
429
          <classpath>
430
            <path refid="compile.classpath"/>
431
          </classpath>
432
        </javac>
433
   </target>
434

    
435
   <target name="clientjar" depends="client"
436
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
437
       <delete file="${build.dir}/${name}-client.jar" />
438
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
439
            includes="**/metacat/client/" />
440
   </target>
441

    
442
   <target name="harvester" depends="client"
443
           description="Compiles harvester java code to build dir">
444
       <javac srcdir="${build.src}"
445
              destdir="${build.dest}"
446
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
447
          <classpath>
448
            <path refid="compile.classpath"/>
449
          </classpath>
450
        </javac>
451
   </target>
452

    
453
   <target name="harvesterjar" depends="harvester"
454
           description="Compiles and jars harvester java code to harvester.jar in build dir">
455
       <delete file="${build.dir}/harvester.jar" />
456
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
457
            includes="**/metacat/harvesterClient/" />
458
   </target>
459

    
460
   <target name="harvestListEditorDist" depends="harvesterjar"
461
           description="Prepares a distribution of the Harvest List Editor tool">
462
       <mkdir dir="${dist.dir.hle}"/>
463
       <delete dir="${ver.dir.hle}" />
464
       <mkdir dir="${ver.dir.hle}"/>
465
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
466
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
467
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
468
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
469
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
470
       <delete file="./harvest-list-editor-${release}.zip"/>
471
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
472
       <delete file="./harvest-list-editor-${release}.tar.gz" />
473
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
474
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
475
             src="./harvest-list-editor-${release}.tar"/>
476
       <delete file="./harvest-list-editor-${release}.tar" />
477
   </target>
478

    
479
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
480
            description="Calls getemlpre2 and geteml2+ targets" />
481

    
482
   <target name="getemlpre2" depends="prepare" if="eml.required"
483
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
484
     <echo>Enter CVS password: </echo>
485
     <cvs cvsRoot="${cvsroot}"
486
          package="${eml-module}"
487
          tag="${eml-tag}"
488
          dest="${build.tmp}/eml_${eml-tag}" />
489
     <mkdir dir="lib/dtd" />
490
     <copy todir="lib/dtd" filtering="yes">
491
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
492
         <include name="*.dtd"/>
493
       </fileset>
494
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
495
     </copy>
496

    
497
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
498
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
499
       <include name="**/*.xsl"/>
500
     </fileset>
501
     </copy>
502
   </target>
503

    
504
   <target name="geteml2+" depends="prepare" if="eml.required"
505
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
506
     <echo>Enter CVS password: </echo>
507
     <cvs cvsRoot="${cvsroot}"
508
          package="${eml-module}"
509
          tag="${eml2_0_0-tag}"
510
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
511
     <mkdir dir="lib/schema/eml-2.0.0" />
512
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
513
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
514
         <include name="*.xsd"/>
515
       </fileset>
516

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

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

    
523
     </copy>
524
     <antcall target="copyxsl">
525
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
526
        <param name="dirname" value="eml-2.0.0" />
527
     </antcall>
528

    
529
     <echo>Enter CVS password: </echo>
530
     <cvs cvsRoot="${cvsroot}"
531
          package="${eml-module}"
532
          tag="${eml2_0_1-tag}"
533
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
534
     <mkdir dir="lib/schema/eml-2.0.1" />
535
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
536
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
537
         <include name="*.xsd"/>
538
       </fileset>
539
     </copy>
540
     <antcall target="copyxsl">
541
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
542
        <param name="dirname" value="eml-2.0.1" />
543
     </antcall>
544
   </target>
545

    
546
   <target  name="copyxsl"
547
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
548

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

    
551
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
552
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
553
       <include name="**/*.xsl"/>
554
     </fileset>
555
     </copy>
556

    
557

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

    
563
   </target>
564

    
565

    
566

    
567
   <target name="register-schemas" depends="prepare"
568
   description="Registers the Schemas with a new Metacat instance">
569
     <echo/>
570
     <echo>Registering the Schemas with the new Metacat instance...</echo>
571
     <sql driver="${dbDriver}"
572
          url="${jdbc-connect}"
573
          userid="${user}"
574
          password="${password}"
575
          src="${build.src}/loaddtdschema.sql">
576
       <classpath>
577
         <path refid="compile.classpath"/>
578
       </classpath>
579
     </sql>
580
   </target>
581

    
582
   <target name="installdb" depends="prepare"
583
            description="Installs the database tables">
584
     <echo/>
585
     <echo>Installing the database tables...</echo>
586
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
587
     <echo/>
588
     <sql driver="${dbDriver}"
589
          url="${jdbc-connect}"
590
          userid="${user}"
591
          password="${password}"
592
          src="${build.src}/${install-sql}">
593
       <classpath>
594
         <path refid="compile.classpath"/>
595
       </classpath>
596
     </sql>
597
   </target>
598

    
599
   <target name="dropdb" depends="prepare"
600
            description="WARNING: Drops the database tables">
601
     <echo/>
602
     <echo>Dropping the database tables...</echo>
603
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
604
     <echo/>
605
     <sql driver="${dbDriver}"
606
          url="${jdbc-connect}"
607
          userid="${user}"
608
          password="${password}"
609
          src="${build.src}/drop-postgres.sql">
610
       <classpath>
611
         <path refid="compile.classpath"/>
612
       </classpath>
613
     </sql>
614
   </target>
615

    
616
   <target name="upgrade12" depends="prepare"
617
            description="Updates the database tables to upgrade to version 1.2">
618
     <echo/>
619
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
620
     <sql driver="${dbDriver}"
621
          url="${jdbc-connect}"
622
          userid="${user}"
623
          password="${password}"
624
          src="${build.src}/${upgrade-1.2-sql}">
625
       <classpath>
626
         <path refid="compile.classpath"/>
627
       </classpath>
628
     </sql>
629
   </target>
630

    
631
   <target name="upgrade13" depends="prepare"
632
            description="Updates the database tables to upgrade to version 1.3">
633
     <echo/>
634
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
635
     <sql driver="${dbDriver}"
636
          url="${jdbc-connect}"
637
          userid="${user}"
638
          password="${password}"
639
          src="${build.src}/${upgrade-1.3-sql}">
640
       <classpath>
641
         <path refid="compile.classpath"/>
642
       </classpath>
643
     </sql>
644
   </target>
645

    
646
   <target name="upgrade14" depends="prepare"
647
            description="Updates the database tables to upgrade to version 1.4">
648
     <echo/>
649
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
650
     <sql driver="${dbDriver}"
651
          url="${jdbc-connect}"
652
          userid="${user}"
653
          password="${password}"
654
          src="${build.src}/${upgrade-1.4-sql}">
655
       <classpath>
656
         <path refid="compile.classpath"/>
657
       </classpath>
658
     </sql>
659
   </target>
660

    
661
   <target name="upgrade15" depends="sqlupgrade15"
662
           description="Updates the database tables to upgrade to version 1.5">
663
     <echo/>
664
     <echo>Updating the database tables to upgrade to version 1.5...</echo>
665
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
666
           todir="${build.tmp}" filtering="yes"/>
667

    
668
     <javac srcdir="${build.tmp}"
669
            destdir="${build.tmp}"
670
            debug="${debug}"
671
            includes="upgrade_db_to_1_5.java">
672
       <classpath>
673
         <path refid="compile.classpath"/>
674
       </classpath>
675
     </javac>
676

    
677
     <java classname="upgrade_db_to_1_5">
678
       <classpath>
679
         <path refid="compile.classpath"/>
680
         <fileset dir="${build.tmp}"/>
681
       </classpath>
682
     </java>
683

    
684
   </target>
685

    
686
   <target name="upgrade16" depends="prepare"
687
            description="Updates the database tables from version 1.5 to version 1.6">
688
     <echo/>
689
     <echo>Updating the database tables to upgrade to version 1.6...</echo>
690
     <sql driver="${dbDriver}"
691
          url="${jdbc-connect}"
692
          userid="${user}"
693
          password="${password}"
694
          src="${build.src}/${upgrade-1.6-sql}">
695
       <classpath>
696
         <path refid="compile.classpath"/>
697
       </classpath>
698
     </sql>
699
   </target>
700

    
701

    
702
   <target name="sqlupgrade15" depends="prepare">
703
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
704
      <sql driver="${dbDriver}"
705
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
706
          url="${jdbc-connect}"
707
          userid="${user}"
708
          password="${password}"
709
          src="${build.src}/${upgrade-1.5-sql}" />
710
      <sql driver="${dbDriver}"
711
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
712
          url="${jdbc-connect}"
713
          userid="${user}"
714
          password="${password}"
715
          rdbms="oracle"
716
          delimiter="/">
717
        <transaction>
718
           CREATE TRIGGER xml_returnfield_before_insert
719
           BEFORE INSERT ON xml_returnfield FOR EACH ROW
720
           BEGIN
721
              SELECT xml_returnfield_id_seq.nextval
722
                 INTO :new.returnfield_id
723
                 FROM dual;
724
           END;
725
           /
726
        </transaction>
727
        <transaction>
728
           CREATE TRIGGER xml_queryresult_before_insert
729
           BEFORE INSERT ON xml_queryresult FOR EACH ROW
730
           BEGIN
731
              SELECT xml_queryresult_id_seq.nextval
732
              INTO :new.queryresult_id
733
              FROM dual;
734
           END;
735
           /
736
        </transaction>
737
      </sql>
738
   </target>
739

    
740
   <target name="install" depends="war" description="* Full Install *">
741
       <mkdir dir="${datafilepath}" />
742
       <mkdir dir="${inlinedatafilepath}" />
743
       <chmod dir="${datafilepath}" perm="ug+w" />
744
       <mkdir dir="${temp-dir}"/>
745
       <chmod dir="${temp-dir}" perm="ug+w" />
746
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
747
   </target>
748

    
749
   <target name="upgrade" depends="install"
750
          description="* Upgrade an existing metacat installation with a new version *">
751
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
752
   </target>
753

    
754
   <target name="install-registry" depends="init,getConversionXSL"
755
            description="Install Registry">
756

    
757
      <copy file="${srcdir}/perl/register-dataset.cgi"
758
            todir="${inst.cgi.dir}" filtering="yes"/>
759
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
760

    
761
      <mkdir dir="${temp-dir}" />
762
      <copy todir="${temp-dir}" filtering="yes">
763
       <fileset dir="lib/style/common/emlb6toeml2">
764
         <include name="*.xsl"/>
765
         <include name="*.xml"/>
766
       </fileset>
767
      </copy>
768

    
769
      <echo message="Install Registry completed." />
770
   </target>
771

    
772
   <target name="install-ldap" depends="init">
773
      <copy file="${srcdir}/perl/ldapweb.cgi"
774
            todir="${inst.cgi.dir}" filtering="yes"/>
775
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
776
      <copy file="lib/ldapweb.cfg"
777
            todir="${inst.cgi.dir}" filtering="yes"/>
778
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
779
      <mkdir dir="${templates.dir}" />
780
      <copy todir="${templates.dir}" filtering="yes">
781
        <fileset dir="lib/style/common/templates">
782
            <include name="${defaultChangePass}"/>
783
            <include name="${defaultResetPass}"/>
784
            <include name="${changePassSuccess}"/>
785
            <include name="${resetPassSuccess}"/>
786
            <include name="${registerFailed}"/>
787
            <include name="${registerLter}"/>
788
            <include name="${registerMatch}"/>
789
            <include name="${registerSuccess}"/>
790
            <include name="${register}"/>
791
            <include name="${searchResults}"/>
792
        </fileset>
793
      </copy>
794
      <echo message="ldapweb install complete." />
795
   </target>
796

    
797

    
798
   <target name="install-skin" depends="init"
799
            description="Install a Skin">
800

    
801
      <input message="Please enter name of the skin"
802
             addproperty="skin-name"/>
803

    
804
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
805
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
806
       <fileset dir="lib/style/skins/${skin-name}">
807
           <exclude name="*.png"/>
808
           <exclude name="*.gif"/>
809
           <exclude name="*.jpg"/>
810
           <exclude name="**/CVS*"/>
811
           <exclude name="**/.#*"/>
812
       </fileset>
813
      </copy>
814
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
815
       <fileset dir="lib/style/skins/${skin-name}">
816
           <include name="*.png"/>
817
           <include name="*.gif"/>
818
           <include name="*.jpg"/>
819
           <exclude name="**/CVS*"/>
820
           <exclude name="**/.#*"/>
821
       </fileset>
822
      </copy>
823
      <!--
824
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
825
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
826
       <fileset dir="lib/style/skins/${skin-name}/images">
827
           <include name="*.png"/>
828
           <include name="*.gif"/>
829
           <include name="*.jpg"/>
830
       </fileset>
831
      </copy>
832
      -->
833

    
834
      <echo message="Install Skin completed." />
835
   </target>
836

    
837
   <target name="war" depends="warPrepare,warMSSQL"
838
            description="Create a web archive (WAR) for servlet deployment">
839
       <war destfile="${build.dir}/${context}.war"
840
            webxml="${build.war}/web.xml">
841
         <fileset dir="${war.context}"/>
842
         <lib dir="${war.lib}"/>
843
         <webinf dir="${war.webinf}"/>
844
       </war>
845
   </target>
846

    
847
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
848
            description="Prepare files for creating a web archive (WAR)">
849

    
850
       <property name="war.lib" value="${build.war}/lib" />
851
       <property name="war.webinf" value="${build.war}/WEB-INF" />
852
       <property name="war.context" value="${build.war}/${context}" />
853
       <mkdir dir="${war.lib}" />
854
       <mkdir dir="${war.webinf}" />
855
       <mkdir dir="${war.context}" />
856
       
857
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
858
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
859
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
860
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
861
       <copy todir="${war.lib}" filtering="no">
862
         <fileset dir="lib">
863
            <not>
864
               <filename name="${jdbc-jar-name}"/>
865
            </not>
866
            <include name="*.jar"/>
867
         </fileset>
868
         <fileset dir="lib/xalan">
869
           <include name="*.jar"/>
870
         </fileset>
871
       </copy>
872
       <copy file="lib/web.xml.${tomcatversion}"
873
             tofile="${build.war}/web.xml" />
874
       <copy file="lib/metacat.properties" todir="${war.webinf}"
875
             filtering="yes" />
876
       <copy file="lib/log4j.properties" todir="${war.webinf}"
877
             filtering="yes" />
878
       <copy todir="${war.context}" filtering="no">
879
         <fileset dir="lib">
880
           <include name="**/*.jpg"/>
881
           <include name="**/*.png"/>
882
           <include name="**/*.gif"/>
883
         </fileset>
884
       </copy>
885
       <copy todir="${war.context}" filtering="yes">
886
         <fileset dir="lib">
887
           <exclude name="*.jar"/>
888
           <exclude name="*.properties"/>
889
           <exclude name="web.xml"/>
890
           <exclude name="**/*.jpg"/>
891
           <exclude name="**/*.png"/>
892
           <exclude name="**/*.gif"/>
893
         </fileset>
894
       </copy>
895
       <copy todir="${war.context}" filtering="no">
896
         <fileset dir="lib">
897
           <include name="**/*.jpg"/>
898
           <include name="**/*.png"/>
899
           <include name="**/*.gif"/>
900
         </fileset>
901
       </copy>
902
   </target>
903

    
904
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
905
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
906
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
907
   </target>
908

    
909
   <target name="getConversionXSL" depends="prepare"
910
            unless="styles.not.needed"
911
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
912

    
913
     <echo>Enter CVS password: </echo>
914
     <cvs cvsRoot="${cvsroot}"
915
          package="${eml-module}"
916
          tag="${eml2_0_1-tag}"
917
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
918

    
919
     <mkdir dir="lib/style/common/emlb6toeml2" />
920
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
921
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
922
         <include name="*.xsl"/>
923
         <include name="*.xml"/>
924
       </fileset>
925
      </copy>
926
   </target>
927

    
928
   <target name="testprep" depends="jar,clientjar,harvesterjar">
929
      <mkdir dir="${build.tests}"/>
930
      <copy todir="${build.tests}" filtering="yes">
931
        <fileset dir="${testdir}">
932
          <include name="edu/**"/>
933
        </fileset>
934
      </copy>
935
      <!-- copy and compile the tests into a jar file -->
936
      <javac srcdir="${build.tests}"
937
             destdir="${build.tests}"
938
             debug="on"
939
       includes="**/*.java">
940
        <classpath>
941
          <path refid="compile.classpath"/>
942
          <fileset dir="${build.dir}">
943
            <includes name="${name}.jar"/>
944
            <includes name="${name}-client.jar"/>
945
            <includes name="harvester.jar"/>
946
          </fileset>
947
        </classpath>
948
      </javac>
949

    
950
      <jar jarfile="${build.dir}/${name}-junittests.jar"
951
        basedir="${build.tests}"
952
                includes="**/*.class" />
953
   </target>
954

    
955
   <target name="test" depends="testprep"
956
            description="Uses the ant junit task to run all JUnit tests">
957

    
958
      <!-- use the ant "junit" task to run JUnit tests. -->
959
      <junit printsummary="yes" haltonfailure="no" fork="yes"
960
             haltonerror="no">
961
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
962
        <classpath>
963
          <path refid="compile.classpath"/>
964
          <fileset dir="${build.dir}">
965
            <includes name="${name}.jar"/>
966
            <includes name="${name}-client.jar"/>
967
            <includes name="harvester.jar"/>
968
            <includes name="${name}-junittests.jar"/>
969
          </fileset>
970
        </classpath>
971

    
972
        <formatter type="plain" />
973

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

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

    
985
              <echo>testtorun: ${testtorun}</echo>
986

    
987
      <!-- use the ant "junit" task to run JUnit tests. -->
988
      <junit printsummary="yes" haltonfailure="no" fork="yes"
989
             haltonerror="no">
990
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
991
        <classpath>
992
          <path refid="compile.classpath"/>
993
          <fileset dir="${build.dir}">
994
            <includes name="${name}.jar"/>
995
            <includes name="${name}-client.jar"/>
996
            <includes name="harvester.jar"/>
997
            <includes name="${name}-junittests.jar"/>
998
          </fileset>
999
        </classpath>
1000

    
1001
        <formatter type="plain" />
1002

    
1003
        <batchtest fork="yes" todir="${build.dir}">
1004
          <fileset dir="${build.tests}">
1005
            <include name="**/${testtorun}.class" />
1006
          </fileset>
1007
        </batchtest>
1008
     </junit>
1009
   </target>
1010

    
1011
   <target name="testharvester"
1012
           depends="testprep"
1013
           description="Uses the ant junit task to test only the Harvester code">
1014
     <junit printsummary="yes"
1015
            haltonfailure="off"
1016
            fork="yes"
1017
            haltonerror="off">
1018
        <classpath>
1019
          <path refid="compile.classpath"/>
1020
          <fileset dir="${build.dir}">
1021
            <includes name="${name}.jar"/>
1022
            <includes name="${name}-client.jar"/>
1023
            <includes name="harvester.jar"/>
1024
            <includes name="${name}-junittests.jar"/>
1025
          </fileset>
1026
        </classpath>
1027
       <formatter type="plain" />
1028
       <batchtest fork="yes" todir="${build.dir}">
1029
         <fileset dir="${build.tests}">
1030
           <include name="**/harvesterClient/*.class" />
1031
         </fileset>
1032
       </batchtest>
1033
     </junit>
1034
   </target>
1035

    
1036
  <target name="gethttpclient" depends="prepare"
1037
            description="checks out and compiles morpho httpclient code">
1038
  <!--mkdir dir="${morphosourcedir}" -->
1039
        <cvs cvsRoot="${cvsroot}"
1040
             package="morpho"
1041
             dest="." />
1042
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1043
   </target>
1044

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

    
1049
      <echo>***********************************
1050
      Please run ant gethttpclient first!
1051
      ***********************************
1052
      </echo>
1053
      <!-- copy and compile the tests into a jar file -->
1054
      <mkdir dir="${build.metacatnettest}"/>
1055
      <javac srcdir="${junitnettestsdir}"
1056
             destdir="${build.metacatnettest}"
1057
             includes="**/*.java">
1058
        <classpath>
1059
          <path refid="compile.classpath"/>
1060
          <fileset dir="${build.dir}">
1061
            <includes name="${name}.jar"/>
1062
          </fileset>
1063
        </classpath>
1064
      </javac>
1065

    
1066
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1067
                    basedir="${build.metacatnettest}"
1068
                    includes="**/*.class" />
1069

    
1070
      <!-- use the ant "junit" task to run JUnit tests. -->
1071
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1072
             haltonerror="no">
1073
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1074
        <classpath>
1075
          <path refid="compile.classpath"/>
1076
          <fileset dir="${build.dir}">
1077
            <includes name="${name}.jar"/>
1078
            <includes name="${name}-junitnettests.jar"/>
1079
          </fileset>
1080
        </classpath>
1081

    
1082
        <formatter type="plain" />
1083

    
1084
        <batchtest fork="yes" todir="${build.dir}">
1085
          <fileset dir="${build.metacatnettest}">
1086
            <include name="**/*.class" />
1087
          </fileset>
1088
        </batchtest>
1089
     </junit>
1090
   </target>
1091

    
1092
   <target name="cleanweb" depends="clean"
1093
            description="deletes tomcat web context dir and all its contents">
1094
     <delete dir="${installdir}" />
1095
   </target>
1096

    
1097

    
1098
   <target name="clean" depends="init"
1099
            description="deletes build dir and files that can be regenerated form the release">
1100
       <delete dir="${build.dir}" />
1101
   </target>
1102

    
1103
   <target name="fullclean" depends="clean"
1104
            description="deletes even jars that depend on external sources such as stylesheets and jars">
1105
       <delete file="lib/httpclient.jar" />
1106
       <delete file="lib/utilities.jar" />
1107
       <delete includeEmptyDirs="true" failonerror="false">
1108
         <fileset dir="${style-common-cvsrelpath}">
1109
           <include name="${eml-css}" />
1110
           <include name="eml-*/*.xsl" />
1111
           <include name="eml-*" />
1112
         </fileset>
1113
       </delete>
1114
   </target>
1115

    
1116
   <target name="jdoc" depends="prepare"
1117
            description="generates javadoc documentation">
1118
       <javadoc packagenames="edu.ucsb.nceas.*"
1119
           sourcepath="${build.src}"
1120
           destdir="${build.javadocs}"
1121
           author="true"
1122
           version="true"
1123
           use="true"
1124
           windowtitle="${Name} API"
1125
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1126
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1127
         <classpath>
1128
           <path refid="compile.classpath"/>
1129
         </classpath>
1130
       </javadoc>
1131
   </target>
1132

    
1133
   <target name="dist"
1134
       depends="geteml,jar,protocol,jdoc,getConversionXSL,getutilities"
1135
            description="prepares a full release distribution">
1136
      <mkdir dir="${dist.dir}"/>
1137
      <delete dir="${ver.dir}" />
1138
      <mkdir dir="${ver.dir}"/>
1139
      <copy todir="${ver.dir}">
1140
        <fileset dir="."
1141
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1142
      </copy>
1143
      <copy todir="${ver.dir}" file="build.xml"/>
1144
      <copy todir="${ver.dir}" file="build.properties"/>
1145

    
1146
      <copy todir="${ver.dir}/docs" filtering="yes">
1147
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1148
      </copy>
1149
      <copy todir="${ver.dir}/docs" filtering="no">
1150
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1151
      </copy>
1152
      <copy todir="${ver.dir}/docs/dev">
1153
        <fileset dir="${build.dir}/docs"/>
1154
      </copy>
1155
      <copy todir="${ver.dir}/src">
1156
        <fileset dir="${build.dir}/src"/>
1157
      </copy>
1158
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1159
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1160
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1161
      <!--
1162
      <delete dir="./${ver.dir}/${build.dir}"/>
1163
      <delete dir="./${ver.dir}/dist"/>
1164
      -->
1165
      <delete file="./${name}-${release}.zip"/>
1166
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1167
      <delete file="./${name}-${release}.tar.gz" />
1168
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1169
      <gzip zipfile="./${name}-${release}.tar.gz"
1170
                src="./${name}-${release}.tar"/>
1171
      <delete file="./${name}-${release}.tar" />
1172
  </target>
1173

    
1174
  <target name="distsrc" depends="dist"
1175
            description="prepares a source distribution">
1176
      <mkdir dir="${ver.src}"/>
1177
      <copy todir="${ver.src}">
1178
        <fileset dir="./src"/>
1179
      </copy>
1180
      <mkdir dir="${util.dir}"/>
1181
      <copy todir="${util.dir}">
1182
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1183
      </copy>
1184

    
1185
      <delete file="./${name}-src-${release}.zip"/>
1186
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1187
      <delete file="./${name}-src-${release}.tar.gz" />
1188
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1189
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1190
                src="./${name}-src-${release}.tar"/>
1191
      <delete file="./${name}-src-${release}.tar" />
1192
      <delete dir="${dist.dir}"/>
1193
  </target>
1194

    
1195
   <target name="stylesheettest">
1196
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1197
      <param name="displaymodule" expression="${displaymodule}"/>
1198
      <param name="docid" expression="${input}"/>
1199
      <param name="entitytype" expression="${entitytype}"/>
1200
      <param name="entityindex" expression="${entityindex}"/>
1201
      <outputproperty name="method" value="html"/>
1202
      <outputproperty name="standalone" value="yes"/>
1203
      <outputproperty name="encoding" value="iso8859_1"/>
1204
      <outputproperty name="indent" value="yes"/>
1205
    </xslt>
1206
  </target>
1207

    
1208
 <target name="gridinit" depends="init">
1209
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1210
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1211
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1212
   <property environment="env"/>
1213
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1214
    <path id="webservicepath">
1215
        <pathelement location="."/>
1216
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1217
        <pathelement location="${build.dest}"/>
1218
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1219
           <include name="*.jar"/>
1220
        </fileset>
1221
      </path>
1222
</target>
1223

    
1224
 <target name="gridprepare" depends="gridinit, prepare">
1225
 </target>
1226

    
1227
  <target name="compileinterface" depends="clean, gridprepare">
1228
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1229
  </target>
1230

    
1231
  <target name="generateWSDL" depends="compileinterface">
1232
    <echo message="Generating wsdl from ${interface.name} interface"/>
1233
    <java classname="${java2wsdl.tool}"
1234
          dir="${build.src}" fork="yes"
1235
          classpathref="webservicepath"  failonerror="true" >
1236
      <arg value="-P"/>
1237
      <arg value="${interface.name}PortType"/>
1238
      <arg value="-S"/>
1239
      <arg value="${interface.name}Service"/>
1240
      <arg value="-y"/>
1241
      <arg value="WRAPPED"/>
1242
      <arg value="-u"/>
1243
      <arg value="LITERAL"/>
1244
      <arg value="-l"/>
1245
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1246
      <arg value="-n"/>
1247
      <arg value="http://${services.namespace}/${interface.name}"/>
1248
      <arg value="${interface.package}.${interface.name}"/>
1249
    </java>
1250
  </target>
1251

    
1252
   <target name="decorateWSDL" depends="generateWSDL">
1253
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1254
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1255
            fork="yes"
1256
            classpathref="webservicepath" failonerror="true" >
1257
        <arg value="${binding.file}"/>
1258
        <arg value="${wsdl.file}"/>
1259
      </java>
1260
   </target>
1261

    
1262
   <target name="generatestubs" depends="decorateWSDL">
1263
      <echo message=" Generating stubs " />
1264
      <echo message="wsdl file is ${wsdl.file}"/>
1265
      <echo message="build.src is ${build.src}"/>
1266
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1267
            classpathref="webservicepath" failonerror="true" >
1268
         <arg value="${wsdl.file}"/>
1269
    </java>
1270
  </target>
1271

    
1272
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1273
     <echo message=" Compiling stubs " />
1274
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1275
     <echo message=" Compiling impl " />
1276
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1277
  </target>
1278

    
1279
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1280
     <echo message=" jar stubs classes " />
1281
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1282
     <echo message=" jar impl classes " />
1283
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1284
  </target>
1285

    
1286
  <target name="gar" depends="jarStubsAndImpl">
1287
     <echo message=" jar the gar file"/>
1288
     <mkdir dir="${build.dir}/gar"/>
1289
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1290
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1291
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1292
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1293
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1294
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1295
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1296
  </target>
1297

    
1298
  <target name="compilewebclient" depends="prepare">
1299
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1300
  </target>
1301

    
1302
  <target name="runwebclient" depends="compilewebclient">
1303
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1304
           dir="${build.dest}" fork="yes"
1305
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1306
         <arg value="${serviceUrl}"/>
1307
         <arg value="${docid}"/>
1308
     </java>
1309
  </target>
1310
  
1311
  <target name="spatial_option" depends="init" description=" -- compiles code for the spatial option">
1312

    
1313
    <echo message="Compiling the metatcat shapefile creator"/>
1314
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1315
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1316
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1317
    </exec>
1318
  
1319
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1320
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/libshp.a -o bin/test.out" />
1321
    </exec>
1322
  </target>
1323

    
1324
</project>
(5-5/5)