Project

General

Profile

1 113 jones
<?xml version="1.0"?>
2 1311 berkley
<!--
3 670 jones
  *   '$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 113 jones
  *
9 670 jones
  *    '$Author$'
10 1292 tao
  *    '$Date$'
11
  *    '$Revision$'
12 666 jones
  *
13 670 jones
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15 113 jones
  *
16 303 jones
  * usage: ant [compile|jar|install|jdoc]
17 666 jones
  *
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 1311 berkley
-->
32 329 jones
<project name="metacat" default="jar" basedir=".">
33 1929 brooke
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35
36
  <target name="check-db">
37
    <condition property="use-oracle">
38
      <equals arg1="${database}" arg2="oracle" />
39
    </condition>
40
    <condition property="use-postgresql">
41
      <equals arg1="${database}" arg2="postgresql" />
42
    </condition>
43
    <condition property="use-sqlserver">
44
      <equals arg1="${database}" arg2="sqlserver" />
45
    </condition>
46
  </target>
47
48
  <target name="oracle" if="use-oracle">
49 931 jones
     <!-- Customize these properties if you are using oracle -->
50 1929 brooke
     <echo message="Using oracle..."/>
51 925 berkley
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
52
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
53 1929 brooke
     <property name="jdbc" value="${jdbc_base}/classes111.zip" />
54 1744 tao
     <!-- Property to indicate is not MSSQL installation-->
55
     <property name="other" value="yes"/>
56 925 berkley
   </target>
57 1311 berkley
58 1929 brooke
   <target name="postgresql" if="use-postgresql">
59 931 jones
     <!-- Customize these properties if you are using postgres -->
60 1929 brooke
     <echo message="Using PostgreSQL..."/>
61 925 berkley
     <property name="dbDriver" value="org.postgresql.Driver"/>
62 1311 berkley
     <property name="dbAdapter"
63 931 jones
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
64 1716 berkley
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
65 1744 tao
     <!-- Property to indicate is not MSSQL installation-->
66
     <property name="other" value="yes"/>
67
    </target>
68 1739 tao
69 1929 brooke
   <target name="sqlserver" if="use-sqlserver">
70 1739 tao
     <!-- Customize these properties if you are using SQL server -->
71 1929 brooke
     <echo message="Using SQL Server..."/>
72 1739 tao
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
73
     <property name="dbAdapter"
74
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
75 1742 tao
     <property name="jdbc" value="${jdbc-base}/msbase.jar" />
76 1744 tao
     <property name="jdbc-add1" value="${jdbc-base}/msutil.jar" />
77
     <property name="jdbc-add2" value="${jdbc-base}/mssqlserver.jar" />
78
     <!-- Property to indicate is a MSSQL installation-->
79
     <property name="MSSQL" value="yes"/>
80 1739 tao
   </target>
81 1311 berkley
82 1929 brooke
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
83 1814 tao
      <!-- usr for client testing, generally you don't need change-->
84 1801 tao
      <property name="mcuser" value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org"/>
85 1783 jones
      <property name="mcpassword" value=""/>
86 1801 tao
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
87
      <property name="mcanotherpassword" value=""/>
88
89 1827 jones
      <property name="debug" value="on" />
90 2053 sgarg
      <property name="debuglevel" value="55" />
91 1716 berkley
92 1522 berkley
      <property name="morphosourcedir" value="../morpho" />
93 1570 tao
      <property name="defaultcontenttype" value="application/octet-stream" />
94 1780 jones
      <property name="utilitiesdir" value="../utilities" />
95 1811 tao
96 931 jones
      <!-- Make sure these paths match the location of the jar files
97
           on your system, the defaults should usually work -->
98 1941 brooke
      <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
99
        <equals arg1="${tomcatversion}" arg2="tomcat3" />
100
      </condition>
101
      <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
102
        <equals arg1="${tomcatversion}" arg2="tomcat4" />
103
      </condition>
104 2011 cjones
      <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
105
        <equals arg1="${tomcatversion}" arg2="tomcat5" />
106
      </condition>
107 1941 brooke
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
108
      <echo>*********** set jsdk to ${jsdk}</echo>
109 1311 berkley
      <property name="xmlp"
110 1376 tao
                value="lib/xercesImpl.jar" />
111 1311 berkley
      <property name="cos"
112 931 jones
                value="lib/cos.jar" />
113 939 tao
      <property name="morpho"
114
                value="lib/morpho.jar" />
115 931 jones
      <property name="xalan"
116
                value="lib/xalan/xalan.jar" />
117
      <property name="apis"
118
                value="lib/xalan/xml-apis.jar" />
119 1103 tao
      <property name="httpclient"
120 1780 jones
                value="lib/httpclient.jar" />
121 1470 tao
      <property name="emlparser"
122
                value="lib/eml.jar" />
123
      <property name="configxml"
124
                value="lib/configxml.jar" />
125 1578 tao
      <property name="itislib"
126
                value="lib/itislib.jar" />
127 1487 tao
      <property name="emlparser"
128 1941 brooke
129 1487 tao
                value="lib/eml.jar" />
130 1780 jones
      <property name="util"
131
                value="lib/utilities.jar" />
132 1103 tao
  </target>
133
134 931 jones
   <target name="init" depends="config">
135
      <!-- It is less likely you'll need to make any changes from here down,
136
           but customization is possible -->
137 1929 brooke
      <property name="installdir"          value="${webapps}/${context}" />
138
      <property name="temp-dir"            value="/tmp/${context}" />
139
      <property name="name"                value="metacat"/>
140
      <property name="Name"                value="MetaCat"/>
141
      <property name="debugprefix"         value="${Name}:"/>
142 1990 jones
      <property name="release"             value="1.4.0"/>
143 1929 brooke
      <property name="replication-path"    value="/${context}/servlet/replication"/>
144 1952 jones
      <property name="servlet-path"        value="/${context}/metacat"/>
145 1929 brooke
      <property name="html-path"           value="/${context}"/>
146
      <property name="systemidserver"      value="http://${server}"/>
147 1933 brooke
      <property name="style-common-relpath"
148
                                           value="/style/common"/>
149 1938 brooke
      <property name="style-common-cvsrelpath"
150
                                           value="lib${style-common-relpath}"/>
151 1929 brooke
      <property name="style-common-fullpath"
152 1933 brooke
                                           value="/${installdir}${style-common-relpath}"/>
153 1929 brooke
      <property name="style-common-path"
154 1933 brooke
                                           value="/${context}${style-common-relpath}"/>
155 1929 brooke
      <property name="style-skins-relpath" value="/style/skins"/>
156
      <property name="style-skins-path"    value="/${context}${style-skins-relpath}"/>
157
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
158 1579 tao
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
159 1929 brooke
      <property name="config-dir"          value="${webapps}/${style-skins-path}" />
160
      <property name="eml-module"          value="eml" />
161
      <property name="eml-version"         value="2.0.0beta6" />
162
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
163
      <property name="eml2-tag"            value="EML_2_0_0_FOR_METACAT" />
164
      <property name="eml2namespace"       value="eml://ecoinformatics.org/eml-2.0.0" />
165
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
166 1933 brooke
      <property name="eml-css"             value="eml_xsl.css"/>
167
      <property name="eml-module.default.css"
168
                                           value="default.css"/>
169 1929 brooke
      <property name="conversion-module"   value="webmdentry" />
170 348 jones
171 1929 brooke
      <!-- Config for registry variables -->
172 1933 brooke
      <property name="scope"               value="obfs"/>
173
      <property name="responseForm"        value="genericResponse.tmpl"/>
174
      <property name="entryForm"           value="entryForm.tmpl"/>
175
      <property name="guide"               value="genericGuide.tmpl"/>
176 1929 brooke
      <property name="confirmData" value="confirmData.tmpl"/>
177
      <property name="deleteData" value="deleteData.tmpl"/>
178
      <property name="genericHeader" value="genericHeader.tmpl"/>
179
      <property name="genericFooter" value="genericFooter.tmpl"/>
180
      <property name="adminname" value="KNB Support"/>
181
      <property name="recipient" value="knb-software\@nceas.ucsb.edu"/>
182
      <filter token="scope" value="${scope}"/>
183
      <filter token="responseForm" value="${responseForm}"/>
184
      <filter token="entryForm" value="${entryForm}"/>
185
      <filter token="guide" value="${guide}"/>
186
      <filter token="confirmData" value="${confirmData}"/>
187
      <filter token="deleteData" value="${deleteData}"/>
188
      <filter token="genericHeader" value="${genericHeader}"/>
189
      <filter token="genericFooter" value="${genericFooter}"/>
190
      <filter token="adminname" value="${adminname}"/>
191
      <filter token="recipient" value="${recipient}"/>
192
193 1311 berkley
      <property name="cpath"
194 1986 jones
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${cos}:${morpho}:${emlparser}:${jdbc-add1}:${jdbc-add2}:${util}:${httpclient}"/>
195 882 jones
196
      <filter token="docrooturl" value="./" />
197 588 berkley
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
198 882 jones
      <filter token="dbDriver" value="${dbDriver}"/>
199 915 berkley
      <filter token="dbAdapter" value="${dbAdapter}"/>
200 614 bojilova
      <filter token="install-dir" value="${installdir}"/>
201 1929 brooke
      <filter token="temp-dir" value="${temp-dir}"/>
202 586 berkley
      <filter token="server" value="${server}"/>
203 977 tao
      <filter token="systemidserver" value="${systemidserver}"/>
204 1929 brooke
      <filter token="cgi-prefix" value="${cgi-prefix}"/>
205
      <filter token="ldapUrl" value="${ldapUrl}"/>
206 586 berkley
      <filter token="replication-log" value="${replication-log}"/>
207 1579 tao
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
208 348 jones
      <filter token="release" value="${release}"/>
209
      <filter token="servlet-path" value="${servlet-path}"/>
210 359 bojilova
      <filter token="html-path" value="${html-path}"/>
211 362 jones
      <filter token="user" value="${user}"/>
212
      <filter token="password" value="${password}"/>
213 1783 jones
      <filter token="mcuser" value="${mcuser}"/>
214
      <filter token="mcpassword" value="${mcpassword}"/>
215 1801 tao
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
216
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
217 1929 brooke
      <filter token="knb-site-url" value="${knb-site-url}"/>
218 1933 brooke
      <filter token="eml-css" value="${eml-css}"/>
219 1929 brooke
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
220
      <filter token="style-skins-path" value="${style-skins-path}"/>
221
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
222
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
223
      <filter token="style-common-path" value="${style-common-path}"/>
224
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
225
      <filter token="style-path" value="${style-skins-path}"/>
226 525 berkley
      <filter token="replication-path" value="${replication-path}"/>
227 832 jones
      <filter token="config-dir" value="${config-dir}"/>
228
      <filter token="default-style" value="${default-style}"/>
229 877 jones
      <filter token="eml-version" value="${eml-version}"/>
230 1570 tao
      <filter token="eml2namespace" value="${eml2namespace}"/>
231 1718 tao
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
232 1009 tao
      <filter token="context" value="${context}"/>
233 1292 tao
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
234 1051 tao
      <filter token="debuglevel" value="${debuglevel}" />
235 1079 tao
      <filter token="datafilepath" value="${datafilepath}" />
236 1455 tao
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
237 1522 berkley
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
238 1538 berkley
      <filter token="debugprefix" value="${debugprefix}"/>
239 1487 tao
240 254 jones
      <property name="srcdir" value="./src" />
241 1783 jones
      <property name="testdir" value="./test" />
242
      <property name="testtorun" value="MetacatClientTest" />
243 1116 tao
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
244
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
245 348 jones
      <property name="build.dir" value="./build"/>
246
      <property name="build.src" value="${build.dir}/src"/>
247
      <property name="build.dest" value="${build.dir}/classes"/>
248 516 jones
      <property name="build.docs" value="${build.dir}/docs"/>
249 348 jones
      <property name="build.samples" value="${build.dir}/samples"/>
250
      <property name="build.tests" value="${build.dir}/tests"/>
251 1778 tao
      <property name="build.tmp" value="${build.dir}/tmp"/>
252 1116 tao
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
253
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
254 348 jones
      <property name="build.data" value="${build.dir}/data"/>
255 806 jones
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
256 1952 jones
      <property name="build.war" value="${build.dir}/war"/>
257 348 jones
258 882 jones
      <property name="dist.dir" value="dist"/>
259 806 jones
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
260
      <property name="ver.src" value="${ver.dir}/src"/>
261
262 254 jones
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
263 113 jones
   </target>
264 1311 berkley
265 348 jones
   <target name="prepare" depends="init">
266
      <mkdir dir="${build.dir}"/>
267
      <mkdir dir="${build.src}"/>
268
      <mkdir dir="${build.dest}"/>
269 516 jones
      <mkdir dir="${build.javadocs}"/>
270 1778 tao
      <mkdir dir="${build.tmp}"/>
271 348 jones
272 822 jones
      <copy todir="${build.src}" filtering="yes">
273
        <fileset dir="${srcdir}">
274
          <include name="edu/**"/>
275
          <include name="com/**"/>
276 877 jones
          <include name="**/*.sql"/>
277 822 jones
          <exclude name="**/CVS*"/>
278
          <exclude name="**/.#*"/>
279
        </fileset>
280
      </copy>
281 1954 jones
      <available file="build/tmp/${conversion-module}" type="dir"
282
                 property="styles.not.needed"/>
283 348 jones
   </target>
284
285 1939 brooke
   <target name="compile" depends="prepare,utilities"
286 1986 jones
    description="Compiles java code to build dir, and copies metacat props files there">
287 1939 brooke
288 1311 berkley
       <javac srcdir="${build.src}"
289
              destdir="${build.dest}"
290
              classpath="${cpath}"
291 1827 jones
              debug="${debug}"
292 1819 tao
              excludes="**/*.sql **/stringclient/** **/client/*.java"/>
293 1311 berkley
   </target>
294 113 jones
295 1939 brooke
   <target name="jar" depends="compile"
296
    description="Compiles and jars metacat java code to metacat.jar in build dir">
297
298 353 jones
       <delete file="${build.dir}/${name}.jar" />
299 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
300
            excludes="**/protocols/" />
301 1311 berkley
   </target>
302
303 1939 brooke
   <target name="protocol" depends="compile"
304
    description="Compiles and jars protocol java code to protocol.jar in build dir">
305 635 jones
       <delete file="${build.dir}/protocol.jar" />
306
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
307
            includes="**/protocols/" />
308 1311 berkley
   </target>
309 113 jones
310 1780 jones
   <target name="utilities" depends="config">
311 1796 jones
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
312
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
313 1780 jones
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
314
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
315
   </target>
316
317 1939 brooke
   <target name="client" depends="utilities, prepare"
318
    description="Compiles metacat-client java code to build dir">
319 1780 jones
       <javac srcdir="${build.src}"
320
              destdir="${build.dest}"
321
              classpath="${cpath}"
322
              includes="edu/ucsb/nceas/metacat/client/*" />
323
   </target>
324
325 1939 brooke
   <target name="clientjar" depends="client"
326
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
327 1780 jones
       <delete file="${build.dir}/${name}-client.jar" />
328
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
329
            includes="**/metacat/client/" />
330
   </target>
331
332 2059 costa
   <target name="harvester" depends="client"
333 1950 costa
           description="Compiles harvester java code to build dir">
334
       <echo message="classpath is:   ${cpath}"/>
335
       <javac srcdir="${build.src}"
336
              destdir="${build.dest}"
337
              classpath="${cpath}"
338
              includes="edu/ucsb/nceas/metacat/harvesterClient/*" />
339
   </target>
340
341
   <target name="harvesterjar" depends="harvester"
342 2059 costa
           description="Compiles and jars harvester java code to harvester.jar in build dir">
343
       <delete file="${build.dir}/harvester.jar" />
344
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
345 1950 costa
            includes="**/metacat/harvesterClient/" />
346
   </target>
347
348 1939 brooke
   <target  name="geteml" depends="getemlpre2,geteml2+"
349
            description="Calls getemlpre2 and geteml2+ targets" />
350
351
   <target name="getemlpre2" depends="prepare"
352
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
353 1612 tao
     <echo>Enter CVS password: </echo>
354
     <cvs cvsRoot="${cvsroot}"
355
          package="${eml-module}"
356
          tag="${eml-tag}"
357 1939 brooke
          dest="${build.tmp}/eml_${eml-tag}" />
358 1612 tao
     <mkdir dir="lib/dtd" />
359
     <copy todir="lib/dtd" filtering="yes">
360 1939 brooke
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
361 1612 tao
         <include name="*.dtd"/>
362
       </fileset>
363
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
364
     </copy>
365 1939 brooke
     <antcall target="copyxsl">
366
        <param name="cvs.tagname" value="${eml-tag}" />
367
     </antcall>
368
   </target>
369
370
   <target name="geteml2+" depends="prepare"
371
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
372
     <echo>Enter CVS password: </echo>
373 1612 tao
     <cvs cvsRoot="${cvsroot}"
374
          package="${eml-module}"
375
          tag="${eml2-tag}"
376 1939 brooke
          dest="${build.tmp}/eml_${eml2-tag}" />
377 1612 tao
     <mkdir dir="lib/schema" />
378
     <copy todir="lib/schema" filtering="yes">
379 1939 brooke
       <fileset dir="${build.tmp}/eml_${eml2-tag}/${eml-module}">
380 1612 tao
         <include name="*.xsd"/>
381
       </fileset>
382 1939 brooke
383
       <!-- shouldn't we have a mapper here like this??
384
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
385
386
       Jing's code didn't nave one - does it need to be added?
387
       NOTE that eml-version is set to beta 6, so this would need changing -->
388
389 1612 tao
     </copy>
390 1939 brooke
     <antcall target="copyxsl">
391
        <param name="cvs.tagname" value="${eml2-tag}" />
392
     </antcall>
393
   </target>
394
395
396
397
   <target  name="copyxsl"
398
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
399
400
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
401
402 1938 brooke
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
403 1939 brooke
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style">
404 1929 brooke
       <include name="**/*.xsl"/>
405 1612 tao
     </fileset>
406
     </copy>
407 1933 brooke
408 1939 brooke
409 1933 brooke
     <!-- now copy default css from eml module and put it in style-common-path
410
          dir with a new name, so other skin-specific css can import it if reqd -->
411 1939 brooke
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
412 1938 brooke
           tofile="${style-common-cvsrelpath}/${eml-css}" />
413 1612 tao
414 1463 tao
   </target>
415 1939 brooke
416
417
418
   <target name="dtdschemasql" depends="prepare"
419
   description="Registers the DTDs with the new Metacat instance">
420 877 jones
     <echo/>
421
     <echo>Registering the DTDs with the new Metacat instance...</echo>
422
     <sql driver="${dbDriver}"
423 1744 tao
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
424 877 jones
          url="${jdbc-connect}"
425
          userid="${user}"
426
          password="${password}"
427 1593 tao
          src="${build.src}/loaddtdschema.sql" />
428 877 jones
   </target>
429 1716 berkley
430 1939 brooke
   <target name="schemasql" depends="prepare"
431
            description="Registers the Schema with the new Metacat instance">
432 1570 tao
     <echo/>
433 1939 brooke
     <echo>Registering the Schema with the new Metacat instance...</echo>
434 1570 tao
     <sql driver="${dbDriver}"
435 1744 tao
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
436 1570 tao
          url="${jdbc-connect}"
437
          userid="${user}"
438
          password="${password}"
439
          src="${build.src}/loadschema.sql" />
440
   </target>
441 1801 tao
442 1939 brooke
   <target name="installdb" depends="prepare"
443
            description="Installs the database tables">
444 1827 jones
     <echo/>
445
     <echo>Installing the database tables...</echo>
446
     <sql driver="${dbDriver}"
447
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
448
          url="${jdbc-connect}"
449
          userid="${user}"
450
          password="${password}"
451
          src="${build.src}/xmltables.sql" />
452
   </target>
453
454 1939 brooke
   <target name="upgrade12" depends="prepare"
455
            description="Updates the database tables to upgrade to version 1.2">
456 1827 jones
     <echo/>
457
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
458
     <sql driver="${dbDriver}"
459
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
460
          url="${jdbc-connect}"
461
          userid="${user}"
462
          password="${password}"
463
          src="${build.src}/upgrade-db-to-1.2.sql" />
464
   </target>
465
466 1939 brooke
   <target name="upgrade13" depends="prepare"
467
            description="Updates the database tables to upgrade to version 1.3">
468 1827 jones
     <echo/>
469
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
470
     <sql driver="${dbDriver}"
471
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
472
          url="${jdbc-connect}"
473
          userid="${user}"
474
          password="${password}"
475
          src="${build.src}/upgrade-db-to-1.3.sql" />
476
   </target>
477
478 1952 jones
   <target name="install" depends="war" description="* Full Install *">
479 1079 tao
       <mkdir dir="${datafilepath}" />
480 1455 tao
       <mkdir dir="${inlinedatafilepath}" />
481 1079 tao
       <chmod dir="${datafilepath}" perm="ug+w" />
482 1929 brooke
       <mkdir dir="${temp-dir}"/>
483
       <chmod dir="${temp-dir}" perm="ug+w" />
484 1952 jones
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
485
   </target>
486
487
   <target name="upgrade" depends="install"
488
          description="* Upgrade an existing metacat installation with a new version *">
489
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
490
   </target>
491
492 1954 jones
   <target name="install-registry" depends="init,getConversionXSL"
493 1952 jones
            description="Install Registry">
494
495
      <copy file="${srcdir}/perl/register-dataset.cgi"
496
            todir="${inst.cgi.dir}" filtering="yes"/>
497
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
498
499
      <mkdir dir="${temp-dir}" />
500
     <copy todir="${temp-dir}" filtering="yes">
501
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
502
         <include name="*.xsl"/>
503
         <include name="*.xml"/>
504
       </fileset>
505
     </copy>
506
507
      <echo message="Install Registry completed." />
508
   </target>
509
510 2052 sgarg
   <target name="install-skin" depends="init"
511
            description="Install a Skin">
512
513
      <input message="Please enter name of the skin"
514
             addproperty="skin-name"/>
515
516
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
517
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
518
       <fileset dir="lib/style/skins/${skin-name}">
519 2054 sgarg
           <include name="*.*"/>
520
           <exclude name="*.png"/>
521
           <exclude name="*.gif"/>
522 2052 sgarg
       </fileset>
523
      </copy>
524 2054 sgarg
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
525
       <fileset dir="lib/style/skins/${skin-name}">
526
           <include name="*.png"/>
527
           <include name="*.gif"/>
528
       </fileset>
529
      </copy>
530 2052 sgarg
531
      <echo message="Install Skin completed." />
532
   </target>
533
534 1952 jones
   <target name="war" depends="warPrepare,warMSSQL"
535
            description="Create a web archive (WAR) for servlet deployment">
536
       <war destfile="${build.dir}/${context}.war"
537
            webxml="${build.war}/web.xml">
538
         <fileset dir="${war.context}"/>
539
         <lib dir="${war.lib}"/>
540
         <webinf dir="${war.webinf}"/>
541
       </war>
542
   </target>
543
544 2059 costa
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
545 1952 jones
            description="Prepare files for creating a web archive (WAR)">
546
547
       <property name="war.lib" value="${build.war}/lib" />
548
       <property name="war.webinf" value="${build.war}/WEB-INF" />
549
       <property name="war.context" value="${build.war}/${context}" />
550
       <mkdir dir="${war.lib}" />
551
       <mkdir dir="${war.webinf}" />
552
       <mkdir dir="${war.context}" />
553
554
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
555
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
556 2059 costa
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
557 1952 jones
       <copy todir="${war.lib}" filtering="no">
558 1823 jones
         <fileset dir="lib">
559
           <include name="*.jar"/>
560
         </fileset>
561
         <fileset dir="lib/xalan">
562
           <include name="*.jar"/>
563
         </fileset>
564
       </copy>
565 1952 jones
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
566 1729 tao
       <copy file="lib/web.xml.${tomcatversion}"
567 1952 jones
             tofile="${build.war}/web.xml" />
568
       <copy file="lib/metacat.properties" todir="${war.webinf}"
569 1951 jones
             filtering="yes" />
570 1952 jones
       <copy todir="${war.context}" filtering="no">
571 822 jones
         <fileset dir="lib">
572
           <include name="**/*.jpg"/>
573
           <include name="**/*.png"/>
574
           <include name="**/*.gif"/>
575
         </fileset>
576
       </copy>
577 1952 jones
       <copy todir="${war.context}" filtering="yes">
578 822 jones
         <fileset dir="lib">
579
           <exclude name="*.jar"/>
580
           <exclude name="*.properties"/>
581
           <exclude name="web.xml"/>
582 1437 berkley
           <exclude name="**/*.jpg"/>
583
           <exclude name="**/*.png"/>
584
           <exclude name="**/*.gif"/>
585 822 jones
         </fileset>
586
       </copy>
587 1952 jones
       <copy todir="${war.context}" filtering="no">
588 1929 brooke
         <fileset dir="lib">
589
           <include name="**/*.jpg"/>
590
           <include name="**/*.png"/>
591
           <include name="**/*.gif"/>
592
         </fileset>
593
       </copy>
594 1311 berkley
   </target>
595 1929 brooke
596 1952 jones
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
597
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
598
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
599 1929 brooke
   </target>
600
601 1954 jones
   <target name="getConversionXSL" depends="prepare"
602
            unless="styles.not.needed"
603 1939 brooke
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
604 1929 brooke
     <echo>Enter CVS password: </echo>
605
     <cvs cvsRoot="${cvsroot-alternate}"
606
          package="${conversion-module}"
607
          dest="${build.tmp}" />
608
   </target>
609
610 1822 jones
   <target name="testprep" depends="jar,clientjar">
611 1783 jones
      <mkdir dir="${build.tests}"/>
612
      <copy todir="${build.tests}" filtering="yes">
613
        <fileset dir="${testdir}">
614
          <include name="edu/**"/>
615
        </fileset>
616
      </copy>
617 971 tao
      <!-- copy and compile the tests into a jar file -->
618 1783 jones
      <javac srcdir="${build.tests}"
619
             destdir="${build.tests}"
620 1822 jones
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar"
621 1612 tao
             debug="on"
622 1311 berkley
       includes="**/*.java" />
623 204 jones
624 1311 berkley
      <jar jarfile="${build.dir}/${name}-junittests.jar"
625 1783 jones
        basedir="${build.tests}"
626 1311 berkley
                includes="**/*.class" />
627 1822 jones
   </target>
628 971 tao
629 1939 brooke
   <target name="test" depends="testprep"
630
            description="Uses the ant junit task to run all JUnit tests">
631 1822 jones
632 971 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
633 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
634 971 tao
             haltonerror="no">
635 1783 jones
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
636 971 tao
        <classpath>
637 1783 jones
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
638 971 tao
        </classpath>
639
640
        <formatter type="plain" />
641
642
        <batchtest fork="yes" todir="${build.dir}">
643 1783 jones
          <fileset dir="${build.tests}">
644 1116 tao
            <include name="**/*.class" />
645 971 tao
          </fileset>
646
        </batchtest>
647
     </junit>
648
   </target>
649 1103 tao
650 1939 brooke
    <target name="runonetest" depends="testprep"
651
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
652 1500 tao
653 1939 brooke
              <echo>testtorun: ${testtorun}</echo>
654
655 1500 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
656 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
657 1500 tao
             haltonerror="no">
658 2044 tao
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
659 1500 tao
        <classpath>
660 1783 jones
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
661 1500 tao
        </classpath>
662
663
        <formatter type="plain" />
664
665
        <batchtest fork="yes" todir="${build.dir}">
666 1783 jones
          <fileset dir="${build.tests}">
667 1500 tao
            <include name="**/${testtorun}.class" />
668
          </fileset>
669
        </batchtest>
670
     </junit>
671
   </target>
672
673 1939 brooke
  <target name="gethttpclient" depends="prepare"
674
            description="checks out and compiles morpho httpclient code">
675 1311 berkley
  <!--mkdir dir="${morphosourcedir}" -->
676 1487 tao
        <cvs cvsRoot="${cvsroot}"
677 1103 tao
             package="morpho"
678
             dest="." />
679 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
680 1103 tao
   </target>
681
682
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
683 1939 brooke
   <target name="nettest" depends="install"
684
            description="compiles and runs the metacatnettest code">
685
686 1103 tao
      <echo>***********************************
687 1311 berkley
      Please run ant gethttpclient first!
688
      ***********************************
689 1103 tao
      </echo>
690
      <!-- copy and compile the tests into a jar file -->
691 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
692 1103 tao
      <javac srcdir="${junitnettestsdir}"
693 1116 tao
             destdir="${build.metacatnettest}"
694 1103 tao
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
695
             includes="**/*.java" />
696
697
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
698 1116 tao
                    basedir="${build.metacatnettest}"
699 1103 tao
                    includes="**/*.class" />
700
701
      <!-- use the ant "junit" task to run JUnit tests. -->
702 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
703 1103 tao
             haltonerror="no">
704 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
705 1103 tao
        <classpath>
706 1807 tao
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
707 1103 tao
        </classpath>
708
709
        <formatter type="plain" />
710
711
        <batchtest fork="yes" todir="${build.dir}">
712 1116 tao
          <fileset dir="${build.metacatnettest}">
713
            <include name="**/*.class" />
714 1103 tao
          </fileset>
715
        </batchtest>
716
     </junit>
717 1311 berkley
   </target>
718 1103 tao
719 1939 brooke
   <target name="cleanweb" depends="clean"
720
            description="deletes tomcat web context dir and all its contents">
721 1522 berkley
     <delete dir="${installdir}" />
722
   </target>
723
724
725 1939 brooke
   <target name="clean" depends="init"
726
            description="deletes build dir and any files copied to cvs sandbox by build process (jars, xsl) Currently *not* schema/DTDs">
727 822 jones
       <delete dir="${build.dir}" />
728 1822 jones
       <delete file="lib/httpclient.jar" />
729
       <delete file="lib/utilities.jar" />
730 1939 brooke
       <delete includeEmptyDirs="true" failonerror="false">
731
         <fileset dir="${style-common-cvsrelpath}">
732
           <include name="${eml-css}" />
733
           <include name="eml-*/*.xsl" />
734
           <include name="eml-*" />
735
         </fileset>
736
     </delete>
737 113 jones
   </target>
738
739 1939 brooke
   <target name="jdoc" depends="prepare"
740
            description="generates javadoc documentation">
741 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
742 516 jones
           sourcepath="${build.src}"
743
           destdir="${build.javadocs}"
744 113 jones
           author="true"
745
           version="true"
746
           use="true"
747 348 jones
           windowtitle="${Name} API"
748
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
749 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
750
       />
751
   </target>
752
753 1939 brooke
   <target name="dist" depends="jar,protocol,jdoc,geteml"
754
            description="prepares a full release distribution">
755 806 jones
      <mkdir dir="${dist.dir}"/>
756
      <delete dir="${ver.dir}" />
757
      <mkdir dir="${ver.dir}"/>
758
      <copy todir="${ver.dir}">
759 1311 berkley
        <fileset dir="."
760 882 jones
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
761 806 jones
      </copy>
762
      <copy todir="${ver.dir}" file="build.xml"/>
763
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
764
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
765 882 jones
766
      <copy todir="${ver.dir}/docs" filtering="yes">
767
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
768
      </copy>
769
      <copy todir="${ver.dir}/docs" filtering="no">
770
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
771
      </copy>
772 806 jones
      <copy todir="${ver.dir}/docs/dev">
773
        <fileset dir="${build.dir}/docs"/>
774
      </copy>
775 917 berkley
      <copy todir="${ver.dir}/src">
776
        <fileset dir="${build.dir}/src"/>
777
      </copy>
778
779 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
780
      <delete dir="./${ver.dir}/dist"/>
781 882 jones
      <delete file="./${name}-${release}.zip"/>
782 1312 tao
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
783 882 jones
      <delete file="./${name}-${release}.tar.gz" />
784 1312 tao
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
785 1311 berkley
      <gzip zipfile="./${name}-${release}.tar.gz"
786 882 jones
                src="./${name}-${release}.tar"/>
787
      <delete file="./${name}-${release}.tar" />
788 1311 berkley
  </target>
789 806 jones
790 1939 brooke
  <target name="distsrc" depends="dist"
791
            description="prepares a source distribution">
792 806 jones
      <mkdir dir="${ver.src}"/>
793
      <copy todir="${ver.src}">
794
        <fileset dir="./src"/>
795
      </copy>
796
797 882 jones
      <delete file="./${name}-src-${release}.zip"/>
798
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
799
      <delete file="./${name}-src-${release}.tar.gz" />
800
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
801 1311 berkley
      <gzip zipfile="./${name}-src-${release}.tar.gz"
802 882 jones
                src="./${name}-src-${release}.tar"/>
803
      <delete file="./${name}-src-${release}.tar" />
804 807 jones
      <delete dir="${dist.dir}"/>
805 1311 berkley
  </target>
806 806 jones
807 1702 tao
   <target name="stylesheettest">
808 1939 brooke
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
809 1702 tao
      <param name="displaymodule" expression="${displaymodule}"/>
810
      <param name="docid" expression="${input}"/>
811
      <param name="entitytype" expression="${entitytype}"/>
812
      <param name="entityindex" expression="${entityindex}"/>
813
      <outputproperty name="method" value="html"/>
814
      <outputproperty name="standalone" value="yes"/>
815
      <outputproperty name="encoding" value="iso8859_1"/>
816
      <outputproperty name="indent" value="yes"/>
817
    </xslt>
818
  </target>
819 1811 tao
820 1819 tao
 <target name="gridinit" depends="init">
821
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
822
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
823
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
824
   <property environment="env"/>
825
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
826 1820 tao
    <path id="webservicepath">
827
        <pathelement location="."/>
828
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
829
        <pathelement location="${build.dest}"/>
830
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
831
           <include name="*.jar"/>
832
        </fileset>
833
      </path>
834 1819 tao
</target>
835
836 1821 tao
 <target name="gridprepare" depends="gridinit, prepare">
837 1819 tao
 </target>
838 1811 tao
839 1821 tao
  <target name="compileinterface" depends="clean, gridprepare">
840 1817 tao
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
841 1811 tao
  </target>
842
843
  <target name="generateWSDL" depends="compileinterface">
844
    <echo message="Generating wsdl from ${interface.name} interface"/>
845
    <java classname="${java2wsdl.tool}"
846 1814 tao
          dir="${build.src}" fork="yes"
847 1811 tao
          classpathref="webservicepath"  failonerror="true" >
848
      <arg value="-P"/>
849
      <arg value="${interface.name}PortType"/>
850
      <arg value="-S"/>
851
      <arg value="${interface.name}Service"/>
852
      <arg value="-y"/>
853
      <arg value="WRAPPED"/>
854
      <arg value="-u"/>
855
      <arg value="LITERAL"/>
856
      <arg value="-l"/>
857
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
858
      <arg value="-n"/>
859
      <arg value="http://${services.namespace}/${interface.name}"/>
860
      <arg value="${interface.package}.${interface.name}"/>
861
    </java>
862
  </target>
863
864
   <target name="decorateWSDL" depends="generateWSDL">
865
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
866 1814 tao
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
867 1811 tao
            fork="yes"
868
            classpathref="webservicepath" failonerror="true" >
869
        <arg value="${binding.file}"/>
870
        <arg value="${wsdl.file}"/>
871
      </java>
872
   </target>
873
874
   <target name="generatestubs" depends="decorateWSDL">
875
      <echo message=" Generating stubs " />
876 1814 tao
      <echo message="wsdl file is ${wsdl.file}"/>
877
      <echo message="build.src is ${build.src}"/>
878 1811 tao
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
879
            classpathref="webservicepath" failonerror="true" >
880 1814 tao
         <arg value="${wsdl.file}"/>
881 1811 tao
    </java>
882
  </target>
883
884
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
885
     <echo message=" Compiling stubs " />
886
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
887
     <echo message=" Compiling impl " />
888
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
889
  </target>
890
891
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
892
     <echo message=" jar stubs classes " />
893
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
894
     <echo message=" jar impl classes " />
895
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
896
  </target>
897
898
  <target name="gar" depends="jarStubsAndImpl">
899
     <echo message=" jar the gar file"/>
900
     <mkdir dir="${build.dir}/gar"/>
901
     <mkdir dir="${build.dir}/gar/schema/edu"/>
902
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
903
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
904 1814 tao
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
905
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
906
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
907
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
908 1811 tao
  </target>
909 1814 tao
910
  <target name="compilewebclient" depends="prepare">
911
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
912
  </target>
913
914
  <target name="runwebclient" depends="compilewebclient">
915
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
916
           dir="${build.dest}" fork="yes"
917
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
918
         <arg value="${serviceUrl}"/>
919
         <arg value="${docid}"/>
920
     </java>
921
  </target>
922 113 jones
</project>