Index: src/edu/ucsb/nceas/metacat/MetaCatVersion.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatVersion.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/MetaCatVersion.java	(nonexistent)
@@ -1,63 +0,0 @@
-/**
- *  '$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
- */
-package edu.ucsb.nceas.metacat;
-
-import edu.ucsb.nceas.metacat.service.PropertyService;
-import edu.ucsb.nceas.utilities.PropertyNotFoundException;
-
-/**
- * @author jones
- *
- * Version represents the current version information for this Metacat instance.
- */
-public class MetaCatVersion extends Version {
-    public MetaCatVersion(String versionID) {
-    	super(versionID);
-    }
-	
-	/**
-	 * Get the current version string for this metacat instance. It is currently
-	 * stored in the metacat.properties file.
-	 * 
-	 * @return a string indicating the version of Metacat running
-	 */
-	public static String getVersionID() throws PropertyNotFoundException {
-		String version = PropertyService.getProperty("application.metacatVersion");
-		return version;
-	}
-    
-    /**
-	 * Get the version number in an XML document.
-	 * 
-	 * @return the version wrapped in an XML document
-	 */
-    public static String getVersionAsXml() throws PropertyNotFoundException {
-        StringBuffer sb = new StringBuffer();
-        sb.append("<?xml version=\"1.0\"?>");
-        sb.append("<version>");
-        sb.append(getVersionID());
-        sb.append("</version>");
-        return sb.toString();
-    }
-}

Property changes on: src/edu/ucsb/nceas/metacat/MetaCatVersion.java
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 5025)
@@ -86,7 +86,6 @@
 import edu.ucsb.nceas.metacat.service.SessionService;
 import edu.ucsb.nceas.metacat.service.SkinPropertyService;
 import edu.ucsb.nceas.metacat.service.XMLSchemaService;
-import edu.ucsb.nceas.metacat.shared.BaseException;
 import edu.ucsb.nceas.metacat.shared.HandlerException;
 import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
 import edu.ucsb.nceas.metacat.shared.ServiceException;
@@ -93,13 +92,13 @@
 import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
 import edu.ucsb.nceas.metacat.spatial.SpatialQuery;
 import edu.ucsb.nceas.metacat.util.AuthUtil;
+import edu.ucsb.nceas.metacat.util.ConfigurationUtil;
 import edu.ucsb.nceas.metacat.util.ErrorSendingErrorException;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.metacat.util.RequestUtil;
-import edu.ucsb.nceas.metacat.util.ResponseUtil;
 import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.metacat.util.SessionData;
-import edu.ucsb.nceas.metacat.workflow.WorkflowScheduler;
 import edu.ucsb.nceas.utilities.FileUtil;
 import edu.ucsb.nceas.utilities.GeneralPropertyException;
 import edu.ucsb.nceas.utilities.LSIDUtil;
@@ -129,7 +128,7 @@
  *     searchmode --
  *     anyfield --
  * action=spatial_query -- run a spatial query.  these queries may include any of the
- *     queries supported by the WFS / WMS standards
+ *                         queries supported by the WFS / WMS standards
  *     xmax --
  *     ymax --
  *     xmin --
@@ -204,34 +203,60 @@
  *     event -- filter on event type (e.g., read, insert, update, delete)
  *     start -- filter out events before the start date-time
  *     end -- filter out events before the end date-time
- * action=shrink --
+ * action=shrink -- Shrink the database connection pool size if it has grown and 
+ *                  extra connections are no longer being used.
  * action=buildindex --
  *     docid --
- * action=gohome --
  * action=refreshServices --
- * action=scheduleWorkflow --
- *     delay --
- *     starttime --
- *     endtime --
- *     intervalvalue -- 
- *     intervalunit --
- *     workflowid --
- *     karid --
- *     workflowname --
- *     forwardto --
- *     qformat --
- * action=unscheduleWorkflow --
- *     workflowjobid --
- *     forwardto --
- *     qformat --
- * action=rescheduleWorkflow --
- *     workflowjobid --
- *     forwardto --
- *     qformat --
- * action=deleteScheduledWorkflow --
- *     workflowjobid --
- *     forwardto --
- *     qformat --
+ * action=scheduleWorkflow -- Schedule a workflow to be run.  Scheduling a workflow 
+ *                            registers it with the scheduling engine and creates a row
+ *                            in the scheduled_job table.  Note that this may be 
+ *                            extracted into a separate servlet.
+ *     delay -- The amount of time from now before the workflow should be run.  The 
+ *              delay can be expressed in number of seconds, minutes, hours and days, 
+ *              for instance 30s, 2h, etc.
+ *     starttime -- The time that the workflow should first run.  If both are provided
+ *                  this takes precedence over delay.  The time should be expressed as: 
+ *                  MM/dd/yyyy HH:mm:ss with the timezone assumed to be that of the OS.
+ *     endtime -- The time when the workflow should end. The time should be expressed as: 
+ *                  MM/dd/yyyy HH:mm:ss with the timezone assumed to be that of the OS.
+ *     intervalvalue -- The numeric value of the interval between runs
+ *     intervalunit -- The unit of the interval between runs.  Can be s, m, h, d for 
+ *                     seconds, minutes, hours and days respectively
+ *     workflowid -- The lsid of the workflow that we want to schedule.  This workflow
+ *                   must already exist in the database.
+ *     karid -- The karid for the workflow that we want to schedule.
+ *     workflowname -- The name of the workflow.
+ *     forwardto -- If provided, forward to this page when processing is done.
+ *     qformat -- If provided, render results using the stylesheets associated with
+ *                this skin.  Default is xml.
+ * action=unscheduleWorkflow -- Unschedule a workflow.  Unscheduling a workflow 
+ *                            removes it from the scheduling engine and changes the 
+ *                            status in the scheduled_job table to " unscheduled.  Note 
+ *                            that this may be extracted into a separate servlet.
+ *     workflowjobid -- The job ID for the workflow run that we want to unschedule.  This
+ *                      is held in the database as scheduled_job.name
+ *     forwardto -- If provided, forward to this page when processing is done.
+ *     qformat -- If provided, render results using the stylesheets associated with
+ *                this skin.  Default is xml.
+ * action=rescheduleWorkflow -- Unschedule a workflow.  Rescheduling a workflow 
+ *                            registers it with the scheduling engine and changes the 
+ *                            status in the scheduled_job table to " scheduled.  Note 
+ *                            that this may be extracted into a separate servlet.
+ *     workflowjobid -- The job ID for the workflow run that we want to reschedule.  This
+ *                      is held in the database as scheduled_job.name
+ *     forwardto -- If provided, forward to this page when processing is done.
+ *     qformat -- If provided, render results using the stylesheets associated with
+ *                this skin.  Default is xml.
+ * action=deleteScheduledWorkflow -- Delete a workflow.  Deleting a workflow 
+ *                            removes it from the scheduling engine and changes the 
+ *                            status in the scheduled_job table to " deleted.  Note 
+ *                            that this may be extracted into a separate servlet.
+ *     workflowjobid -- The job ID for the workflow run that we want to delete.  This
+ *                      is held in the database as scheduled_job.name
+ *     forwardto -- If provided, forward to this page when processing is done.
+ *     qformat -- If provided, render results using the stylesheets associated with
+ *                this skin.  Default is xml.
  *     
  *     
  * Here are some of the common parameters for actions
@@ -266,7 +291,6 @@
     public static final String SCHEMALOCATIONKEYWORD = ":schemaLocation";
     public static final String NONAMESPACELOCATION = ":noNamespaceSchemaLocation";
     public static final String EML2KEYWORD = ":eml";
-    public static final String XMLFORMAT = "xml";
     private static final String FALSE = "false";
     private static final String TRUE  = "true";
     private static String LOG_CONFIG_NAME = null;
@@ -302,7 +326,7 @@
     		// Check to see if the user has requested to bypass configuration 
             // (dev option) and check see if metacat has been configured.
     		// If both are false then stop the initialization
-            if (!MetacatUtil.bypassConfiguration() && !MetacatUtil.isMetacatConfigured()) {
+            if (!ConfigurationUtil.bypassConfiguration() && !ConfigurationUtil.isMetacatConfigured()) {
             	return;
             }  
             
@@ -430,7 +454,7 @@
 
 			fullyInitialized = true;
 			
-			logMetacat.warn("Metacat (" + MetaCatVersion.getVersionID()
+			logMetacat.warn("Metacat (" + MetacatVersion.getVersionID()
 					+ ") initialized.");
 			
 		} catch (SQLException e) {
@@ -641,8 +665,8 @@
 		
 		// Each time metacat is called, check to see if metacat has been 
 		// configured. If not then forward to the administration servlet
-		if (!MetacatUtil.isMetacatConfigured()) {
-			RequestUtil.forwardRequest(request, response, "/admin?action=configure");
+		if (!ConfigurationUtil.isMetacatConfigured()) {
+			RequestUtil.forwardRequest(request, response, "/admin?action=configure", null);
 			return;
 		}
 
@@ -927,7 +951,7 @@
 				} else if (action.equals("getversion")) {
 					response.setContentType("text/xml");
 					PrintWriter out = response.getWriter();
-					out.println(MetaCatVersion.getVersionAsXml());
+					out.println(MetacatVersion.getVersionAsXml());
 					out.close();
 				} else if (action.equals("getlog")) {
 					handleGetLogAction(params, request, response, userName, groupNames);
@@ -985,9 +1009,6 @@
 					 * out.println(mue.getMessage()); mue.printStackTrace(out);
 					 * out.close(); }
 					 */
-				} else if (action.equals("gohome")) {
-					// forward to the default page
-					RequestUtil.forwardRequest(request, response, "/");
 				} else if (action.equals("refreshServices")) {
 					// TODO MCD this interface is for testing.  It should go through a 
 					// ServiceService class and only work for an admin user.  Move to the
@@ -994,51 +1015,51 @@
 					// MetacatAdminServlet
 					ServiceService.refreshService("XMLSchemaService");
 					return;
-				} else if (action.equals("scheduleWorkflow")) {
-					try {
-						WorkflowScheduler.getInstance().scheduleJob(request, response, params, 
-							userName, groupNames);
-						return;
-					} catch (BaseException be) {
-						ResponseUtil.sendErrorXML(response, ResponseUtil.SCHEDULE_WORKFLOW_ERROR, be);
-						return;						
-					}
-				} else if (action.equals("unscheduleWorkflow")) {
-					try {
-						WorkflowScheduler.getInstance().unScheduleJob(request, response, params, 
-							userName, groupNames);
-						return;
-					} catch (BaseException be) {
-						ResponseUtil.sendErrorXML(response, ResponseUtil.UNSCHEDULE_WORKFLOW_ERROR, be);
-						return;						
-					}
-				} else if (action.equals("rescheduleWorkflow")) {
-					try {
-						WorkflowScheduler.getInstance().reScheduleJob(request, response, params, 
-							userName, groupNames);
-						return;
-					} catch (BaseException be) {
-						ResponseUtil.sendErrorXML(response, ResponseUtil.RESCHEDULE_WORKFLOW_ERROR, be);
-						return;						
-					}
-				} else if (action.equals("getScheduledWorkflow")) {
-					try {
-						WorkflowScheduler.getInstance().getJobs(request, response, params, 
-								userName, groupNames);				
-						return;
-					} catch (BaseException be) {
-						ResponseUtil.sendErrorXML(response, ResponseUtil.GET_SCHEDULED_WORKFLOW_ERROR, be);
-						return;						
-					}
-				} else if (action.equals("deleteScheduledWorkflow")) {
-					try {
-						WorkflowScheduler.getInstance().deleteJob(request, response, params, 
-								userName, groupNames);				
-						return;
-					} catch (BaseException be) {
-						ResponseUtil.sendErrorXML(response, ResponseUtil.DELETE_SCHEDULED_WORKFLOW_ERROR, be);
-						return;						
-					}
+//				} else if (action.equals("scheduleWorkflow")) {
+//					try {
+//						WorkflowScheduler.getInstance().scheduleJob(request, response, params, 
+//							userName, groupNames);
+//						return;
+//					} catch (BaseException be) {
+//						ResponseUtil.sendErrorXML(response, ResponseUtil.SCHEDULE_WORKFLOW_ERROR, be);
+//						return;						
+//					}
+//				} else if (action.equals("unscheduleWorkflow")) {
+//					try {
+//						WorkflowScheduler.getInstance().unScheduleJob(request, response, params, 
+//							userName, groupNames);
+//						return;
+//					} catch (BaseException be) {
+//						ResponseUtil.sendErrorXML(response, ResponseUtil.UNSCHEDULE_WORKFLOW_ERROR, be);
+//						return;						
+//					}
+//				} else if (action.equals("rescheduleWorkflow")) {
+//					try {
+//						WorkflowScheduler.getInstance().reScheduleJob(request, response, params, 
+//							userName, groupNames);
+//						return;
+//					} catch (BaseException be) {
+//						ResponseUtil.sendErrorXML(response, ResponseUtil.RESCHEDULE_WORKFLOW_ERROR, be);
+//						return;						
+//					}
+//				} else if (action.equals("getScheduledWorkflow")) {
+//					try {
+//						WorkflowScheduler.getInstance().getJobs(request, response, params, 
+//								userName, groupNames);				
+//						return;
+//					} catch (BaseException be) {
+//						ResponseUtil.sendErrorXML(response, ResponseUtil.GET_SCHEDULED_WORKFLOW_ERROR, be);
+//						return;						
+//					}
+//				} else if (action.equals("deleteScheduledWorkflow")) {
+//					try {
+//						WorkflowScheduler.getInstance().deleteJob(request, response, params, 
+//								userName, groupNames);				
+//						return;
+//					} catch (BaseException be) {
+//						ResponseUtil.sendErrorXML(response, ResponseUtil.DELETE_SCHEDULED_WORKFLOW_ERROR, be);
+//						return;						
+//					}
 				} else {
 					PrintWriter out = response.getWriter();
 					out.println("<?xml version=\"1.0\"?>");
@@ -1336,7 +1357,7 @@
                 response.setContentType("text/html");
                 trans.transformXMLDocument(sess.getMessage(),
                         "-//NCEAS//login//EN", "-//W3C//HTML//EN", qformat,
-                        out, null);
+                        out, null, null);
             } catch (Exception e) {               
                 logMetacat.error("Error in MetaCatServlet.handleLoginAction: "
                         + e.getMessage());
@@ -1385,7 +1406,7 @@
                 response.setContentType("text/html");
                 trans.transformXMLDocument(output.toString(),
                         "-//NCEAS//login//EN", "-//W3C//HTML//EN", qformat,
-                        out, null);
+                        out, null, null);
             } catch (Exception e) {
                 logMetacat.error(
                         "Error in MetaCatServlet.handleLogoutAction"
@@ -1578,8 +1599,8 @@
                 throw new Exception("You didn't specify requested inlinedataid"); }
             
             // check for permission
-            docId = MetacatUtil
-                    .getDocIdWithoutRevFromInlineDataID(inlineDataId);
+            docId = 
+            	DocumentUtil.getDocIdWithoutRevFromInlineDataID(inlineDataId);
             PermissionController controller = new PermissionController(docId);
             // check top level read permission
             if (!controller.hasPermission(user, groups,
@@ -1593,7 +1614,7 @@
                     Hashtable<String,String> unReadableInlineDataList =
                             PermissionController.getUnReadableInlineDataIdList(docId,
                             user, groups, false);
-                    String inlineDataIdWithoutRev = MetacatUtil.getInlineDataIdWithoutRev(inlineDataId);
+                    String inlineDataIdWithoutRev = DocumentUtil.getInlineDataIdWithoutRev(inlineDataId);
                     if (unReadableInlineDataList.containsValue(inlineDataIdWithoutRev)) {
                         throw new Exception("User " + user
                                 + " doesn't have permission " + " to read inlinedata "
@@ -2011,7 +2032,7 @@
                     DBTransform dbt = new DBTransform();
                     dbt.transformXMLDocument(doc.toString(user, groups,
                             withInlineData), doctype, "-//W3C//HTML//EN",
-                            qformat, out, params);
+                            qformat, out, params, null);
                 }
                 
             }
@@ -2405,7 +2426,7 @@
                 response.setContentType("text/html");
                 trans.transformXMLDocument(output,
                         "message", "-//W3C//HTML//EN", qformat,
-                        out, null);
+                        out, null, null);
             } catch (Exception e) {
                 
                 logMetacat.error(
@@ -2517,7 +2538,7 @@
                     // Delete from spatial cache if runningSpatialOption
                     if ( PropertyService.getProperty("spatial.runSpatialOption").equals("true") ) {
                         SpatialHarvester sh = new SpatialHarvester();
-                        sh.addToDeleteQue( MetacatUtil.getSmartDocId( docid[0] ) );
+                        sh.addToDeleteQue( DocumentUtil.getSmartDocId( docid[0] ) );
                         sh.destroy();
                     }
                     
@@ -3418,7 +3439,7 @@
                 response.setContentType("text/html");
                 trans.transformXMLDocument(output,
                         "message", "-//W3C//HTML//EN", qformat,
-                        out, null);
+                        out, null, null);
             } catch (Exception e) {
                 
                 logMetacat.error(
@@ -3610,7 +3631,7 @@
         int serialNumber = -1;
         
         // get rid of revision if access number has
-        docId = MetacatUtil.getDocIdFromString(accessionNumber);
+        docId = DocumentUtil.getDocIdFromString(accessionNumber);
         try {
             //check out DBConnection
             conn = DBConnectionPool
Index: src/edu/ucsb/nceas/metacat/ContentTypeProvider.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ContentTypeProvider.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/ContentTypeProvider.java	(revision 5025)
@@ -59,6 +59,7 @@
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 /**
@@ -123,7 +124,7 @@
    */
   public ContentTypeProvider(String docIdWithRevision)
   {
-    dataFileId = MetacatUtil.getDocIdFromString(docIdWithRevision);
+    dataFileId = DocumentUtil.getDocIdFromString(docIdWithRevision);
     //get relative doclist for data file and package type
     Vector docLists = null;
     docLists = getRelativeDocIdList(dataFileId);
@@ -344,10 +345,10 @@
           if (URLData.indexOf(DBSAXHandler.ECOGRID) != -1 )
           {
             // Get docid from url
-            String docId = MetacatUtil.
-                               getAccessionNumberFromEcogridIdentifier(URLData);
+            String docId = 
+            	DocumentUtil.getAccessionNumberFromEcogridIdentifier(URLData);
             // Get rid of revision
-            docId = MetacatUtil.getDocIdFromAccessionNumber(docId);
+            docId = DocumentUtil.getDocIdFromAccessionNumber(docId);
             logMetacat.info("docid from url element in xml is: " +
                                      docId);
             //if this docid equals target one, we find it
Index: src/edu/ucsb/nceas/metacat/PermissionController.java
===================================================================
--- src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 5025)
@@ -39,6 +39,7 @@
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
@@ -61,7 +62,7 @@
    public PermissionController(String myDocid) throws McdbException
    {
      // Get rid of rev number
-     docId = MetacatUtil.getSmartDocId(myDocid);
+     docId = DocumentUtil.getSmartDocId(myDocid);
      //hasSubTreeAccessControl = checkSubTreeAccessControl();
    }
 
@@ -78,7 +79,7 @@
      }
      else
      {
-         docId = MetacatUtil.getDocIdFromAccessionNumber(myDocid);
+         docId = DocumentUtil.getDocIdFromAccessionNumber(myDocid);
      }
    }
 
@@ -433,7 +434,7 @@
 	 */
 	private boolean isAccessDocument(String docId) throws SQLException {
 		// detele the rev number if docid contains it
-		docId = MetacatUtil.getDocIdFromString(docId);
+		docId = DocumentUtil.getDocIdFromString(docId);
 		PreparedStatement pStmt = null;
 		DBConnection conn = null;
 		int serialNumber = -1;
@@ -1112,12 +1113,11 @@
             {
                 logMetacat.info("Put subtree id " + subTreeId +
                                          " and " + "inline data file name " +
-                                         MetacatUtil.
-                                         getInlineDataIdWithoutRev(fileId) +
+                                         DocumentUtil.getInlineDataIdWithoutRev(fileId) +
                                          " into " + "un" + permission +
                                          " hash");
-                unAccessibleIdList.put(subTreeId, MetacatUtil.
-                                      getInlineDataIdWithoutRev(fileId));
+                unAccessibleIdList.put(subTreeId, 
+                		DocumentUtil.getInlineDataIdWithoutRev(fileId));
             }
         }
       }
Index: src/edu/ucsb/nceas/metacat/DocumentImpl.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 5025)
@@ -64,6 +64,7 @@
 import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
 import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
 import edu.ucsb.nceas.metacat.util.AuthUtil;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.FileUtil;
@@ -190,8 +191,8 @@
     {
         try {
             //this.conn = conn;
-            this.docid = MetacatUtil.getDocIdFromAccessionNumber(accNum);
-            this.rev   = MetacatUtil.getRevisionFromAccessionNumber(accNum);
+            this.docid = DocumentUtil.getDocIdFromAccessionNumber(accNum);
+            this.rev   = DocumentUtil.getRevisionFromAccessionNumber(accNum);
 
             // Look up the document information
             getDocumentInfo(docid, rev);
@@ -341,8 +342,8 @@
             serialNumber = conn.getCheckOutSerialNumber();
             conn.setAutoCommit(false);
             String action = null;
-            String docIdWithoutRev = MetacatUtil.getDocIdFromAccessionNumber(accnum);
-            int userSpecifyRev = MetacatUtil.getRevisionFromAccessionNumber(accnum);
+            String docIdWithoutRev = DocumentUtil.getDocIdFromAccessionNumber(accnum);
+            int userSpecifyRev = DocumentUtil.getRevisionFromAccessionNumber(accnum);
             action = checkRevInXMLDocuments(docIdWithoutRev, userSpecifyRev);
             logMetacat.warn("after check rev, the action is "+action);
             if (action.equals("UPDATE"))
@@ -421,8 +422,8 @@
             serialNumber = conn.getCheckOutSerialNumber();
             conn.setAutoCommit(false);
             String action = null;
-            String docIdWithoutRev = MetacatUtil.getDocIdFromAccessionNumber(accnum);
-            int userSpecifyRev = MetacatUtil.getRevisionFromAccessionNumber(accnum);
+            String docIdWithoutRev = DocumentUtil.getDocIdFromAccessionNumber(accnum);
+            int userSpecifyRev = DocumentUtil.getRevisionFromAccessionNumber(accnum);
             if (tableName.equals(DOCUMENTTABLE))
             {
                 action = checkRevInXMLDocuments(docIdWithoutRev, userSpecifyRev);
@@ -750,8 +751,8 @@
             throws Exception
     {
         boolean flag = true;
-        String docid = MetacatUtil.getDocIdFromString(accnum);
-        int rev = MetacatUtil.getVersionFromString(accnum);
+        String docid = DocumentUtil.getDocIdFromString(accnum);
+        int rev = DocumentUtil.getVersionFromString(accnum);
 
         if (serverCode == 1) {
             flag = true;
@@ -1207,8 +1208,8 @@
                     // if it is inline data first to get the inline data
                     // internal id
                     String fileName = currentNode.getNodeData();
-                    String accessfileName = MetacatUtil
-                            .getDocIdWithoutRevFromInlineDataID(fileName);
+                    String accessfileName = 
+                    	DocumentUtil.getDocIdWithoutRevFromInlineDataID(fileName);
                     // check if user has read permision for this inline data
                     boolean readInlinedata = false;
                     try {
@@ -2569,7 +2570,7 @@
             }
 
             //DocumentIdentifier id = new DocumentIdentifier(accnum);
-            int revision = MetacatUtil.getRevisionFromAccessionNumber(accnum);
+            int revision = DocumentUtil.getRevisionFromAccessionNumber(accnum);
             String updaterev = (new Integer(revision)).toString();
             String server = ReplicationService
                     .getServerNameForServerCode(serverCode);
@@ -2800,10 +2801,10 @@
         String catalogId = null;
         logMetacat.info("user in replication" + user);
         // Docid without revision
-        String docid = MetacatUtil.getDocIdFromAccessionNumber(accnum);
+        String docid = DocumentUtil.getDocIdFromAccessionNumber(accnum);
         logMetacat.warn("The docid without rev is " + docid);
         // Revision specified by user (int)
-        int userSpecifyRev = MetacatUtil.getRevisionFromAccessionNumber(accnum);
+        int userSpecifyRev = DocumentUtil.getRevisionFromAccessionNumber(accnum);
         logMetacat.warn("The user specifyRev: " + userSpecifyRev);
         // Revision for this docid in current database
         int revInDataBase = DBUtil.getLatestRevisionInDocumentTable(docid);
@@ -2953,8 +2954,8 @@
             String packagedoctype = PropertyService.getProperty("xml.packagedoctype");
             Vector<String> packagedoctypes = new Vector<String>();
             packagedoctypes = MetacatUtil.getOptionList(packagedoctype);
-            String docIdWithoutRev = MetacatUtil.getDocIdFromAccessionNumber(accnumber);
-            int revision = MetacatUtil.getRevisionFromAccessionNumber(accnumber);
+            String docIdWithoutRev = DocumentUtil.getDocIdFromAccessionNumber(accnumber);
+            int revision = DocumentUtil.getRevisionFromAccessionNumber(accnumber);
             if (documenttype != null &&
                     packagedoctypes.contains(documenttype)) {
                 dbconn = DBConnectionPool.getDBConnection(
@@ -2965,8 +2966,8 @@
                 String aclidWithRev = RelationHandler.getAccessFileIDWithRevision(docIdWithoutRev);
                 if (aclidWithRev != null)
                 {
-                  String aclid = MetacatUtil.getDocIdFromAccessionNumber(aclidWithRev);
-                  revision = MetacatUtil.getRevisionFromAccessionNumber(aclidWithRev);
+                  String aclid = DocumentUtil.getDocIdFromAccessionNumber(aclidWithRev);
+                  revision = DocumentUtil.getRevisionFromAccessionNumber(aclidWithRev);
                  
                   // if there are access file, write ACL for that package
                   if (aclid != null) {
@@ -3034,7 +3035,7 @@
         int serialNumber = -1;
         try {
             //get rid of revision number
-            docid = MetacatUtil.getDocIdFromString(accnumber);
+            docid = DocumentUtil.getDocIdFromString(accnumber);
             dbConnection = DBConnectionPool.getDBConnection(
                     "DocumentImpl.getDocTypeFromDBForCurrentDoc");
             serialNumber = dbConnection.getCheckOutSerialNumber();
@@ -3088,7 +3089,7 @@
             // NEW - WHEN CLIENT ALWAYS PROVIDE ACCESSION NUMBER INCLUDING REV
             // IN IT
             //AccessionNumber ac = new AccessionNumber(accnum, "DELETE");
-            String docid = MetacatUtil.getDocIdFromAccessionNumber(accnum);
+            String docid = DocumentUtil.getDocIdFromAccessionNumber(accnum);
             //String rev = ac.getRev();
 
             // Check if the document exists.
@@ -3686,7 +3687,7 @@
             throws SQLException
     {
         //get rid of revNum part
-        String docId = MetacatUtil.getDocIdFromString(accNum);
+        String docId = DocumentUtil.getDocIdFromString(accNum);
         PreparedStatement pStmt = null;
         int serverLocation = 1;
         DBConnection conn = null;
@@ -4170,9 +4171,9 @@
             dbconn = DBConnectionPool.getDBConnection(
                     "DeletedDocumentImpl.registerDeletedDataFile");
             serialNumber = dbconn.getCheckOutSerialNumber();
-            String docIdWithoutRev = MetacatUtil
-                    .getDocIdFromAccessionNumber(accnum);
-            String rev = MetacatUtil.getRevisionStringFromString(accnum);
+            String docIdWithoutRev = 
+            	DocumentUtil.getDocIdFromAccessionNumber(accnum);
+            String rev = DocumentUtil.getRevisionStringFromString(accnum);
             writeDocumentToRevisionTable(dbconn, docIdWithoutRev, 
                     rev, doctype, docname, user,
                     null, serverCode, -1, createDate, updateDate); 
Index: src/edu/ucsb/nceas/metacat/RelationHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/RelationHandler.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/RelationHandler.java	(revision 5025)
@@ -24,6 +24,7 @@
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.morpho.datapackage.Triple;
 import edu.ucsb.nceas.morpho.datapackage.TripleCollection;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
@@ -114,10 +115,10 @@
         logMetacat.info("relationship from triple:"+triple.getRelationship());
         logMetacat.info("object from triple: "+triple.getObject());
         //subject = (new DocumentIdentifier(triple.getSubject())).getIdentifier();
-        subject = MetacatUtil.getDocIdFromString(triple.getSubject());
+        subject = DocumentUtil.getDocIdFromString(triple.getSubject());
         relationship = triple.getRelationship();
         //object = (new DocumentIdentifier(triple.getObject())).getIdentifier();
-        object = MetacatUtil.getDocIdFromString(triple.getObject());
+        object = DocumentUtil.getDocIdFromString(triple.getObject());
         
         if (subject != null && relationship != null && object != null)
         {
Index: src/edu/ucsb/nceas/metacat/DBUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBUtil.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/DBUtil.java	(revision 5025)
@@ -50,7 +50,7 @@
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.service.PropertyService;
-import edu.ucsb.nceas.metacat.util.MetacatUtil;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
@@ -632,7 +632,7 @@
     String docType = null;
     
     // Get docid without rev
-    docIdWithoutRevision = MetacatUtil.getDocIdFromString(givenDocId);
+    docIdWithoutRevision = DocumentUtil.getDocIdFromString(givenDocId);
     // SQL comand is:
     sqlCommand = "select rev, doctype from xml_documents where docid like ?";
     
Index: src/edu/ucsb/nceas/metacat/util/MetacatUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/MetacatUtil.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/util/MetacatUtil.java	(revision 5025)
@@ -33,7 +33,6 @@
 import java.io.PrintWriter;
 import java.net.MalformedURLException;
 import java.util.Hashtable;
-import java.util.Stack;
 import java.util.Vector;
 
 import org.apache.log4j.Logger;
@@ -41,17 +40,9 @@
 import com.oreilly.servlet.multipart.FilePart;
 
 import edu.ucsb.nceas.dbadapter.AbstractDatabase;
-import edu.ucsb.nceas.metacat.DBSAXHandler;
-import edu.ucsb.nceas.metacat.NodeRecord;
 import edu.ucsb.nceas.metacat.service.PropertyService;
-import edu.ucsb.nceas.metacat.service.ServiceService;
-import edu.ucsb.nceas.metacat.service.SkinPropertyService;
-import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
-import edu.ucsb.nceas.metacat.shared.ServiceException;
-import edu.ucsb.nceas.utilities.GeneralPropertyException;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import edu.ucsb.nceas.utilities.FileUtil;
-import edu.ucsb.nceas.utilities.UtilException;
 
 /**
  * A suite of utility classes for the metadata catalog server
@@ -59,25 +50,16 @@
 public class MetacatUtil
 {
 
+    public static final String XMLFORMAT = "xml";	
     public static AbstractDatabase dbAdapter;
     
     private static boolean debugErrorDisplayed = false;
     
     private static Logger logMetacat = Logger.getLogger(MetacatUtil.class);
-    private static char separator = '.';
 
-    static {
-        try {
-        	separator = PropertyService.getProperty("document.accNumSeparator").charAt(0);
-        } catch (PropertyNotFoundException pnfe) {
-        	logMetacat.error("Could not retrieve account number separator. " 
-        			+ "Separator set to '.' : " + pnfe.getMessage());
-        }
-    }
-
     /**
      * Utility method to parse the query part of a URL into parameters. This
-     * method assumes the format of the query par tof the url is an ampersand
+     * method assumes the format of the query part of the url is an ampersand
      * separated list of name/value pairs, with equal signs separating the name
      * from the value (e.g., name=tom&zip=99801 ). Returns a has of the name
      * value pairs, hashed on name.
@@ -290,310 +272,6 @@
     }
 
     /**
-     * Get docid from online/url string
-     */
-    public static String getDocIdWithRevFromOnlineURL(String url)
-    {
-        String docid = null;
-        String DOCID = "docid";
-        boolean find = false;
-        char limited = '&';
-        int count = 0; //keep track how many & was found
-        Vector list = new Vector();// keep index number for &
-        if (url == null) {
-            logMetacat.info("url is null and null will be returned");
-            return docid;
-        }
-        // the first element in list is 0
-        list.add(new Integer(0));
-        for (int i = 0; i < url.length(); i++) {
-            if (url.charAt(i) == limited) {
-                // count plus 1
-                count++;
-                list.add(new Integer(i));
-                // get substring beween two &
-                String str = url.substring(
-                        ((Integer) list.elementAt(count - 1)).intValue(), i);
-                logMetacat.info("substring between two & is: " + str);
-                //if the subString contains docid, we got it
-                if (str.indexOf(DOCID) != -1) {
-                    //get index of '="
-                    int start = getIndexForGivenChar(str, '=') + 1;
-                    int end = str.length();
-                    docid = str.substring(start, end);
-                    find = true;
-                }//if
-            }//if
-        }//for
-        //if not find, we need check the subtring between the index of last &
-        // and
-        // the end of string
-        if (!find) {
-            logMetacat.info("Checking the last substring");
-            String str = url.substring(((Integer) list.elementAt(count))
-                    .intValue() + 1, url.length());
-            logMetacat.info("Last substring is: " + str);
-            if (str.indexOf(DOCID) != -1) {
-                //get index of '="
-                int start = getIndexForGivenChar(str, '=') + 1;
-                int end = str.length();
-                docid = str.substring(start, end);
-                find = true;
-            }//if
-        }//if
-        logMetacat.info("The docid from online url is:" + docid);
-        return docid.trim();
-    }
-
-
-    /**
-     * Eocgorid identifier will look like: ecogrid://knb/tao.1.1
-     * The AccessionNumber tao.1.1 will be returned. If the given doesn't
-     * contains ecogrid, null will be returned.
-     * @param identifier String
-     * @return String
-     */
-    public static String getAccessionNumberFromEcogridIdentifier(String identifier)
-    {
-      String accessionNumber = null;
-      if (identifier != null && identifier.startsWith(DBSAXHandler.ECOGRID))
-      {
-        // find the last "/" in identifier
-        int indexOfLastSlash = identifier.lastIndexOf("/");
-        int start = indexOfLastSlash+1;
-        int end   = identifier.length();
-        accessionNumber = identifier.substring(start, end);
-      }
-      logMetacat.warn("The accession number from url is " +
-                                 accessionNumber);
-      return accessionNumber;
-    }
-
-    private static int getIndexForGivenChar(String str, char character)
-    {
-        int index = -1;
-        // make sure str is not null
-        if (str == null) {
-            logMetacat.info(
-                    "The given str is null and -1 will be returned");
-            return index;
-        }
-        // got though the string
-        for (int i = 0; i < str.length(); i++) {
-            // find the first one then break the loop
-            if (str.charAt(i) == character) {
-                index = i;
-                break;
-            }//if
-        }//for
-        logMetacat.info("the index for char " + character + " is: "
-                + index);
-        return index;
-    }
-
-    /**
-     * Utility method to get docid from a given string
-     *
-     * @param string, the given string should be these two format: 1) str1.str2
-     *            in this case docid= str1.str2 2) str1.str2.str3, in this case
-     *            docid =str1.str2
-     * @param the sperator char
-     */
-    public static String getDocIdFromString(String str)
-    {
-        String docId = null;
-        if (str == null) {
-            logMetacat.info(
-                    "The given str is null and null will be returned"
-                            + " in getDocIdfromString");
-            return docId;
-        } //make sure docid is not null
-        int dotNumber = 0;//count how many dots in given string
-        int indexOfLastDot = 0;
-
-        for (int i = 0; i < str.length(); i++) {
-            if (str.charAt(i) == separator) {
-                dotNumber++;//count how many dots
-                indexOfLastDot = i;//keep the last dot postion
-            }
-        }//for
-
-        //The string formatt is wrong, because it has more than two or less
-        // than
-        //one seperator
-        if (dotNumber > 2 || dotNumber < 1) {
-            docId = null;
-        } else if (dotNumber == 2) //the case for str1.str2.str3
-        {
-            docId = str.substring(0, indexOfLastDot);
-        } else if (dotNumber == 1) //the case for str1.str2
-        {
-            docId = str;
-        }
-
-        return docId;
-    }//getDocIdFromString
-
-    /**
-     * Utility method to get version number from a given string
-     *
-     * @param string, the given string should be these two format: 1)
-     *            str1.str2(no version) version =-1; 2) str1.str2.str3, in this
-     *            case version = str3; 3) other, vresion =-2
-     */
-    public static int getVersionFromString(String str)
-            throws NumberFormatException
-    {
-        int version = -1;
-        String versionString = null;
-        int dotNumber = 0;//count how many dots in given string
-        int indexOfLastDot = 0;
-
-        for (int i = 0; i < str.length(); i++) {
-            if (str.charAt(i) == separator) {
-                dotNumber++;//count how many dots
-                indexOfLastDot = i;//keep the last dot postion
-            }
-        }//for
-
-        //The string formatt is wrong, because it has more than two or less
-        // than
-        //one seperator
-        if (dotNumber > 2 || dotNumber < 1) {
-            version = -2;
-        } else if (dotNumber == 2 && (indexOfLastDot != (str.length() - 1)))
-        //the case for str1.str2.str3
-        {
-            versionString = str.substring((indexOfLastDot + 1), str.length());
-            version = Integer.parseInt(versionString);
-        } else if (dotNumber == 1) //the case for str1.str2
-        {
-            version = -1;
-        }
-
-        return version;
-    }//getVersionFromString
-
-    /**
-     * Utility method to get version string from a given string
-     *
-     * @param string, the given string should be these two format: 1)
-     *            str1.str2(no version) version=null; 2) str1.str2.str3, in
-     *            this case version = str3; 3) other, vresion =null;
-     */
-    public static String getRevisionStringFromString(String str)
-            throws NumberFormatException
-    {
-        // String to store the version
-        String versionString = null;
-        int dotNumber = 0;//count how many dots in given string
-        int indexOfLastDot = 0;
-
-        for (int i = 0; i < str.length(); i++) {
-            if (str.charAt(i) == separator) {
-                dotNumber++;//count how many dots
-                indexOfLastDot = i;//keep the last dot postion
-            }
-        }//for
-
-        //The string formatt is wrong, because it has more than two or less
-        // than
-        //one seperator
-        if (dotNumber > 2 || dotNumber < 1) {
-            versionString = null;
-        } else if (dotNumber == 2 && (indexOfLastDot != (str.length() - 1))) {
-            //the case for str1.str2.str3
-            // indexOfLastDot != (str.length() -1) means get rid of str1.str2.
-            versionString = str.substring((indexOfLastDot + 1), str.length());
-        } else if (dotNumber == 1) //the case for str1.str2 or str1.str2.
-        {
-            versionString = null;
-        }
-
-        return versionString;
-    }//getVersionFromString
-
-    /**
-     * This method will get docid from an AccessionNumber. There is no
-     * assumption the accessnumber will be str1.str2.str3. It can be more. So
-     * we think the docid will be get rid of last part
-     */
-    public static String getDocIdFromAccessionNumber(String accessionNumber)
-    {
-        String docid = null;
-        if (accessionNumber == null) { return docid; }
-        int indexOfLastSeperator = accessionNumber.lastIndexOf(separator);
-        docid = accessionNumber.substring(0, indexOfLastSeperator);
-        logMetacat.info("after parsing accessionnumber, docid is "
-                + docid);
-        return docid;
-    }
-
-    /**
-     * This method will get inline data id without the revision number.
-     * So if inlineData.1.2 is passed as input, inlineData.2 is returned.
-     */
-    public static String getInlineDataIdWithoutRev(String accessionNumber)
-    {
-        String docid = null;
-        if (accessionNumber == null) { return docid; }
-        int indexOfLastSeperator = accessionNumber.lastIndexOf(separator);
-        String version = accessionNumber.substring(indexOfLastSeperator,
-                                                   accessionNumber.length());
-        accessionNumber = accessionNumber.substring(0, indexOfLastSeperator);
-        indexOfLastSeperator = accessionNumber.lastIndexOf(separator);
-        docid = accessionNumber.substring(0, indexOfLastSeperator) + version;
-        logMetacat.info("after parsing accessionnumber, docid is "
-                                 + docid);
-
-        return docid;
-    }
-
-    /**
-     * This method will call both getDocIdFromString and
-     * getDocIdFromAccessionNumber. So first, if the string looks str1.str2,
-     * the docid will be str1.str2. If the string is str1.str2.str3, the docid
-     * will be str1.str2. If the string is str1.str2.str3.str4 or more, the
-     * docid will be str1.str2.str3. If the string look like str1, null will be
-     * returned
-     *
-     */
-    public static String getSmartDocId(String str)
-    {
-        String docid = null;
-        //call geDocIdFromString first.
-        docid = getDocIdFromString(str);
-        // If docid is null, try to call getDocIdFromAccessionNumber
-        // it will handle the seperator more than2
-        if (docid == null) {
-            docid = getDocIdFromAccessionNumber(str);
-        }
-        logMetacat.info("The docid get from smart docid getor is "
-                + docid);
-        return docid;
-    }
-
-    /**
-     * This method will get revision from an AccessionNumber. There is no
-     * assumption the accessnumber will be str1.str2.str3. It can be more. So
-     * we think the docid will be get rid of last part
-     */
-    public static int getRevisionFromAccessionNumber(String accessionNumber)
-            throws NumberFormatException
-    {
-        String rev = null;
-        int revNumber = -1;
-        if (accessionNumber == null) { return revNumber; }
-        int indexOfLastSeperator = accessionNumber.lastIndexOf(separator);
-        rev = accessionNumber.substring(indexOfLastSeperator + 1,
-                accessionNumber.length());
-        revNumber = Integer.parseInt(rev);
-        logMetacat.info("after parsing accessionnumber, rev is "
-                + revNumber);
-        return revNumber;
-    }
-
-    /**
      * Method to get the name of local replication server
      */
     public static String getLocalReplicationServerName()
@@ -616,55 +294,6 @@
 
     }
 
-    /**
-     * Method to get docidwithrev from eml2 inline data id The eml inline data
-     * id would look like eml.200.2.3
-     */
-    public static String getDocIdWithoutRevFromInlineDataID(String inlineDataID)
-    {
-        String docidWithoutRev = null;
-        if (inlineDataID == null) { return docidWithoutRev; }
-        char charSeperator = separator;
-        int targetNumberOfSeperator = 2;// we want to know his index
-        int numberOfSeperator = 0;
-        for (int i = 0; i < inlineDataID.length(); i++) {
-            // meet seperator, increase number of seperator
-            if (inlineDataID.charAt(i) == charSeperator) {
-                numberOfSeperator++;
-            }
-            // if number of seperator reach the target one, record the index(i)
-            // and get substring and terminate the loop
-            if (numberOfSeperator == targetNumberOfSeperator) {
-                docidWithoutRev = inlineDataID.substring(0, i);
-                break;
-            }
-        }
-
-        logMetacat.info("Docid without rev from inlinedata id: "
-                + docidWithoutRev);
-        return docidWithoutRev;
-
-    }
-
-    /**
-     * Revise stack change a stack to opposite order
-     */
-    public static Stack<NodeRecord> reviseStack(Stack<NodeRecord> stack)
-    {
-        Stack result = new Stack();
-        // make sure the parameter is correct
-        if (stack == null || stack.isEmpty()) {
-            result = stack;
-            return result;
-        }
-
-        while (!stack.isEmpty()) {
-            Object obj = stack.pop();
-            result.push(obj);
-        }
-        return result;
-    }
-
     /** A method to replace whitespace in url */
     public static String replaceWhiteSpaceForURL(String urlHasWhiteSpace)
     {
@@ -909,101 +538,4 @@
         }
         return new File(dirname);
     }
-
-	/**
-	 * Reports whether metacat is fully configured.
-	 * 
-	 * @return a boolean that is true if all sections are configured and 
-	 * false otherwise
-	 */
-	public static boolean isMetacatConfigured() {
-		boolean metacatConfigured = false;
-		try {			
-			metacatConfigured = PropertyService.arePropertiesConfigured()
-					&& AuthUtil.isAuthConfigured()
-					&& SkinUtil.areSkinsConfigured()
-					&& DatabaseUtil.isDatabaseConfigured()
-					&& GeoserverUtil.isGeoserverConfigured()
-					&& isBackupDirConfigured();
-		} catch (MetacatUtilException ue) {
-			logMetacat.error("Could not determine if metacat is configured due to utility exception: "
-					+ ue.getMessage());
-		} catch (PropertyNotFoundException pnfe) {
-			logMetacat.error("Could not determine if metacat is configured due to property exception: "
-					+ pnfe.getMessage());
-		}
-
-		return metacatConfigured;
-	}
-
-	/**
-	 * Check if the application.backupDir property is populated in
-	 * metacat.properties and that it points to a writable directory.
-	 * 
-	 * @return false if the application.backupDir property does not point to a
-	 *         writable directory.
-	 */
-	public static boolean isBackupDirConfigured() throws MetacatUtilException, PropertyNotFoundException {
-		String backupDir = PropertyService.getProperty("application.backupDir");
-		if (backupDir == null || backupDir.equals("")) {
-			return false;
-		}		
-		if (FileUtil.getFileStatus(backupDir) < FileUtil.EXISTS_READ_WRITABLE) {
-			return false;
-		}	
-		return true;
-	}
-		
-	/**
-	 * Reports whether the metacat configuration utility should be run. Returns
-	 * false if 
-	 *   -- dev.runConfiguration=false and 
-	 *   -- backup properties file exists 
-	 * Note that dev.runConfiguration should only be set to false when reinstalling the 
-	 * same version of the application in development.
-	 * 
-	 * @return a boolean that is false if dev.runConfiguration is false and the
-	 *         backup properties file exists.
-	 */
-	public static boolean bypassConfiguration() throws MetacatUtilException, ServiceException {
-		try {
-			// If the system is not configured to do bypass, return false.
-			if (!PropertyService.doBypass()) {
-				return false;
-			}
-
-			// Get the most likely backup files.  If these cannot be found, we 
-			// cannot do the configuration bypass.
-			String ExternalBaseDir = SystemUtil.discoverExternalDir();
-			if (ExternalBaseDir == null) {
-				logMetacat.error("bypassConfiguration: Could not find backup directory.");
-				// could not find backup files ... force the configuration
-				return false;
-			}
-			String realContext = ServiceService.getRealApplicationContext();
-			PropertyService.setRecommendedExternalDir(ExternalBaseDir);
-			PropertyService.setProperty("application.backupDir", 
-					ExternalBaseDir + FileUtil.getFS() + "." + realContext);
-
-			// Refresh the property service and skin property service.  This will pick up 
-			// the backup directory and populate backup properties in caches.
-			ServiceService.refreshService("PropertyService");
-			ServiceService.refreshService("SkinPropertyService");
-
-			// Call bypassConfiguration to make sure backup properties get persisted 
-			// to active properties for both main and skin properties.
-			PropertyService.bypassConfiguration();
-			SkinPropertyService.bypassConfiguration();
-
-			return true;
-		} catch (GeneralPropertyException gpe) {
-			throw new MetacatUtilException("Property error while discovering backup directory: "
-					+ gpe.getMessage());
-		} catch (MetacatUtilException mue) {
-			throw new MetacatUtilException("Utility error while discovering backup directory: "
-					+ mue.getMessage());
-		}
-
-	}
-		
 }
Index: src/edu/ucsb/nceas/metacat/util/DocumentUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/DocumentUtil.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/DocumentUtil.java	(revision 5025)
@@ -0,0 +1,413 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements utility methods for a metadata catalog
+ *  Copyright: 2009 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$Author: daigle $'
+ *     '$Date: 2009-08-04 14:32:58 -0700 (Tue, 04 Aug 2009) $'
+ * '$Revision: 5015 $'
+ *
+ * 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
+ */
+
+package edu.ucsb.nceas.metacat.util;
+
+import java.util.Stack;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.DBSAXHandler;
+import edu.ucsb.nceas.metacat.NodeRecord;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
+/**
+ * A suite of utility classes for the metadata catalog server
+ */
+public class DocumentUtil
+{
+	
+    public static AbstractDatabase dbAdapter;
+    
+    private static Logger logMetacat = Logger.getLogger(DocumentUtil.class);
+    private static char separator = '.';
+
+    static {
+        try {
+        	separator = PropertyService.getProperty("document.accNumSeparator").charAt(0);
+        } catch (PropertyNotFoundException pnfe) {
+        	logMetacat.error("Could not retrieve account number separator. " 
+        			+ "Separator set to '.' : " + pnfe.getMessage());
+        }
+    }
+
+    /**
+     * Get docid from online/url string
+     */
+    public static String getDocIdWithRevFromOnlineURL(String url)
+    {
+        String docid = null;
+        String DOCID = "docid";
+        boolean find = false;
+        char limited = '&';
+        int count = 0; //keep track how many & was found
+        Vector list = new Vector();// keep index number for &
+        if (url == null) {
+            logMetacat.info("url is null and null will be returned");
+            return docid;
+        }
+        // the first element in list is 0
+        list.add(new Integer(0));
+        for (int i = 0; i < url.length(); i++) {
+            if (url.charAt(i) == limited) {
+                // count plus 1
+                count++;
+                list.add(new Integer(i));
+                // get substring beween two &
+                String str = url.substring(
+                        ((Integer) list.elementAt(count - 1)).intValue(), i);
+                logMetacat.info("substring between two & is: " + str);
+                //if the subString contains docid, we got it
+                if (str.indexOf(DOCID) != -1) {
+                    //get index of '="
+                    int start = getIndexForGivenChar(str, '=') + 1;
+                    int end = str.length();
+                    docid = str.substring(start, end);
+                    find = true;
+                }//if
+            }//if
+        }//for
+        //if not find, we need check the subtring between the index of last &
+        // and
+        // the end of string
+        if (!find) {
+            logMetacat.info("Checking the last substring");
+            String str = url.substring(((Integer) list.elementAt(count))
+                    .intValue() + 1, url.length());
+            logMetacat.info("Last substring is: " + str);
+            if (str.indexOf(DOCID) != -1) {
+                //get index of '="
+                int start = getIndexForGivenChar(str, '=') + 1;
+                int end = str.length();
+                docid = str.substring(start, end);
+                find = true;
+            }//if
+        }//if
+        logMetacat.info("The docid from online url is:" + docid);
+        return docid.trim();
+    }
+
+
+    /**
+     * Eocgorid identifier will look like: ecogrid://knb/tao.1.1
+     * The AccessionNumber tao.1.1 will be returned. If the given doesn't
+     * contains ecogrid, null will be returned.
+     * @param identifier String
+     * @return String
+     */
+    public static String getAccessionNumberFromEcogridIdentifier(String identifier)
+    {
+      String accessionNumber = null;
+      if (identifier != null && identifier.startsWith(DBSAXHandler.ECOGRID))
+      {
+        // find the last "/" in identifier
+        int indexOfLastSlash = identifier.lastIndexOf("/");
+        int start = indexOfLastSlash+1;
+        int end   = identifier.length();
+        accessionNumber = identifier.substring(start, end);
+      }
+      logMetacat.warn("The accession number from url is " +
+                                 accessionNumber);
+      return accessionNumber;
+    }
+
+    private static int getIndexForGivenChar(String str, char character)
+    {
+        int index = -1;
+        // make sure str is not null
+        if (str == null) {
+            logMetacat.info(
+                    "The given str is null and -1 will be returned");
+            return index;
+        }
+        // got though the string
+        for (int i = 0; i < str.length(); i++) {
+            // find the first one then break the loop
+            if (str.charAt(i) == character) {
+                index = i;
+                break;
+            }//if
+        }//for
+        logMetacat.info("the index for char " + character + " is: "
+                + index);
+        return index;
+    }
+
+    /**
+     * Utility method to get docid from a given string
+     *
+     * @param string, the given string should be these two format: 1) str1.str2
+     *            in this case docid= str1.str2 2) str1.str2.str3, in this case
+     *            docid =str1.str2
+     * @param the sperator char
+     */
+    public static String getDocIdFromString(String str)
+    {
+        String docId = null;
+        if (str == null) {
+            logMetacat.info(
+                    "The given str is null and null will be returned"
+                            + " in getDocIdfromString");
+            return docId;
+        } //make sure docid is not null
+        int dotNumber = 0;//count how many dots in given string
+        int indexOfLastDot = 0;
+
+        for (int i = 0; i < str.length(); i++) {
+            if (str.charAt(i) == separator) {
+                dotNumber++;//count how many dots
+                indexOfLastDot = i;//keep the last dot postion
+            }
+        }//for
+
+        //The string formatt is wrong, because it has more than two or less
+        // than
+        //one seperator
+        if (dotNumber > 2 || dotNumber < 1) {
+            docId = null;
+        } else if (dotNumber == 2) //the case for str1.str2.str3
+        {
+            docId = str.substring(0, indexOfLastDot);
+        } else if (dotNumber == 1) //the case for str1.str2
+        {
+            docId = str;
+        }
+
+        return docId;
+    }//getDocIdFromString
+
+    /**
+     * Utility method to get version number from a given string
+     *
+     * @param string, the given string should be these two format: 1)
+     *            str1.str2(no version) version =-1; 2) str1.str2.str3, in this
+     *            case version = str3; 3) other, vresion =-2
+     */
+    public static int getVersionFromString(String str)
+            throws NumberFormatException
+    {
+        int version = -1;
+        String versionString = null;
+        int dotNumber = 0;//count how many dots in given string
+        int indexOfLastDot = 0;
+
+        for (int i = 0; i < str.length(); i++) {
+            if (str.charAt(i) == separator) {
+                dotNumber++;//count how many dots
+                indexOfLastDot = i;//keep the last dot postion
+            }
+        }//for
+
+        //The string formatt is wrong, because it has more than two or less
+        // than
+        //one seperator
+        if (dotNumber > 2 || dotNumber < 1) {
+            version = -2;
+        } else if (dotNumber == 2 && (indexOfLastDot != (str.length() - 1)))
+        //the case for str1.str2.str3
+        {
+            versionString = str.substring((indexOfLastDot + 1), str.length());
+            version = Integer.parseInt(versionString);
+        } else if (dotNumber == 1) //the case for str1.str2
+        {
+            version = -1;
+        }
+
+        return version;
+    }//getVersionFromString
+
+    /**
+     * Utility method to get version string from a given string
+     *
+     * @param string, the given string should be these two format: 1)
+     *            str1.str2(no version) version=null; 2) str1.str2.str3, in
+     *            this case version = str3; 3) other, vresion =null;
+     */
+    public static String getRevisionStringFromString(String str)
+            throws NumberFormatException
+    {
+        // String to store the version
+        String versionString = null;
+        int dotNumber = 0;//count how many dots in given string
+        int indexOfLastDot = 0;
+
+        for (int i = 0; i < str.length(); i++) {
+            if (str.charAt(i) == separator) {
+                dotNumber++;//count how many dots
+                indexOfLastDot = i;//keep the last dot postion
+            }
+        }//for
+
+        //The string formatt is wrong, because it has more than two or less
+        // than
+        //one seperator
+        if (dotNumber > 2 || dotNumber < 1) {
+            versionString = null;
+        } else if (dotNumber == 2 && (indexOfLastDot != (str.length() - 1))) {
+            //the case for str1.str2.str3
+            // indexOfLastDot != (str.length() -1) means get rid of str1.str2.
+            versionString = str.substring((indexOfLastDot + 1), str.length());
+        } else if (dotNumber == 1) //the case for str1.str2 or str1.str2.
+        {
+            versionString = null;
+        }
+
+        return versionString;
+    }//getVersionFromString
+
+    /**
+     * This method will get docid from an AccessionNumber. There is no
+     * assumption the accessnumber will be str1.str2.str3. It can be more. So
+     * we think the docid will be get rid of last part
+     */
+    public static String getDocIdFromAccessionNumber(String accessionNumber)
+    {
+        String docid = null;
+        if (accessionNumber == null) { return docid; }
+        int indexOfLastSeperator = accessionNumber.lastIndexOf(separator);
+        docid = accessionNumber.substring(0, indexOfLastSeperator);
+        logMetacat.info("after parsing accessionnumber, docid is "
+                + docid);
+        return docid;
+    }
+
+    /**
+     * This method will get inline data id without the revision number.
+     * So if inlineData.1.2 is passed as input, inlineData.2 is returned.
+     */
+    public static String getInlineDataIdWithoutRev(String accessionNumber)
+    {
+        String docid = null;
+        if (accessionNumber == null) { return docid; }
+        int indexOfLastSeperator = accessionNumber.lastIndexOf(separator);
+        String version = accessionNumber.substring(indexOfLastSeperator,
+                                                   accessionNumber.length());
+        accessionNumber = accessionNumber.substring(0, indexOfLastSeperator);
+        indexOfLastSeperator = accessionNumber.lastIndexOf(separator);
+        docid = accessionNumber.substring(0, indexOfLastSeperator) + version;
+        logMetacat.info("after parsing accessionnumber, docid is "
+                                 + docid);
+
+        return docid;
+    }
+
+    /**
+     * This method will call both getDocIdFromString and
+     * getDocIdFromAccessionNumber. So first, if the string looks str1.str2,
+     * the docid will be str1.str2. If the string is str1.str2.str3, the docid
+     * will be str1.str2. If the string is str1.str2.str3.str4 or more, the
+     * docid will be str1.str2.str3. If the string look like str1, null will be
+     * returned
+     *
+     */
+    public static String getSmartDocId(String str)
+    {
+        String docid = null;
+        //call geDocIdFromString first.
+        docid = getDocIdFromString(str);
+        // If docid is null, try to call getDocIdFromAccessionNumber
+        // it will handle the seperator more than2
+        if (docid == null) {
+            docid = getDocIdFromAccessionNumber(str);
+        }
+        logMetacat.info("The docid get from smart docid getor is "
+                + docid);
+        return docid;
+    }
+
+    /**
+     * This method will get revision from an AccessionNumber. There is no
+     * assumption the accessnumber will be str1.str2.str3. It can be more. So
+     * we think the docid will be get rid of last part
+     */
+    public static int getRevisionFromAccessionNumber(String accessionNumber)
+            throws NumberFormatException
+    {
+        String rev = null;
+        int revNumber = -1;
+        if (accessionNumber == null) { return revNumber; }
+        int indexOfLastSeperator = accessionNumber.lastIndexOf(separator);
+        rev = accessionNumber.substring(indexOfLastSeperator + 1,
+                accessionNumber.length());
+        revNumber = Integer.parseInt(rev);
+        logMetacat.info("after parsing accessionnumber, rev is "
+                + revNumber);
+        return revNumber;
+    }
+
+    /**
+     * Method to get docidwithrev from eml2 inline data id The eml inline data
+     * id would look like eml.200.2.3
+     */
+    public static String getDocIdWithoutRevFromInlineDataID(String inlineDataID)
+    {
+        String docidWithoutRev = null;
+        if (inlineDataID == null) { return docidWithoutRev; }
+        char charSeperator = separator;
+        int targetNumberOfSeperator = 2;// we want to know his index
+        int numberOfSeperator = 0;
+        for (int i = 0; i < inlineDataID.length(); i++) {
+            // meet seperator, increase number of seperator
+            if (inlineDataID.charAt(i) == charSeperator) {
+                numberOfSeperator++;
+            }
+            // if number of seperator reach the target one, record the index(i)
+            // and get substring and terminate the loop
+            if (numberOfSeperator == targetNumberOfSeperator) {
+                docidWithoutRev = inlineDataID.substring(0, i);
+                break;
+            }
+        }
+
+        logMetacat.info("Docid without rev from inlinedata id: "
+                + docidWithoutRev);
+        return docidWithoutRev;
+
+    }
+    
+    /**
+     * Revise stack change a stack to opposite order
+     */
+    public static Stack<NodeRecord> reviseStack(Stack<NodeRecord> stack)
+    {
+        Stack result = new Stack();
+        // make sure the parameter is correct
+        if (stack == null || stack.isEmpty()) {
+            result = stack;
+            return result;
+        }
+
+        while (!stack.isEmpty()) {
+            Object obj = stack.pop();
+            result.push(obj);
+        }
+        return result;
+    }
+
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/DocumentUtil.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/DBQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 5025)
@@ -52,6 +52,7 @@
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.metacat.util.AuthUtil;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.morpho.datapackage.Triple;
 import edu.ucsb.nceas.morpho.datapackage.TripleCollection;
@@ -361,7 +362,7 @@
 
 
 
-      if (qformat != null && qformat.equals(MetaCatServlet.XMLFORMAT))
+      if (qformat != null && qformat.equals(MetacatUtil.XMLFORMAT))
       {
         //xml format
         response.setContentType("text/xml");
@@ -2160,7 +2161,7 @@
                 StringWriter docString = new StringWriter();
                 xmlToHtml.transformXMLDocument(((DocumentImpl) docImplList
                         .elementAt(i)).toString(), "-//NCEAS//eml-generic//EN",
-                        "-//W3C//HTML//EN", "html", docString);
+                        "-//W3C//HTML//EN", "html", docString, null, null);
                 htmlDoc.append(docString.toString());
                 htmlDoc.append("<br><br><hr><br><br>");
             }//if
@@ -2212,9 +2213,9 @@
         String docId = null;
         int version = -5;
         // Docid without revision
-        docId = MetacatUtil.getDocIdFromString(docIdString);
+        docId = DocumentUtil.getDocIdFromString(docIdString);
         // revision number
-        version = MetacatUtil.getVersionFromString(docIdString);
+        version = DocumentUtil.getVersionFromString(docIdString);
 
         //check if the reqused docId is a data package id
         if (!isDataPackageId(docId)) {
@@ -2316,13 +2317,13 @@
                     String documentId = (String) documentImplList.elementAt(i);
                     logMetacat.info("docid: " + documentId);
                     // Get doicd without revision
-                    String docidWithoutRevision = MetacatUtil
-                            .getDocIdFromString(documentId);
+                    String docidWithoutRevision = 
+                    	DocumentUtil.getDocIdFromString(documentId);
                     logMetacat.info("docidWithoutRevsion: "
                             + docidWithoutRevision);
                     // Get revision
-                    String revision = MetacatUtil
-                            .getRevisionStringFromString(documentId);
+                    String revision = 
+                    	DocumentUtil.getRevisionStringFromString(documentId);
                     logMetacat.info("revsion from docIdentifier: "
                             + revision);
                     // Zip entry string
Index: src/edu/ucsb/nceas/metacat/AccessControlForSingleFile.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AccessControlForSingleFile.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/AccessControlForSingleFile.java	(revision 5025)
@@ -38,7 +38,7 @@
 
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
-import edu.ucsb.nceas.metacat.util.MetacatUtil;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 
 
 /** 
@@ -77,7 +77,7 @@
     try
     {
       //Get rid of dev if myaccessNumber has one;
-      docId = MetacatUtil.getDocIdFromString(myAccessionNumber);
+      docId = DocumentUtil.getDocIdFromString(myAccessionNumber);
       if (docId == null || docId.equals(""))
       {
         throw new Exception("Docid couldn't be null");
Index: src/edu/ucsb/nceas/metacat/DBTransform.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBTransform.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/DBTransform.java	(revision 5025)
@@ -28,66 +28,39 @@
 package edu.ucsb.nceas.metacat;
 
 import java.io.*;
-import java.net.URL;
-import java.net.MalformedURLException;
 import java.sql.*;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Stack;
 
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerConfigurationException;
 
 import org.apache.log4j.Logger;
 import org.apache.xerces.parsers.DOMParser;
-import org.w3c.dom.Attr;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
-import org.w3c.dom.DocumentType;
-import org.xml.sax.SAXException;
 import org.xml.sax.InputSource;
-import org.apache.xerces.dom.DocumentTypeImpl;
 import org.apache.xpath.XPathAPI;
 
-/*
-import oracle.xml.parser.v2.XSLStylesheet;
-import oracle.xml.parser.v2.XSLException;
-import oracle.xml.parser.v2.XMLParseException;
-import oracle.xml.parser.v2.XSLProcessor;
-import oracle.xml.parser.v2.XMLDocument;
-import oracle.xml.parser.v2.DOMParser;
-*/
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
 import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.metacat.service.SkinPropertyService;
-import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import edu.ucsb.nceas.utilities.SortedProperties;
 
-import java.util.Properties;
-
-
 /**
  * A Class that transforms XML documents utitlizing XSL style sheets
  */
 public class DBTransform {
 
-  //private Connection	conn = null;
-  private MetacatUtil   util = null;
+  // private Connection	conn = null;
+  // private MetacatUtil   util = null;
   private String 	configDir = null;
   private String	defaultStyle = null;
   private Logger logMetacat = Logger.getLogger(DBTransform.class);
@@ -94,6 +67,7 @@
   private String httpServer = null;
   private String contextURL = null;
   private String servletURL = null;
+  private String webServletURL = null;
   
   /**
    * construct a DBTransform instance.
@@ -113,33 +87,10 @@
     httpServer = SystemUtil.getServerURL();
     contextURL = SystemUtil.getContextURL();
     servletURL = SystemUtil.getServletURL();
+    webServletURL = SystemUtil.getWebServletURL();
   }
 
   /**
-   * @see transformXMLDocument(String doc, String sourceType,
-   *            String targetType, String qformat, PrintWriter pw,
-   *            String sessionid)
-   */
-  public void transformXMLDocument(String doc, String sourceType,
-                String targetType, String qformat, PrintWriter pw,
-                Hashtable param)
-  {
-    transformXMLDocument(doc, sourceType, targetType, qformat, pw, param, null);
-  }
-
-   /**
-   * @see transformXMLDocument(String doc, String sourceType,
-   *            String targetType, String qFormat, StringWriter pw
-   *            String sessionid)
-   */
-  public void transformXMLDocument(String doc, String sourceType,
-                String targetType, String qFormat, StringWriter pw)
-  {
-    transformXMLDocument(doc, sourceType, targetType, qFormat, pw, null);
-  }
-
-
-  /**
    * Transform an XML document using the stylesheet reference from the db
    *
    * @param doc the document to be transformed
@@ -151,7 +102,7 @@
    */
   public void transformXMLDocument(String doc, String sourceType,
                                    String targetType, String qformat,
-                                   PrintWriter pw, Hashtable param,
+                                   PrintWriter pw, Hashtable<String, String[]> param,
                                    String sessionid)
  {
 
@@ -182,7 +133,7 @@
       pw.print(doc);
     }
   }
-
+  
   /**
    * Transform an XML document to StringWriter using the stylesheet reference
    * from the db
@@ -194,7 +145,7 @@
    */
   public void transformXMLDocument(String doc, String sourceType,
                 String targetType, String qFormat, StringWriter pw,
-                String sessionid)
+                Hashtable<String, String[]> param, String sessionid)
   {
 
     // Look up the stylesheet for this type combination
@@ -207,7 +158,7 @@
         doc = removeDOCTYPE(doc);
         StringReader xml = new StringReader(doc);
         StreamResult result = new StreamResult(pw);
-        doTransform(xml, result, xslSystemId, null, qFormat, sessionid);
+        doTransform(xml, result, xslSystemId, param, qFormat, sessionid);
       }
       catch (Exception e)
       {
@@ -236,7 +187,7 @@
    */
    public void transformXMLDocument(StringReader docContent, String sourceType,
                                    String targetType, String qformat,
-                                   PrintWriter pw, Hashtable param,
+                                   PrintWriter pw, Hashtable<String, String[]> param,
                                    String sessionid)
    {
      // Look up the stylesheet for this type combination
@@ -274,7 +225,7 @@
   private void doTransform(StringReader docContent, 
           StreamResult resultOutput,
           String xslSystemId, 
-          Hashtable param,
+          Hashtable<String, String[]> param,
           String qformat, 
           String sessionid) 
           throws Exception {
@@ -284,9 +235,9 @@
       Transformer transformer;
       String key, value;
       StreamSource xml;
-      Enumeration en;
-      Iterator iterIt;
-      Map.Entry entry;
+      Enumeration<String> en;
+      Iterator<Map.Entry<String, String>> iterIt;
+      Map.Entry<String, String> entry;
       
       if (xslSystemId != null) {
         tFactory = TransformerFactory.newInstance();
@@ -299,9 +250,9 @@
         if (skinOptions != null) {            
             iterIt = skinOptions.getProperties().entrySet().iterator();
             while (iterIt.hasNext()) {
-                entry = (Entry) iterIt.next();
-                key = (String) entry.getKey();
-                value = (String) entry.getValue();
+                entry = iterIt.next();
+                key = entry.getKey();
+                value = entry.getValue();
                 //only include the plain properties
                 if (key.indexOf('.') == -1) {
                 	transformer.setParameter(key, value);
@@ -318,18 +269,20 @@
         logMetacat.debug("cgi-prefix=" + cgiPrefix);
         logMetacat.debug("httpServer=" + httpServer);
         logMetacat.debug("contextURL=" + contextURL);
-        logMetacat.debug("serletPath=" + servletURL);
+        logMetacat.debug("serletURL=" + servletURL);
+        logMetacat.debug("webServletURL=" + webServletURL);
         transformer.setParameter("cgi-prefix", cgiPrefix);
         transformer.setParameter("httpServer", httpServer);
         transformer.setParameter("contextURL", contextURL);
         transformer.setParameter("servletURL", servletURL);
+        transformer.setParameter("webServletURL", webServletURL);
         
         // Set up parameter for transformation
         if ( param != null) {
           en = param.keys();
           while (en.hasMoreElements()) {
-            key = (String) en.nextElement();
-            value = ((String[]) (param.get(key)))[0];
+            key = en.nextElement();
+            value = (param.get(key))[0];
             logMetacat.info(key+" : "+value);
             transformer.setParameter(key, value);
           }
@@ -483,25 +436,25 @@
     return systemId;
   }
 
- /* Method to modified the system id of xml input -- make sure it
-    points to system id in xml_catalog table
-  */
-  private void modifiedXmlStreamSource(StreamSource xml, String publicId)
-                                       throws Exception
-  {
-    // make sure the xml is not null
-    if (xml == null || publicId == null)
-    {
-      return;
-    }
-    logMetacat.info("public id of input stream is " +publicId);
-    // Get system id from xml_catalog table
-    String systemId = DBEntityResolver.getDTDSystemID(publicId);
-    logMetacat.info("system id of input stream from xml_catalog"
-                               +"table is " +systemId);
-    //set system id to input stream
-    xml.setSystemId(systemId);
-  }
+// /* Method to modified the system id of xml input -- make sure it
+//    points to system id in xml_catalog table
+//  */
+//  private void modifiedXmlStreamSource(StreamSource xml, String publicId)
+//                                       throws Exception
+//  {
+//    // make sure the xml is not null
+//    if (xml == null || publicId == null)
+//    {
+//      return;
+//    }
+//    logMetacat.info("public id of input stream is " +publicId);
+//    // Get system id from xml_catalog table
+//    String systemId = DBEntityResolver.getDTDSystemID(publicId);
+//    logMetacat.info("system id of input stream from xml_catalog"
+//                               +"table is " +systemId);
+//    //set system id to input stream
+//    xml.setSystemId(systemId);
+//  }
 
   /*
    * removes the DOCTYPE element and its contents from a Sting
@@ -547,7 +500,7 @@
                                    "-//NCEAS//eml-dataset//EN",
                                    "-//W3C//HTML//EN",
                                    "knb",
-                                   new PrintWriter(System.out), null);
+                                   new PrintWriter(System.out), null, null);
 
         } catch (Exception e) {
           System.err.println("EXCEPTION HANDLING REQUIRED");
@@ -557,8 +510,8 @@
      }
   }
 
-  private void dbg(int position) {
-    System.err.println("Debug flag: " + position);
-  }
+//  private void dbg(int position) {
+//    System.err.println("Debug flag: " + position);
+//  }
 
 }
Index: src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java	(revision 5025)
@@ -52,6 +52,7 @@
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.metacat.util.AuthUtil;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
@@ -599,7 +600,7 @@
                 //intitialize namespace hash for in line data
                 inlineDataNameSpace = new Hashtable();
                 //initialize file writer
-                String docidWithoutRev = MetacatUtil.getDocIdFromString(docid);
+                String docidWithoutRev = DocumentUtil.getDocIdFromString(docid);
                 String seperator = ".";
                 try {
 					seperator = PropertyService.getProperty("document.accNumSeparator");
@@ -2659,12 +2660,12 @@
       String docid = null;
       // if the url is not a ecogrid protocol, null will be getten
       String accessionNumber =
-                 MetacatUtil.getAccessionNumberFromEcogridIdentifier(url);
+    	  DocumentUtil.getAccessionNumberFromEcogridIdentifier(url);
       if (accessionNumber != null)
       {
         // handle ecogrid protocol
         // get rid of revision number to get the docid.
-        docid = MetacatUtil.getDocIdFromAccessionNumber(accessionNumber);
+        docid = DocumentUtil.getDocIdFromAccessionNumber(accessionNumber);
         onlineDataFileIdInRelationVector.add(docid);
         try
         {
Index: src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java	(revision 5024)
+++ src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java	(revision 5025)
@@ -50,6 +50,7 @@
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.DocumentUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
@@ -356,7 +357,7 @@
 				// initialize namespace hash for in line data
 				inlineDataNameSpace = new Hashtable<String, String>();
 				// initialize file writer
-				String docidWithoutRev = MetacatUtil.getDocIdFromString(docid);
+				String docidWithoutRev = DocumentUtil.getDocIdFromString(docid);
 				String seperator = ".";
 				try {
 					seperator = PropertyService.getProperty("document.accNumSeparator");
@@ -1432,7 +1433,7 @@
 							Stack<NodeRecord> newStack = accessObj
 									.getStoredTmpNodeStack();
 							// revise order
-							newStack = MetacatUtil.reviseStack(newStack);
+							newStack = DocumentUtil.reviseStack(newStack);
 							// go throught the vector of
 							// unChangeableAccessSubtreevector
 							// and find the one whose id is as same as
@@ -2173,7 +2174,7 @@
 		}
 
 		// if the url is not in ecogrid protocol, null will be returned
-		String accessionNumber = MetacatUtil.getAccessionNumberFromEcogridIdentifier(url);
+		String accessionNumber = DocumentUtil.getAccessionNumberFromEcogridIdentifier(url);
 		if (accessionNumber == null) {
 			// the accession number is null if the url does not references a
 			// local data file (url would start with "ecogrid://"
@@ -2182,7 +2183,7 @@
 		} else {
 			// handle ecogrid protocol
 			// get rid of revision number to get the docid.
-			String docid = MetacatUtil.getDocIdFromAccessionNumber(accessionNumber);
+			String docid = DocumentUtil.getDocIdFromAccessionNumber(accessionNumber);
 
 			currentDistributionSection
 					.setDistributionType(DistributionSection.DATA_DISTRIBUTION);
Index: src/edu/ucsb/nceas/metacat/MetacatVersion.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetacatVersion.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/MetacatVersion.java	(revision 5025)
@@ -0,0 +1,63 @@
+/**
+ *  '$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
+ */
+package edu.ucsb.nceas.metacat;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
+/**
+ * @author jones
+ *
+ * Version represents the current version information for this Metacat instance.
+ */
+public class MetacatVersion extends Version {
+    public MetacatVersion(String versionID) {
+    	super(versionID);
+    }
+	
+	/**
+	 * Get the current version string for this metacat instance. It is currently
+	 * stored in the metacat.properties file.
+	 * 
+	 * @return a string indicating the version of Metacat running
+	 */
+	public static String getVersionID() throws PropertyNotFoundException {
+		String version = PropertyService.getProperty("application.metacatVersion");
+		return version;
+	}
+    
+    /**
+	 * Get the version number in an XML document.
+	 * 
+	 * @return the version wrapped in an XML document
+	 */
+    public static String getVersionAsXml() throws PropertyNotFoundException {
+        StringBuffer sb = new StringBuffer();
+        sb.append("<?xml version=\"1.0\"?>");
+        sb.append("<version>");
+        sb.append(getVersionID());
+        sb.append("</version>");
+        return sb.toString();
+    }
+}

Property changes on: src/edu/ucsb/nceas/metacat/MetacatVersion.java
___________________________________________________________________
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
Added: svn:mergeinfo
## -0,0 +0,0 ##
