Project

General

Profile

« Previous | Next » 

Revision 329

Added by Matt Jones over 24 years ago

-Reorganized xmltodb module to support new install process for the new
linux server (dev.nceas.ucsb.edu). Added "build.sh" shell script that
calls ant withthe proper umask set for installation. Use:

./build.sh install

to post a new copy of the servlet and its supporting files to the install
directory defined in build.xml.

-Updated the servlet to use a new servlet prefix that we'll use with the
Tomcat servlet engine.

-Update bin dir shell scripts to reflect new locations of relevant jar files.

View differences:

Makefile
1
# For Win32, make 'SEP' be a semicolon
2
SEP=:
3
#CPATH=../../xml.jar$(SEP)$(JAVA_HOME)/lib/classes.zip
4
CPATH=/home/httpd/servlets/xsql/lib/xmlparserv2.jar$(SEP)$(ORACLE_HOME)/jdbc/lib/classes111.zip$(SEP)/usr/lib/apache/ApacheJServ.jar$(SEP)/home/httpd/classes/servlet-2.0.jar$(SEP)./classes$(SEP)catalog.jar$(SEP)./classes
5

  
6
USER=jones
7
PW=your-pw-goes-here
8

  
9
JAVAC=javac -d classes
10

  
11
JAVASRC=BasicElement.java \
12
	DBDTDHandler.java \
13
	DBEntityResolver.java \
14
	DBReader.java \
15
	DBSAXDocument.java \
16
	DBSAXElement.java \
17
	DBSAXHandler.java \
18
	DBSAXWriter.java \
19
	DBSimpleQuery.java \
20
	DBTransform.java \
21
	GenericXMLValidate.java \
22
	MetaCatServlet.java \
23
	ReaderElement.java \
24
	XMLValidate.java
25

  
26
default: all
27

  
28
all: orasax reader query servlet xvalid transform
29

  
30
transform:
31
	$(JAVAC) -classpath "$(CPATH)" \
32
		DBTransform.java
33

  
34
xvalid:
35
	$(JAVAC) -classpath "$(CPATH)" \
36
		XMLValidate.java \
37
		GenericXMLValidate.java
38

  
39
orasax: util
40
	$(JAVAC) -classpath "$(CPATH)" \
41
		DBSAXWriter.java \
42
		BasicElement.java \
43
		DBSAXElement.java \
44
		DBSAXHandler.java \
45
		DBEntityResolver.java \
46
		DBDTDHandler.java \
47
		DBSAXDocument.java
48
		
49
sundom:
50
	$(JAVAC) -classpath "$(CPATH)" \
51
		DBWriter.java \
52
		DBElement.java
53
		
54
reader: util
55
	$(JAVAC) -classpath "$(CPATH)" \
56
		DBReader.java \
57
		BasicElement.java \
58
		ReaderElement.java
59

  
60
query: util
61
	$(JAVAC) -classpath "$(CPATH)" \
62
		DBSimpleQuery.java
63

  
64
servlet: query reader orasax xvalid transform
65
	$(JAVAC) -classpath "$(CPATH)" MetaCatServlet.java
66
	cp -r classes/edu /home/httpd/servlets/
67
	cp metacat.properties /home/httpd/servlets/edu/ucsb/nceas/metacat/
68

  
69
util: 
70
	$(JAVAC) -classpath "$(CPATH)" \
71
		MetaCatUtil.java
72

  
73
test:
74
	java -cp $(CPATH) edu.ucsb.nceas.metacat.DBSAXWriter \
75
		test.xml $(USER) $(PW)
76

  
77
test1:
78
	java -cp $(CPATH) edu.ucsb.nceas.metacat.DBSAXWriter \
79
		test.xml $(USER) $(PW) \
80
		jdbc:oracle:thin:@localhost:1521:test
81

  
82
rdtest:
83
	java -cp $(CPATH) edu.ucsb.nceas.metacat.DBReader 1 $(USER) $(PW) 
84

  
85
rdtest1:
86
	java -cp $(CPATH) edu.ucsb.nceas.metacat.DBReader 11 $(USER) $(PW) 
87

  
88
qtest:
89
	java -cp $(CPATH) edu.ucsb.nceas.metacat.DBSimpleQuery \
90
		Value1 $(USER) $(PW) 
91

  
92
qtest1:
93
	java -cp $(CPATH) edu.ucsb.nceas.metacat.DBSimpleQuery \
94
		lakename $(USER) $(PW) 
95

  
96
xvtest:
97
	java -cp $(CPATH) XMLValidate \
98
		test.xml
99

  
100
trantest:
101
	java -cp $(CPATH) edu.ucsb.nceas.metacat.DBTransform \
102
		$(USER) $(PW) 
103

  
104
javadoc:
105
	cp $(JAVASRC) ./classes/edu/ucsb/nceas/metacat
106
	javadoc -classpath $(CPATH) -d docs \
107
		-sourcepath ./classes edu.ucsb.nceas.metacat
108
        #-rm ./classes/edu/ucsb/nceas/metacat/*.java
109

  
110
clean:
111
	-rm -f *.class Log classes/edu/ucsb/nceas/metacat/*.class classes/*.class
112 0

  
test-query.xml
1 1
<?xml version="1.0"?>
2 2
<!DOCTYPE pathquery PUBLIC "-//NCEAS//pathquery-1.0//EN" 
3
          "file:///home/jones/projects/pbi/development/xmltodb/lib/pathquery.dtd" >
3
          "file:///home/computer/jones/projects/pbi/development/xmltodb/lib/pathquery.dtd" >
4 4
<pathquery version="1.0">
5 5
  <meta_file_id>Example-03</meta_file_id>
6 6
  <querytitle>Test query</querytitle>
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="/servlets/MetaCatServlet" target="right" method="POST">
25
<form action="/xmltodb/servlet/metacat" 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/test-query.xml
1 1
<?xml version="1.0"?>
2 2
<!DOCTYPE pathquery PUBLIC "-//NCEAS//pathquery-1.0//EN" 
3
          "file:///home/jones/projects/pbi/development/xmltodb/lib/pathquery.dtd" >
3
          "file:///home/computer/jones/projects/pbi/development/xmltodb/lib/pathquery.dtd" >
4 4
<pathquery version="1.0">
5 5
  <meta_file_id>Example-03</meta_file_id>
6 6
  <querytitle>Test query</querytitle>
lib/validate.html
7 7
</head>
8 8
<body bgcolor="#FFFFFF">
9 9
Insert XML to be validated here:
10
<br><form action="/servlets/MetaCatServlet" method="POST">
10
<br><form action="/xmltodb/servlet/metacat" 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/resultset.xsl
20 20
  <xsl:template match="/">
21 21
    <html>
22 22
      <head>
23
	<link rel="stylesheet" type="text/css" href="/xmltodb/lib/rowcol.css" />
23
	<link rel="stylesheet" type="text/css" href="/xmltodb/rowcol.css" />
24 24
      </head>
25 25
      <body class="emlbody">
26 26
	<center>
......
28 28
          for query <xsl:value-of select="resultset/query"/>
29 29
        </center>
30 30
        
31
        <form action="/servlets/MetaCatServlet" method="POST">
31
        <form action="/xmltodb/servlet/metacat" method="POST">
32 32
        <input type="hidden" name="action" value="getdocument"/>
33 33

  
34 34
        <xsl:text>Output Format: </xsl:text>
......
67 67
                <xsl:attribute name="src">
68 68
                  <xsl:choose>
69 69
                    <xsl:when test="position() 
70
                         mod 2 = 1">/xmltodb/images/bttns-white.png</xsl:when>
70
                         mod 2 = 1">/xmltodb/bttns-white.png</xsl:when>
71 71
                    <xsl:when test="position() 
72
                         mod 2 = 0">/xmltodb/images/bttns-blue.jpg</xsl:when>
72
                         mod 2 = 0">/xmltodb/bttns-blue.jpg</xsl:when>
73 73
                  </xsl:choose>
74 74
                </xsl:attribute>
75 75
                <xsl:attribute name="name">
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="/servlets/MetaCatServlet" target="right" method="POST">
25
<form action="/xmltodb/servlet/metacat" 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/style/resultset.xsl
20 20
  <xsl:template match="/">
21 21
    <html>
22 22
      <head>
23
	<link rel="stylesheet" type="text/css" href="/xmltodb/lib/rowcol.css" />
23
	<link rel="stylesheet" type="text/css" href="/xmltodb/rowcol.css" />
24 24
      </head>
25 25
      <body class="emlbody">
26 26
	<center>
......
28 28
          for query <xsl:value-of select="resultset/query"/>
29 29
        </center>
30 30
        
31
        <form action="/servlets/MetaCatServlet" method="POST">
31
        <form action="/xmltodb/servlet/metacat" method="POST">
32 32
        <input type="hidden" name="action" value="getdocument"/>
33 33

  
34 34
        <xsl:text>Output Format: </xsl:text>
......
67 67
                <xsl:attribute name="src">
68 68
                  <xsl:choose>
69 69
                    <xsl:when test="position() 
70
                         mod 2 = 1">/xmltodb/images/bttns-white.png</xsl:when>
70
                         mod 2 = 1">/xmltodb/bttns-white.png</xsl:when>
71 71
                    <xsl:when test="position() 
72
                         mod 2 = 0">/xmltodb/images/bttns-blue.jpg</xsl:when>
72
                         mod 2 = 0">/xmltodb/bttns-blue.jpg</xsl:when>
73 73
                  </xsl:choose>
74 74
                </xsl:attribute>
75 75
                <xsl:attribute name="name">
lib/loadxml.html
19 19
<p>
20 20
Upload, Change, or Delete an XML document using this form.
21 21
</p>
22
<form action="/servlets/MetaCatServlet" target="right" method="POST">
22
<form action="/xmltodb/servlet/metacat" 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/metacat.properties
4 4
# '$Id$'
5 5
#
6 6
user=jones
7
password=your-pw-goes-here
8
defaultDB=jdbc:oracle:thin:@heen:1521:test
7
password=kinkaj0u
8
defaultDB=jdbc:oracle:thin:@24.237.21.98:1521:test
9 9
dbDriver=oracle.jdbc.driver.OracleDriver
10 10
initialConnections=10
11 11
incrementConnections=5
12 12
maximumConnections=20
13
resultStyleURL=file:///home/httpd/html/xmltodb/lib/resultset.xsl
14
xmlcatalogfile=/home/httpd/html/xmltodb/lib/catalog.txt
13
resultStyleURL=file:///opt/tomcat/webapps/xmltodb/resultset.xsl
14
xmlcatalogfile=/opt/tomcat/webapps/xmltodb/catalog.txt
15 15
defaultdatapath=C:\Temp\
16 16
executescript=test.bat
17 17
defaultGlobalName=NCEAS
lib/index.html
21 21
    
22 22
    <FRAME SRC="queform.html" BORDER=0 NAME="left">
23 23

  
24
    <FRAME SRC="/servlets/MetaCatServlet?action=query&query=NCEAS%25&qformat=html&doctype=-//NCEAS//eml-dataset//EN" BORDER=0 NAME="right">
24
    <FRAME SRC="/xmltodb/servlet/metacat?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="/servlets/MetaCatServlet" METHOD="POST">
27
  <FORM ACTION="/xmltodb/servlet/metacat" 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/MetaCatUtil.java
65 65
     // Load the Oracle JDBC driver
66 66
     Class.forName (dbDriver);
67 67

  
68
     debugMessage("Opening connection: " + connection);
68 69
     // Connect to the database
69 70
     Connection conn = DriverManager.getConnection( connection, user, password);
70 71
     return conn;
......
236 237

  
237 238
/**
238 239
 * '$Log$
240
 * 'Revision 1.12  2000/08/04 23:34:10  bojilova
241
 * 'more precise handling of the Connection Pool
242
 * '
239 243
 * 'Revision 1.11  2000/08/01 18:26:50  bojilova
240 244
 * 'added Pool of Connections
241 245
 * 'DBQuery, DBReader, DBTransform, DBUtil are created on every request and use the connections from the Pool
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
226 226
    } else if (action.equals("Logout")) {
227 227
      HttpSession sess = request.getSession(false);
228 228
      if (sess != null) { sess.invalidate();  }    
229
      response.sendRedirect("/xmltodb/lib/login.html"); 
229
      response.sendRedirect("/xmltodb/login.html"); 
230 230
    // aware of session expiration on every request  
231 231
    } else {    
232 232
      HttpSession sess = request.getSession(false);
......
234 234
        // session expired or has not been stored b/w user requests
235 235
        // or anonymous user access with query privs only by default;
236 236
        // redirect to default page for query only access
237
//        response.sendRedirect("/xmltodb/lib/index.html"); 
237
//        response.sendRedirect("/xmltodb/index.html"); 
238 238
//      } 
239 239
    }    
240 240
// End of Jivka added
......
300 300
                    out.println("</success>");
301 301
                } else {
302 302
                    response.sendRedirect(
303
                    response.encodeRedirectUrl("/xmltodb/lib/index.html"));
303
                    response.encodeRedirectUrl("/xmltodb/index.html"));
304 304
                }    
305 305
            } catch ( java.io.IOException ioe) {
306 306
                sess.disconnect();            
......
784 784

  
785 785
/**
786 786
 * '$Log$
787
 * 'Revision 1.59  2000/08/08 00:31:20  bojilova
788
 * 'rearrange html pages for login and metacat access
789
 * '
787 790
 * 'Revision 1.58  2000/08/04 23:34:09  bojilova
788 791
 * 'more precise handling of the Connection Pool
789 792
 * '
bin/loadxml
1 1
#!/bin/sh
2 2

  
3
export PARSER=/home/httpd/servlets/xerces.jar
4
export PDIR=/home/jones/projects/pbi/development/xmltodb
5
export JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
3
PARSER=/usr/local/devtools/xerces-1_1_3/xerces.jar
4
PDIR=/home/computer/jones/projects/pbi/development/xmltodb
5
JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
6 6

  
7 7
export CPATH=$PDIR/lib/metacat.jar:$PARSER:$JDBC
8 8

  
bin/xml2sql
1 1
#!/bin/sh
2 2

  
3
export PARSER=/home/jones/software/xml-xerces/java/build/xerces.jar
4
export PDIR=/home/jones/projects/pbi/development/xmltodb
5
export JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
3
PARSER=/usr/local/devtools/xerces-1_1_3/xerces.jar
4
PDIR=/home/computer/jones/projects/pbi/development/xmltodb
5
JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
6 6

  
7 7
export CPATH=$PDIR/lib/metacat.jar:$PARSER:$JDBC
8 8

  
bin/valxml
1 1
#!/bin/sh
2 2

  
3
PARSER=/home/jones/software/xml-xerces/java/build/xerces.jar
4
PDIR=/home/jones/projects/pbi/development/xmltodb
3
PARSER=/usr/local/devtools/xerces-1_1_3/xerces.jar
4
PDIR=/home/computer/jones/projects/pbi/development/xmltodb
5 5
JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
6 6

  
7 7
export CPATH=$PDIR/lib/metacat.jar:$PARSER:$JDBC
bin/queryxml
1 1
#!/bin/sh
2 2

  
3
export PARSER=/home/jones/software/xml-xerces/java/build/xerces.jar
4
export PDIR=/home/jones/projects/pbi/development/xmltodb
5
export JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
3
PARSER=/usr/local/devtools/xerces-1_1_3/xerces.jar
4
PDIR=/home/computer/jones/projects/pbi/development/xmltodb
5
JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
6 6

  
7 7
export CPATH=$PDIR/lib/metacat.jar:$PARSER:$JDBC
8 8

  
bin/squeryxml
1 1
#!/bin/sh
2 2

  
3
export PARSER=/home/jones/software/xml-xerces/java/build/xerces.jar
4
export PDIR=/home/jones/projects/pbi/development/xmltodb
5
export JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
3
PARSER=/usr/local/devtools/xerces-1_1_3/xerces.jar
4
PDIR=/home/computer/jones/projects/pbi/development/xmltodb
5
JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
6 6

  
7 7
export CPATH=$PDIR/lib/metacat.jar:$PARSER:$JDBC
8 8

  
bin/readxml
1 1
#!/bin/sh
2 2

  
3
export PARSER=/home/jones/software/xml-xerces/java/build/xerces.jar
4
export PDIR=/home/jones/projects/pbi/development/xmltodb
5
export JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
3
PARSER=/usr/local/devtools/xerces-1_1_3/xerces.jar
4
PDIR=/home/computer/jones/projects/pbi/development/xmltodb
5
JDBC=${ORACLE_HOME}/jdbc/lib/classes111.zip
6 6

  
7 7
export CPATH=$PDIR/lib/metacat.jar:$PARSER:$JDBC
8 8

  
build.sh
1
#!/bin/sh
2
#
3
# Build script to call the ant build system
4
#
5
umask 002; ant $*
0 6

  
build.xml
13 13
  *
14 14
  * usage: ant [compile|jar|install|jdoc]
15 15
--> 
16
<project name="metacat" default="compile" basedir=".">
16
<project name="metacat" default="jar" basedir=".">
17 17
   <target name="init">
18
      <property name="installdir" value="/home/httpd/servlets/" />
18
      <property name="installdir" value="/opt/tomcat/webapps/xmltodb" />
19 19
      <property name="destdir" value="./classes" />
20 20
      <property name="srcdir" value="./src" />
21 21
      <property name="oracle_home" 
22
                value="/oracle01/app/oracle/product/8.1.5" />
22
                value="/oracle01/app/oracle/product/8.1.6" />
23
      <property name="toolsdir" 
24
                value="/usr/local/devtools" />
23 25
      <property name="xmlp" 
24
                value="/home/httpd/servlets/xsql/lib/xmlparserv2.jar" />
26
                value="${toolsdir}/OracleXSU111/lib/xmlparserv2.jar" />
25 27
      <property name="xmlp2" 
26
                value="/home/httpd/servlets/xerces.jar" />
28
                value="${toolsdir}/xerces-1_1_3/xerces.jar" />
27 29
      <property name="jdbc" 
28 30
                value="${oracle_home}/jdbc/lib/classes111.zip" />
29 31
      <property name="jserv" 
30 32
                value="/usr/lib/apache/ApacheJServ.jar" />
31 33
      <property name="jsdk" 
32
                value="/home/httpd/classes/servlet-2.0.jar" />
34
                value="${toolsdir}/jakarta-tomcat/lib/servlet.jar" />
33 35
      <property name="srb" 
34 36
                value="lib/srbrmi" />
35 37
      <property name="cpath" 
......
56 58
   </target> 
57 59

  
58 60
   <target name="install" depends="jar">
59
       <copyfile src="lib/metacat.jar" dest="${installdir}/metacat.jar" />
61
       <mkdir dir="${installdir}/WEB-INF/lib" />
62
       <copyfile src="lib/metacat.jar" 
63
                 dest="${installdir}/WEB-INF/lib/metacat.jar" />
64
       <copyfile src="${xmlp2}" 
65
                 dest="${installdir}/WEB-INF/lib/xerces.jar" />
66
       <copyfile src="${xmlp}" 
67
                 dest="${installdir}/WEB-INF/lib/xmlparserv2.jar" />
68
       <copyfile src="${jdbc}" 
69
                 dest="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
70
       <copyfile src="lib/web.xml" 
71
                 dest="${installdir}/WEB-INF/web.xml" />
72
       <copydir src="lib" dest="${installdir}"
73
                excludes="*.jar,*.properties,web.xml,**/srbrmi/*" />
74
       <copydir src="images" dest="${installdir}" />
60 75
   </target> 
61 76

  
62 77
   <target name="clean" depends="init">

Also available in: Unified diff