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 2599 jones
  <!-- Determine which tomcat we are using and tomcat-specific settings -->
37
  <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
38
    <equals arg1="${tomcatversion}" arg2="tomcat3" />
39
  </condition>
40
  <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
41
    <equals arg1="${tomcatversion}" arg2="tomcat4" />
42
  </condition>
43
  <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
44
    <equals arg1="${tomcatversion}" arg2="tomcat5" />
45
  </condition>
46 2957 tao
47
  <!-- Determine if installed ecogrid -->
48
  <condition property="enable.ecogrid">
49
    <equals arg1="${install.ecogrid}" arg2="true" />
50
  </condition>
51 3034 perry
52 1929 brooke
  <target name="check-db">
53
    <condition property="use-oracle">
54
      <equals arg1="${database}" arg2="oracle" />
55
    </condition>
56
    <condition property="use-postgresql">
57
      <equals arg1="${database}" arg2="postgresql" />
58
    </condition>
59
    <condition property="use-sqlserver">
60
      <equals arg1="${database}" arg2="sqlserver" />
61
    </condition>
62
  </target>
63
64
  <target name="oracle" if="use-oracle">
65 931 jones
     <!-- Customize these properties if you are using oracle -->
66 1929 brooke
     <echo message="Using oracle..."/>
67 925 berkley
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
68
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
69 2617 tao
     <property name="jdbc-jar-name" value="classes111.zip" />
70
     <property name="jdbc" value="${jdbc_base}/${jdbc-jar-name}" />
71 1744 tao
     <!-- Property to indicate is not MSSQL installation-->
72
     <property name="other" value="yes"/>
73 2175 tao
     <property name="install-sql"
74 2103 jones
               value="xmltables.sql" />
75 2175 tao
     <property name="upgrade-1.2-sql"
76 2103 jones
               value="upgrade-db-to-1.2.sql" />
77 2175 tao
     <property name="upgrade-1.3-sql"
78 2103 jones
               value="upgrade-db-to-1.3.sql" />
79 2175 tao
     <property name="upgrade-1.4-sql"
80 2103 jones
               value="upgrade-db-to-1.4.sql" />
81 2518 sgarg
     <property name="upgrade-1.5-sql"
82 2431 sgarg
               value="upgrade-db-to-1.5.sql" />
83 2518 sgarg
     <property name="upgrade-1.6-sql"
84
               value="upgrade-db-to-1.6.sql" />
85 925 berkley
   </target>
86 1311 berkley
87 1929 brooke
   <target name="postgresql" if="use-postgresql">
88 931 jones
     <!-- Customize these properties if you are using postgres -->
89 1929 brooke
     <echo message="Using PostgreSQL..."/>
90 925 berkley
     <property name="dbDriver" value="org.postgresql.Driver"/>
91 1311 berkley
     <property name="dbAdapter"
92 931 jones
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
93 2610 tao
     <property name="jdbc-jar-name" value="postgresql-8.0-312.jdbc3.jar" />
94
     <property name="jdbc" value="lib/${jdbc-jar-name}" />
95 1744 tao
     <!-- Property to indicate is not MSSQL installation-->
96
     <property name="other" value="yes"/>
97 2175 tao
     <property name="install-sql"
98 2277 jones
               value="xmltables-postgres.sql" />
99 2175 tao
     <property name="upgrade-1.2-sql"
100 2277 jones
               value="upgrade-db-to-1.2-postgres.sql" />
101 2175 tao
     <property name="upgrade-1.3-sql"
102 2277 jones
               value="upgrade-db-to-1.3-postgres.sql" />
103 2175 tao
     <property name="upgrade-1.4-sql"
104 2277 jones
               value="upgrade-db-to-1.4-postgres.sql" />
105 2518 sgarg
     <property name="upgrade-1.5-sql"
106 2431 sgarg
               value="upgrade-db-to-1.5-postgres.sql" />
107 2518 sgarg
     <property name="upgrade-1.6-sql"
108
               value="upgrade-db-to-1.6-postgres.sql" />
109 1744 tao
    </target>
110 2175 tao
111 1929 brooke
   <target name="sqlserver" if="use-sqlserver">
112 1739 tao
     <!-- Customize these properties if you are using SQL server -->
113 1929 brooke
     <echo message="Using SQL Server..."/>
114 1739 tao
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
115
     <property name="dbAdapter"
116
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
117 2296 sgarg
     <property name="jdbc" value="${jdbc_base}/msbase.jar" />
118
     <property name="jdbc-add1" value="${jdbc_base}/msutil.jar" />
119
     <property name="jdbc-add2" value="${jdbc_base}/mssqlserver.jar" />
120 1744 tao
     <!-- Property to indicate is a MSSQL installation-->
121
     <property name="MSSQL" value="yes"/>
122 2175 tao
     <property name="install-sql"
123 2118 costa
               value="xmltables-sqlserver.sql" />
124 1739 tao
   </target>
125 1311 berkley
126 1929 brooke
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
127 1814 tao
      <!-- usr for client testing, generally you don't need change-->
128 2991 berkley
      <property name="mcuser" value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org"/>
129
      <property name="mcpassword" value="kepler"/>
130 1801 tao
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
131
      <property name="mcanotherpassword" value=""/>
132
133 1827 jones
      <property name="debug" value="on" />
134 2053 sgarg
      <property name="debuglevel" value="55" />
135 1716 berkley
136 1522 berkley
      <property name="morphosourcedir" value="../morpho" />
137 1570 tao
      <property name="defaultcontenttype" value="application/octet-stream" />
138 1780 jones
      <property name="utilitiesdir" value="../utilities" />
139 2175 tao
140 1941 brooke
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
141
      <echo>*********** set jsdk to ${jsdk}</echo>
142 1103 tao
  </target>
143
144 931 jones
   <target name="init" depends="config">
145 2631 tao
      <path id="compile.classpath">
146
        <pathelement location="${jsdk}"/>
147
        <pathelement location="lib" />
148
        <fileset dir="lib">
149
          <include name="*.jar"/>
150
        </fileset>
151 3059 berkley
	<fileset dir="lib">
152
           <include name="xalan.jar"/>
153 3030 sgarg
         </fileset>
154 2631 tao
       <fileset dir="lib/lsid_lib">
155
         <include name="*.jar"/>
156
       </fileset>
157
       <fileset dir="${jdbc_base}">
158
         <include name="${jdbc-jar-name}"/>
159
          <include name="msbase.jar"/>
160
          <include name="msutil.jar"/>
161
          <include name="mssqlserver.jar"/>
162 3034 perry
       </fileset>
163
164
        <!-- Include geoserver, geotools, et. al. -->
165
        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
166
          <include name="*.jar"/>
167 2631 tao
        </fileset>
168 3034 perry
        <pathelement location="lib/spatial/geoserver/WEB-INF/classes"/>
169
170 2631 tao
       </path>
171
172 931 jones
      <!-- It is less likely you'll need to make any changes from here down,
173
           but customization is possible -->
174 2737 jones
      <property name="installdir"          value="${deploy.dir}/${metacat.context}" />
175
      <property name="temp-dir"            value="/tmp/${metacat.context}" />
176 1929 brooke
      <property name="name"                value="metacat"/>
177
      <property name="Name"                value="MetaCat"/>
178
      <property name="debugprefix"         value="${Name}:"/>
179 2577 sgarg
      <property name="release"             value="1.6.0"/>
180 2737 jones
      <property name="replication-path"    value="/${metacat.context}/servlet/replication"/>
181
      <property name="harvester-registration-login-path" value="/${metacat.context}/harvesterRegistrationLogin"/>
182
      <property name="harvester-registration-path"       value="/${metacat.context}/harvesterRegistration"/>
183
      <property name="servlet-path"        value="/${metacat.context}/metacat"/>
184
      <property name="html-path"           value="/${metacat.context}"/>
185 2974 jones
      <property name="systemidserver"      value="${http.protocol}://${httpserver}"/>
186 2175 tao
      <property name="style-common-relpath"
187 1933 brooke
                                           value="/style/common"/>
188 2175 tao
      <property name="style-common-cvsrelpath"
189 1938 brooke
                                           value="lib${style-common-relpath}"/>
190 2175 tao
      <property name="style-common-fullpath"
191 1933 brooke
                                           value="/${installdir}${style-common-relpath}"/>
192 2343 sgarg
      <property name="templates.dir"       value="${style-common-fullpath}/templates"/>
193 2175 tao
      <property name="style-common-path"
194 2737 jones
                                           value="/${metacat.context}${style-common-relpath}"/>
195 1929 brooke
      <property name="style-skins-relpath" value="/style/skins"/>
196 2737 jones
      <property name="style-skins-path"    value="/${metacat.context}${style-skins-relpath}"/>
197 1929 brooke
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
198 1579 tao
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
199 2737 jones
      <property name="config-dir"          value="${deploy.dir}/${style-skins-path}" />
200 2461 sgarg
      <property name="util-module"         value="utilities" />
201 1929 brooke
      <property name="eml-module"          value="eml" />
202
      <property name="eml-version"         value="2.0.0beta6" />
203
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
204 2232 sgarg
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
205 3012 sgarg
      <property name="eml2_0_1-tag"        value="RELEASE_EML_2_0_1_UPDATE_3" />
206 2228 sgarg
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
207
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
208
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
209 1929 brooke
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
210 1933 brooke
      <property name="eml-css"             value="eml_xsl.css"/>
211
      <property name="eml-module.default.css"
212
                                           value="default.css"/>
213 2965 tao
214 1929 brooke
      <!-- Config for registry variables -->
215 1933 brooke
      <property name="scope"               value="obfs"/>
216
      <property name="responseForm"        value="genericResponse.tmpl"/>
217
      <property name="entryForm"           value="entryForm.tmpl"/>
218
      <property name="guide"               value="genericGuide.tmpl"/>
219 2781 sgarg
      <property name="loginForm"           value="loginForm.tmpl"/>
220 2343 sgarg
      <property name="confirmData"         value="confirmData.tmpl"/>
221
      <property name="deleteData"          value="deleteData.tmpl"/>
222
      <property name="genericHeader"       value="genericHeader.tmpl"/>
223
      <property name="genericFooter"       value="genericFooter.tmpl"/>
224
      <property name="adminname"           value="KNB Support"/>
225
      <property name="recipient"           value="knb-software\@nceas.ucsb.edu"/>
226 1929 brooke
227 2343 sgarg
      <property name="defaultStage"        value="initregister"/>
228
      <property name="defaultHeader"       value="genericHeader.tmpl"/>
229
      <property name="defaultFooter"       value="genericFooter.tmpl"/>
230
      <property name="defaultChangePass"   value="ldapChangePass.tmpl"/>
231
      <property name="defaultResetPass"    value="ldapResetPass.tmpl"/>
232
      <property name="changePassSuccess"   value="ldapChangePassSuccess.tmpl"/>
233
      <property name="resetPassSuccess"    value="ldapResetPassSuccess.tmpl"/>
234
      <property name="registerFailed"      value="ldapRegisterFailed.tmpl"/>
235
      <property name="registerLter"        value="ldapRegisterLter.tmpl"/>
236
      <property name="registerMatch"       value="ldapRegisterMatch.tmpl"/>
237
      <property name="registerSuccess"     value="ldapRegisterSuccess.tmpl"/>
238
      <property name="register"            value="ldapRegister.tmpl"/>
239
      <property name="searchResults"       value="searchResults.tmpl"/>
240
241
      <filter token="scope"                value="${scope}"/>
242
      <filter token="responseForm"         value="${responseForm}"/>
243
      <filter token="entryForm"            value="${entryForm}"/>
244
      <filter token="guide"                value="${guide}"/>
245 2781 sgarg
      <filter token="loginForm"            value="${loginForm}"/>
246 2343 sgarg
      <filter token="confirmData"          value="${confirmData}"/>
247
      <filter token="deleteData"           value="${deleteData}"/>
248
      <filter token="genericHeader"        value="${genericHeader}"/>
249
      <filter token="genericFooter"        value="${genericFooter}"/>
250
      <filter token="adminname"            value="${adminname}"/>
251
      <filter token="recipient"            value="${recipient}"/>
252
253
      <filter token="ldapurl"              value="ldap.ecoinformatics.org"/>
254
      <filter token="ldapSearchBase"       value="dc=ecoinformatics,dc=org"/>
255
      <filter token="ldap_user"            value="cn=Manager,dc=ecoinformatics,dc=org"/>
256
      <filter token="ldap_password"        value="ldap_password"/>
257 2870 sgarg
      <filter token="mailhost"             value="localhost"/>
258 2343 sgarg
      <filter token="sender"               value="knb-software\@nceas.ucsb.edu"/>
259 2974 jones
      <filter token="cgiurl"               value="${cgi-prefix}/ldapweb.cgi"/>
260 2343 sgarg
261 882 jones
      <filter token="docrooturl" value="./" />
262 2356 sgarg
      <filter token="database" value="${database}" />
263 588 berkley
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
264 882 jones
      <filter token="dbDriver" value="${dbDriver}"/>
265 915 berkley
      <filter token="dbAdapter" value="${dbAdapter}"/>
266 614 bojilova
      <filter token="install-dir" value="${installdir}"/>
267 1929 brooke
      <filter token="temp-dir" value="${temp-dir}"/>
268 586 berkley
      <filter token="server" value="${server}"/>
269 977 tao
      <filter token="systemidserver" value="${systemidserver}"/>
270 1929 brooke
      <filter token="cgi-prefix" value="${cgi-prefix}"/>
271
      <filter token="ldapUrl" value="${ldapUrl}"/>
272 586 berkley
      <filter token="replication-log" value="${replication-log}"/>
273 1579 tao
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
274 348 jones
      <filter token="release" value="${release}"/>
275
      <filter token="servlet-path" value="${servlet-path}"/>
276 359 bojilova
      <filter token="html-path" value="${html-path}"/>
277 362 jones
      <filter token="user" value="${user}"/>
278
      <filter token="password" value="${password}"/>
279 1783 jones
      <filter token="mcuser" value="${mcuser}"/>
280
      <filter token="mcpassword" value="${mcpassword}"/>
281 1801 tao
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
282
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
283 1929 brooke
      <filter token="knb-site-url" value="${knb-site-url}"/>
284 1933 brooke
      <filter token="eml-css" value="${eml-css}"/>
285 1929 brooke
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
286
      <filter token="style-skins-path" value="${style-skins-path}"/>
287
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
288
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
289
      <filter token="style-common-path" value="${style-common-path}"/>
290 2343 sgarg
      <filter token="templates.dir" value="${templates.dir}"/>
291
292 1929 brooke
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
293
      <filter token="style-path" value="${style-skins-path}"/>
294 525 berkley
      <filter token="replication-path" value="${replication-path}"/>
295 2299 costa
      <filter token="harvester-registration-login-path" value="${harvester-registration-login-path}"/>
296
      <filter token="harvester-registration-path" value="${harvester-registration-path}"/>
297 832 jones
      <filter token="config-dir" value="${config-dir}"/>
298
      <filter token="default-style" value="${default-style}"/>
299 877 jones
      <filter token="eml-version" value="${eml-version}"/>
300 2175 tao
      <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}"/>
301 2228 sgarg
      <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}"/>
302 2175 tao
      <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}"/>
303 1718 tao
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
304 2737 jones
      <filter token="context" value="${metacat.context}"/>
305 2961 tao
   	  <filter token="httpserver" value="${httpserver}"/>
306 1292 tao
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
307 1051 tao
      <filter token="debuglevel" value="${debuglevel}" />
308 1079 tao
      <filter token="datafilepath" value="${datafilepath}" />
309 1455 tao
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
310 1522 berkley
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
311 1538 berkley
      <filter token="debugprefix" value="${debugprefix}"/>
312 2308 jones
      <filter token="administrators" value="${administrators}"/>
313 2577 sgarg
      <filter token="moderators" value="${moderators}"/>
314
      <filter token="allowedSubmitters" value="${allowedSubmitters}"/>
315
      <filter token="deniedSubmitters" value="${deniedSubmitters}"/>
316 2872 sgarg
      <filter token="indexPaths" value="${indexPaths}"/>
317 1487 tao
318 2343 sgarg
      <filter token="defaultStage" value="${defaultStage}"/>
319
      <filter token="defaultHeader" value="${defaultHeader}"/>
320
      <filter token="defaultFooter" value="${defaultFooter}"/>
321
      <filter token="defaultChangePass" value="${defaultChangePass}"/>
322
      <filter token="defaultResetPass" value="${defaultResetPass}"/>
323
      <filter token="changePassSuccess" value="${changePassSuccess}"/>
324
      <filter token="resetPassSuccess" value="${resetPassSuccess}"/>
325
      <filter token="registerFailed" value="${registerFailed}"/>
326
      <filter token="registerLter" value="${registerLter}"/>
327
      <filter token="registerMatch" value="${registerMatch}"/>
328
      <filter token="registerSuccess" value="${registerSuccess}"/>
329
      <filter token="register" value="${register}"/>
330
      <filter token="searchResults" value="${searchResults}"/>
331 2549 tao
332
   	  <filter token="timedreplication" value="${timedreplication}" />
333
   	  <filter token="firsttimedreplication" value="${firsttimedreplication}" />
334
   	  <filter token="timedreplicationinterval" value="${timedreplicationinterval}" />
335
336
   	  <property name="srcdir" value="./src" />
337 2599 jones
   	  <property name="lib.dir" value="./lib" />
338 1783 jones
      <property name="testdir" value="./test" />
339 2277 jones
      <property name="testtorun" value="BuildIndexTest" />
340 1116 tao
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
341
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
342 348 jones
      <property name="build.dir" value="./build"/>
343
      <property name="build.src" value="${build.dir}/src"/>
344
      <property name="build.dest" value="${build.dir}/classes"/>
345 516 jones
      <property name="build.docs" value="${build.dir}/docs"/>
346 348 jones
      <property name="build.samples" value="${build.dir}/samples"/>
347
      <property name="build.tests" value="${build.dir}/tests"/>
348 1778 tao
      <property name="build.tmp" value="${build.dir}/tmp"/>
349 1116 tao
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
350
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
351 348 jones
      <property name="build.data" value="${build.dir}/data"/>
352 806 jones
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
353 1952 jones
      <property name="build.war" value="${build.dir}/war"/>
354 348 jones
355 882 jones
      <property name="dist.dir" value="dist"/>
356 806 jones
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
357
      <property name="ver.src" value="${ver.dir}/src"/>
358 2461 sgarg
      <property name="util.dir" value="${dist.dir}/${util-module}"/>
359 2401 costa
	  <!-- directories for creating a Harvest List Editor distribution -->
360
      <property name="dist.dir.hle" value="disthle"/>
361
      <property name="ver.dir.hle" value="${dist.dir.hle}/harvest-list-editor-${release}"/>
362 2965 tao
363
364
   	  <property name="ecogrid-target-name" value="metacatImpl"/>
365
   	  <property name="ecogrid-module-dest-dir" value =".."/>
366
   	  <property name="ecogrid-module" value="seek/projects/ecogrid"/>
367
   	  <property name="ecogrid-dist-dir" value="${dist.dir}/${ecogrid-module}"/>
368
   	  <property name="ecogrid-dir" value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
369 806 jones
370 254 jones
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
371 2317 jones
      <condition property="utilities.required">
372
        <or>
373
          <not><available file="lib/httpclient.jar"/></not>
374
          <not><available file="lib/utilities.jar"/></not>
375
        </or>
376
      </condition>
377 2318 jones
      <condition property="eml.required">
378
        <or>
379
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
380
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
381
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
382
        </or>
383
      </condition>
384 2965 tao
385
      <condition property="ecogrid.required">
386
      	   <or>
387
             <not><available file="${ecogrid-dir}/build.properties"/></not>
388
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
389
           </or>
390
      </condition>
391 2599 jones
392 113 jones
   </target>
393 1311 berkley
394 348 jones
   <target name="prepare" depends="init">
395
      <mkdir dir="${build.dir}"/>
396
      <mkdir dir="${build.src}"/>
397
      <mkdir dir="${build.dest}"/>
398 516 jones
      <mkdir dir="${build.javadocs}"/>
399 1778 tao
      <mkdir dir="${build.tmp}"/>
400 348 jones
401 822 jones
      <copy todir="${build.src}" filtering="yes">
402
        <fileset dir="${srcdir}">
403
          <include name="edu/**"/>
404
          <include name="com/**"/>
405 877 jones
          <include name="**/*.sql"/>
406 822 jones
          <exclude name="**/CVS*"/>
407
          <exclude name="**/.#*"/>
408
        </fileset>
409
      </copy>
410 2344 sgarg
      <available file="lib/style/common/emlb6toeml2" type="dir"
411 1954 jones
                 property="styles.not.needed"/>
412 348 jones
   </target>
413
414 1939 brooke
   <target name="compile" depends="prepare,utilities"
415 1986 jones
    description="Compiles java code to build dir, and copies metacat props files there">
416 1939 brooke
417 1311 berkley
       <javac srcdir="${build.src}"
418
              destdir="${build.dest}"
419 1827 jones
              debug="${debug}"
420 2599 jones
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
421
        <classpath>
422
          <path refid="compile.classpath"/>
423
        </classpath>
424
      </javac>
425 1311 berkley
   </target>
426 113 jones
427 2322 jones
   <target name="jar" depends="compile,geteml"
428 1939 brooke
    description="Compiles and jars metacat java code to metacat.jar in build dir">
429
430 353 jones
       <delete file="${build.dir}/${name}.jar" />
431 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
432 2135 costa
            excludes="**/protocols/ **/harvesterClient/" />
433 1311 berkley
   </target>
434
435 1939 brooke
   <target name="protocol" depends="compile"
436
    description="Compiles and jars protocol java code to protocol.jar in build dir">
437 635 jones
       <delete file="${build.dir}/protocol.jar" />
438
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
439
            includes="**/protocols/" />
440 1311 berkley
   </target>
441 113 jones
442 2317 jones
   <target name="utilities" depends="config" if="utilities.required">
443 1796 jones
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
444
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
445 1780 jones
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
446
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
447
   </target>
448
449 2461 sgarg
   <target name="getutilities" depends="prepare"
450
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
451
     <echo>Enter CVS password: </echo>
452
     <cvs cvsRoot="${cvsroot}"
453 2468 sgarg
          package="${util-module}"
454 2461 sgarg
          dest="${build.tmp}" />
455
   </target>
456
457 1939 brooke
   <target name="client" depends="utilities, prepare"
458
    description="Compiles metacat-client java code to build dir">
459 1780 jones
       <javac srcdir="${build.src}"
460
              destdir="${build.dest}"
461 2599 jones
              includes="edu/ucsb/nceas/metacat/client/*">
462
          <classpath>
463
            <path refid="compile.classpath"/>
464
          </classpath>
465
        </javac>
466 1780 jones
   </target>
467
468 1939 brooke
   <target name="clientjar" depends="client"
469
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
470 1780 jones
       <delete file="${build.dir}/${name}-client.jar" />
471
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
472
            includes="**/metacat/client/" />
473
   </target>
474
475 2748 costa
    <target name="advancedsearchjar" depends="compile"
476
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
477
        <delete file="${build.dir}/advancedsearch.jar" />
478
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
479
             includes="**/metacat/advancedsearch/" />
480
    </target>
481
482 2059 costa
   <target name="harvester" depends="client"
483 1950 costa
           description="Compiles harvester java code to build dir">
484
       <javac srcdir="${build.src}"
485
              destdir="${build.dest}"
486 2599 jones
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
487
          <classpath>
488
            <path refid="compile.classpath"/>
489
          </classpath>
490
        </javac>
491 1950 costa
   </target>
492
493
   <target name="harvesterjar" depends="harvester"
494 2059 costa
           description="Compiles and jars harvester java code to harvester.jar in build dir">
495
       <delete file="${build.dir}/harvester.jar" />
496
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
497 1950 costa
            includes="**/metacat/harvesterClient/" />
498
   </target>
499
500 2369 costa
   <target name="harvestListEditorDist" depends="harvesterjar"
501
           description="Prepares a distribution of the Harvest List Editor tool">
502 2401 costa
       <mkdir dir="${dist.dir.hle}"/>
503
       <delete dir="${ver.dir.hle}" />
504
       <mkdir dir="${ver.dir.hle}"/>
505
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
506
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
507
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
508
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
509
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
510
       <delete file="./harvest-list-editor-${release}.zip"/>
511
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
512
       <delete file="./harvest-list-editor-${release}.tar.gz" />
513
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
514
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
515
             src="./harvest-list-editor-${release}.tar"/>
516
       <delete file="./harvest-list-editor-${release}.tar" />
517 2369 costa
   </target>
518
519 2318 jones
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
520 1939 brooke
            description="Calls getemlpre2 and geteml2+ targets" />
521
522 2318 jones
   <target name="getemlpre2" depends="prepare" if="eml.required"
523 1939 brooke
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
524 1612 tao
     <echo>Enter CVS password: </echo>
525
     <cvs cvsRoot="${cvsroot}"
526
          package="${eml-module}"
527
          tag="${eml-tag}"
528 1939 brooke
          dest="${build.tmp}/eml_${eml-tag}" />
529 1612 tao
     <mkdir dir="lib/dtd" />
530
     <copy todir="lib/dtd" filtering="yes">
531 1939 brooke
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
532 1612 tao
         <include name="*.dtd"/>
533
       </fileset>
534
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
535
     </copy>
536 2228 sgarg
537
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
538
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
539
       <include name="**/*.xsl"/>
540
     </fileset>
541
     </copy>
542 1939 brooke
   </target>
543
544 2318 jones
   <target name="geteml2+" depends="prepare" if="eml.required"
545 1939 brooke
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
546
     <echo>Enter CVS password: </echo>
547 1612 tao
     <cvs cvsRoot="${cvsroot}"
548
          package="${eml-module}"
549 2228 sgarg
          tag="${eml2_0_0-tag}"
550
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
551
     <mkdir dir="lib/schema/eml-2.0.0" />
552
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
553
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
554 1612 tao
         <include name="*.xsd"/>
555
       </fileset>
556 2175 tao
557 1939 brooke
       <!-- shouldn't we have a mapper here like this??
558
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
559 2175 tao
560
       Jing's code didn't nave one - does it need to be added?
561 1939 brooke
       NOTE that eml-version is set to beta 6, so this would need changing -->
562 2175 tao
563 1612 tao
     </copy>
564 3018 sgarg
     <!-- <antcall target="copyxsl">
565 2228 sgarg
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
566
        <param name="dirname" value="eml-2.0.0" />
567 3018 sgarg
     </antcall> -->
568 2228 sgarg
569
     <echo>Enter CVS password: </echo>
570
     <cvs cvsRoot="${cvsroot}"
571
          package="${eml-module}"
572
          tag="${eml2_0_1-tag}"
573
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
574
     <mkdir dir="lib/schema/eml-2.0.1" />
575
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
576
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
577
         <include name="*.xsd"/>
578
       </fileset>
579
     </copy>
580
     <antcall target="copyxsl">
581
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
582
        <param name="dirname" value="eml-2.0.1" />
583
     </antcall>
584 1939 brooke
   </target>
585
586 2175 tao
   <target  name="copyxsl"
587 1939 brooke
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
588
589
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
590 2175 tao
591 2228 sgarg
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
592
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
593 1929 brooke
       <include name="**/*.xsl"/>
594 1612 tao
     </fileset>
595
     </copy>
596 1939 brooke
597 2175 tao
598
     <!-- now copy default css from eml module and put it in style-common-path
599 1933 brooke
          dir with a new name, so other skin-specific css can import it if reqd -->
600 1939 brooke
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
601 1938 brooke
           tofile="${style-common-cvsrelpath}/${eml-css}" />
602 1612 tao
603 1463 tao
   </target>
604 2175 tao
605
606
607 2322 jones
   <target name="register-schemas" depends="prepare"
608
   description="Registers the Schemas with a new Metacat instance">
609 877 jones
     <echo/>
610 2322 jones
     <echo>Registering the Schemas with the new Metacat instance...</echo>
611 877 jones
     <sql driver="${dbDriver}"
612
          url="${jdbc-connect}"
613
          userid="${user}"
614
          password="${password}"
615 2599 jones
          src="${build.src}/loaddtdschema.sql">
616
       <classpath>
617
         <path refid="compile.classpath"/>
618
       </classpath>
619
     </sql>
620 877 jones
   </target>
621 1716 berkley
622 1939 brooke
   <target name="installdb" depends="prepare"
623
            description="Installs the database tables">
624 1827 jones
     <echo/>
625
     <echo>Installing the database tables...</echo>
626 2445 sgarg
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
627 2599 jones
     <echo/>
628 1827 jones
     <sql driver="${dbDriver}"
629
          url="${jdbc-connect}"
630
          userid="${user}"
631
          password="${password}"
632 2599 jones
          src="${build.src}/${install-sql}">
633
       <classpath>
634
         <path refid="compile.classpath"/>
635
       </classpath>
636
     </sql>
637 1827 jones
   </target>
638
639 2599 jones
   <target name="dropdb" depends="prepare"
640
            description="WARNING: Drops the database tables">
641
     <echo/>
642
     <echo>Dropping the database tables...</echo>
643
     <echo>In case of failure, run the sql script manually. Look at Metacat install instructions for more details</echo>
644
     <echo/>
645
     <sql driver="${dbDriver}"
646
          url="${jdbc-connect}"
647
          userid="${user}"
648
          password="${password}"
649
          src="${build.src}/drop-postgres.sql">
650
       <classpath>
651
         <path refid="compile.classpath"/>
652
       </classpath>
653
     </sql>
654
   </target>
655
656 1939 brooke
   <target name="upgrade12" depends="prepare"
657
            description="Updates the database tables to upgrade to version 1.2">
658 1827 jones
     <echo/>
659
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
660
     <sql driver="${dbDriver}"
661
          url="${jdbc-connect}"
662
          userid="${user}"
663
          password="${password}"
664 2599 jones
          src="${build.src}/${upgrade-1.2-sql}">
665
       <classpath>
666
         <path refid="compile.classpath"/>
667
       </classpath>
668
     </sql>
669 1827 jones
   </target>
670
671 1939 brooke
   <target name="upgrade13" depends="prepare"
672
            description="Updates the database tables to upgrade to version 1.3">
673 1827 jones
     <echo/>
674
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
675
     <sql driver="${dbDriver}"
676
          url="${jdbc-connect}"
677
          userid="${user}"
678
          password="${password}"
679 2599 jones
          src="${build.src}/${upgrade-1.3-sql}">
680
       <classpath>
681
         <path refid="compile.classpath"/>
682
       </classpath>
683
     </sql>
684 1827 jones
   </target>
685
686 2103 jones
   <target name="upgrade14" depends="prepare"
687
            description="Updates the database tables to upgrade to version 1.4">
688
     <echo/>
689
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
690
     <sql driver="${dbDriver}"
691
          url="${jdbc-connect}"
692
          userid="${user}"
693
          password="${password}"
694 2599 jones
          src="${build.src}/${upgrade-1.4-sql}">
695
       <classpath>
696
         <path refid="compile.classpath"/>
697
       </classpath>
698
     </sql>
699 2103 jones
   </target>
700
701 2395 tao
   <target name="upgrade15" depends="sqlupgrade15"
702 2391 tao
           description="Updates the database tables to upgrade to version 1.5">
703 2353 sgarg
     <echo/>
704 2461 sgarg
     <echo>Updating the database tables to upgrade to version 1.5...</echo>
705 2353 sgarg
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
706 2391 tao
           todir="${build.tmp}" filtering="yes"/>
707 2461 sgarg
708 2353 sgarg
     <javac srcdir="${build.tmp}"
709
            destdir="${build.tmp}"
710
            debug="${debug}"
711 2599 jones
            includes="upgrade_db_to_1_5.java">
712
       <classpath>
713
         <path refid="compile.classpath"/>
714
       </classpath>
715
     </javac>
716 2461 sgarg
717 2599 jones
     <java classname="upgrade_db_to_1_5">
718
       <classpath>
719
         <path refid="compile.classpath"/>
720
         <fileset dir="${build.tmp}"/>
721
       </classpath>
722
     </java>
723 2353 sgarg
724 2393 tao
   </target>
725 2461 sgarg
726 2518 sgarg
   <target name="upgrade16" depends="prepare"
727
            description="Updates the database tables from version 1.5 to version 1.6">
728
     <echo/>
729
     <echo>Updating the database tables to upgrade to version 1.6...</echo>
730
     <sql driver="${dbDriver}"
731
          url="${jdbc-connect}"
732
          userid="${user}"
733
          password="${password}"
734 2599 jones
          src="${build.src}/${upgrade-1.6-sql}">
735
       <classpath>
736
         <path refid="compile.classpath"/>
737
       </classpath>
738
     </sql>
739 2518 sgarg
   </target>
740
741
742 2395 tao
   <target name="sqlupgrade15" depends="prepare">
743
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
744 2393 tao
      <sql driver="${dbDriver}"
745
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
746
          url="${jdbc-connect}"
747
          userid="${user}"
748
          password="${password}"
749
          src="${build.src}/${upgrade-1.5-sql}" />
750 2444 sgarg
      <sql driver="${dbDriver}"
751
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
752
          url="${jdbc-connect}"
753
          userid="${user}"
754
          password="${password}"
755
          rdbms="oracle"
756
          delimiter="/">
757
        <transaction>
758
           CREATE TRIGGER xml_returnfield_before_insert
759
           BEFORE INSERT ON xml_returnfield FOR EACH ROW
760
           BEGIN
761
              SELECT xml_returnfield_id_seq.nextval
762
                 INTO :new.returnfield_id
763
                 FROM dual;
764
           END;
765
           /
766
        </transaction>
767
        <transaction>
768
           CREATE TRIGGER xml_queryresult_before_insert
769
           BEFORE INSERT ON xml_queryresult FOR EACH ROW
770
           BEGIN
771
              SELECT xml_queryresult_id_seq.nextval
772
              INTO :new.queryresult_id
773
              FROM dual;
774
           END;
775
           /
776
        </transaction>
777
      </sql>
778 2393 tao
   </target>
779 2353 sgarg
780 3072 perry
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
781 3034 perry
           description="Installs spatial option for metacat">
782
783
      <property name="spatial.dir" value="./lib/spatial"/>
784
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
785
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
786
787
      <!-- Copy geoserver libs into ${war.lib} -->
788
      <copy todir="${war.lib}" filtering="no">
789
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
790
          <include name="**"/>
791
        </fileset>
792
      </copy>
793
794
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
795
      <copy todir="${war.webinf}" filtering="no">
796
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
797
          <exclude name="lib/**"/>
798
          <exclude name="web.xml"/>
799
        </fileset>
800
      </copy>
801
802
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
803
      <copy todir="${war.context}" filtering="no">
804
        <fileset dir="${spatial.geoserver.dir}">
805
          <exclude name="WEB-INF/**"/>
806
          <exclude name="index.jsp"/>
807
        </fileset>
808
      </copy>
809
810
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
811
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
812
          tofile="${war.context}/geoserver.jsp"
813
          overwrite="true"
814
          filtering="no"/>
815
816
      <!-- Copy the geoserver/metacat combined web.xml into ${build.war}/web.xml   -->
817
      <copy file="${spatial.webinf-mods}/web.xml.combined"
818
          tofile="${build.war}/web.xml"
819
          overwrite="true"
820
          filtering="no"/>
821
822
      <!-- Copy the rest of the modified geoserver web-inf files
823
      <copy todir="${war.webinf}" filtering="no">
824
        <fileset dir="${spatial.webinf-mods}">
825
          <exclude name="web.xml.combined"/>
826
        </fileset>
827
      </copy> -->
828
829
    </target>
830
831
832 2957 tao
   <target name="install" depends="install-ecogrid" description="* Full Install *">
833 1079 tao
       <mkdir dir="${datafilepath}" />
834 1455 tao
       <mkdir dir="${inlinedatafilepath}" />
835 1079 tao
       <chmod dir="${datafilepath}" perm="ug+w" />
836 1929 brooke
       <mkdir dir="${temp-dir}"/>
837
       <chmod dir="${temp-dir}" perm="ug+w" />
838 2737 jones
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
839 2993 tao
   	   <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo>
840 1952 jones
   </target>
841 2957 tao
842 2965 tao
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
843 2957 tao
			    description="Install Ecogrid Compentent">
844 2965 tao
   	  <copyfile src="lib/metacat.url" dest="${ecogrid-dir}/conf/MetacatImpl/classes/metacat.properties" forceoverwrite="true" filtering="yes"/>
845 2991 berkley
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
846 2977 tao
   	         <property name="context" value="${metacat.context}"/>
847
   	   	     <property name="target" value="${ecogrid-target-name}"/>
848
   	   	     <property name="metacat.dir" value="${metacat.dir}"/>
849
   	  </ant>
850 2991 berkley
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
851 2957 tao
   	     <property name="context" value="${metacat.context}"/>
852
   	     <property name="target" value="${ecogrid-target-name}"/>
853 2965 tao
   	     <property name="metacat.dir" value="${metacat.dir}"/>
854 2957 tao
   	  </ant>
855 2978 tao
   	  <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
856
  	      <webinf dir="${ecogrid-dir}/lib">
857
   	        <include name="server-config.wsdd"/>
858
   	      </webinf>
859
   	  </war>
860 2965 tao
   	  <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
861 2978 tao
862
863 2957 tao
   </target>
864 2965 tao
865
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
866
	<echo>Enter CVS password: </echo>
867
	     <cvs cvsRoot="${cvsroot}"
868
	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
869
   </target>
870
871
872 2175 tao
   <target name="upgrade" depends="install"
873 1952 jones
          description="* Upgrade an existing metacat installation with a new version *">
874 2737 jones
       <unwar src="${deploy.dir}/${metacat.context}.war" dest="${deploy.dir}/${metacat.context}" />
875 1952 jones
   </target>
876 2957 tao
877 2978 tao
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
878 2991 berkley
   	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
879 2957 tao
   	   	 <property name="context" value="${metacat.context}"/>
880
   	   	 <property name="target" value="${ecogrid-target-name}"/>
881 2965 tao
   	     <property name="metacat.dir" value="${metacat.dir}"/>
882 2977 tao
   	     <property name="hostname" value="${config.hostname}"/>
883
   	     <property name="port" value="${config.port}"/>
884 2957 tao
   	 </ant>
885
   </target>
886 2978 tao
887
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
888
      <delete file="${deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
889
   </target>
890 1952 jones
891 2175 tao
   <target name="install-registry" depends="init,getConversionXSL"
892 1952 jones
            description="Install Registry">
893 2175 tao
894 1952 jones
      <copy file="${srcdir}/perl/register-dataset.cgi"
895
            todir="${inst.cgi.dir}" filtering="yes"/>
896
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
897 2175 tao
898 1952 jones
      <mkdir dir="${temp-dir}" />
899 2343 sgarg
      <copy todir="${temp-dir}" filtering="yes">
900
       <fileset dir="lib/style/common/emlb6toeml2">
901 1952 jones
         <include name="*.xsl"/>
902
         <include name="*.xml"/>
903
       </fileset>
904 2343 sgarg
      </copy>
905 1952 jones
906
      <echo message="Install Registry completed." />
907
   </target>
908
909 2343 sgarg
   <target name="install-ldap" depends="init">
910
      <copy file="${srcdir}/perl/ldapweb.cgi"
911
            todir="${inst.cgi.dir}" filtering="yes"/>
912
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
913
      <copy file="lib/ldapweb.cfg"
914
            todir="${inst.cgi.dir}" filtering="yes"/>
915
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
916
      <mkdir dir="${templates.dir}" />
917
      <copy todir="${templates.dir}" filtering="yes">
918
        <fileset dir="lib/style/common/templates">
919
            <include name="${defaultChangePass}"/>
920
            <include name="${defaultResetPass}"/>
921
            <include name="${changePassSuccess}"/>
922
            <include name="${resetPassSuccess}"/>
923
            <include name="${registerFailed}"/>
924
            <include name="${registerLter}"/>
925
            <include name="${registerMatch}"/>
926
            <include name="${registerSuccess}"/>
927
            <include name="${register}"/>
928
            <include name="${searchResults}"/>
929 2974 jones
            <include name="${defaultHeader}"/>
930
            <include name="${defaultFooter}"/>
931
            <include name="${responseForm}"/>
932 2343 sgarg
        </fileset>
933
      </copy>
934
      <echo message="ldapweb install complete." />
935
   </target>
936
937
938 2175 tao
   <target name="install-skin" depends="init"
939 2052 sgarg
            description="Install a Skin">
940
941 2175 tao
      <input message="Please enter name of the skin"
942 2052 sgarg
             addproperty="skin-name"/>
943
944
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
945
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
946
       <fileset dir="lib/style/skins/${skin-name}">
947 3014 costa
           <exclude name="**/*.png"/>
948
           <exclude name="**/*.gif"/>
949
           <exclude name="**/*.jpg"/>
950 2277 jones
           <exclude name="**/CVS*"/>
951
           <exclude name="**/.#*"/>
952 2052 sgarg
       </fileset>
953
      </copy>
954 2054 sgarg
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
955
       <fileset dir="lib/style/skins/${skin-name}">
956 3014 costa
           <include name="**/*.png"/>
957
           <include name="**/*.gif"/>
958
           <include name="**/*.jpg"/>
959 2277 jones
           <exclude name="**/CVS*"/>
960
           <exclude name="**/.#*"/>
961 2054 sgarg
       </fileset>
962
      </copy>
963 2974 jones
      <copy todir="${installdir}/style/common" filtering="yes">
964
       <fileset dir="lib/style/common">
965
           <include name="*.js"/>
966
           <include name="*.jsp"/>
967
           <include name="*.css"/>
968
           <exclude name="*.png"/>
969
           <exclude name="*.gif"/>
970
           <exclude name="*.jpg"/>
971
           <exclude name="**/CVS*"/>
972
           <exclude name="**/.#*"/>
973
       </fileset>
974
      </copy>
975 2277 jones
      <!--
976 2210 jones
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
977
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
978
       <fileset dir="lib/style/skins/${skin-name}/images">
979
           <include name="*.png"/>
980
           <include name="*.gif"/>
981
           <include name="*.jpg"/>
982
       </fileset>
983
      </copy>
984 2277 jones
      -->
985 2052 sgarg
986
      <echo message="Install Skin completed." />
987
   </target>
988
989 3034 perry
   <target name="war" depends="warPrepare,warMSSQL,install-spatial"
990 1952 jones
            description="Create a web archive (WAR) for servlet deployment">
991 2737 jones
       <mkdir dir="${dist.dir}" />
992
       <war destfile="${dist.dir}/${metacat.context}.war"
993 1952 jones
            webxml="${build.war}/web.xml">
994
         <fileset dir="${war.context}"/>
995
         <lib dir="${war.lib}"/>
996
         <webinf dir="${war.webinf}"/>
997
       </war>
998
   </target>
999 2957 tao
1000
1001 1952 jones
1002 2059 costa
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
1003 1952 jones
            description="Prepare files for creating a web archive (WAR)">
1004
1005
       <property name="war.lib" value="${build.war}/lib" />
1006
       <property name="war.webinf" value="${build.war}/WEB-INF" />
1007 2737 jones
       <property name="war.context" value="${build.war}/${metacat.context}" />
1008 1952 jones
       <mkdir dir="${war.lib}" />
1009
       <mkdir dir="${war.webinf}" />
1010
       <mkdir dir="${war.context}" />
1011 2610 tao
1012
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
1013 1952 jones
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
1014
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
1015 2059 costa
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
1016 1952 jones
       <copy todir="${war.lib}" filtering="no">
1017 1823 jones
         <fileset dir="lib">
1018 2610 tao
            <not>
1019
               <filename name="${jdbc-jar-name}"/>
1020
            </not>
1021
            <include name="*.jar"/>
1022 1823 jones
         </fileset>
1023 3059 berkley
         <fileset dir="lib">
1024
           <include name="xalan.jar"/>
1025 1823 jones
         </fileset>
1026
       </copy>
1027 1729 tao
       <copy file="lib/web.xml.${tomcatversion}"
1028 1952 jones
             tofile="${build.war}/web.xml" />
1029
       <copy file="lib/metacat.properties" todir="${war.webinf}"
1030 1951 jones
             filtering="yes" />
1031 2900 sgarg
       <copy todir="${war.webinf}" filtering="yes">
1032
	   	  <fileset dir="lib">
1033
           <include name="skin.configs/**"/>
1034
		  </fileset>
1035
	   </copy>
1036 2583 sgarg
       <copy file="lib/log4j.properties" todir="${war.webinf}"
1037
             filtering="yes" />
1038 1952 jones
       <copy todir="${war.context}" filtering="no">
1039 822 jones
         <fileset dir="lib">
1040
           <include name="**/*.jpg"/>
1041
           <include name="**/*.png"/>
1042
           <include name="**/*.gif"/>
1043 2844 costa
           <include name="LiveMap_30/**"/>
1044 822 jones
         </fileset>
1045
       </copy>
1046 1952 jones
       <copy todir="${war.context}" filtering="yes">
1047 822 jones
         <fileset dir="lib">
1048
           <exclude name="*.jar"/>
1049
           <exclude name="*.properties"/>
1050
           <exclude name="web.xml"/>
1051 1437 berkley
           <exclude name="**/*.jpg"/>
1052
           <exclude name="**/*.png"/>
1053
           <exclude name="**/*.gif"/>
1054 2778 jones
           <exclude name="lsid_lib/**"/>
1055
           <exclude name="lsid_conf/**"/>
1056 2844 costa
           <exclude name="LiveMap_30/**"/>
1057 2900 sgarg
           <exclude name="skin.configs/**"/>
1058 3034 perry
           <exclude name="spatial/geoserver/**"/>
1059
           <exclude name="spatial/WEB-INF/**"/>
1060 822 jones
         </fileset>
1061
       </copy>
1062 1311 berkley
   </target>
1063 1929 brooke
1064 1952 jones
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
1065
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
1066
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
1067 1929 brooke
   </target>
1068
1069 2175 tao
   <target name="getConversionXSL" depends="prepare"
1070 1954 jones
            unless="styles.not.needed"
1071 1939 brooke
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1072 2497 sgarg
1073 1929 brooke
     <echo>Enter CVS password: </echo>
1074 2497 sgarg
     <cvs cvsRoot="${cvsroot}"
1075
          package="${eml-module}"
1076
          tag="${eml2_0_1-tag}"
1077
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
1078 2343 sgarg
1079
     <mkdir dir="lib/style/common/emlb6toeml2" />
1080
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1081 2497 sgarg
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}/lib/beta6toeml2/xsl">
1082 2343 sgarg
         <include name="*.xsl"/>
1083
         <include name="*.xml"/>
1084
       </fileset>
1085
      </copy>
1086 1929 brooke
   </target>
1087
1088 2135 costa
   <target name="testprep" depends="jar,clientjar,harvesterjar">
1089 1783 jones
      <mkdir dir="${build.tests}"/>
1090
      <copy todir="${build.tests}" filtering="yes">
1091
        <fileset dir="${testdir}">
1092
          <include name="edu/**"/>
1093
        </fileset>
1094
      </copy>
1095 971 tao
      <!-- copy and compile the tests into a jar file -->
1096 1783 jones
      <javac srcdir="${build.tests}"
1097
             destdir="${build.tests}"
1098 1612 tao
             debug="on"
1099 2982 jones
             includes="**/*.java">
1100 2599 jones
        <classpath>
1101
          <path refid="compile.classpath"/>
1102
          <fileset dir="${build.dir}">
1103 2982 jones
            <include name="${name}.jar"/>
1104
            <include name="${name}-client.jar"/>
1105
            <include name="harvester.jar"/>
1106 2599 jones
          </fileset>
1107
        </classpath>
1108
      </javac>
1109 204 jones
1110 1311 berkley
      <jar jarfile="${build.dir}/${name}-junittests.jar"
1111 1783 jones
        basedir="${build.tests}"
1112 1311 berkley
                includes="**/*.class" />
1113 1822 jones
   </target>
1114 971 tao
1115 1939 brooke
   <target name="test" depends="testprep"
1116
            description="Uses the ant junit task to run all JUnit tests">
1117 1822 jones
1118 971 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
1119 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1120 971 tao
             haltonerror="no">
1121 1783 jones
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
1122 971 tao
        <classpath>
1123 2599 jones
          <path refid="compile.classpath"/>
1124
          <fileset dir="${build.dir}">
1125 2982 jones
            <include name="${name}.jar"/>
1126
            <include name="${name}-client.jar"/>
1127
            <include name="harvester.jar"/>
1128
            <include name="${name}-junittests.jar"/>
1129 2599 jones
          </fileset>
1130 971 tao
        </classpath>
1131
1132
        <formatter type="plain" />
1133
1134
        <batchtest fork="yes" todir="${build.dir}">
1135 1783 jones
          <fileset dir="${build.tests}">
1136 1116 tao
            <include name="**/*.class" />
1137 971 tao
          </fileset>
1138
        </batchtest>
1139
     </junit>
1140
   </target>
1141 1103 tao
1142 1939 brooke
    <target name="runonetest" depends="testprep"
1143
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1144 1500 tao
1145 1939 brooke
              <echo>testtorun: ${testtorun}</echo>
1146
1147 1500 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
1148 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1149 1500 tao
             haltonerror="no">
1150 2044 tao
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1151 1500 tao
        <classpath>
1152 2599 jones
          <path refid="compile.classpath"/>
1153
          <fileset dir="${build.dir}">
1154 2982 jones
            <include name="${name}.jar"/>
1155
            <include name="${name}-client.jar"/>
1156
            <include name="harvester.jar"/>
1157
            <include name="${name}-junittests.jar"/>
1158 2599 jones
          </fileset>
1159 1500 tao
        </classpath>
1160
1161
        <formatter type="plain" />
1162
1163
        <batchtest fork="yes" todir="${build.dir}">
1164 1783 jones
          <fileset dir="${build.tests}">
1165 1500 tao
            <include name="**/${testtorun}.class" />
1166
          </fileset>
1167
        </batchtest>
1168
     </junit>
1169
   </target>
1170
1171 2175 tao
   <target name="testharvester"
1172 2135 costa
           depends="testprep"
1173
           description="Uses the ant junit task to test only the Harvester code">
1174 2175 tao
     <junit printsummary="yes"
1175
            haltonfailure="off"
1176 2135 costa
            fork="yes"
1177
            haltonerror="off">
1178 2599 jones
        <classpath>
1179
          <path refid="compile.classpath"/>
1180
          <fileset dir="${build.dir}">
1181 2982 jones
            <include name="${name}.jar"/>
1182
            <include name="${name}-client.jar"/>
1183
            <include name="harvester.jar"/>
1184
            <include name="${name}-junittests.jar"/>
1185 2599 jones
          </fileset>
1186
        </classpath>
1187 2135 costa
       <formatter type="plain" />
1188
       <batchtest fork="yes" todir="${build.dir}">
1189
         <fileset dir="${build.tests}">
1190
           <include name="**/harvesterClient/*.class" />
1191
         </fileset>
1192
       </batchtest>
1193
     </junit>
1194
   </target>
1195
1196 1939 brooke
  <target name="gethttpclient" depends="prepare"
1197
            description="checks out and compiles morpho httpclient code">
1198 1311 berkley
  <!--mkdir dir="${morphosourcedir}" -->
1199 1487 tao
        <cvs cvsRoot="${cvsroot}"
1200 1103 tao
             package="morpho"
1201
             dest="." />
1202 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1203 1103 tao
   </target>
1204
1205
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1206 1939 brooke
   <target name="nettest" depends="install"
1207
            description="compiles and runs the metacatnettest code">
1208 2175 tao
1209 1103 tao
      <echo>***********************************
1210 1311 berkley
      Please run ant gethttpclient first!
1211
      ***********************************
1212 1103 tao
      </echo>
1213
      <!-- copy and compile the tests into a jar file -->
1214 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
1215 1103 tao
      <javac srcdir="${junitnettestsdir}"
1216 1116 tao
             destdir="${build.metacatnettest}"
1217 2599 jones
             includes="**/*.java">
1218
        <classpath>
1219
          <path refid="compile.classpath"/>
1220
          <fileset dir="${build.dir}">
1221 2982 jones
            <include name="${name}.jar"/>
1222 2599 jones
          </fileset>
1223
        </classpath>
1224
      </javac>
1225 1103 tao
1226
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1227 1116 tao
                    basedir="${build.metacatnettest}"
1228 1103 tao
                    includes="**/*.class" />
1229
1230
      <!-- use the ant "junit" task to run JUnit tests. -->
1231 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1232 1103 tao
             haltonerror="no">
1233 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1234 1103 tao
        <classpath>
1235 2599 jones
          <path refid="compile.classpath"/>
1236
          <fileset dir="${build.dir}">
1237 2982 jones
            <include name="${name}.jar"/>
1238
            <include name="${name}-junitnettests.jar"/>
1239 2599 jones
          </fileset>
1240 1103 tao
        </classpath>
1241
1242
        <formatter type="plain" />
1243
1244
        <batchtest fork="yes" todir="${build.dir}">
1245 1116 tao
          <fileset dir="${build.metacatnettest}">
1246
            <include name="**/*.class" />
1247 1103 tao
          </fileset>
1248
        </batchtest>
1249
     </junit>
1250 1311 berkley
   </target>
1251 1103 tao
1252 1939 brooke
   <target name="cleanweb" depends="clean"
1253
            description="deletes tomcat web context dir and all its contents">
1254 1522 berkley
     <delete dir="${installdir}" />
1255
   </target>
1256
1257
1258 1939 brooke
   <target name="clean" depends="init"
1259 2320 jones
            description="deletes build dir and files that can be regenerated form the release">
1260 822 jones
       <delete dir="${build.dir}" />
1261 2737 jones
       <delete dir="${dist.dir}" />
1262 2320 jones
   </target>
1263
1264
   <target name="fullclean" depends="clean"
1265
            description="deletes even jars that depend on external sources such as stylesheets and jars">
1266
       <delete file="lib/httpclient.jar" />
1267
       <delete file="lib/utilities.jar" />
1268 1939 brooke
       <delete includeEmptyDirs="true" failonerror="false">
1269
         <fileset dir="${style-common-cvsrelpath}">
1270
           <include name="${eml-css}" />
1271
           <include name="eml-*/*.xsl" />
1272
           <include name="eml-*" />
1273
         </fileset>
1274 2320 jones
       </delete>
1275 113 jones
   </target>
1276
1277 1939 brooke
   <target name="jdoc" depends="prepare"
1278
            description="generates javadoc documentation">
1279 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
1280 516 jones
           sourcepath="${build.src}"
1281
           destdir="${build.javadocs}"
1282 113 jones
           author="true"
1283
           version="true"
1284
           use="true"
1285 348 jones
           windowtitle="${Name} API"
1286
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1287 2599 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1288
         <classpath>
1289
           <path refid="compile.classpath"/>
1290
         </classpath>
1291
       </javadoc>
1292 113 jones
   </target>
1293
1294 2461 sgarg
   <target name="dist"
1295 2965 tao
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1296 1939 brooke
            description="prepares a full release distribution">
1297 806 jones
      <mkdir dir="${dist.dir}"/>
1298
      <delete dir="${ver.dir}" />
1299
      <mkdir dir="${ver.dir}"/>
1300
      <copy todir="${ver.dir}">
1301 1311 berkley
        <fileset dir="."
1302 2401 costa
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1303 806 jones
      </copy>
1304
      <copy todir="${ver.dir}" file="build.xml"/>
1305 2317 jones
      <copy todir="${ver.dir}" file="build.properties"/>
1306 882 jones
1307
      <copy todir="${ver.dir}/docs" filtering="yes">
1308
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1309
      </copy>
1310
      <copy todir="${ver.dir}/docs" filtering="no">
1311
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1312
      </copy>
1313 806 jones
      <copy todir="${ver.dir}/docs/dev">
1314
        <fileset dir="${build.dir}/docs"/>
1315
      </copy>
1316 917 berkley
      <copy todir="${ver.dir}/src">
1317
        <fileset dir="${build.dir}/src"/>
1318
      </copy>
1319 2391 tao
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1320
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1321 2395 tao
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1322 2323 jones
      <!--
1323 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
1324
      <delete dir="./${ver.dir}/dist"/>
1325 2323 jones
      -->
1326 882 jones
      <delete file="./${name}-${release}.zip"/>
1327 1312 tao
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1328 882 jones
      <delete file="./${name}-${release}.tar.gz" />
1329 1312 tao
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1330 1311 berkley
      <gzip zipfile="./${name}-${release}.tar.gz"
1331 882 jones
                src="./${name}-${release}.tar"/>
1332
      <delete file="./${name}-${release}.tar" />
1333 1311 berkley
  </target>
1334 806 jones
1335 1939 brooke
  <target name="distsrc" depends="dist"
1336
            description="prepares a source distribution">
1337 806 jones
      <mkdir dir="${ver.src}"/>
1338
      <copy todir="${ver.src}">
1339
        <fileset dir="./src"/>
1340
      </copy>
1341 2461 sgarg
      <mkdir dir="${util.dir}"/>
1342
      <copy todir="${util.dir}">
1343
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1344
      </copy>
1345 2965 tao
1346
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1347
  	  <copy todir="${ecogrid-dist-dir}">
1348
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1349
  	  </copy>
1350 806 jones
1351 882 jones
      <delete file="./${name}-src-${release}.zip"/>
1352
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1353
      <delete file="./${name}-src-${release}.tar.gz" />
1354
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1355 1311 berkley
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1356 882 jones
                src="./${name}-src-${release}.tar"/>
1357
      <delete file="./${name}-src-${release}.tar" />
1358 807 jones
      <delete dir="${dist.dir}"/>
1359 1311 berkley
  </target>
1360 806 jones
1361 1702 tao
   <target name="stylesheettest">
1362 1939 brooke
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1363 1702 tao
      <param name="displaymodule" expression="${displaymodule}"/>
1364
      <param name="docid" expression="${input}"/>
1365
      <param name="entitytype" expression="${entitytype}"/>
1366
      <param name="entityindex" expression="${entityindex}"/>
1367
      <outputproperty name="method" value="html"/>
1368
      <outputproperty name="standalone" value="yes"/>
1369
      <outputproperty name="encoding" value="iso8859_1"/>
1370
      <outputproperty name="indent" value="yes"/>
1371
    </xslt>
1372
  </target>
1373 2175 tao
1374 1819 tao
 <target name="gridinit" depends="init">
1375
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1376
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1377
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1378
   <property environment="env"/>
1379
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1380 1820 tao
    <path id="webservicepath">
1381
        <pathelement location="."/>
1382
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1383
        <pathelement location="${build.dest}"/>
1384
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1385
           <include name="*.jar"/>
1386
        </fileset>
1387
      </path>
1388 1819 tao
</target>
1389
1390 1821 tao
 <target name="gridprepare" depends="gridinit, prepare">
1391 2175 tao
 </target>
1392
1393 1821 tao
  <target name="compileinterface" depends="clean, gridprepare">
1394 1817 tao
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1395 1811 tao
  </target>
1396 2175 tao
1397 1811 tao
  <target name="generateWSDL" depends="compileinterface">
1398
    <echo message="Generating wsdl from ${interface.name} interface"/>
1399
    <java classname="${java2wsdl.tool}"
1400 1814 tao
          dir="${build.src}" fork="yes"
1401 1811 tao
          classpathref="webservicepath"  failonerror="true" >
1402
      <arg value="-P"/>
1403
      <arg value="${interface.name}PortType"/>
1404
      <arg value="-S"/>
1405
      <arg value="${interface.name}Service"/>
1406
      <arg value="-y"/>
1407
      <arg value="WRAPPED"/>
1408
      <arg value="-u"/>
1409
      <arg value="LITERAL"/>
1410
      <arg value="-l"/>
1411
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1412
      <arg value="-n"/>
1413
      <arg value="http://${services.namespace}/${interface.name}"/>
1414
      <arg value="${interface.package}.${interface.name}"/>
1415
    </java>
1416
  </target>
1417 2175 tao
1418 1811 tao
   <target name="decorateWSDL" depends="generateWSDL">
1419
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1420 1814 tao
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1421 1811 tao
            fork="yes"
1422
            classpathref="webservicepath" failonerror="true" >
1423
        <arg value="${binding.file}"/>
1424
        <arg value="${wsdl.file}"/>
1425
      </java>
1426
   </target>
1427 2175 tao
1428 1811 tao
   <target name="generatestubs" depends="decorateWSDL">
1429
      <echo message=" Generating stubs " />
1430 1814 tao
      <echo message="wsdl file is ${wsdl.file}"/>
1431
      <echo message="build.src is ${build.src}"/>
1432 1811 tao
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1433
            classpathref="webservicepath" failonerror="true" >
1434 1814 tao
         <arg value="${wsdl.file}"/>
1435 1811 tao
    </java>
1436
  </target>
1437 2175 tao
1438 1811 tao
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1439
     <echo message=" Compiling stubs " />
1440
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1441
     <echo message=" Compiling impl " />
1442
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1443
  </target>
1444 2175 tao
1445 1811 tao
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1446
     <echo message=" jar stubs classes " />
1447
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1448
     <echo message=" jar impl classes " />
1449
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1450
  </target>
1451 2175 tao
1452 1811 tao
  <target name="gar" depends="jarStubsAndImpl">
1453
     <echo message=" jar the gar file"/>
1454
     <mkdir dir="${build.dir}/gar"/>
1455
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1456
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1457
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1458 1814 tao
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1459
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1460
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1461
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1462 1811 tao
  </target>
1463 2175 tao
1464 1814 tao
  <target name="compilewebclient" depends="prepare">
1465
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1466
  </target>
1467 2175 tao
1468 1814 tao
  <target name="runwebclient" depends="compilewebclient">
1469 2175 tao
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1470 1814 tao
           dir="${build.dest}" fork="yes"
1471
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1472
         <arg value="${serviceUrl}"/>
1473
         <arg value="${docid}"/>
1474
     </java>
1475
  </target>
1476 2598 harris
1477 2639 harris
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1478 2598 harris
1479
    <echo message="Compiling the metatcat shapefile creator"/>
1480
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1481
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1482
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1483
    </exec>
1484
1485
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1486 2639 harris
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1487 2598 harris
    </exec>
1488
  </target>
1489
1490 2737 jones
    <!-- LSID Authority support -->
1491
    <patternset id="lsid.jars">
1492
        <include name="axis.jar" />
1493 2772 jones
        <include name="commons-discovery-0.2.jar" />
1494 2737 jones
        <include name="jaxrpc.jar" />
1495
        <include name="lsid-client-1.1.1.jar" />
1496
        <include name="lsid-server-1.1.1.jar" />
1497
        <include name="saaj.jar" />
1498 2772 jones
        <include name="wsdl4j-1.5.1.jar" />
1499 2737 jones
        <include name="activation.jar" />
1500
        <include name="castor-0.9.5.jar" />
1501
        <include name="dnsjava-1.3.2.jar" />
1502
        <include name="mail.jar" />
1503 2778 jones
        <include name="commons-logging-1.0.4.jar" />
1504
        <!-- These jars may be needed but seem to not actually be,
1505
             so leaving them out for now
1506
        <include name="axis-ant.jar" />
1507 2737 jones
        -->
1508
        <!--<include name="GenCastor.class" />-->
1509
    </patternset>
1510
    <patternset id="lib.jars">
1511
        <include name="httpclient.jar" />
1512
        <include name="log4j-1.2.12.jar" />
1513
        <include name="utilities.jar" />
1514
        <include name="xercesImpl.jar" />
1515
        <include name="xalan.jar" />
1516
        <include name="xml-apis.jar" />
1517
    </patternset>
1518
1519
    <path id="lsid.classpath">
1520
        <fileset dir="${lsid.lib.dir}">
1521
            <patternset refid="lsid.jars"/>
1522
        </fileset>
1523
        <fileset dir="${lib.dir}">
1524
            <patternset refid="lsid.jars"/>
1525
        </fileset>
1526 3059 berkley
        <fileset dir="${lib.dir}">
1527 2737 jones
            <include name="xalan.jar" />
1528
            <include name="xml-apis.jar" />
1529
        </fileset>
1530
        <fileset dir="${build.dir}">
1531
            <include name="metacat-client.jar" />
1532
        </fileset>
1533
    </path>
1534
1535
    <filterset id="configFilters">
1536
        <filter token="LSID_AUTHORITY_HOSTNAME"
1537
                value="${config.hostname}" />
1538
        <filter token="LSID_AUTHORITY_PORT"
1539
                value="${config.port}" />
1540
        <filter token="METADATA_LABELS"
1541
                value="${config.metadataLabelLsid}" />
1542
        <filter token="METACAT_SERVER"
1543
                value="${config.metacatserver}" />
1544
        <filter token="LSID_AUTHORITY_STRING"
1545
                value="${config.lsidauthority}" />
1546
    </filterset>
1547
1548
    <target name="prepare-lsid"
1549
            depends="prepare,utilities,clientjar"
1550
            description="Configure files prior to compilation">
1551
        <mkdir dir="${lsid.build.dir}" />
1552
        <!-- Copy the properties file into the build -->
1553
        <copy file="${conf.dir}/metacat-lsid.properties"
1554
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1555
              overwrite="true">
1556
            <filterset refid="configFilters" />
1557
        </copy>
1558 2817 jones
        <copy file="${conf.dir}/log4j.properties"
1559
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1560
              overwrite="true">
1561
            <filterset refid="configFilters" />
1562
        </copy>
1563 2737 jones
        <!-- Copy config files into the build -->
1564
        <copy todir="${lsid.build.dir}/WEB-INF">
1565
            <fileset dir="${webinf.dir}"
1566
                     includes="**/*.wsdd" />
1567
        </copy>
1568
        <!-- Copy the metadata configuration files into the build -->
1569
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1570
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1571
            <fileset dir="${conf.dir}"
1572
                     includes="**/*.xml" />
1573
            <fileset dir="${conf.dir}"
1574
                     includes="**/*.xslt" />
1575
            <filterset refid="configFilters" />
1576
        </copy>
1577
        <!-- Copy services files into the build -->
1578
        <mkdir dir="${lsid.build.dir}/services" />
1579
        <copy todir="${lsid.build.dir}/services">
1580
            <fileset dir="${services.dir}" />
1581
            <filterset refid="configFilters" />
1582
        </copy>
1583 2778 jones
        <!-- Copy axis files into the build -->
1584
        <mkdir dir="${lsid.build.dir}" />
1585
        <copy todir="${lsid.build.dir}">
1586
            <fileset dir="${conf.dir}/axis"
1587
                     excludes="*.properties"/>
1588
        </copy>
1589
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1590
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1591
            <fileset dir="${conf.dir}/axis"
1592
                     includes="*.properties"/>
1593
        </copy>
1594 2737 jones
    </target>
1595
1596
    <target name="compile-lsid"
1597
            depends="prepare-lsid"
1598
            description="Compile Java sources">
1599
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1600
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1601
               destdir="${lsid.build.dir}/WEB-INF/classes"
1602
               debug="${compile.debug}"
1603
               deprecation="${compile.deprecation}"
1604
               optimize="${compile.optimize}">
1605
            <classpath refid="lsid.classpath" />
1606
        </javac>
1607
    </target>
1608
1609
    <target name="war-lsid"
1610
            depends="compile-lsid"
1611
            description="Create a war file for the application">
1612
        <mkdir dir="${dist.dir}" />
1613
        <war destfile="${dist.dir}/${authority.context}.war"
1614
             webxml="${webinf.dir}/web.xml">
1615
            <fileset dir="${lsid.build.dir}" />
1616
            <lib dir="${lsid.lib.dir}">
1617
                <patternset refid="lsid.jars"/>
1618
            </lib>
1619
            <lib dir="${lib.dir}">
1620
                <patternset refid="lib.jars"/>
1621
            </lib>
1622 3059 berkley
            <lib dir="${lib.dir}">
1623 2737 jones
                <include name="xalan.jar" />
1624
                <include name="xml-apis.jar" />
1625
            </lib>
1626
            <lib dir="${build.dir}">
1627
                <include name="metacat-client.jar" />
1628
            </lib>
1629
        </war>
1630
    </target>
1631
1632
    <target name="deploy-lsid"
1633
            depends="war-lsid"
1634
            description="Deploy LSID war to servlet container">
1635
        <delete dir="${deploy.dir}/${authority.context}" />
1636
        <delete file="${deploy.dir}/${authority.context}.war" />
1637
        <mkdir dir="${deploy.dir}" />
1638
        <copy todir="${deploy.dir}">
1639
            <fileset dir="${dist.dir}" />
1640
        </copy>
1641
    </target>
1642 113 jones
</project>