Index: src/xmltables_postgres.sql
===================================================================
--- src/xmltables_postgres.sql	(revision 2098)
+++ src/xmltables_postgres.sql	(revision 2099)
@@ -1,17 +1,28 @@
-/*
- * xmltables-postgres.sql
- *             : Create or replace tables for storing XML in PostgreSQL
+/**
+ *  '$RCSfile$'
+ *  Copyright: 2004 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
  *
- *      Purpose: creates tables needed for storing XML in PostgreSQL database
- * 
- *      Created: 08 May 2001 
- *       Author: John Harris
- * Organization: National Center for Ecological Analysis and Synthesis
- *    Copyright: 2000 Regents of the University of California and the
- *               National Center for Ecological Analysis and Synthesis
- *  For Details: http://www.nceas.ucsb.edu/
- *    File Info: '$Id$'
+ *   '$Author$'
+ *     '$Date$'
+ * '$Revision$'
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+ 
+/*
  *	this is sql script does the same as the sql script named 
  *	xmltables.sql except that this script is to be use to 
  *	create the database tables on a Postgresql backend rather
@@ -259,16 +270,16 @@
 );
 
 /*
- *Logging -- table to store metadata and data access log
+ * Logging -- table to store metadata and data access log
  */
 CREATE SEQUENCE access_log_id_seq;
 CREATE TABLE access_log (
-  entryid       INT8 default nextval ('access_log_id_seq'),
-  ip_address    VARCHAR(512),
-  principal     VARCHAR(512),
+  entryid       INT8 default nextval ('access_log_id_seq'), -- the identifier for the log event
+  ip_address    VARCHAR(512),   -- the ip address inititiating the event
+  principal     VARCHAR(512),   -- the user initiiating the event
   docid         VARCHAR(250),	-- the document id #
   rev           INT8,           -- the revision number
-  event         VARCHAR(512),
-  date_logged   TIMESTAMP,
+  event         VARCHAR(512),   -- the code symbolizing the event type
+  date_logged   TIMESTAMP,      -- the datetime on which the event occurred
   CONSTRAINT access_log_pk PRIMARY KEY (entryid)
 );
Index: src/upgrade-db-to-1.4.sql
===================================================================
--- src/upgrade-db-to-1.4.sql	(nonexistent)
+++ src/upgrade-db-to-1.4.sql	(revision 2099)
@@ -0,0 +1,47 @@
+/**
+ *  '$RCSfile$'
+ *  Copyright: 2004 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *
+ *   '$Author$'
+ *     '$Date$'
+ * '$Revision$'
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+ 
+/*
+ * Logging -- table to store metadata and data access log
+ */
+CREATE TABLE access_log (
+  entryid       NUMBER(20),     -- the identifier for the log event
+  ip_address    VARCHAR2(512),  -- the ip address inititiating the event
+  principal     VARCHAR2(512),  -- the user initiiating the event
+  docid         VARCHAR2(250),	-- the document id #
+  rev           NUMBER(10),     -- the revision number
+  event         VARCHAR2(512),  -- the code symbolizing the event type
+  date_logged   DATE,           -- the datetime on which the event occurred
+  CONSTRAINT access_log_pk PRIMARY KEY (entryid)
+);  
+ 
+CREATE SEQUENCE access_log_id_seq;
+CREATE TRIGGER access_log_before_insert
+BEFORE INSERT ON access_log FOR EACH ROW
+BEGIN
+  SELECT access_log_id_seq.nextval
+    INTO :new.entryid
+    FROM dual;
+END;
+/
\ No newline at end of file

Property changes on: src/upgrade-db-to-1.4.sql
___________________________________________________________________
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: src/xmltables.sql
===================================================================
--- src/xmltables.sql	(revision 2098)
+++ src/xmltables.sql	(revision 2099)
@@ -1,16 +1,25 @@
-/*
- * xmltables.sql -- Create or replace tables for storing XML in the db
+/**
+ *  '$RCSfile$'
+ *  Copyright: 2004 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
  *
- *      Purpose: creates tables needed for XML database
- * 
- *      Created: 12 September 1999
- *       Author: Matt Jones
- * Organization: National Center for Ecological Analysis and Synthesis
- *    Copyright: 2000 Regents of the University of California and the
- *               National Center for Ecological Analysis and Synthesis
- *  For Details: http://www.nceas.ucsb.edu/
- *    File Info: '$Id$'
+ *   '$Author$'
+ *     '$Date$'
+ * '$Revision$'
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 /*
@@ -26,6 +35,7 @@
 DROP SEQUENCE accnum_uniqueid_seq;
 DROP SEQUENCE xml_documents_id_seq;
 DROP SEQUENCE accession_number_id_seq;
+DROP SEQUENCE access_log_seq;
                
 /* Drop triggers are not necessary */
 DROP TRIGGER xml_nodes_before_insert;
@@ -34,6 +44,7 @@
 DROP TRIGGER xml_relation_before_insert;
 DROP TRIGGER xml_replication_before_insert;
 DROP TRIGGER accession_number_before_insert;
+DROP TRIGGER access_log_before_insert;
 
 DROP TABLE xml_index;
 DROP TABLE xml_access;
@@ -45,6 +56,7 @@
 DROP TABLE xml_replication;
 DROP TABLE xml_catalog;
 DROP TABLE accession_number;
+DROP TABLE access_log;
 
 /*
  *Replication -- table to store servers that metacat is replicated to
@@ -310,3 +322,25 @@
 		FOREIGN KEY (docid) REFERENCES xml_documents
 );
 
+/*
+ * Logging -- table to store metadata and data access log
+ */
+CREATE TABLE access_log (
+  entryid       NUMBER(20),     -- the identifier for the log event
+  ip_address    VARCHAR2(512),  -- the ip address inititiating the event
+  principal     VARCHAR2(512),  -- the user initiiating the event
+  docid         VARCHAR2(250),	-- the document id #
+  rev           NUMBER(10),     -- the revision number
+  event         VARCHAR2(512),  -- the code symbolizing the event type
+  date_logged   DATE,           -- the datetime on which the event occurred
+  CONSTRAINT access_log_pk PRIMARY KEY (entryid)
+);
+
+CREATE SEQUENCE access_log_id_seq;
+CREATE TRIGGER access_log_before_insert
+BEFORE INSERT ON access_log FOR EACH ROW
+BEGIN
+  SELECT access_log_id_seq.nextval
+    INTO :new.entryid
+    FROM dual;
+END;
Index: src/edu/ucsb/nceas/metacat/EventLog.java
===================================================================
--- src/edu/ucsb/nceas/metacat/EventLog.java	(revision 2098)
+++ src/edu/ucsb/nceas/metacat/EventLog.java	(revision 2099)
@@ -86,13 +86,20 @@
      * include basic identification information about the principal or computer
      * that initiated the event.
      * 
-     * @param logData the data to be logged when an event occurs
+     * @param ipAddress the internet protocol address for the event
+	 * @param principal the principal for the event (a username, etc)
+	 * @param docid the identifier of the document to which the event applies
+	 * @param revision the revision of the document to which the event applies
+	 * @param event the string code for the event
      */
-    public void log(EventLogData logData)
+    public void log(String ipAddress, String principal, String docid,
+			long revision, String event)
     {
+        EventLogData logData = new EventLogData(ipAddress, principal, docid,
+                revision, event);
         insertLogEntry(logData);
     }
-
+    
     /**
      * Insert a single log event record to the database.
      * 
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 2098)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 2099)
@@ -495,7 +495,7 @@
                     out.println("   Query: " + pquery);
                     out.println("  Params: ");
                     if (pquery != null) {
-                        Hashtable qparams = util.parseQuery(u.getQuery());
+                        Hashtable qparams = MetaCatUtil.parseQuery(u.getQuery());
                         for (Enumeration en = qparams.keys(); en
                                 .hasMoreElements();) {
                             String pname = (String) en.nextElement();
@@ -974,7 +974,8 @@
                 try {
 
                     URL murl = new URL(docs[i]);
-                    Hashtable murlQueryStr = util.parseQuery(murl.getQuery());
+                    Hashtable murlQueryStr = MetaCatUtil.parseQuery(
+                            murl.getQuery());
                     // case docid="http://.../?docid=aaa"
                     // or docid="metacat://.../?docid=bbb"
                     if (murlQueryStr.containsKey("docid")) {
@@ -997,8 +998,10 @@
                             readFromURLConnection(response, docid);
                         }
                     }
-
-                    // case docid="ccc"
+                    
+                    // Log the event to the event table
+                    EventLog.getInstance().log("192.168.1.103", "public", 
+                            "test.1", 1, "read");
                 } catch (MalformedURLException mue) {
                     docid = docs[i];
                     if (zip) {
@@ -1009,7 +1012,7 @@
                     }
                 }
 
-            } /* end for */
+            }
 
             if (zip) {
                 zout.finish(); //terminate the zip file
Index: src/upgrade-db-to-1.4_postgres.sql
===================================================================
--- src/upgrade-db-to-1.4_postgres.sql	(revision 2098)
+++ src/upgrade-db-to-1.4_postgres.sql	(revision 2099)
@@ -1,18 +1,38 @@
-/*
- * logging.sql -- Create or replace tables for logging events
+/**
+ *  '$RCSfile$'
+ *  Copyright: 2004 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *
+ *   '$Author$'
+ *     '$Date$'
+ * '$Revision$'
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-
+ 
 /*
  *Logging -- table to store metadata and data access log
  */
 CREATE SEQUENCE access_log_id_seq;
 CREATE TABLE access_log (
-  entryid       INT8 default nextval ('access_log_id_seq'),
-  ip_address    VARCHAR(512),
-  principal     VARCHAR(512),
+  entryid       INT8 default nextval ('access_log_id_seq'), -- the identifier for the log event
+  ip_address    VARCHAR(512),   -- the ip address inititiating the event
+  principal     VARCHAR(512),   -- the user initiiating the event
   docid         VARCHAR(250),	-- the document id #
   rev           INT8,           -- the revision number
-  event         VARCHAR(512),
-  date_logged   TIMESTAMP,
+  event         VARCHAR(512),   -- the code symbolizing the event type
+  date_logged   TIMESTAMP,      -- the datetime on which the event occurred
   CONSTRAINT access_log_pk PRIMARY KEY (entryid)
 );
