Index: lib/queform.html
===================================================================
--- lib/queform.html	(nonexistent)
+++ lib/queform.html	(revision 311)
@@ -0,0 +1,53 @@
+<!--
+  * queform.html
+  *
+  *      Authors: Jivka Bojilova
+  *    Copyright: 2000 Regents of the University of California and the
+  *               National Center for Ecological Analysis and Synthesis
+  *  For Details: http://www.nceas.ucsb.edu/
+  *      Created: 2000 April 5
+  *      Version: 0.01
+  *    File Info: '$Id$'
+  * 
+  * This is an HTML document for displaying examples of the use of 
+  * Oracle XML tools for query only
+-->
+<html>
+<head>
+<title>MetaCat</title>
+</head>
+<body bgcolor="white">
+<table width="100%">
+<tr><td colspan="2">
+<b>MetaCat Query</b> -- a simple database query against MetaCat
+</td></tr>
+<tr><td width="40%" valign="top">
+<form action="/servlets/MetaCatServlet" target="right" method="POST">
+  <input type="hidden" name="action" value="query">
+  <input type="text" name="query" value="NCEAS%" size="15">
+  <input type="submit" value="Run query"><br />
+  Format: 
+  <input type="radio" name="qformat" value="xml">XML
+  <input type="radio" name="qformat" value="html" checked>HTML
+  <br />
+  Return: &nbsp;
+  <select name=doctype>
+  <option value="-//NCEAS//eml-dataset//EN">eml-dataset
+  <option value="any">Any
+  </select>
+</form>
+</td>
+<td valign="top">
+<font size="-1">
+For the test database, some valid values for the search that produce document
+results include "Value1" and "lakename" and maybe "122W"
+<p>
+To view results that are XML formatted in this demo, it is easiest to use 
+Internet Explorer 5. Although Netscape browsers will allow you to 
+download XML documents, only IE5 will display XML at this time.
+</font>
+</td>
+</tr>
+</table>
+</body>
+</html>

Property changes on: lib/queform.html
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/sexpire.html
===================================================================
--- lib/sexpire.html	(revision 310)
+++ lib/sexpire.html	(revision 311)
@@ -9,7 +9,7 @@
   *      Version: 0.01
   *    File Info: '$Id$'
   * 
-  * This is an HTML document for displaying metadata catalog tools
+  * This is an HTML document for showing session expiration message
 -->
 <HTML>
 <HEAD>
Index: lib/query.html
===================================================================
--- lib/query.html	(nonexistent)
+++ lib/query.html	(revision 311)
@@ -0,0 +1,27 @@
+<!--
+  * query.html
+  *
+  *      Authors: Jivka Bojilova
+  *    Copyright: 2000 Regents of the University of California and the
+  *               National Center for Ecological Analysis and Synthesis
+  *  For Details: http://www.nceas.ucsb.edu/
+  *      Created: 2000 April 5
+  *      Version: 0.01
+  *    File Info: '$Id$'
+  * 
+  * This is an HTML document for displaying metadata catalog tools
+-->
+  <HTML>
+  <HEAD>
+  <TITLE>MetaCat</TITLE>
+  </HEAD> 
+  <FRAMESET COLS="*" FRAMEBORDER=0 BORDER=0>
+
+    <FRAMESET ROWS="165,*"  FRAMEBORDER=0 BORDER=0>
+    
+    <FRAME SRC="queform.html" BORDER=0 NAME="left">
+
+    <FRAME SRC="/servlets/MetaCatServlet?action=query&query=NCEAS%25&qformat=html&doctype=-//NCEAS//eml-dataset//EN" BORDER=0 NAME="right">
+
+    </FRAMESET>
+  </FRAMESET>

Property changes on: lib/query.html
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/login.html
===================================================================
--- lib/login.html	(revision 310)
+++ lib/login.html	(revision 311)
@@ -9,24 +9,39 @@
   *      Version: 0.01
   *    File Info: '$Id$'
   * 
-  * This is an HTML document for displaying metadata catalog tools
+  * This is an HTML document for login to MetaCat
 -->
 <HTML>
 <HEAD>
 <TITLE>MetaCat</TITLE>
+<script language="JavaScript">
+   function PutFocus(theForm) {
+	theForm.Go.focus()
+   }
+</script>
 </HEAD>
-<BODY bgcolor="#FFFFFF">
+<BODY bgcolor="#FFFFFF" onLoad="PutFocus(document.forms[0]);">
 
   <P>&nbsp;
-  <P>
+
   <FORM ACTION="/servlets/MetaCatServlet" METHOD="POST">
+    Login as "anonymous" user in <b>MetaCat</b>
     <INPUT TYPE="hidden" NAME="action" VALUE="Login">
-    <P>Username
+    <INPUT TYPE="hidden" NAME="username" VALUE="anonymous">
+    <INPUT TYPE="hidden" NAME="password">
+    <INPUT TYPE="submit" NAME="Go" VALUE=" Go ">
+  </FORM>
+
+  <HR WIDTH="300" ALIGN="left">
+
+  <FORM ACTION="/servlets/MetaCatServlet" METHOD="POST">
+    Login as registered user in <b>MetaCat</b>
+    <INPUT TYPE="hidden" NAME="action" VALUE="Login">
+    <P>Username &nbsp;&nbsp;&nbsp;
     <INPUT TYPE="text" NAME="username" SIZE="15">
-    <P>Password
-    <INPUT TYPE="password" NAME="password" SIZE="15">
-    <P>
-    <INPUT TYPE="submit" VALUE="Login">
+    <P>Password &nbsp;&nbsp;&nbsp;
+    <INPUT TYPE="password" NAME="password" SIZE="15">&nbsp;&nbsp;&nbsp;
+    <INPUT TYPE="submit" VALUE=" Login ">
   </FORM>
 
 </BODY>
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 310)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 311)
@@ -80,11 +80,6 @@
   private ServletConfig		config = null;
   private ServletContext	context = null;
   private Hashtable 		connectionPool = new Hashtable();
-  //private connection  conn = null;
-  //private DBQuery		queryobj = null;
-  //private DBReader    docreader = null;
-  //private DBTransform dbt = null;
-  //private DBUtil      dbutil = null;
   private String 		resultStyleURL = null;
   private String 		xmlcatalogfile = null;
   private String 		saxparser = null;
@@ -124,21 +119,6 @@
         System.err.println("Error creating pool of database connections");
         System.err.println(e.getMessage());
       }
-/*
-      try {
-        // Open a connection to the database
-        conn = util.openDBConnection();
-
-        queryobj = new DBQuery(conn,saxparser);
-        docreader = new DBReader(conn);
-        dbt = new DBTransform(conn);
-        dbutil = new DBUtil(conn);
-
-      } catch (Exception e) {
-        System.err.println("Error creating pool of database connections");
-        System.err.println(e.getMessage());
-      }
-*/
     } catch ( ServletException ex ) {
       throw ex;
     }
@@ -179,23 +159,6 @@
         System.err.println(e.getMessage());
       }
     }    
-/*    
-    if (conn == null) {
-      System.err.println("Connection to database lost.  Reopening...");
-      try {
-        // Open a connection to the database
-        conn = util.openDBConnection();
-  
-        queryobj = new DBQuery(conn, saxparser);
-        docreader = new DBReader(conn);
-        dbt = new DBTransform(conn);
-        dbutil = new DBUtil(conn);
-  
-      } catch (Exception e) {
-        System.err.println("Error opening database connection");
-      }
-    }
-*/
     // Get a handle to the output stream back to the client
     PrintWriter out = response.getWriter();
     //response.setContentType("text/html");
@@ -246,6 +209,7 @@
     }
 
 // Jivka added  
+    String username = null;
     // handle login action
     if (action.equals("Login") || action.equals("Login Client")) {
       handleLoginAction(out, params, request, response);
@@ -256,13 +220,14 @@
       response.sendRedirect("/xmltodb/lib/login.html"); 
     // aware of session expiration on every request  
     } else {    
-      //HttpSession sess = request.getSession(false);
-      HttpSession sess = request.getSession(true);
+      HttpSession sess = request.getSession(false);
+      //HttpSession sess = request.getSession(true);
       if (sess == null) { 
         // session expired or has not been stored b/w user requests
         // redirect to session expiration message page
         response.sendRedirect("/xmltodb/lib/sexpire.html"); 
       }
+      username = (String)sess.getValue("username");
     }    
 // End of Jivka added
 
@@ -277,11 +242,23 @@
         out.println(se.getMessage());
       }
     } else if (action.equals("insert") || action.equals("update")) {
-      handleInsertOrUpdateAction(out, params, response);
+      if ( username == "anonymous" ) {
+        out.println("You are not authorized to use that option.");
+      } else {
+        handleInsertOrUpdateAction(out, params, response);
+      }
     } else if (action.equals("delete")) {
-      handleDeleteAction(out, params, response);
+      if ( username == "anonymous" ) {
+        out.println("You are not authorized to use that option");
+      } else {
+        handleDeleteAction(out, params, response);
+      }
     } else if (action.equals("validate")) {
-      handleValidateAction(out, params, response);  
+      if ( username == "anonymous" ) {
+        out.println("You are not authorized to use that option");
+      } else {
+        handleValidateAction(out, params, response);  
+      }
     } else if (action.equals("getdatadoc")) {
       handleGetDataDocumentAction(out, params, response);  
     } else if (action.equals("getdoctypes")) {
@@ -317,6 +294,21 @@
       out.println(e.getMessage());
     }
 
+    if ( un == "anonymous" ) {
+        try {
+            response.sendRedirect(
+            response.encodeRedirectUrl("/xmltodb/lib/query.html"));
+        } catch (java.io.IOException ioe) {
+            sess.disconnect();            
+            out.println("<?xml version=\"1.0\"?>");
+            out.println("<error>");
+            out.println("MetaCatServlet.handleLoginAction() - " +
+                        "Error on redirect of HttpServletResponse: " + 
+                        ioe.getMessage());
+            out.println("</error>");
+        }    
+    }
+    
     try { 
         if (sess.userAuth(un, pw)) {
             try {
@@ -807,6 +799,11 @@
 
 /**
  * '$Log$
+ * 'Revision 1.55  2000/08/01 18:26:50  bojilova
+ * 'added Pool of Connections
+ * 'DBQuery, DBReader, DBTransform, DBUtil are created on every request and use the connections from the Pool
+ * 'same with DBWriter and DBValidate
+ * '
  * 'Revision 1.54  2000/07/27 23:12:21  bojilova
  * 'Added "getdoctypes" and "getdataguide" action handlers
  * '
