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 2277 jones
  <property environment="env"/>
34 1929 brooke
  <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 2175 tao
     <property name="install-sql"
57 2103 jones
               value="xmltables.sql" />
58 2175 tao
     <property name="upgrade-1.2-sql"
59 2103 jones
               value="upgrade-db-to-1.2.sql" />
60 2175 tao
     <property name="upgrade-1.3-sql"
61 2103 jones
               value="upgrade-db-to-1.3.sql" />
62 2175 tao
     <property name="upgrade-1.4-sql"
63 2103 jones
               value="upgrade-db-to-1.4.sql" />
64 2431 sgarg
    <property name="upgrade-1.5-sql"
65
               value="upgrade-db-to-1.5.sql" />
66 925 berkley
   </target>
67 1311 berkley
68 1929 brooke
   <target name="postgresql" if="use-postgresql">
69 931 jones
     <!-- Customize these properties if you are using postgres -->
70 1929 brooke
     <echo message="Using PostgreSQL..."/>
71 925 berkley
     <property name="dbDriver" value="org.postgresql.Driver"/>
72 1311 berkley
     <property name="dbAdapter"
73 931 jones
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
74 1716 berkley
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
75 1744 tao
     <!-- Property to indicate is not MSSQL installation-->
76
     <property name="other" value="yes"/>
77 2175 tao
     <property name="install-sql"
78 2277 jones
               value="xmltables-postgres.sql" />
79 2175 tao
     <property name="upgrade-1.2-sql"
80 2277 jones
               value="upgrade-db-to-1.2-postgres.sql" />
81 2175 tao
     <property name="upgrade-1.3-sql"
82 2277 jones
               value="upgrade-db-to-1.3-postgres.sql" />
83 2175 tao
     <property name="upgrade-1.4-sql"
84 2277 jones
               value="upgrade-db-to-1.4-postgres.sql" />
85 2431 sgarg
    <property name="upgrade-1.5-sql"
86
               value="upgrade-db-to-1.5-postgres.sql" />
87 1744 tao
    </target>
88 2175 tao
89 1929 brooke
   <target name="sqlserver" if="use-sqlserver">
90 1739 tao
     <!-- Customize these properties if you are using SQL server -->
91 1929 brooke
     <echo message="Using SQL Server..."/>
92 1739 tao
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
93
     <property name="dbAdapter"
94
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
95 2296 sgarg
     <property name="jdbc" value="${jdbc_base}/msbase.jar" />
96
     <property name="jdbc-add1" value="${jdbc_base}/msutil.jar" />
97
     <property name="jdbc-add2" value="${jdbc_base}/mssqlserver.jar" />
98 1744 tao
     <!-- Property to indicate is a MSSQL installation-->
99
     <property name="MSSQL" value="yes"/>
100 2175 tao
     <property name="install-sql"
101 2118 costa
               value="xmltables-sqlserver.sql" />
102 1739 tao
   </target>
103 1311 berkley
104 1929 brooke
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
105 1814 tao
      <!-- usr for client testing, generally you don't need change-->
106 2277 jones
      <property name="mcuser" value="uid=jones,o=NCEAS,dc=ecoinformatics,dc=org"/>
107 1783 jones
      <property name="mcpassword" value=""/>
108 1801 tao
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
109
      <property name="mcanotherpassword" value=""/>
110
111 1827 jones
      <property name="debug" value="on" />
112 2053 sgarg
      <property name="debuglevel" value="55" />
113 1716 berkley
114 1522 berkley
      <property name="morphosourcedir" value="../morpho" />
115 1570 tao
      <property name="defaultcontenttype" value="application/octet-stream" />
116 1780 jones
      <property name="utilitiesdir" value="../utilities" />
117 2175 tao
118 931 jones
      <!-- Make sure these paths match the location of the jar files
119
           on your system, the defaults should usually work -->
120 1941 brooke
      <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
121
        <equals arg1="${tomcatversion}" arg2="tomcat3" />
122
      </condition>
123
      <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
124
        <equals arg1="${tomcatversion}" arg2="tomcat4" />
125
      </condition>
126 2011 cjones
      <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
127
        <equals arg1="${tomcatversion}" arg2="tomcat5" />
128
      </condition>
129 1941 brooke
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
130
      <echo>*********** set jsdk to ${jsdk}</echo>
131 1311 berkley
      <property name="xmlp"
132 1376 tao
                value="lib/xercesImpl.jar" />
133 1311 berkley
      <property name="cos"
134 931 jones
                value="lib/cos.jar" />
135 939 tao
      <property name="morpho"
136
                value="lib/morpho.jar" />
137 931 jones
      <property name="xalan"
138
                value="lib/xalan/xalan.jar" />
139
      <property name="apis"
140
                value="lib/xalan/xml-apis.jar" />
141 1103 tao
      <property name="httpclient"
142 1780 jones
                value="lib/httpclient.jar" />
143 1470 tao
      <property name="emlparser"
144
                value="lib/eml.jar" />
145
      <property name="configxml"
146
                value="lib/configxml.jar" />
147 1578 tao
      <property name="itislib"
148
                value="lib/itislib.jar" />
149 1487 tao
      <property name="emlparser"
150 2175 tao
151 1487 tao
                value="lib/eml.jar" />
152 1780 jones
      <property name="util"
153
                value="lib/utilities.jar" />
154 1103 tao
  </target>
155
156 931 jones
   <target name="init" depends="config">
157
      <!-- It is less likely you'll need to make any changes from here down,
158
           but customization is possible -->
159 1929 brooke
      <property name="installdir"          value="${webapps}/${context}" />
160
      <property name="temp-dir"            value="/tmp/${context}" />
161
      <property name="name"                value="metacat"/>
162
      <property name="Name"                value="MetaCat"/>
163
      <property name="debugprefix"         value="${Name}:"/>
164 1990 jones
      <property name="release"             value="1.4.0"/>
165 1929 brooke
      <property name="replication-path"    value="/${context}/servlet/replication"/>
166 2331 costa
      <property name="harvester-registration-login-path" value="/${context}/harvesterRegistrationLogin"/>
167
      <property name="harvester-registration-path"       value="/${context}/harvesterRegistration"/>
168 1952 jones
      <property name="servlet-path"        value="/${context}/metacat"/>
169 1929 brooke
      <property name="html-path"           value="/${context}"/>
170 2180 tao
      <property name="systemidserver"      value="http://${httpserver}"/>
171 2175 tao
      <property name="style-common-relpath"
172 1933 brooke
                                           value="/style/common"/>
173 2175 tao
      <property name="style-common-cvsrelpath"
174 1938 brooke
                                           value="lib${style-common-relpath}"/>
175 2175 tao
      <property name="style-common-fullpath"
176 1933 brooke
                                           value="/${installdir}${style-common-relpath}"/>
177 2343 sgarg
      <property name="templates.dir"       value="${style-common-fullpath}/templates"/>
178 2175 tao
      <property name="style-common-path"
179 1933 brooke
                                           value="/${context}${style-common-relpath}"/>
180 1929 brooke
      <property name="style-skins-relpath" value="/style/skins"/>
181
      <property name="style-skins-path"    value="/${context}${style-skins-relpath}"/>
182
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
183 1579 tao
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
184 1929 brooke
      <property name="config-dir"          value="${webapps}/${style-skins-path}" />
185
      <property name="eml-module"          value="eml" />
186
      <property name="eml-version"         value="2.0.0beta6" />
187
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
188 2232 sgarg
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
189
      <property name="eml2_0_1-tag"        value="RELEASE_EML_2_0_1" />
190 2228 sgarg
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
191
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
192
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
193 1929 brooke
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
194 1933 brooke
      <property name="eml-css"             value="eml_xsl.css"/>
195
      <property name="eml-module.default.css"
196
                                           value="default.css"/>
197 1929 brooke
      <property name="conversion-module"   value="webmdentry" />
198 348 jones
199 1929 brooke
      <!-- Config for registry variables -->
200 1933 brooke
      <property name="scope"               value="obfs"/>
201
      <property name="responseForm"        value="genericResponse.tmpl"/>
202
      <property name="entryForm"           value="entryForm.tmpl"/>
203
      <property name="guide"               value="genericGuide.tmpl"/>
204 2343 sgarg
      <property name="confirmData"         value="confirmData.tmpl"/>
205
      <property name="deleteData"          value="deleteData.tmpl"/>
206
      <property name="genericHeader"       value="genericHeader.tmpl"/>
207
      <property name="genericFooter"       value="genericFooter.tmpl"/>
208
      <property name="adminname"           value="KNB Support"/>
209
      <property name="recipient"           value="knb-software\@nceas.ucsb.edu"/>
210 1929 brooke
211 2343 sgarg
      <property name="defaultStage"        value="initregister"/>
212
      <property name="defaultHeader"       value="genericHeader.tmpl"/>
213
      <property name="defaultFooter"       value="genericFooter.tmpl"/>
214
      <property name="defaultChangePass"   value="ldapChangePass.tmpl"/>
215
      <property name="defaultResetPass"    value="ldapResetPass.tmpl"/>
216
      <property name="changePassSuccess"   value="ldapChangePassSuccess.tmpl"/>
217
      <property name="resetPassSuccess"    value="ldapResetPassSuccess.tmpl"/>
218
      <property name="registerFailed"      value="ldapRegisterFailed.tmpl"/>
219
      <property name="registerLter"        value="ldapRegisterLter.tmpl"/>
220
      <property name="registerMatch"       value="ldapRegisterMatch.tmpl"/>
221
      <property name="registerSuccess"     value="ldapRegisterSuccess.tmpl"/>
222
      <property name="register"            value="ldapRegister.tmpl"/>
223
      <property name="searchResults"       value="searchResults.tmpl"/>
224
225
      <filter token="scope"                value="${scope}"/>
226
      <filter token="responseForm"         value="${responseForm}"/>
227
      <filter token="entryForm"            value="${entryForm}"/>
228
      <filter token="guide"                value="${guide}"/>
229
      <filter token="confirmData"          value="${confirmData}"/>
230
      <filter token="deleteData"           value="${deleteData}"/>
231
      <filter token="genericHeader"        value="${genericHeader}"/>
232
      <filter token="genericFooter"        value="${genericFooter}"/>
233
      <filter token="adminname"            value="${adminname}"/>
234
      <filter token="recipient"            value="${recipient}"/>
235
236
      <filter token="ldapurl"              value="ldap.ecoinformatics.org"/>
237
      <filter token="ldapSearchBase"       value="dc=ecoinformatics,dc=org"/>
238
      <filter token="ldap_user"            value="cn=Manager,dc=ecoinformatics,dc=org"/>
239
      <filter token="ldap_password"        value="ldap_password"/>
240
      <filter token="mailhost"             value="smtp.ecoinformatics.org"/>
241
      <filter token="sender"               value="knb-software\@nceas.ucsb.edu"/>
242
      <filter token="cgiurl"               value="http://${server}/cgi-bin/ldapweb.cgi"/>
243
244 1311 berkley
      <property name="cpath"
245 1986 jones
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${cos}:${morpho}:${emlparser}:${jdbc-add1}:${jdbc-add2}:${util}:${httpclient}"/>
246 882 jones
247
      <filter token="docrooturl" value="./" />
248 2356 sgarg
      <filter token="database" value="${database}" />
249 588 berkley
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
250 882 jones
      <filter token="dbDriver" value="${dbDriver}"/>
251 915 berkley
      <filter token="dbAdapter" value="${dbAdapter}"/>
252 614 bojilova
      <filter token="install-dir" value="${installdir}"/>
253 1929 brooke
      <filter token="temp-dir" value="${temp-dir}"/>
254 586 berkley
      <filter token="server" value="${server}"/>
255 977 tao
      <filter token="systemidserver" value="${systemidserver}"/>
256 1929 brooke
      <filter token="cgi-prefix" value="${cgi-prefix}"/>
257
      <filter token="ldapUrl" value="${ldapUrl}"/>
258 586 berkley
      <filter token="replication-log" value="${replication-log}"/>
259 1579 tao
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
260 348 jones
      <filter token="release" value="${release}"/>
261
      <filter token="servlet-path" value="${servlet-path}"/>
262 359 bojilova
      <filter token="html-path" value="${html-path}"/>
263 362 jones
      <filter token="user" value="${user}"/>
264
      <filter token="password" value="${password}"/>
265 1783 jones
      <filter token="mcuser" value="${mcuser}"/>
266
      <filter token="mcpassword" value="${mcpassword}"/>
267 1801 tao
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
268
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
269 1929 brooke
      <filter token="knb-site-url" value="${knb-site-url}"/>
270 1933 brooke
      <filter token="eml-css" value="${eml-css}"/>
271 1929 brooke
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
272
      <filter token="style-skins-path" value="${style-skins-path}"/>
273
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
274
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
275
      <filter token="style-common-path" value="${style-common-path}"/>
276 2343 sgarg
      <filter token="templates.dir" value="${templates.dir}"/>
277
278 1929 brooke
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
279
      <filter token="style-path" value="${style-skins-path}"/>
280 525 berkley
      <filter token="replication-path" value="${replication-path}"/>
281 2299 costa
      <filter token="harvester-registration-login-path" value="${harvester-registration-login-path}"/>
282
      <filter token="harvester-registration-path" value="${harvester-registration-path}"/>
283 832 jones
      <filter token="config-dir" value="${config-dir}"/>
284
      <filter token="default-style" value="${default-style}"/>
285 877 jones
      <filter token="eml-version" value="${eml-version}"/>
286 2175 tao
      <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}"/>
287 2228 sgarg
      <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}"/>
288 2175 tao
      <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}"/>
289 1718 tao
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
290 1009 tao
      <filter token="context" value="${context}"/>
291 1292 tao
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
292 1051 tao
      <filter token="debuglevel" value="${debuglevel}" />
293 1079 tao
      <filter token="datafilepath" value="${datafilepath}" />
294 1455 tao
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
295 1522 berkley
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
296 1538 berkley
      <filter token="debugprefix" value="${debugprefix}"/>
297 2308 jones
      <filter token="administrators" value="${administrators}"/>
298 1487 tao
299 2343 sgarg
      <filter token="defaultStage" value="${defaultStage}"/>
300
      <filter token="defaultHeader" value="${defaultHeader}"/>
301
      <filter token="defaultFooter" value="${defaultFooter}"/>
302
      <filter token="defaultChangePass" value="${defaultChangePass}"/>
303
      <filter token="defaultResetPass" value="${defaultResetPass}"/>
304
      <filter token="changePassSuccess" value="${changePassSuccess}"/>
305
      <filter token="resetPassSuccess" value="${resetPassSuccess}"/>
306
      <filter token="registerFailed" value="${registerFailed}"/>
307
      <filter token="registerLter" value="${registerLter}"/>
308
      <filter token="registerMatch" value="${registerMatch}"/>
309
      <filter token="registerSuccess" value="${registerSuccess}"/>
310
      <filter token="register" value="${register}"/>
311
      <filter token="searchResults" value="${searchResults}"/>
312
313 254 jones
      <property name="srcdir" value="./src" />
314 1783 jones
      <property name="testdir" value="./test" />
315 2277 jones
      <property name="testtorun" value="BuildIndexTest" />
316 1116 tao
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
317
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
318 348 jones
      <property name="build.dir" value="./build"/>
319
      <property name="build.src" value="${build.dir}/src"/>
320
      <property name="build.dest" value="${build.dir}/classes"/>
321 516 jones
      <property name="build.docs" value="${build.dir}/docs"/>
322 348 jones
      <property name="build.samples" value="${build.dir}/samples"/>
323
      <property name="build.tests" value="${build.dir}/tests"/>
324 1778 tao
      <property name="build.tmp" value="${build.dir}/tmp"/>
325 1116 tao
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
326
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
327 348 jones
      <property name="build.data" value="${build.dir}/data"/>
328 806 jones
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
329 1952 jones
      <property name="build.war" value="${build.dir}/war"/>
330 348 jones
331 882 jones
      <property name="dist.dir" value="dist"/>
332 806 jones
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
333
      <property name="ver.src" value="${ver.dir}/src"/>
334 2401 costa
	  <!-- directories for creating a Harvest List Editor distribution -->
335
      <property name="dist.dir.hle" value="disthle"/>
336
      <property name="ver.dir.hle" value="${dist.dir.hle}/harvest-list-editor-${release}"/>
337 806 jones
338 254 jones
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
339 2317 jones
      <condition property="utilities.required">
340
        <or>
341
          <not><available file="lib/httpclient.jar"/></not>
342
          <not><available file="lib/utilities.jar"/></not>
343
        </or>
344
      </condition>
345 2318 jones
      <condition property="eml.required">
346
        <or>
347
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
348
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
349
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
350
        </or>
351
      </condition>
352 113 jones
   </target>
353 1311 berkley
354 348 jones
   <target name="prepare" depends="init">
355
      <mkdir dir="${build.dir}"/>
356
      <mkdir dir="${build.src}"/>
357
      <mkdir dir="${build.dest}"/>
358 516 jones
      <mkdir dir="${build.javadocs}"/>
359 1778 tao
      <mkdir dir="${build.tmp}"/>
360 348 jones
361 822 jones
      <copy todir="${build.src}" filtering="yes">
362
        <fileset dir="${srcdir}">
363
          <include name="edu/**"/>
364
          <include name="com/**"/>
365 877 jones
          <include name="**/*.sql"/>
366 822 jones
          <exclude name="**/CVS*"/>
367
          <exclude name="**/.#*"/>
368
        </fileset>
369
      </copy>
370 2344 sgarg
      <available file="lib/style/common/emlb6toeml2" type="dir"
371 1954 jones
                 property="styles.not.needed"/>
372 348 jones
   </target>
373
374 1939 brooke
   <target name="compile" depends="prepare,utilities"
375 1986 jones
    description="Compiles java code to build dir, and copies metacat props files there">
376 1939 brooke
377 1311 berkley
       <javac srcdir="${build.src}"
378
              destdir="${build.dest}"
379
              classpath="${cpath}"
380 1827 jones
              debug="${debug}"
381 2135 costa
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
382 1311 berkley
   </target>
383 113 jones
384 2322 jones
   <target name="jar" depends="compile,geteml"
385 1939 brooke
    description="Compiles and jars metacat java code to metacat.jar in build dir">
386
387 353 jones
       <delete file="${build.dir}/${name}.jar" />
388 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
389 2135 costa
            excludes="**/protocols/ **/harvesterClient/" />
390 1311 berkley
   </target>
391
392 1939 brooke
   <target name="protocol" depends="compile"
393
    description="Compiles and jars protocol java code to protocol.jar in build dir">
394 635 jones
       <delete file="${build.dir}/protocol.jar" />
395
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
396
            includes="**/protocols/" />
397 1311 berkley
   </target>
398 113 jones
399 2317 jones
   <target name="utilities" depends="config" if="utilities.required">
400 1796 jones
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
401
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
402 1780 jones
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
403
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
404
   </target>
405
406 1939 brooke
   <target name="client" depends="utilities, prepare"
407
    description="Compiles metacat-client java code to build dir">
408 1780 jones
       <javac srcdir="${build.src}"
409
              destdir="${build.dest}"
410
              classpath="${cpath}"
411
              includes="edu/ucsb/nceas/metacat/client/*" />
412
   </target>
413
414 1939 brooke
   <target name="clientjar" depends="client"
415
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
416 1780 jones
       <delete file="${build.dir}/${name}-client.jar" />
417
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
418
            includes="**/metacat/client/" />
419
   </target>
420
421 2059 costa
   <target name="harvester" depends="client"
422 1950 costa
           description="Compiles harvester java code to build dir">
423
       <echo message="classpath is:   ${cpath}"/>
424
       <javac srcdir="${build.src}"
425
              destdir="${build.dest}"
426
              classpath="${cpath}"
427
              includes="edu/ucsb/nceas/metacat/harvesterClient/*" />
428
   </target>
429
430
   <target name="harvesterjar" depends="harvester"
431 2059 costa
           description="Compiles and jars harvester java code to harvester.jar in build dir">
432
       <delete file="${build.dir}/harvester.jar" />
433
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
434 1950 costa
            includes="**/metacat/harvesterClient/" />
435
   </target>
436
437 2369 costa
   <target name="harvestListEditorDist" depends="harvesterjar"
438
           description="Prepares a distribution of the Harvest List Editor tool">
439 2401 costa
       <mkdir dir="${dist.dir.hle}"/>
440
       <delete dir="${ver.dir.hle}" />
441
       <mkdir dir="${ver.dir.hle}"/>
442
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
443
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
444
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
445
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
446
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
447
       <delete file="./harvest-list-editor-${release}.zip"/>
448
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
449
       <delete file="./harvest-list-editor-${release}.tar.gz" />
450
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
451
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
452
             src="./harvest-list-editor-${release}.tar"/>
453
       <delete file="./harvest-list-editor-${release}.tar" />
454 2369 costa
   </target>
455
456 2318 jones
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
457 1939 brooke
            description="Calls getemlpre2 and geteml2+ targets" />
458
459 2318 jones
   <target name="getemlpre2" depends="prepare" if="eml.required"
460 1939 brooke
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
461 1612 tao
     <echo>Enter CVS password: </echo>
462
     <cvs cvsRoot="${cvsroot}"
463
          package="${eml-module}"
464
          tag="${eml-tag}"
465 1939 brooke
          dest="${build.tmp}/eml_${eml-tag}" />
466 1612 tao
     <mkdir dir="lib/dtd" />
467
     <copy todir="lib/dtd" filtering="yes">
468 1939 brooke
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
469 1612 tao
         <include name="*.dtd"/>
470
       </fileset>
471
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
472
     </copy>
473 2228 sgarg
474
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
475
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
476
       <include name="**/*.xsl"/>
477
     </fileset>
478
     </copy>
479 1939 brooke
   </target>
480
481 2318 jones
   <target name="geteml2+" depends="prepare" if="eml.required"
482 1939 brooke
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
483
     <echo>Enter CVS password: </echo>
484 1612 tao
     <cvs cvsRoot="${cvsroot}"
485
          package="${eml-module}"
486 2228 sgarg
          tag="${eml2_0_0-tag}"
487
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
488
     <mkdir dir="lib/schema/eml-2.0.0" />
489
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
490
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
491 1612 tao
         <include name="*.xsd"/>
492
       </fileset>
493 2175 tao
494 1939 brooke
       <!-- shouldn't we have a mapper here like this??
495
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
496 2175 tao
497
       Jing's code didn't nave one - does it need to be added?
498 1939 brooke
       NOTE that eml-version is set to beta 6, so this would need changing -->
499 2175 tao
500 1612 tao
     </copy>
501 1939 brooke
     <antcall target="copyxsl">
502 2228 sgarg
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
503
        <param name="dirname" value="eml-2.0.0" />
504 1939 brooke
     </antcall>
505 2228 sgarg
506
     <echo>Enter CVS password: </echo>
507
     <cvs cvsRoot="${cvsroot}"
508
          package="${eml-module}"
509
          tag="${eml2_0_1-tag}"
510
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
511
     <mkdir dir="lib/schema/eml-2.0.1" />
512
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
513
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
514
         <include name="*.xsd"/>
515
       </fileset>
516
     </copy>
517
     <antcall target="copyxsl">
518
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
519
        <param name="dirname" value="eml-2.0.1" />
520
     </antcall>
521 1939 brooke
   </target>
522
523 2175 tao
524
525
   <target  name="copyxsl"
526 1939 brooke
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
527
528
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
529 2175 tao
530 2228 sgarg
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
531
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
532 1929 brooke
       <include name="**/*.xsl"/>
533 1612 tao
     </fileset>
534
     </copy>
535 1939 brooke
536 2175 tao
537
     <!-- now copy default css from eml module and put it in style-common-path
538 1933 brooke
          dir with a new name, so other skin-specific css can import it if reqd -->
539 1939 brooke
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
540 1938 brooke
           tofile="${style-common-cvsrelpath}/${eml-css}" />
541 1612 tao
542 1463 tao
   </target>
543 2175 tao
544
545
546 2322 jones
   <target name="register-schemas" depends="prepare"
547
   description="Registers the Schemas with a new Metacat instance">
548 877 jones
     <echo/>
549 2322 jones
     <echo>Registering the Schemas with the new Metacat instance...</echo>
550 877 jones
     <sql driver="${dbDriver}"
551 1744 tao
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
552 877 jones
          url="${jdbc-connect}"
553
          userid="${user}"
554
          password="${password}"
555 1593 tao
          src="${build.src}/loaddtdschema.sql" />
556 877 jones
   </target>
557 1716 berkley
558 1939 brooke
   <target name="installdb" depends="prepare"
559
            description="Installs the database tables">
560 1827 jones
     <echo/>
561
     <echo>Installing the database tables...</echo>
562 2445 sgarg
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
563 1827 jones
     <sql driver="${dbDriver}"
564
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
565
          url="${jdbc-connect}"
566
          userid="${user}"
567
          password="${password}"
568 2103 jones
          src="${build.src}/${install-sql}" />
569 1827 jones
   </target>
570
571 1939 brooke
   <target name="upgrade12" depends="prepare"
572
            description="Updates the database tables to upgrade to version 1.2">
573 1827 jones
     <echo/>
574
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
575
     <sql driver="${dbDriver}"
576
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
577
          url="${jdbc-connect}"
578
          userid="${user}"
579
          password="${password}"
580 2103 jones
          src="${build.src}/${upgrade-1.2-sql}" />
581 1827 jones
   </target>
582
583 1939 brooke
   <target name="upgrade13" depends="prepare"
584
            description="Updates the database tables to upgrade to version 1.3">
585 1827 jones
     <echo/>
586
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
587
     <sql driver="${dbDriver}"
588
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
589
          url="${jdbc-connect}"
590
          userid="${user}"
591
          password="${password}"
592 2103 jones
          src="${build.src}/${upgrade-1.3-sql}" />
593 1827 jones
   </target>
594
595 2103 jones
   <target name="upgrade14" depends="prepare"
596
            description="Updates the database tables to upgrade to version 1.4">
597
     <echo/>
598
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
599
     <sql driver="${dbDriver}"
600
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
601
          url="${jdbc-connect}"
602
          userid="${user}"
603
          password="${password}"
604
          src="${build.src}/${upgrade-1.4-sql}" />
605
   </target>
606
607 2395 tao
   <target name="upgrade15" depends="sqlupgrade15"
608 2391 tao
           description="Updates the database tables to upgrade to version 1.5">
609 2353 sgarg
     <echo/>
610
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
611
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
612 2391 tao
           todir="${build.tmp}" filtering="yes"/>
613 2353 sgarg
614
     <javac srcdir="${build.tmp}"
615
            destdir="${build.tmp}"
616
            classpath="${cpath}"
617
            debug="${debug}"
618
            includes="upgrade_db_to_1_5.java"/>
619
620
     <java classname="upgrade_db_to_1_5"
621
           classpath="${cpath}:${build.tmp}"/>
622
623 2393 tao
   </target>
624
625 2395 tao
   <target name="sqlupgrade15" depends="prepare">
626
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
627 2393 tao
      <sql driver="${dbDriver}"
628
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
629
          url="${jdbc-connect}"
630
          userid="${user}"
631
          password="${password}"
632
          src="${build.src}/${upgrade-1.5-sql}" />
633 2444 sgarg
      <sql driver="${dbDriver}"
634
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
635
          url="${jdbc-connect}"
636
          userid="${user}"
637
          password="${password}"
638
          rdbms="oracle"
639
          delimiter="/">
640
        <transaction>
641
           CREATE TRIGGER xml_returnfield_before_insert
642
           BEFORE INSERT ON xml_returnfield FOR EACH ROW
643
           BEGIN
644
              SELECT xml_returnfield_id_seq.nextval
645
                 INTO :new.returnfield_id
646
                 FROM dual;
647
           END;
648
           /
649
        </transaction>
650
        <transaction>
651
           CREATE TRIGGER xml_queryresult_before_insert
652
           BEFORE INSERT ON xml_queryresult FOR EACH ROW
653
           BEGIN
654
              SELECT xml_queryresult_id_seq.nextval
655
              INTO :new.queryresult_id
656
              FROM dual;
657
           END;
658
           /
659
        </transaction>
660
      </sql>
661 2393 tao
   </target>
662 2353 sgarg
663 1952 jones
   <target name="install" depends="war" description="* Full Install *">
664 1079 tao
       <mkdir dir="${datafilepath}" />
665 1455 tao
       <mkdir dir="${inlinedatafilepath}" />
666 1079 tao
       <chmod dir="${datafilepath}" perm="ug+w" />
667 1929 brooke
       <mkdir dir="${temp-dir}"/>
668
       <chmod dir="${temp-dir}" perm="ug+w" />
669 1952 jones
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
670
   </target>
671 2175 tao
672
   <target name="upgrade" depends="install"
673 1952 jones
          description="* Upgrade an existing metacat installation with a new version *">
674
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
675
   </target>
676
677 2175 tao
   <target name="install-registry" depends="init,getConversionXSL"
678 1952 jones
            description="Install Registry">
679 2175 tao
680 1952 jones
      <copy file="${srcdir}/perl/register-dataset.cgi"
681
            todir="${inst.cgi.dir}" filtering="yes"/>
682
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
683 2175 tao
684 1952 jones
      <mkdir dir="${temp-dir}" />
685 2343 sgarg
      <copy todir="${temp-dir}" filtering="yes">
686
       <fileset dir="lib/style/common/emlb6toeml2">
687 1952 jones
         <include name="*.xsl"/>
688
         <include name="*.xml"/>
689
       </fileset>
690 2343 sgarg
      </copy>
691 1952 jones
692
      <echo message="Install Registry completed." />
693
   </target>
694
695 2343 sgarg
   <target name="install-ldap" depends="init">
696
      <copy file="${srcdir}/perl/ldapweb.cgi"
697
            todir="${inst.cgi.dir}" filtering="yes"/>
698
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
699
      <copy file="lib/ldapweb.cfg"
700
            todir="${inst.cgi.dir}" filtering="yes"/>
701
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
702
      <mkdir dir="${templates.dir}" />
703
      <copy todir="${templates.dir}" filtering="yes">
704
        <fileset dir="lib/style/common/templates">
705
            <include name="${defaultChangePass}"/>
706
            <include name="${defaultResetPass}"/>
707
            <include name="${changePassSuccess}"/>
708
            <include name="${resetPassSuccess}"/>
709
            <include name="${registerFailed}"/>
710
            <include name="${registerLter}"/>
711
            <include name="${registerMatch}"/>
712
            <include name="${registerSuccess}"/>
713
            <include name="${register}"/>
714
            <include name="${searchResults}"/>
715
        </fileset>
716
      </copy>
717
      <echo message="ldapweb install complete." />
718
   </target>
719
720
721 2175 tao
   <target name="install-skin" depends="init"
722 2052 sgarg
            description="Install a Skin">
723
724 2175 tao
      <input message="Please enter name of the skin"
725 2052 sgarg
             addproperty="skin-name"/>
726
727
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
728
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
729
       <fileset dir="lib/style/skins/${skin-name}">
730 2054 sgarg
           <exclude name="*.png"/>
731
           <exclude name="*.gif"/>
732 2210 jones
           <exclude name="*.jpg"/>
733 2277 jones
           <exclude name="**/CVS*"/>
734
           <exclude name="**/.#*"/>
735 2052 sgarg
       </fileset>
736
      </copy>
737 2054 sgarg
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
738
       <fileset dir="lib/style/skins/${skin-name}">
739
           <include name="*.png"/>
740
           <include name="*.gif"/>
741 2210 jones
           <include name="*.jpg"/>
742 2277 jones
           <exclude name="**/CVS*"/>
743
           <exclude name="**/.#*"/>
744 2054 sgarg
       </fileset>
745
      </copy>
746 2277 jones
      <!--
747 2210 jones
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
748
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
749
       <fileset dir="lib/style/skins/${skin-name}/images">
750
           <include name="*.png"/>
751
           <include name="*.gif"/>
752
           <include name="*.jpg"/>
753
       </fileset>
754
      </copy>
755 2277 jones
      -->
756 2052 sgarg
757
      <echo message="Install Skin completed." />
758
   </target>
759
760 1952 jones
   <target name="war" depends="warPrepare,warMSSQL"
761
            description="Create a web archive (WAR) for servlet deployment">
762 2175 tao
       <war destfile="${build.dir}/${context}.war"
763 1952 jones
            webxml="${build.war}/web.xml">
764
         <fileset dir="${war.context}"/>
765
         <lib dir="${war.lib}"/>
766
         <webinf dir="${war.webinf}"/>
767
       </war>
768
   </target>
769
770 2059 costa
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
771 1952 jones
            description="Prepare files for creating a web archive (WAR)">
772
773
       <property name="war.lib" value="${build.war}/lib" />
774
       <property name="war.webinf" value="${build.war}/WEB-INF" />
775
       <property name="war.context" value="${build.war}/${context}" />
776
       <mkdir dir="${war.lib}" />
777
       <mkdir dir="${war.webinf}" />
778
       <mkdir dir="${war.context}" />
779
780
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
781
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
782 2059 costa
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
783 1952 jones
       <copy todir="${war.lib}" filtering="no">
784 1823 jones
         <fileset dir="lib">
785
           <include name="*.jar"/>
786
         </fileset>
787
         <fileset dir="lib/xalan">
788
           <include name="*.jar"/>
789
         </fileset>
790
       </copy>
791 1952 jones
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
792 1729 tao
       <copy file="lib/web.xml.${tomcatversion}"
793 1952 jones
             tofile="${build.war}/web.xml" />
794
       <copy file="lib/metacat.properties" todir="${war.webinf}"
795 1951 jones
             filtering="yes" />
796 1952 jones
       <copy todir="${war.context}" filtering="no">
797 822 jones
         <fileset dir="lib">
798
           <include name="**/*.jpg"/>
799
           <include name="**/*.png"/>
800
           <include name="**/*.gif"/>
801
         </fileset>
802
       </copy>
803 1952 jones
       <copy todir="${war.context}" filtering="yes">
804 822 jones
         <fileset dir="lib">
805
           <exclude name="*.jar"/>
806
           <exclude name="*.properties"/>
807
           <exclude name="web.xml"/>
808 1437 berkley
           <exclude name="**/*.jpg"/>
809
           <exclude name="**/*.png"/>
810
           <exclude name="**/*.gif"/>
811 822 jones
         </fileset>
812
       </copy>
813 1952 jones
       <copy todir="${war.context}" filtering="no">
814 1929 brooke
         <fileset dir="lib">
815
           <include name="**/*.jpg"/>
816
           <include name="**/*.png"/>
817
           <include name="**/*.gif"/>
818
         </fileset>
819
       </copy>
820 1311 berkley
   </target>
821 1929 brooke
822 1952 jones
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
823
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
824
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
825 1929 brooke
   </target>
826
827 2175 tao
   <target name="getConversionXSL" depends="prepare"
828 1954 jones
            unless="styles.not.needed"
829 1939 brooke
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
830 1929 brooke
     <echo>Enter CVS password: </echo>
831
     <cvs cvsRoot="${cvsroot-alternate}"
832
          package="${conversion-module}"
833
          dest="${build.tmp}" />
834 2343 sgarg
835
     <mkdir dir="lib/style/common/emlb6toeml2" />
836
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
837
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
838
         <include name="*.xsl"/>
839
         <include name="*.xml"/>
840
       </fileset>
841
      </copy>
842 1929 brooke
   </target>
843
844 2135 costa
   <target name="testprep" depends="jar,clientjar,harvesterjar">
845 1783 jones
      <mkdir dir="${build.tests}"/>
846
      <copy todir="${build.tests}" filtering="yes">
847
        <fileset dir="${testdir}">
848
          <include name="edu/**"/>
849
        </fileset>
850
      </copy>
851 971 tao
      <!-- copy and compile the tests into a jar file -->
852 1783 jones
      <javac srcdir="${build.tests}"
853
             destdir="${build.tests}"
854 2135 costa
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
855 1612 tao
             debug="on"
856 1311 berkley
       includes="**/*.java" />
857 204 jones
858 1311 berkley
      <jar jarfile="${build.dir}/${name}-junittests.jar"
859 1783 jones
        basedir="${build.tests}"
860 1311 berkley
                includes="**/*.class" />
861 1822 jones
   </target>
862 971 tao
863 1939 brooke
   <target name="test" depends="testprep"
864
            description="Uses the ant junit task to run all JUnit tests">
865 1822 jones
866 971 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
867 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
868 971 tao
             haltonerror="no">
869 1783 jones
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
870 971 tao
        <classpath>
871 1783 jones
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
872 971 tao
        </classpath>
873
874
        <formatter type="plain" />
875
876
        <batchtest fork="yes" todir="${build.dir}">
877 1783 jones
          <fileset dir="${build.tests}">
878 1116 tao
            <include name="**/*.class" />
879 971 tao
          </fileset>
880
        </batchtest>
881
     </junit>
882
   </target>
883 1103 tao
884 1939 brooke
    <target name="runonetest" depends="testprep"
885
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
886 1500 tao
887 1939 brooke
              <echo>testtorun: ${testtorun}</echo>
888
889 1500 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
890 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
891 1500 tao
             haltonerror="no">
892 2044 tao
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
893 1500 tao
        <classpath>
894 1783 jones
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
895 1500 tao
        </classpath>
896
897
        <formatter type="plain" />
898
899
        <batchtest fork="yes" todir="${build.dir}">
900 1783 jones
          <fileset dir="${build.tests}">
901 1500 tao
            <include name="**/${testtorun}.class" />
902
          </fileset>
903
        </batchtest>
904
     </junit>
905
   </target>
906
907 2175 tao
   <target name="testharvester"
908 2135 costa
           depends="testprep"
909
           description="Uses the ant junit task to test only the Harvester code">
910 2175 tao
     <junit printsummary="yes"
911
            haltonfailure="off"
912 2135 costa
            fork="yes"
913
            haltonerror="off">
914
       <classpath>
915
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
916
       </classpath>
917
       <formatter type="plain" />
918
       <batchtest fork="yes" todir="${build.dir}">
919
         <fileset dir="${build.tests}">
920
           <include name="**/harvesterClient/*.class" />
921
         </fileset>
922
       </batchtest>
923
     </junit>
924
   </target>
925
926 1939 brooke
  <target name="gethttpclient" depends="prepare"
927
            description="checks out and compiles morpho httpclient code">
928 1311 berkley
  <!--mkdir dir="${morphosourcedir}" -->
929 1487 tao
        <cvs cvsRoot="${cvsroot}"
930 1103 tao
             package="morpho"
931
             dest="." />
932 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
933 1103 tao
   </target>
934
935
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
936 1939 brooke
   <target name="nettest" depends="install"
937
            description="compiles and runs the metacatnettest code">
938 2175 tao
939 1103 tao
      <echo>***********************************
940 1311 berkley
      Please run ant gethttpclient first!
941
      ***********************************
942 1103 tao
      </echo>
943
      <!-- copy and compile the tests into a jar file -->
944 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
945 1103 tao
      <javac srcdir="${junitnettestsdir}"
946 1116 tao
             destdir="${build.metacatnettest}"
947 1103 tao
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
948
             includes="**/*.java" />
949
950
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
951 1116 tao
                    basedir="${build.metacatnettest}"
952 1103 tao
                    includes="**/*.class" />
953
954
      <!-- use the ant "junit" task to run JUnit tests. -->
955 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
956 1103 tao
             haltonerror="no">
957 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
958 1103 tao
        <classpath>
959 1807 tao
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
960 1103 tao
        </classpath>
961
962
        <formatter type="plain" />
963
964
        <batchtest fork="yes" todir="${build.dir}">
965 1116 tao
          <fileset dir="${build.metacatnettest}">
966
            <include name="**/*.class" />
967 1103 tao
          </fileset>
968
        </batchtest>
969
     </junit>
970 1311 berkley
   </target>
971 1103 tao
972 1939 brooke
   <target name="cleanweb" depends="clean"
973
            description="deletes tomcat web context dir and all its contents">
974 1522 berkley
     <delete dir="${installdir}" />
975
   </target>
976
977
978 1939 brooke
   <target name="clean" depends="init"
979 2320 jones
            description="deletes build dir and files that can be regenerated form the release">
980 822 jones
       <delete dir="${build.dir}" />
981 2320 jones
   </target>
982
983
   <target name="fullclean" depends="clean"
984
            description="deletes even jars that depend on external sources such as stylesheets and jars">
985
       <delete file="lib/httpclient.jar" />
986
       <delete file="lib/utilities.jar" />
987 1939 brooke
       <delete includeEmptyDirs="true" failonerror="false">
988
         <fileset dir="${style-common-cvsrelpath}">
989
           <include name="${eml-css}" />
990
           <include name="eml-*/*.xsl" />
991
           <include name="eml-*" />
992
         </fileset>
993 2320 jones
       </delete>
994 113 jones
   </target>
995
996 1939 brooke
   <target name="jdoc" depends="prepare"
997
            description="generates javadoc documentation">
998 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
999 516 jones
           sourcepath="${build.src}"
1000
           destdir="${build.javadocs}"
1001 2319 jones
           classpath="${cpath}"
1002 113 jones
           author="true"
1003
           version="true"
1004
           use="true"
1005 348 jones
           windowtitle="${Name} API"
1006
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1007 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
1008
       />
1009
   </target>
1010
1011 2317 jones
   <target name="dist" depends="geteml,jar,protocol,jdoc"
1012 1939 brooke
            description="prepares a full release distribution">
1013 806 jones
      <mkdir dir="${dist.dir}"/>
1014
      <delete dir="${ver.dir}" />
1015
      <mkdir dir="${ver.dir}"/>
1016
      <copy todir="${ver.dir}">
1017 1311 berkley
        <fileset dir="."
1018 2401 costa
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1019 806 jones
      </copy>
1020
      <copy todir="${ver.dir}" file="build.xml"/>
1021 2317 jones
      <copy todir="${ver.dir}" file="build.properties"/>
1022 882 jones
1023
      <copy todir="${ver.dir}/docs" filtering="yes">
1024
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1025
      </copy>
1026
      <copy todir="${ver.dir}/docs" filtering="no">
1027
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1028
      </copy>
1029 806 jones
      <copy todir="${ver.dir}/docs/dev">
1030
        <fileset dir="${build.dir}/docs"/>
1031
      </copy>
1032 917 berkley
      <copy todir="${ver.dir}/src">
1033
        <fileset dir="${build.dir}/src"/>
1034
      </copy>
1035 2391 tao
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1036
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1037 2395 tao
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1038 2323 jones
      <!--
1039 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
1040
      <delete dir="./${ver.dir}/dist"/>
1041 2323 jones
      -->
1042 882 jones
      <delete file="./${name}-${release}.zip"/>
1043 1312 tao
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1044 882 jones
      <delete file="./${name}-${release}.tar.gz" />
1045 1312 tao
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1046 1311 berkley
      <gzip zipfile="./${name}-${release}.tar.gz"
1047 882 jones
                src="./${name}-${release}.tar"/>
1048
      <delete file="./${name}-${release}.tar" />
1049 1311 berkley
  </target>
1050 806 jones
1051 1939 brooke
  <target name="distsrc" depends="dist"
1052
            description="prepares a source distribution">
1053 806 jones
      <mkdir dir="${ver.src}"/>
1054
      <copy todir="${ver.src}">
1055
        <fileset dir="./src"/>
1056
      </copy>
1057
1058 882 jones
      <delete file="./${name}-src-${release}.zip"/>
1059
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1060
      <delete file="./${name}-src-${release}.tar.gz" />
1061
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1062 1311 berkley
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1063 882 jones
                src="./${name}-src-${release}.tar"/>
1064
      <delete file="./${name}-src-${release}.tar" />
1065 807 jones
      <delete dir="${dist.dir}"/>
1066 1311 berkley
  </target>
1067 806 jones
1068 1702 tao
   <target name="stylesheettest">
1069 1939 brooke
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1070 1702 tao
      <param name="displaymodule" expression="${displaymodule}"/>
1071
      <param name="docid" expression="${input}"/>
1072
      <param name="entitytype" expression="${entitytype}"/>
1073
      <param name="entityindex" expression="${entityindex}"/>
1074
      <outputproperty name="method" value="html"/>
1075
      <outputproperty name="standalone" value="yes"/>
1076
      <outputproperty name="encoding" value="iso8859_1"/>
1077
      <outputproperty name="indent" value="yes"/>
1078
    </xslt>
1079
  </target>
1080 2175 tao
1081 1819 tao
 <target name="gridinit" depends="init">
1082
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1083
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1084
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1085
   <property environment="env"/>
1086
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1087 1820 tao
    <path id="webservicepath">
1088
        <pathelement location="."/>
1089
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1090
        <pathelement location="${build.dest}"/>
1091
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1092
           <include name="*.jar"/>
1093
        </fileset>
1094
      </path>
1095 1819 tao
</target>
1096
1097 1821 tao
 <target name="gridprepare" depends="gridinit, prepare">
1098 2175 tao
 </target>
1099
1100 1821 tao
  <target name="compileinterface" depends="clean, gridprepare">
1101 1817 tao
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1102 1811 tao
  </target>
1103 2175 tao
1104 1811 tao
  <target name="generateWSDL" depends="compileinterface">
1105
    <echo message="Generating wsdl from ${interface.name} interface"/>
1106
    <java classname="${java2wsdl.tool}"
1107 1814 tao
          dir="${build.src}" fork="yes"
1108 1811 tao
          classpathref="webservicepath"  failonerror="true" >
1109
      <arg value="-P"/>
1110
      <arg value="${interface.name}PortType"/>
1111
      <arg value="-S"/>
1112
      <arg value="${interface.name}Service"/>
1113
      <arg value="-y"/>
1114
      <arg value="WRAPPED"/>
1115
      <arg value="-u"/>
1116
      <arg value="LITERAL"/>
1117
      <arg value="-l"/>
1118
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1119
      <arg value="-n"/>
1120
      <arg value="http://${services.namespace}/${interface.name}"/>
1121
      <arg value="${interface.package}.${interface.name}"/>
1122
    </java>
1123
  </target>
1124 2175 tao
1125 1811 tao
   <target name="decorateWSDL" depends="generateWSDL">
1126
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1127 1814 tao
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1128 1811 tao
            fork="yes"
1129
            classpathref="webservicepath" failonerror="true" >
1130
        <arg value="${binding.file}"/>
1131
        <arg value="${wsdl.file}"/>
1132
      </java>
1133
   </target>
1134 2175 tao
1135 1811 tao
   <target name="generatestubs" depends="decorateWSDL">
1136
      <echo message=" Generating stubs " />
1137 1814 tao
      <echo message="wsdl file is ${wsdl.file}"/>
1138
      <echo message="build.src is ${build.src}"/>
1139 1811 tao
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1140
            classpathref="webservicepath" failonerror="true" >
1141 1814 tao
         <arg value="${wsdl.file}"/>
1142 1811 tao
    </java>
1143
  </target>
1144 2175 tao
1145 1811 tao
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1146
     <echo message=" Compiling stubs " />
1147
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1148
     <echo message=" Compiling impl " />
1149
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1150
  </target>
1151 2175 tao
1152 1811 tao
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1153
     <echo message=" jar stubs classes " />
1154
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1155
     <echo message=" jar impl classes " />
1156
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1157
  </target>
1158 2175 tao
1159 1811 tao
  <target name="gar" depends="jarStubsAndImpl">
1160
     <echo message=" jar the gar file"/>
1161
     <mkdir dir="${build.dir}/gar"/>
1162
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1163
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1164
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1165 1814 tao
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1166
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1167
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1168
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1169 1811 tao
  </target>
1170 2175 tao
1171 1814 tao
  <target name="compilewebclient" depends="prepare">
1172
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1173
  </target>
1174 2175 tao
1175 1814 tao
  <target name="runwebclient" depends="compilewebclient">
1176 2175 tao
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1177 1814 tao
           dir="${build.dest}" fork="yes"
1178
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1179
         <arg value="${serviceUrl}"/>
1180
         <arg value="${docid}"/>
1181
     </java>
1182
  </target>
1183 113 jones
</project>