Project

General

Profile

« Previous | Next » 

Revision 348

Added by Matt Jones over 24 years ago

Updated build process to now use a copy of the source files so that keyword
substitution can ocur before the build. This allows for substitution of
hardcoded values into the source before the compile. Currently, I am
using this feature to do the following:

1) Substitute a "Release" number into the code
2) Substitute a hardcoded servlet path into the code and html files

By changing the value of "servlet-path" and "installdir" properties in
build.xml, one can now easily install a new version of the servlet in a
different location by simply using "ant install".

View differences:

lib/metacat.html
21 21
    
22 22
    <FRAME SRC="contents.html" BORDER=0 NAME="left">
23 23

  
24
    <FRAME SRC="/xmltodb/servlet/metacat?action=query&query=NCEAS%25&qformat=html&doctype=-//NCEAS//eml-dataset//EN" BORDER=0 NAME="right">
24
    <FRAME SRC="@servlet-path@?action=query&query=NCEAS%25&qformat=html&doctype=-//NCEAS//eml-dataset//EN" BORDER=0 NAME="right">
25 25

  
26 26
    </FRAMESET>
27 27
  </FRAMESET>
lib/queform.html
22 22
<b>MetaCat Query</b> -- a simple database query against MetaCat
23 23
</td></tr>
24 24
<tr><td width="40%" valign="top">
25
<form action="/xmltodb/servlet/metacat" target="right" method="POST">
25
<form action="@servlet-path@" target="right" method="POST">
26 26
  <input type="hidden" name="action" value="query">
27 27
  <input type="text" name="query" value="NCEAS%" size="15">
28 28
  <input type="submit" value="Run query"><br />
lib/validate.html
7 7
</head>
8 8
<body bgcolor="#FFFFFF">
9 9
Insert XML to be validated here:
10
<br><form action="/xmltodb/servlet/metacat" method="POST">
10
<br><form action="@servlet-path@" method="POST">
11 11
<input type="hidden" name="action" value="validate">
12 12
<p><textarea 
13 13
    name="valtext" rows="16" cols="146">&lt;?xml version="1.0"?>
lib/contents.html
22 22
<b>MetaCat Query</b> -- a simple database query against MetaCat
23 23
</td></tr>
24 24
<tr><td width="40%" valign="top">
25
<form action="/xmltodb/servlet/metacat" target="right" method="POST">
25
<form action="@servlet-path@" target="right" method="POST">
26 26
  <input type="hidden" name="action" value="query">
27 27
  <input type="text" name="query" value="NCEAS%" size="15">
28 28
  <input type="submit" value="Run query"><br />
......
36 36
  <option value="any">Any
37 37
  </select>
38 38
</form>
39
<a href="/xmltodb/servlet/metacat?action=Logout" target="_top">Logout</a>
39
<a href="@servlet-path@?action=Logout" target="_top">Logout</a>
40 40
<br /><a href="loadxml.html" target="right">Load an XML Document</a>
41 41
<br /><a href="validate.html" target="right">Validate an XML Document</a>
42 42
<br /><a href="../docs/" target="top">Browse the API for the Servlet</a>
lib/loadxml.html
19 19
<p>
20 20
Upload, Change, or Delete an XML document using this form.
21 21
</p>
22
<form action="/xmltodb/servlet/metacat" target="right" method="POST">
22
<form action="@servlet-path@" target="right" method="POST">
23 23
  <strong>1. Choose an action: </strong>
24 24
  <input type="radio" name="action" value="insert" checked> Insert
25 25
  <input type="radio" name="action" value="update"> Update
lib/index.html
21 21
    
22 22
    <FRAME SRC="queform.html" BORDER=0 NAME="left">
23 23

  
24
    <FRAME SRC="/xmltodb/servlet/metacat?action=query&query=NCEAS%25&qformat=html&doctype=-//NCEAS//eml-dataset//EN" BORDER=0 NAME="right">
24
    <FRAME SRC="@servlet-path@?action=query&query=NCEAS%25&qformat=html&doctype=-//NCEAS//eml-dataset//EN" BORDER=0 NAME="right">
25 25

  
26 26
    </FRAMESET>
27 27
  </FRAMESET>
lib/login.html
24 24

  
25 25
  <P>&nbsp;
26 26

  
27
  <FORM ACTION="/xmltodb/servlet/metacat" METHOD="POST">
27
  <FORM ACTION="@servlet-path@" METHOD="POST">
28 28
    <INPUT TYPE="hidden" NAME="action" VALUE="Login">
29 29
    <P>Username &nbsp;&nbsp;&nbsp;
30 30
    <INPUT TYPE="text" NAME="username" SIZE="15">
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
4 4
 *  Copyright: 2000 Regents of the University of California and the
5 5
 *             National Center for Ecological Analysis and Synthesis
6 6
 *    Authors: Matt Jones, Dan Higgins, Jivka Bojilova
7
 *    Release: @release@
7 8
 *
8 9
 *   '$Author$'
9 10
 *     '$Date$'
......
877 878

  
878 879
/**
879 880
 * '$Log$
881
 * 'Revision 1.66  2000/08/14 18:27:37  bojilova
882
 * 'added Logout handling
883
 * '
880 884
 * 'Revision 1.64  2000/08/11 22:20:04  jones
881 885
 * 'Changed exception handling mechanisms for DBReader
882 886
 * '
build.xml
16 16
<project name="metacat" default="jar" basedir=".">
17 17
   <target name="init">
18 18
      <property name="installdir" value="/opt/tomcat/webapps/xmltodb" />
19
      <property name="destdir" value="./classes" />
19
      <property name="name" value="metacat"/>
20
      <property name="Name" value="MetaCat"/>
21
      <property name="release" value="1.0a6"/>
22
      <property name="servlet-path" value="/xmltodb/servlet/metacat"/>
23

  
24
      <filter token="release" value="${release}"/>
25
      <filter token="servlet-path" value="${servlet-path}"/>
26

  
20 27
      <property name="srcdir" value="./src" />
28

  
29
      <property name="build.dir" value="./build"/>
30
      <property name="build.src" value="${build.dir}/src"/>
31
      <property name="build.dest" value="${build.dir}/classes"/>
32
      <property name="build.docs" value="${build.dir}/docs/html"/>
33
      <property name="build.samples" value="${build.dir}/samples"/>
34
      <property name="build.tests" value="${build.dir}/tests"/>
35
      <property name="build.data" value="${build.dir}/data"/>
36
      <property name="build.javadocs" value="${build.dir}/docs/apiDocs"/>
37

  
21 38
      <property name="oracle_home" 
22 39
                value="/oracle01/app/oracle/product/8.1.6" />
23 40
      <property name="toolsdir" 
......
37 54
      <property name="cpath" 
38 55
                value="${xmlp2}:${xmlp}:${jdbc}:${jserv}:${jsdk}:${srb}"/>
39 56
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
40
      <mkdir dir="${destdir}" />
57

  
41 58
   </target>
42 59
   
43
   <target name="compile" depends="init">
44
       <javac srcdir="${srcdir}" 
45
              destdir="${destdir}" 
60
   <target name="prepare" depends="init">
61
      <mkdir dir="${build.dir}"/>
62
      <mkdir dir="${build.src}"/>
63
      <mkdir dir="${build.dest}"/>
64

  
65
      <copydir src="${srcdir}" 
66
               dest="${build.src}" 
67
               filtering="yes"
68
               includes="edu/**, com/**"
69
               excludes="**/CVS* **/.#* **/*.sql"/>
70

  
71
      <!-- substitute tokens as needed -->
72
<!--
73
      <replace file="${build.src}/${version.file}" 
74
               token="@@version@@" value="${version}"/>
75
-->
76
   </target>
77

  
78
   <target name="compile" depends="prepare">
79
       <javac srcdir="${build.src}" 
80
              destdir="${build.dest}" 
46 81
              classpath="${cpath}" 
47 82
              excludes="**/*.sql" /> 
48 83
       <copyfile src="lib/metacat.properties" 
49
                 dest="${destdir}/${package.home}/metacat.properties" />
84
                 dest="${build.dest}/${package.home}/metacat.properties" />
50 85
       <copyfile src="lib/marine/marine.properties" 
51
                 dest="${destdir}/${package.home}/marine/marine.properties" />
86
                 dest="${build.dest}/${package.home}/marine/marine.properties"/>
52 87
   </target> 
53 88

  
54 89
   <target name="jar" depends="compile">
55
       <delete file="lib/metacat.jar" />
56
       <copydir src="lib/srbrmi" dest="${destdir}" />
57
       <jar jarfile="lib/metacat.jar" basedir="${destdir}" />
90
       <delete file="${build.dest}/${name}.jar" />
91
       <copydir src="lib/srbrmi" dest="${build.dest}" />
92
       <jar jarfile="${build.dest}/${name}.jar" basedir="${build.dest}" />
58 93
   </target> 
59 94

  
60 95
   <target name="install" depends="jar">
61 96
       <mkdir dir="${installdir}/WEB-INF/lib" />
62
       <copyfile src="lib/metacat.jar" 
63
                 dest="${installdir}/WEB-INF/lib/metacat.jar" />
97
       <copyfile src="${build.dest}/${name}.jar" 
98
                 dest="${installdir}/WEB-INF/lib/${name}.jar" />
64 99
       <copyfile src="${xmlp2}" 
65 100
                 dest="${installdir}/WEB-INF/lib/xerces.jar" />
66 101
       <copyfile src="${xmlp}" 
......
70 105
       <copyfile src="lib/web.xml" 
71 106
                 dest="${installdir}/WEB-INF/web.xml" />
72 107
       <copydir src="lib" dest="${installdir}"
108
                filtering="yes"
73 109
                excludes="*.jar,*.properties,web.xml,**/srbrmi/*" />
74 110
       <copydir src="images" dest="${installdir}" />
75 111
   </target> 
76 112

  
77 113
   <target name="clean" depends="init">
78
       <delete file="lib/metacat.jar" />
79
       <deltree dir="${destdir}" />
114
       <deltree dir="${build.dir}" />
80 115
   </target>
81 116

  
82 117
   <target name="jdoc" depends="init">
......
86 121
           author="true"
87 122
           version="true"
88 123
           use="true"
89
           windowtitle="MetaCat API"
90
           doctitle="&lt;h1&gt;MetaCat Server&lt;/h1&gt;"
124
           windowtitle="${Name} API"
125
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
91 126
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
92 127
       />
93 128
   </target>

Also available in: Unified diff