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