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