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 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 1950 costa
   <target name="harvester" depends="clientjar"
333
           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
           description="Compiles and jars harvester java code to harvester-client.jar in build dir">
343
       <delete file="${build.dir}/harvester-client.jar" />
344
       <jar jarfile="${build.dir}/harvester-client.jar" basedir="${build.dest}"
345
            includes="**/metacat/harvesterClient/" />
346
   </target>
347
348
   <target name="installharvester" depends="harvesterjar,install"
349
           description="Installs harvester web-server files">
350
      <mkdir dir="${installdir}/WEB-INF/lib" />
351
      <copy file="lib/style/skins/dev/harvesterLogin.html"
352
            tofile="${installdir}/harvesterLogin.html" />
353
      <copy file="lib/style/skins/dev/harvesterUpload.html"
354
            tofile="${installdir}/harvesterUpload.html" />
355
      <copy file="${build.dir}/harvester-client.jar"
356
            tofile="${installdir}/WEB-INF/lib/harvester-client.jar" />
357
   </target>
358
359 1939 brooke
   <target  name="geteml" depends="getemlpre2,geteml2+"
360
            description="Calls getemlpre2 and geteml2+ targets" />
361
362
   <target name="getemlpre2" depends="prepare"
363
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
364 1612 tao
     <echo>Enter CVS password: </echo>
365
     <cvs cvsRoot="${cvsroot}"
366
          package="${eml-module}"
367
          tag="${eml-tag}"
368 1939 brooke
          dest="${build.tmp}/eml_${eml-tag}" />
369 1612 tao
     <mkdir dir="lib/dtd" />
370
     <copy todir="lib/dtd" filtering="yes">
371 1939 brooke
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
372 1612 tao
         <include name="*.dtd"/>
373
       </fileset>
374
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
375
     </copy>
376 1939 brooke
     <antcall target="copyxsl">
377
        <param name="cvs.tagname" value="${eml-tag}" />
378
     </antcall>
379
   </target>
380
381
   <target name="geteml2+" depends="prepare"
382
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
383
     <echo>Enter CVS password: </echo>
384 1612 tao
     <cvs cvsRoot="${cvsroot}"
385
          package="${eml-module}"
386
          tag="${eml2-tag}"
387 1939 brooke
          dest="${build.tmp}/eml_${eml2-tag}" />
388 1612 tao
     <mkdir dir="lib/schema" />
389
     <copy todir="lib/schema" filtering="yes">
390 1939 brooke
       <fileset dir="${build.tmp}/eml_${eml2-tag}/${eml-module}">
391 1612 tao
         <include name="*.xsd"/>
392
       </fileset>
393 1939 brooke
394
       <!-- shouldn't we have a mapper here like this??
395
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
396
397
       Jing's code didn't nave one - does it need to be added?
398
       NOTE that eml-version is set to beta 6, so this would need changing -->
399
400 1612 tao
     </copy>
401 1939 brooke
     <antcall target="copyxsl">
402
        <param name="cvs.tagname" value="${eml2-tag}" />
403
     </antcall>
404
   </target>
405
406
407
408
   <target  name="copyxsl"
409
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
410
411
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
412
413 1938 brooke
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
414 1939 brooke
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style">
415 1929 brooke
       <include name="**/*.xsl"/>
416 1612 tao
     </fileset>
417
     </copy>
418 1933 brooke
419 1939 brooke
420 1933 brooke
     <!-- now copy default css from eml module and put it in style-common-path
421
          dir with a new name, so other skin-specific css can import it if reqd -->
422 1939 brooke
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
423 1938 brooke
           tofile="${style-common-cvsrelpath}/${eml-css}" />
424 1612 tao
425 1463 tao
   </target>
426 1939 brooke
427
428
429
   <target name="dtdschemasql" depends="prepare"
430
   description="Registers the DTDs with the new Metacat instance">
431 877 jones
     <echo/>
432
     <echo>Registering the DTDs with the new Metacat instance...</echo>
433
     <sql driver="${dbDriver}"
434 1744 tao
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
435 877 jones
          url="${jdbc-connect}"
436
          userid="${user}"
437
          password="${password}"
438 1593 tao
          src="${build.src}/loaddtdschema.sql" />
439 877 jones
   </target>
440 1716 berkley
441 1939 brooke
   <target name="schemasql" depends="prepare"
442
            description="Registers the Schema with the new Metacat instance">
443 1570 tao
     <echo/>
444 1939 brooke
     <echo>Registering the Schema with the new Metacat instance...</echo>
445 1570 tao
     <sql driver="${dbDriver}"
446 1744 tao
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
447 1570 tao
          url="${jdbc-connect}"
448
          userid="${user}"
449
          password="${password}"
450
          src="${build.src}/loadschema.sql" />
451
   </target>
452 1801 tao
453 1939 brooke
   <target name="installdb" depends="prepare"
454
            description="Installs the database tables">
455 1827 jones
     <echo/>
456
     <echo>Installing the database tables...</echo>
457
     <sql driver="${dbDriver}"
458
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
459
          url="${jdbc-connect}"
460
          userid="${user}"
461
          password="${password}"
462
          src="${build.src}/xmltables.sql" />
463
   </target>
464
465 1939 brooke
   <target name="upgrade12" depends="prepare"
466
            description="Updates the database tables to upgrade to version 1.2">
467 1827 jones
     <echo/>
468
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
469
     <sql driver="${dbDriver}"
470
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
471
          url="${jdbc-connect}"
472
          userid="${user}"
473
          password="${password}"
474
          src="${build.src}/upgrade-db-to-1.2.sql" />
475
   </target>
476
477 1939 brooke
   <target name="upgrade13" depends="prepare"
478
            description="Updates the database tables to upgrade to version 1.3">
479 1827 jones
     <echo/>
480
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
481
     <sql driver="${dbDriver}"
482
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
483
          url="${jdbc-connect}"
484
          userid="${user}"
485
          password="${password}"
486
          src="${build.src}/upgrade-db-to-1.3.sql" />
487
   </target>
488
489 1952 jones
   <target name="install" depends="war" description="* Full Install *">
490 1079 tao
       <mkdir dir="${datafilepath}" />
491 1455 tao
       <mkdir dir="${inlinedatafilepath}" />
492 1079 tao
       <chmod dir="${datafilepath}" perm="ug+w" />
493 1929 brooke
       <mkdir dir="${temp-dir}"/>
494
       <chmod dir="${temp-dir}" perm="ug+w" />
495 1952 jones
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
496
   </target>
497
498
   <target name="upgrade" depends="install"
499
          description="* Upgrade an existing metacat installation with a new version *">
500
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
501
   </target>
502
503 1954 jones
   <target name="install-registry" depends="init,getConversionXSL"
504 1952 jones
            description="Install Registry">
505
506
      <copy file="${srcdir}/perl/register-dataset.cgi"
507
            todir="${inst.cgi.dir}" filtering="yes"/>
508
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
509
510
      <mkdir dir="${temp-dir}" />
511
     <copy todir="${temp-dir}" filtering="yes">
512
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
513
         <include name="*.xsl"/>
514
         <include name="*.xml"/>
515
       </fileset>
516
     </copy>
517
518
      <echo message="Install Registry completed." />
519
   </target>
520
521
   <target name="war" depends="warPrepare,warMSSQL"
522
            description="Create a web archive (WAR) for servlet deployment">
523
       <war destfile="${build.dir}/${context}.war"
524
            webxml="${build.war}/web.xml">
525
         <fileset dir="${war.context}"/>
526
         <lib dir="${war.lib}"/>
527
         <webinf dir="${war.webinf}"/>
528
       </war>
529
   </target>
530
531
   <target name="warPrepare" depends="jar,clientjar"
532
            description="Prepare files for creating a web archive (WAR)">
533
534
       <property name="war.lib" value="${build.war}/lib" />
535
       <property name="war.webinf" value="${build.war}/WEB-INF" />
536
       <property name="war.context" value="${build.war}/${context}" />
537
       <mkdir dir="${war.lib}" />
538
       <mkdir dir="${war.webinf}" />
539
       <mkdir dir="${war.context}" />
540
541
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
542
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
543
       <copy todir="${war.lib}" filtering="no">
544 1823 jones
         <fileset dir="lib">
545
           <include name="*.jar"/>
546
         </fileset>
547
         <fileset dir="lib/xalan">
548
           <include name="*.jar"/>
549
         </fileset>
550
       </copy>
551 1952 jones
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
552 1729 tao
       <copy file="lib/web.xml.${tomcatversion}"
553 1952 jones
             tofile="${build.war}/web.xml" />
554
       <copy file="lib/metacat.properties" todir="${war.webinf}"
555 1951 jones
             filtering="yes" />
556 1952 jones
       <copy todir="${war.context}" filtering="no">
557 822 jones
         <fileset dir="lib">
558
           <include name="**/*.jpg"/>
559
           <include name="**/*.png"/>
560
           <include name="**/*.gif"/>
561
         </fileset>
562
       </copy>
563 1952 jones
       <copy todir="${war.context}" filtering="yes">
564 822 jones
         <fileset dir="lib">
565
           <exclude name="*.jar"/>
566
           <exclude name="*.properties"/>
567
           <exclude name="web.xml"/>
568 1437 berkley
           <exclude name="**/*.jpg"/>
569
           <exclude name="**/*.png"/>
570
           <exclude name="**/*.gif"/>
571 822 jones
         </fileset>
572
       </copy>
573 1952 jones
       <copy todir="${war.context}" filtering="no">
574 1929 brooke
         <fileset dir="lib">
575
           <include name="**/*.jpg"/>
576
           <include name="**/*.png"/>
577
           <include name="**/*.gif"/>
578
         </fileset>
579
       </copy>
580 1311 berkley
   </target>
581 1929 brooke
582 1952 jones
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
583
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
584
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
585 1929 brooke
   </target>
586
587 1954 jones
   <target name="getConversionXSL" depends="prepare"
588
            unless="styles.not.needed"
589 1939 brooke
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
590 1929 brooke
     <echo>Enter CVS password: </echo>
591
     <cvs cvsRoot="${cvsroot-alternate}"
592
          package="${conversion-module}"
593
          dest="${build.tmp}" />
594
   </target>
595
596 1822 jones
   <target name="testprep" depends="jar,clientjar">
597 1783 jones
      <mkdir dir="${build.tests}"/>
598
      <copy todir="${build.tests}" filtering="yes">
599
        <fileset dir="${testdir}">
600
          <include name="edu/**"/>
601
        </fileset>
602
      </copy>
603 971 tao
      <!-- copy and compile the tests into a jar file -->
604 1783 jones
      <javac srcdir="${build.tests}"
605
             destdir="${build.tests}"
606 1822 jones
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar"
607 1612 tao
             debug="on"
608 1311 berkley
       includes="**/*.java" />
609 204 jones
610 1311 berkley
      <jar jarfile="${build.dir}/${name}-junittests.jar"
611 1783 jones
        basedir="${build.tests}"
612 1311 berkley
                includes="**/*.class" />
613 1822 jones
   </target>
614 971 tao
615 1939 brooke
   <target name="test" depends="testprep"
616
            description="Uses the ant junit task to run all JUnit tests">
617 1822 jones
618 971 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
619 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
620 971 tao
             haltonerror="no">
621 1783 jones
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
622 971 tao
        <classpath>
623 1783 jones
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
624 971 tao
        </classpath>
625
626
        <formatter type="plain" />
627
628
        <batchtest fork="yes" todir="${build.dir}">
629 1783 jones
          <fileset dir="${build.tests}">
630 1116 tao
            <include name="**/*.class" />
631 971 tao
          </fileset>
632
        </batchtest>
633
     </junit>
634
   </target>
635 1103 tao
636 1939 brooke
    <target name="runonetest" depends="testprep"
637
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
638 1500 tao
639 1939 brooke
              <echo>testtorun: ${testtorun}</echo>
640
641 1500 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
642 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
643 1500 tao
             haltonerror="no">
644 2044 tao
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
645 1500 tao
        <classpath>
646 1783 jones
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
647 1500 tao
        </classpath>
648
649
        <formatter type="plain" />
650
651
        <batchtest fork="yes" todir="${build.dir}">
652 1783 jones
          <fileset dir="${build.tests}">
653 1500 tao
            <include name="**/${testtorun}.class" />
654
          </fileset>
655
        </batchtest>
656
     </junit>
657
   </target>
658
659 1939 brooke
  <target name="gethttpclient" depends="prepare"
660
            description="checks out and compiles morpho httpclient code">
661 1311 berkley
  <!--mkdir dir="${morphosourcedir}" -->
662 1487 tao
        <cvs cvsRoot="${cvsroot}"
663 1103 tao
             package="morpho"
664
             dest="." />
665 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
666 1103 tao
   </target>
667
668
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
669 1939 brooke
   <target name="nettest" depends="install"
670
            description="compiles and runs the metacatnettest code">
671
672 1103 tao
      <echo>***********************************
673 1311 berkley
      Please run ant gethttpclient first!
674
      ***********************************
675 1103 tao
      </echo>
676
      <!-- copy and compile the tests into a jar file -->
677 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
678 1103 tao
      <javac srcdir="${junitnettestsdir}"
679 1116 tao
             destdir="${build.metacatnettest}"
680 1103 tao
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
681
             includes="**/*.java" />
682
683
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
684 1116 tao
                    basedir="${build.metacatnettest}"
685 1103 tao
                    includes="**/*.class" />
686
687
      <!-- use the ant "junit" task to run JUnit tests. -->
688 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
689 1103 tao
             haltonerror="no">
690 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
691 1103 tao
        <classpath>
692 1807 tao
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
693 1103 tao
        </classpath>
694
695
        <formatter type="plain" />
696
697
        <batchtest fork="yes" todir="${build.dir}">
698 1116 tao
          <fileset dir="${build.metacatnettest}">
699
            <include name="**/*.class" />
700 1103 tao
          </fileset>
701
        </batchtest>
702
     </junit>
703 1311 berkley
   </target>
704 1103 tao
705 1939 brooke
   <target name="cleanweb" depends="clean"
706
            description="deletes tomcat web context dir and all its contents">
707 1522 berkley
     <delete dir="${installdir}" />
708
   </target>
709
710
711 1939 brooke
   <target name="clean" depends="init"
712
            description="deletes build dir and any files copied to cvs sandbox by build process (jars, xsl) Currently *not* schema/DTDs">
713 822 jones
       <delete dir="${build.dir}" />
714 1822 jones
       <delete file="lib/httpclient.jar" />
715
       <delete file="lib/utilities.jar" />
716 1939 brooke
       <delete includeEmptyDirs="true" failonerror="false">
717
         <fileset dir="${style-common-cvsrelpath}">
718
           <include name="${eml-css}" />
719
           <include name="eml-*/*.xsl" />
720
           <include name="eml-*" />
721
         </fileset>
722
     </delete>
723 113 jones
   </target>
724
725 1939 brooke
   <target name="jdoc" depends="prepare"
726
            description="generates javadoc documentation">
727 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
728 516 jones
           sourcepath="${build.src}"
729
           destdir="${build.javadocs}"
730 113 jones
           author="true"
731
           version="true"
732
           use="true"
733 348 jones
           windowtitle="${Name} API"
734
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
735 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
736
       />
737
   </target>
738
739 1939 brooke
   <target name="dist" depends="jar,protocol,jdoc,geteml"
740
            description="prepares a full release distribution">
741 806 jones
      <mkdir dir="${dist.dir}"/>
742
      <delete dir="${ver.dir}" />
743
      <mkdir dir="${ver.dir}"/>
744
      <copy todir="${ver.dir}">
745 1311 berkley
        <fileset dir="."
746 882 jones
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
747 806 jones
      </copy>
748
      <copy todir="${ver.dir}" file="build.xml"/>
749
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
750
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
751 882 jones
752
      <copy todir="${ver.dir}/docs" filtering="yes">
753
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
754
      </copy>
755
      <copy todir="${ver.dir}/docs" filtering="no">
756
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
757
      </copy>
758 806 jones
      <copy todir="${ver.dir}/docs/dev">
759
        <fileset dir="${build.dir}/docs"/>
760
      </copy>
761 917 berkley
      <copy todir="${ver.dir}/src">
762
        <fileset dir="${build.dir}/src"/>
763
      </copy>
764
765 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
766
      <delete dir="./${ver.dir}/dist"/>
767 882 jones
      <delete file="./${name}-${release}.zip"/>
768 1312 tao
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
769 882 jones
      <delete file="./${name}-${release}.tar.gz" />
770 1312 tao
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
771 1311 berkley
      <gzip zipfile="./${name}-${release}.tar.gz"
772 882 jones
                src="./${name}-${release}.tar"/>
773
      <delete file="./${name}-${release}.tar" />
774 1311 berkley
  </target>
775 806 jones
776 1939 brooke
  <target name="distsrc" depends="dist"
777
            description="prepares a source distribution">
778 806 jones
      <mkdir dir="${ver.src}"/>
779
      <copy todir="${ver.src}">
780
        <fileset dir="./src"/>
781
      </copy>
782
783 882 jones
      <delete file="./${name}-src-${release}.zip"/>
784
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
785
      <delete file="./${name}-src-${release}.tar.gz" />
786
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
787 1311 berkley
      <gzip zipfile="./${name}-src-${release}.tar.gz"
788 882 jones
                src="./${name}-src-${release}.tar"/>
789
      <delete file="./${name}-src-${release}.tar" />
790 807 jones
      <delete dir="${dist.dir}"/>
791 1311 berkley
  </target>
792 806 jones
793 1702 tao
   <target name="stylesheettest">
794 1939 brooke
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
795 1702 tao
      <param name="displaymodule" expression="${displaymodule}"/>
796
      <param name="docid" expression="${input}"/>
797
      <param name="entitytype" expression="${entitytype}"/>
798
      <param name="entityindex" expression="${entityindex}"/>
799
      <outputproperty name="method" value="html"/>
800
      <outputproperty name="standalone" value="yes"/>
801
      <outputproperty name="encoding" value="iso8859_1"/>
802
      <outputproperty name="indent" value="yes"/>
803
    </xslt>
804
  </target>
805 1811 tao
806 1819 tao
 <target name="gridinit" depends="init">
807
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
808
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
809
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
810
   <property environment="env"/>
811
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
812 1820 tao
    <path id="webservicepath">
813
        <pathelement location="."/>
814
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
815
        <pathelement location="${build.dest}"/>
816
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
817
           <include name="*.jar"/>
818
        </fileset>
819
      </path>
820 1819 tao
</target>
821
822 1821 tao
 <target name="gridprepare" depends="gridinit, prepare">
823 1819 tao
 </target>
824 1811 tao
825 1821 tao
  <target name="compileinterface" depends="clean, gridprepare">
826 1817 tao
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
827 1811 tao
  </target>
828
829
  <target name="generateWSDL" depends="compileinterface">
830
    <echo message="Generating wsdl from ${interface.name} interface"/>
831
    <java classname="${java2wsdl.tool}"
832 1814 tao
          dir="${build.src}" fork="yes"
833 1811 tao
          classpathref="webservicepath"  failonerror="true" >
834
      <arg value="-P"/>
835
      <arg value="${interface.name}PortType"/>
836
      <arg value="-S"/>
837
      <arg value="${interface.name}Service"/>
838
      <arg value="-y"/>
839
      <arg value="WRAPPED"/>
840
      <arg value="-u"/>
841
      <arg value="LITERAL"/>
842
      <arg value="-l"/>
843
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
844
      <arg value="-n"/>
845
      <arg value="http://${services.namespace}/${interface.name}"/>
846
      <arg value="${interface.package}.${interface.name}"/>
847
    </java>
848
  </target>
849
850
   <target name="decorateWSDL" depends="generateWSDL">
851
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
852 1814 tao
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
853 1811 tao
            fork="yes"
854
            classpathref="webservicepath" failonerror="true" >
855
        <arg value="${binding.file}"/>
856
        <arg value="${wsdl.file}"/>
857
      </java>
858
   </target>
859
860
   <target name="generatestubs" depends="decorateWSDL">
861
      <echo message=" Generating stubs " />
862 1814 tao
      <echo message="wsdl file is ${wsdl.file}"/>
863
      <echo message="build.src is ${build.src}"/>
864 1811 tao
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
865
            classpathref="webservicepath" failonerror="true" >
866 1814 tao
         <arg value="${wsdl.file}"/>
867 1811 tao
    </java>
868
  </target>
869
870
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
871
     <echo message=" Compiling stubs " />
872
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
873
     <echo message=" Compiling impl " />
874
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
875
  </target>
876
877
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
878
     <echo message=" jar stubs classes " />
879
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
880
     <echo message=" jar impl classes " />
881
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
882
  </target>
883
884
  <target name="gar" depends="jarStubsAndImpl">
885
     <echo message=" jar the gar file"/>
886
     <mkdir dir="${build.dir}/gar"/>
887
     <mkdir dir="${build.dir}/gar/schema/edu"/>
888
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
889
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
890 1814 tao
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
891
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
892
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
893
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
894 1811 tao
  </target>
895 1814 tao
896
  <target name="compilewebclient" depends="prepare">
897
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
898
  </target>
899
900
  <target name="runwebclient" depends="compilewebclient">
901
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
902
           dir="${build.dest}" fork="yes"
903
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
904
         <arg value="${serviceUrl}"/>
905
         <arg value="${docid}"/>
906
     </java>
907
  </target>
908 113 jones
</project>