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