Index: lib/configure.jsp
===================================================================
--- lib/configure.jsp	(revision 4079)
+++ lib/configure.jsp	(nonexistent)
@@ -1,119 +0,0 @@
-<%@ page    language="java" import="java.util.Enumeration,java.util.Iterator,java.util.Set,java.util.Map,edu.ucsb.nceas.utilities.OptionsMetadata" %>
-<% 
-/**
- *  '$RCSfile$'
- *    Copyright: 2006 Regents of the University of California and the
- *               National Center for Ecological Analysis and Synthesis
- *  For Details: http://www.nceas.ucsb.edu/
- *
- *   '$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
- */
-%>
-<html>
-<head>
-<title>Metacat Configuration</title>
-<style language="Javascript">
-body {
-    font-family: Arial, sans-serif;
-    font-size: 12pt;
-    margin-left: 30px;
-    margin-right: 30px;
-    width: 700px;
-}
-
-.section {
-    font-size: 16pt;
-    font-weight: bold;
-    border-bottom: solid #dddddd 1px;
-}
-label,input {
-	display: block;
-	width: 400px;
-	float: left;
-	margin-bottom: 10px;
-}
-
-label {
-	text-align: right;
-	width: 250px;
-	padding-right: 20px;
-}
-
-br {
-	clear: left;
-}
-
-input[type="submit"] {
-    width: 50px;
-}
-</style>
-</head>
-<body>
-<p><img src="metacat-logo.png" width="100px" align="right"/> 
-<h2>Metacat Configuration</h2>
-</p>
-
-<p>Welcome to MetaCat!</p>
-<p>This installation of Metacat needs to be configured before it can
-   function properly. Please fill out the required information and you'll be
-   up and running.
-</p>
-<br clear="right"/>
-
-<form method="POST" action="<%= request.getContextPath() %>/metacat">
-<% 
-    OptionsMetadata metadata = (OptionsMetadata)request.getAttribute("metadata");
-	if (metadata != null) {
-        Set groups = metadata.getGroups();
-        Iterator iter = groups.iterator();
-   		while (iter.hasNext()) {
-       		String groupName = (String)iter.next();
-%>
-			<p class="section"><%= groupName  %></p>
-<%
-			Map keys = metadata.getKeysInGroup(groupName);
-			Iterator optionsList = keys.values().iterator();
-			while (optionsList.hasNext()) {
-    			String name = (String)optionsList.next();
-    			if (!name.equals("configured")) {
-%>
-     				<label for="<%= name %>" title="<%= metadata.getOptionDescription(name) %>"><%= metadata.getOptionLabel(name) %></label>
-	    			<input id="<%= name %>" name="<%= name %>" 
-	           			value="<%= request.getAttribute(name) %>"
-	           			<% if (name.equals("password")) { %>
-	           				type="password"
-	           			<% } else { %>
-	           				type="text" 
-	           			<% } %>
-	           			alt="<%= metadata.getOptionDescription(name) %>"
-	           			/><br/>
-<%
-    			}
-			}
-   		}
-   	}
-%>
-
-			<input type="hidden" name="action" value="configure"/>
-			<p><input type="submit" value="Save"/></p>
-
-</form>
-
-</body>
-</html>

Property changes on: lib/configure.jsp
___________________________________________________________________
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: lib/configure-restart.jsp
===================================================================
--- lib/configure-restart.jsp	(revision 4079)
+++ lib/configure-restart.jsp	(nonexistent)
@@ -1,97 +0,0 @@
-<%@ page    language="java" %>
-<% 
-/**
- *  '$RCSfile$'
- *    Copyright: 2006 Regents of the University of California and the
- *               National Center for Ecological Analysis and Synthesis
- *  For Details: http://www.nceas.ucsb.edu/
- *
- *   '$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
- */
-%>
-<html>
-<head>
-<title>Metacat Configuration Succeeded</title>
-<style language="Javascript">
-body {
-    font-family: Arial, sans-serif;
-    font-size: 12pt;
-    margin-left: 30px;
-    margin-right: 30px;
-    width: 700px;
-}
-.section {
-    font-size: 16pt;
-    font-weight: bold;
-    border-bottom: solid #dddddd 1px;
-}
-</style>
-</head>
-<body>
-<p><img src="metacat-logo.png" width="100px" align="right"/> 
-<h2>Metacat Configuration Succeeded</h2>
-</p>
-
-<p>Congratulations!</p>
-<p>You have now successfully configured this installation of Metacat. All that
-   remains is to configure geoserver and restart the metacat servlet for the changes to take effect.
-</p>
-
-<br clear="right"/>
-<p class="section">Configuring Geoserver</p>
-<p>Metacat ships with <a href="http://docs.codehaus.org/display/GEOS/Home">Geoserver</a> to handle the spatial functionality.
-   Regardless of whether you plan on using the spatial functionality you should,
-   for security purposes, configure geoserver initially so that it doesn't use
-   the default password.
-   To configure geoserver with a new admin password:
-   <ol>
-    <li> Point your browser to 
-     <a href="<%= request.getScheme() + "://" +
-       request.getServerName() + ":" + request.getServerPort() +
-              request.getContextPath() %>/geoserver.jsp"><%= request.getScheme() + "://" +
-	                      request.getServerName() + ":" + request.getServerPort() +
-			                      request.getContextPath() %>/geoserver.jsp</a>. </li>
-     <li> Login using the default username and password ( <em>admin</em> / <em>geoserver</em> ) </li>
-    <li> Point your browser to 
-     <a href="<%= request.getScheme() + "://" +
-       request.getServerName() + ":" + request.getServerPort() +
-              request.getContextPath() %>/config/loginEdit.do"><%= request.getScheme() + "://" +
-	                      request.getServerName() + ":" + request.getServerPort() +
-			                      request.getContextPath() %>/config/loginEdit.do</a>, enter a new user and password then submit. </li>
-     <li> In the upper-left, click <em>Apply</em> then <em>Save</em> to save your new password.
-
-
-    </ol>
-</p>
-
-<br clear="right"/>
-<p class="section">Restarting Metacat</p>
-<p>The simplest way to restart metacat is to restart the entire servlet engine.
-   For Tomcat, this would mean calling "$TOMCAT_HOME/bin/tomcat.sh restart" or
-   an equivalent command appropriate to your operating system. After restarting,
-   you can access your new Metacat server at the URL:
-   <a href="<%= request.getScheme() + "://" + 
-       request.getServerName() + ":" + request.getServerPort() +
-       request.getContextPath() %>"><%= request.getScheme() + "://" + 
-                request.getServerName() + ":" + request.getServerPort() +
-                request.getContextPath() %></a>
-</p>
-
-</body>
-</html>

Property changes on: lib/configure-restart.jsp
___________________________________________________________________
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: lib/index.jsp
===================================================================
--- lib/index.jsp	(revision 4079)
+++ lib/index.jsp	(revision 4080)
@@ -1,6 +1,6 @@
-<%@ page    language="java" %>
-<% 
-/**
+<%@ page    language="java" import="edu.ucsb.nceas.metacat.util.MetaCatUtil" %>
+<%
+	/**
  *  '$RCSfile$'
  *    Copyright: 2000 Regents of the University of California and the
  *               National Center for Ecological Analysis and Synthesis
@@ -43,14 +43,21 @@
  
 String qformat     = request.getParameter("qformat");
 String addedParams = "";
+String redirectURI = "";
 
-//if qformat has not been set, set its value to "DEFAULT_STYLE"
-if (qformat==null) {
-  qformat = DEFAULT_STYLE;
-  addedParams = "?qformat="+qformat;
+if (MetaCatUtil.isMetacatConfigured()) {
+    //if qformat has not been set, set its value to "DEFAULT_STYLE"
+    if (qformat==null) {
+      qformat = DEFAULT_STYLE;
+      addedParams = "?qformat="+qformat;
+    }
+    redirectURI = "/style/skins/"+qformat+"/"+addedParams;
+} else {
+    redirectURI = "/metacat";
 }
 
-String redirectURI = "/style/skins/"+qformat+"/"+addedParams;
+
+
 %>
 
 <jsp:forward page="<%= redirectURI %>" />
Index: lib/web.xml.tomcat5
===================================================================
--- lib/web.xml.tomcat5	(revision 4079)
+++ lib/web.xml.tomcat5	(revision 4080)
@@ -154,6 +154,20 @@
       <load-on-startup>2</load-on-startup>
     </servlet>
     
+    <servlet>
+      <servlet-name>MetaCatAdmin</servlet-name>
+      <servlet-class>edu.ucsb.nceas.metacat.admin.MetaCatAdminServlet</servlet-class>
+      <init-param>
+        <param-name>debug</param-name>
+        <param-value>1</param-value>
+      </init-param>
+      <init-param>
+        <param-name>listings</param-name>
+        <param-value>true</param-value>
+      </init-param>
+      <load-on-startup>3</load-on-startup>
+    </servlet>
+    
      <servlet>
       <servlet-name>replication</servlet-name>
       <servlet-class>edu.ucsb.nceas.metacat.MetacatReplication</servlet-class>
@@ -216,8 +230,8 @@
       </init-param>
       <load-on-startup>3</load-on-startup>
     </servlet>
-    -->    
-
+    -->
+    
 <servlet>
       <servlet-name>AxisServlet</servlet-name>
       <display-name>Apache-Axis Servlet</display-name>
@@ -268,6 +282,19 @@
         <servlet-name>metacat</servlet-name>
         <url-pattern>/servlet/metacat</url-pattern>
     </servlet-mapping>
+
+        
+    <servlet-mapping>
+        <servlet-name>MetaCatAdmin</servlet-name>
+        <url-pattern>/admin</url-pattern>
+    </servlet-mapping>
+
+ <!--   
+    <servlet-mapping>
+        <servlet-name>MetaCatAdmin</servlet-name>
+        <url-pattern>/admin/*</url-pattern>
+    </servlet-mapping>
+-->
     
     <servlet-mapping>
         <servlet-name>replication</servlet-name>
Index: lib/admin/ldap-configuration.jsp
===================================================================
--- lib/admin/ldap-configuration.jsp	(nonexistent)
+++ lib/admin/ldap-configuration.jsp	(revision 4080)
@@ -0,0 +1,171 @@
+<%@ page language="java" import="java.util.Set,java.util.Map,java.util.Vector" %>
+<%@ page language="java" import="edu.ucsb.nceas.utilities.*" %>
+<%
+	/**
+ *  '$RCSfile$'
+ *    Copyright: 2008 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+
+<%
+	PropertiesMetaData propMetadata =
+		(PropertiesMetaData)request.getAttribute("metadata");
+ 	Vector<String> ldapOrganizations = 
+ 		(Vector<String>)request.getAttribute("orgList"); 
+	Map<Integer, MetaDataGroup> groupMap = 
+		(Map<Integer, MetaDataGroup>)request.getAttribute("groupMap"); 
+%>
+
+<html>
+<head>
+
+<title>LDAP Configuration</title>
+<link rel="stylesheet" type="text/css" 
+        href="<%= request.getContextPath() %>/admin/admin.css"></link>
+<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
+<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/help/help.js"></script>
+
+</head>
+<body>
+<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
+<h2>LDAP Configuration</h2>
+Enter authentication service properties here. 
+<br class="ldap-header">
+
+<%@ include file="./page-message-section.jsp"%>
+
+
+<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
+                                        onsubmit="return submitForm(this);">
+<%
+	Map<Integer, MetaDataProperty> globalPropertiesMap = propMetadata.getPropertiesInGroup(1);
+	MetaDataGroup globalGroup = groupMap.get(new Integer(1));
+%>
+  <h3><%=globalGroup.getName()%></h3> 
+  <hr class=config>
+<%
+ 	if (globalGroup.getComment() != null) {
+%>
+  <div class="heading-comment"><%=globalGroup.getComment()%></div><br>
+<%
+	}
+%>
+<br>
+<table class="config-section">
+<%
+	Set<Integer> globalIdSet = globalPropertiesMap.keySet();
+	for (Integer globalId : globalIdSet) {
+		MetaDataProperty globalProperty = globalPropertiesMap.get(globalId);
+%>
+	<tr>
+		<td class="config-property-label">
+			<label for="<%= globalProperty.getKey() %>" title="<%= globalProperty.getDescription() %>"><%=globalProperty.getLabel()%></label>
+		</td>	
+		<td class="config-property-input" >	
+			<input id="<%= globalProperty.getKey() %>" name="<%= globalProperty.getKey() %>" 
+				value="<%= request.getAttribute(globalProperty.getKey()) %>"             		    	    	           		    	             			
+				type="text"           			
+				alt="LDAP server URL"/>	   
+		</td>
+		<td class="config-question-mark">        		    
+			<img src="style/images/question-mark.gif" onClick="helpWindow('<%= request.getContextPath() %>', '<%= globalProperty.getHelpFile() %>')"/><br/>
+		</td>
+	</tr>
+<%
+	}
+    Map<Integer, MetaDataProperty> orgPropertyMap = propMetadata.getPropertiesInGroup(2);
+    MetaDataGroup orgGroup = groupMap.get(new Integer(2));
+    Set<Integer> orgIdSet = orgPropertyMap.keySet();
+%>
+	</table>
+	<h3><%=orgGroup.getName()%></h3> 
+    <hr class=config>
+<%
+ 	if (orgGroup.getComment() != null) {
+%>
+  <div class="heading-comment"><%= orgGroup.getComment() %></div>
+<%
+ 	}
+%>
+<br>
+<%
+	for (String orgName : ldapOrganizations) {
+%>
+<table class="config-section">
+	<tr>
+		<td class="config-checkbox">
+	  		<input class="org" type="checkbox" name="<%= orgName %>.cb" onClick="toggleHiddenTable(this, 'hiding-section-<%= orgName %>')"/>
+	  	</td>
+	  	<td class="config-checkbox-label">	
+			<label for="<%= orgName %>.cb"><%=orgName%></label>
+		</td> 
+		<td class="config-question-mark">
+			<img src="style/images/question-mark.gif"
+					alt="blah"
+					title="blah"/>
+		</td>
+	</tr>
+</table>
+<table class="config-section-hiding" id="hiding-section-<%= orgName %>">  
+<%
+	  	for (Integer orgId : orgIdSet) {
+	  	MetaDataProperty orgProperty = orgPropertyMap.get(orgId);
+	  	String orgKeyName = orgProperty.getKey() + "." + orgName;
+%>		
+	<tr>
+		<td class="config-property-label" >	
+	    	<label for="<%= orgKeyName %>" title="<%= orgProperty.getDescription() %>"><%= orgProperty.getLabel() %></label>
+     	</td>	
+     	<td class="config-property-input" >
+			<input name="<%= orgKeyName %>" 
+				value="<%= request.getAttribute(orgKeyName) %>"	  
+<% 
+			if (orgProperty.getFieldType().equals("password")) { 
+%>           		    	    	           		    	             			
+	           	type="password"       
+<%
+	  		}
+%>    			
+	           alt="List of administrators for this installation in LDAP DN syntax (colon separated)"/>	           		    
+		</td>
+		<td class="config-question-mark">
+			<img src="style/images/question-mark.gif" onClick="helpWindow('<%= request.getContextPath() %>', '<%= orgProperty.getHelpFile() %>')"/>
+		</td>
+	</tr>	  
+<%
+	  	}
+%>
+      </table>
+<%
+	}
+%>
+
+  <input type="hidden" name="configureType" value="ldap"/>
+  <input type="hidden" name="processForm" value="true"/>
+  <input class="left-button" type="submit" value="Save"/>
+  <input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
+
+</form>
+
+</body>
+</html>

Property changes on: lib/admin/ldap-configuration.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/admin.js
===================================================================
--- lib/admin/admin.js	(nonexistent)
+++ lib/admin/admin.js	(revision 4080)
@@ -0,0 +1,98 @@
+ /*
+  *   '$RCSfile$'
+  *     Purpose: Default style sheet for admin web pages 
+  *   Copyright: 2008 Regents of the University of California and the
+  *               National Center for Ecological Analysis and Synthesis
+  *     Authors: Matt Jones
+  *
+  *    '$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
+  */
+
+function validateForm(form_ref) {
+    j = form_ref.length
+    for (i = 0; i < j; i++) {
+        if (form_ref.elements[i].value == "") {
+            alert("All form fields must be populated");
+            return false;
+        }
+    }
+    return true;
+}
+
+function submitForm(action,form_ref) {
+	form_ref.action.value=action;
+	form_ref.sessionId.value=<xsl:value-of select="$sessid" />;
+	form_ref.submit();
+}
+
+function validataAndSubmitForm(action,form_ref) {
+	form_ref.action.value=action;
+	form_ref.sessionId.value=<xsl:value-of select="$sessid" />;
+	validateForm(form_ref)
+	form_ref.submit();
+}
+
+function forward(location) {
+	window.location = location;
+}
+
+function toggleHiddenRow(thisObj, id) {
+	if (thisObj.checked) {
+		showRow(id);
+	} else {
+		hideObject(id);
+	}
+}
+
+function toggleHiddenInline(thisObj, id) {
+	if (thisObj.checked) {
+		showInline(id);
+	} else {
+		hideObject(id);
+	}
+}
+
+function toggleHiddenTable(thisObj, id) {
+	if (thisObj.checked) {
+		showSection(id);
+	} else {
+		hideObject(id);
+	}
+}
+
+function hideObject(objectID) 
+{ 
+	document.getElementById(objectID).style.display = 'none'; 
+} 
+
+function showRow(objectID) 
+{ 
+	document.getElementById(objectID).style.display = 'table-row'; 
+} 
+
+function showInline(objectID)
+{
+        document.getElementById(objectID).style.display = 'inline';
+}
+
+function showSection(objectID) 
+{ 
+	document.getElementById(objectID).style.display = 'table'; 
+} 
+

Property changes on: lib/admin/admin.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/skins-configuration.jsp
===================================================================
--- lib/admin/skins-configuration.jsp	(nonexistent)
+++ lib/admin/skins-configuration.jsp	(revision 4080)
@@ -0,0 +1,207 @@
+<%@ page language="java" %>
+<%@ page import="java.util.Set,java.util.HashMap,java.util.Map,java.util.SortedMap,java.util.Vector" %>
+<%@ page import="edu.ucsb.nceas.utilities.PropertiesMetaData" %>
+<%@ page import="edu.ucsb.nceas.utilities.MetaDataGroup,edu.ucsb.nceas.utilities.MetaDataProperty" %>
+<% 
+/**
+ *  '$RCSfile$'
+ *    Copyright: 2008 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+
+<%
+ 	Vector<String> skinNames = (Vector<String>)request.getAttribute("skinNameList"); 
+	String defaultStyle = (String)request.getAttribute("defaultStyle");
+%>
+
+<html>
+<head>
+
+<title>Skins Configuration</title>
+<link rel="stylesheet" type="text/css" 
+        href="<%= request.getContextPath() %>/admin/admin.css"></link>
+<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
+<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/help/help.js"></script>
+
+
+</head>
+<body>
+<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
+<h2>Skins Configuration</h2>
+
+<br class="skins-header">
+
+<%@ include file="./page-message-section.jsp"%>
+
+<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
+                                        onsubmit="return validate_form();">
+
+
+<h3>Skins Configuration</h3>
+<hr class=config>
+<div class="heading-comment">
+	Choose and configure the skins that will be available in this instance of MetaCat
+</div><br>
+
+<%
+	HashMap<String, HashMap<String, String>> allSkinProperties = 
+		(HashMap<String, HashMap<String, String>>)request.getAttribute("skinProperties");
+	HashMap<String, PropertiesMetaData> allMetaData = 
+		(HashMap<String, PropertiesMetaData>)request.getAttribute("metadataMap");
+
+	for (String skinName : skinNames) {
+%>
+	<table class="config-section">
+		<tr>
+			<td class="config-checkbox">
+				<input type="checkbox" name="<%= skinName %>.cb" id="<%= skinName %>.cb"onClick="toggleHiddenTable(this, 'hiding-section-<%= skinName %>')"/>
+			</td>
+			<td class="config-checkbox-label">	
+				<label for="<%= skinName %>.cb %>"><%= skinName %></label>
+<%
+		if (skinName.equals(defaultStyle)) {
+%>		
+				<div style="display: inline;" id="hiding-default-<%= skinName %>"> (default)<div>	
+<%
+		} else {
+%>		
+				<div style="display: none;" id="hiding-default-<%= skinName %>"> (default)<div>	
+<%
+		} 
+%>
+			</td> 
+			<td class="config-question-mark">
+				<img src="style/images/question-mark.gif"
+						alt="blah"
+						title="blah"/>
+			</td>
+		</tr>
+	</table>
+	<table class="config-section-hiding" id="hiding-section-<%= skinName %>">
+<%
+		HashMap<String, String> skinProperties = allSkinProperties.get(skinName);
+		PropertiesMetaData metaData = (PropertiesMetaData)allMetaData.get(skinName);
+		Map<Integer, MetaDataGroup> metaDataGroups = metaData.getGroups();
+		Set<Integer> groupKeys = metaDataGroups.keySet();
+		for (Integer groupkey : groupKeys) {
+			SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
+			Set<Integer> propertyKeys = propertyMap.keySet();
+%>
+			<tr>
+				<td class="config-property-label" >
+					<label for="<%= skinName %>-radio"> Make <%= skinName %> default </label>
+				</td>
+				<td class="config-property-input" >
+					<input type="radio" name="default-flag" id="<%= skinName %>-radio" value="<%= skinName %>" onChange="toggleHiddenInline(this, 'hiding-default-<%= skinName %>')"/>
+				</td>
+				<td class="config-question-mark">
+					<img src="style/images/question-mark.gif" 
+							alt="boffo" 
+							title="biffo"/><br>
+				</td>
+			</tr>
+<%
+			for (Integer propertyKey : propertyKeys) {
+%>		
+			<tr>	
+<%		
+				MetaDataProperty metaDataProperty = propertyMap.get(propertyKey);							
+				String fieldType = metaDataProperty.getFieldType(); 
+				if (fieldType.equals("select")) {
+%> 
+				<td class="config-property-label">
+					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>  
+				</td>
+				<td class="config-property-input"> 			
+					<select name="<%= metaDataProperty.getKey() %>">
+<%
+					Vector<String> fieldOptions = metaDataProperty.getFieldOptions();
+					for (String optionName : fieldOptions) {
+%>
+						<option value="<%= optionName %>"> <%= optionName %>
+<%
+					}
+%>
+					</select>
+				</td>
+				<td class="config-question-mark"> 
+					<img src="style/images/question-mark.gif" 
+							alt="<%= metaDataProperty.getDescription() %>" 
+							title="<%= metaDataProperty.getDescription() %>"/><br/>
+				</td>
+
+<%		
+				} else if (fieldType.equals("password")) {
+%>
+				<td class="config-property-label">
+					<label  for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
+				</td>
+				<td class="config-property-input"> 
+					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
+							type="<%= fieldType %>"
+							alt="<%= metaDataProperty.getDescription() %>"/> 
+				</td>
+				<td class="config-question-mark"> 
+					<img src="style/images/question-mark.gif" 
+							alt="<%= metaDataProperty.getDescription() %>" 
+							title="<%= metaDataProperty.getDescription() %>"/><br/>
+				</td>
+<%		
+				} else {
+%>
+				<td class="config-property-label">
+					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
+				</td>
+				<td class="config-property-input"> 
+					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 
+							value="<%= skinProperties.get(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
+							type="<%= fieldType %>	"           			
+							alt="<%= metaDataProperty.getDescription() %>"/>	           		    
+				</td>
+				<td class="config-question-mark"> 
+					<img src="style/images/question-mark.gif" onClick="helpWindow('ldap_url_help.html')"/><br/>
+				</td>
+<%   			
+				}					
+			}	
+%>
+			</tr>
+<%
+		}
+
+%>
+
+	</table>
+<%
+	}
+%>
+	<input type="hidden" name="configureType" value="skins"/>
+	<input type="hidden" name="processForm" value="true"/>
+	<br>
+	<input class="left-button" type="submit" value="Save"/>
+	<input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
+
+</form>
+
+</body>
+</html>

Property changes on: lib/admin/skins-configuration.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/properties-configuration.jsp
===================================================================
--- lib/admin/properties-configuration.jsp	(nonexistent)
+++ lib/admin/properties-configuration.jsp	(revision 4080)
@@ -0,0 +1,152 @@
+<%@ page language="java" import="java.util.Collection,java.util.Set,java.util.TreeSet,java.util.Map,java.util.Vector" %>
+<%@ page language="java" import="edu.ucsb.nceas.utilities.PropertiesMetaData,edu.ucsb.nceas.utilities.MetaDataGroup,edu.ucsb.nceas.utilities.MetaDataProperty" %>
+<% 
+/**
+ *  '$RCSfile$'
+ *    Copyright: 2008 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+
+<html>
+<head>
+
+<title>Metacat Properties Configuration</title>
+<link rel="stylesheet" type="text/css" 
+        href="<%= request.getContextPath() %>/admin/admin.css"></link>
+<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
+
+</head>
+<body>
+<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
+<h2>MetaCat Properties Configuration</h2>
+
+<p>Enter MetaCat System properties here.  All Fields must be filled in before saving.
+</p>
+<br clear="right"/>
+
+<%@ include file="page-message-section.jsp"%>
+
+<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
+                                        onsubmit="return submitForm(this);">
+<% 
+	// metadata holds all group and properties metadata
+    PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata");
+	if (metadata != null) {
+		// each group describes a section of properties
+		Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
+		Set<Integer> groupIdSet = groupMap.keySet();
+		for (Integer groupId : groupIdSet) {
+			// for this group, display the header (group name)
+			MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
+%>
+			<p class="section"><%= metaDataGroup.getName()  %></p>
+			<table class="config-section">
+<%
+			// get all the properties in this group
+			Map<Integer, MetaDataProperty> propertyMap = 
+				metadata.getPropertiesInGroup(metaDataGroup.getIndex());
+			Set<Integer> propertyIndexes = propertyMap.keySet();
+			// iterate through each property and display appropriately
+			for (Integer propertyIndex : propertyIndexes) {
+				MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
+    			String fieldType = metaDataProperty.getFieldType(); 
+    			if (fieldType.equals("select")) {
+%> 
+			<tr>
+				<td class="config-property-label">
+     				<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>   
+     			</td>	
+     			<td class="config-property-input" >		
+					<select name="<%= metaDataProperty.getKey() %>">
+<%
+					Vector<String> fieldOptions = metaDataProperty.getFieldOptions();
+					for (String optionName : fieldOptions) {
+%>
+					<option value="<%= optionName %>"> <%= optionName %>
+<%
+				}
+%>
+					</select>
+				</td>
+				<td class="config-question-mark">
+					<img src="style/images/question-mark.gif" 
+	           		       alt="<%= metaDataProperty.getDescription() %>" 
+	           		       title="<%= metaDataProperty.getDescription() %>"/>
+				</td>
+			</tr>
+
+<%		
+				} else if (fieldType.equals("password")) {
+%>
+			<tr>
+				<td class="config-property-label">
+					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
+     			</td>	
+     			<td class="config-property-input" >	
+					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
+	           		    	type="<%= fieldType %>"
+	           		    	alt="<%= metaDataProperty.getDescription() %>"/> 
+				</td>
+				<td class="config-question-mark">
+					<img src="style/images/question-mark.gif" 
+	           		       alt="<%= metaDataProperty.getDescription() %>" 
+	           		       title="<%= metaDataProperty.getDescription() %>"/>
+				</td>
+			</tr>
+<%		
+				} else {
+%>
+			<tr>
+				<td class="config-property-label">
+					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
+     			</td>	
+     			<td class="config-property-input" >							
+					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 
+	    			        value="<%= request.getAttribute(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
+	           		    	type="<%= fieldType %>	"           			
+	           		    	alt="<%= metaDataProperty.getDescription() %>"/>	
+	           	</td>
+				<td class="config-question-mark">           		    
+					<img class=question-mark src="style/images/question-mark.gif" onClick="helpWindow('ldap_url_help.html')"/>
+				</td>
+ 
+<%   			
+				}
+			}
+%>
+
+			</table>
+<%
+		}
+	}
+%>
+
+			<input type="hidden" name="configureType" value="properties"/>
+			<input type="hidden" name="processForm" value="true"/>
+			<input class=left-button type="submit" value="Save"/>
+			<input class=button type="button" value="Cancel" onClick="forward('./admin')"> 
+
+</form>
+
+</body>
+</html>

Property changes on: lib/admin/properties-configuration.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/org.properties.metadata.xml
===================================================================
--- lib/org.properties.metadata.xml	(nonexistent)
+++ lib/org.properties.metadata.xml	(revision 4080)
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+
+<metadataConfig>
+	<group>
+		<index>1</index>
+		<name>Global Values</name>
+		<description>Database Configuration Values.</description>
+	</group>
+	<group>
+		<index>2</index>
+		<name>Organizational Level Values</name>
+		<comment>
+			Select the organizations for which you have admin rights, and update
+			the configuration information if necessary.
+		</comment>
+		<description>Server Configuration Values.</description>
+	</group>
+
+	<config>
+		<key>ldap.url</key>
+		<label>LDAP URL</label>
+		<group>1</group>
+		<index>1</index>
+		<description>LDAP Server URL.</description>
+		<helpFile>properties.html#ldap.url</helpFile>
+	</config>
+
+	<config>
+		<key>ldap.surl</key>
+		<label>LDAP Secure URL</label>
+		<group>1</group>
+		<index>2</index>
+		<description>LDAP Secure Server URL.</description>
+		<helpFile>properties.html#ldap.surl</helpFile>
+	</config>
+
+	<config>
+		<key>ldap.administrators</key>
+		<label>MetaCat Administrators</label>
+		<group>1</group>
+		<index>3</index>
+		<description>LDAP Administrators.</description>
+		<helpFile>properties.html#ldap.admin</helpFile>
+	</config>
+	
+	<config>
+		<key>ldap.allowedSubmitters</key>
+		<label>Allowed Submitters</label>
+		<group>1</group>
+		<index>4</index>
+		<description>Allowed Submitters</description>
+		<helpFile>properties.html#ldap.allowed</helpFile>
+	</config>
+
+	<config>
+		<key>ldap.deniedSubmitters</key>
+		<label>Denied Submitters</label>
+		<group>1</group>
+		<index>5</index>
+		<description>Denied Submitters</description>
+		<helpFile>properties.html#ldap.denied</helpFile>
+	</config>
+	
+	<config>
+		<key>ldap.org</key>
+		<label>LDAP Organization</label>
+		<group>2</group>
+		<index>1</index>
+		<description>LDAP Organization</description>
+		<helpFile>properties.html#ldap.org</helpFile>
+	</config>
+	
+	<config>
+		<key>ldap.base</key>
+		<label>LDAP Base</label>
+		<group>2</group>
+		<index>2</index>
+		<description>LDAP Base.</description>
+		<helpFile>properties.html#ldap.base</helpFile>
+	</config>
+	
+	<config>
+		<key>ldap.user</key>
+		<label>LDAP User Name</label>
+		<group>2</group>
+		<index>3</index>
+		<description>LDAP User Name</description>
+		<helpFile>properties.html#ldap.user</helpFile>
+	</config>
+
+	<config>
+		<key>ldap.password</key>
+		<label>LDAP Password</label>
+		<group>2</group>
+		<fieldType>password</fieldType>
+		<index>4</index>
+		<description>LDAP Password</description>
+		<helpFile>properties.html#ldap.passwd</helpFile>
+	</config>
+
+</metadataConfig>
\ No newline at end of file

Property changes on: lib/org.properties.metadata.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/sanparks/SaeonLogin.jspx
===================================================================
--- lib/style/skins/sanparks/SaeonLogin.jspx	(revision 4079)
+++ lib/style/skins/sanparks/SaeonLogin.jspx	(revision 4080)
@@ -22,7 +22,7 @@
 	<jsp:element name="script">
 		<jsp:attribute name="language">JavaScript</jsp:attribute>
 		<jsp:attribute name="src">
-			<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/searchPathQuery.js"</jsp:expression>
+			<jsp:expression>CONTEXT_URL + "/style/skins/sanparks/searchPathQuery.js"</jsp:expression>
 		</jsp:attribute>
 	</jsp:element>
 	<script type="text/javascript">
@@ -63,7 +63,7 @@
 		<jsp:attribute name="rel">stylesheet</jsp:attribute>
 		<jsp:attribute name="type">text/css</jsp:attribute>
 		<jsp:attribute name="href">
-			<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/sanparks.css"</jsp:expression>
+			<jsp:expression>CONTEXT_URL + "/style/skins/sanparks/sanparks.css"</jsp:expression>
 		</jsp:attribute>
 	</jsp:element>
 </head>
@@ -338,7 +338,7 @@
 				<jsp:element name="form">
 					<jsp:attribute name="method">post</jsp:attribute>
 					<jsp:attribute name="action">
-						<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/upload.jsp"</jsp:expression>
+						<jsp:expression>CONTEXT_URL + "/style/skins/sanparks/upload.jsp"</jsp:expression>
 					</jsp:attribute>
 					<input type="submit" value="Go >" class="button_login" />
 				</jsp:element>
@@ -373,7 +373,7 @@
 	
 		<!-- map frame -->
         <script language="JavaScript">
-            insertMap("<jsp:expression>SERVER_URL_WITH_CONTEXT</jsp:expression>");
+            insertMap("<jsp:expression>CONTEXT_URL</jsp:expression>");
         </script>
 	</td>
 	
Index: test/JDBCTest.java
===================================================================
--- test/JDBCTest.java	(revision 4079)
+++ test/JDBCTest.java	(revision 4080)
@@ -24,188 +24,162 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-
-
 import java.io.*;
 import java.util.Vector;
 import java.lang.*;
 import java.sql.*;
 import edu.ucsb.nceas.metacat.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
-
 /**
  * A class to test DBConnectionPool class
  */
- 
-public class JDBCTest
-{
- 
-  /**
-   * the main routine used to test how many sql command one connection can 
-   * execute   
-   * Usage: java -cp metacat.jar JDBC-diver-file  <-Driver driverName -t times>
-   *
-   * @param drivername, the jdbc dirver name for database
-   * @param times, how many queries  will be run
-   */
-  public static void main(String [] args)
-  {
-    //instaniate a DBConnectionPool object
-    //Becuase it is singleton, we should use getInstance method
-    int loop = 10;
-    String driverName = null;
-    Connection conn = null;
-    long index = (new Double (Math.random()*100000)).longValue();
-    System.out.println("index: "+index);
-   
 
-    try
-    {
-      for ( int i=0 ; i < args.length; ++i ) 
-      {
-        if ( args[i].equals("-Driver"))
-        {
-          driverName=args[++i];
-         
-        }//if
-        else if ( args[i].equals( "-t" ) ) 
-        {
-          loop =  Integer.parseInt(args[++i]);
-        }//else if 
-        else 
-        {
-          System.err.println
-            ( "   args[" +i+ "] '" +args[i]+ "' ignored." );
-        }//else
-      }//for
-      
-      System.out.println("Driver name: "+driverName);
-      //open and get one connection
-      conn = getConnection(driverName);
-    
-      
-      //use this connection excecute sql command
-      for (int i= 0; i<loop; i++)
-      {
-          
-        if (conn == null || conn.isClosed())
-        {
-          System.out.println("db conncetion is bad");
-          break;
-        }
-        //System.out.println("metadata: "+conn.getMetaData());
-        //System.out.println("warning: "+conn.getWarnings());
-        insert(conn, index);
-        select(conn);
-        index++;
-      }//for
-      System.out.println("End");
-     
-    }//try
-    catch (SQLException e)
-    {
-      System.out.println("error in sql: "+e.getMessage());
-    }//catch
-    catch (Exception ee)
-    {
-      System.out.println("error in other: "+ee.getMessage());
-    }
-    finally
-    {
-       try
-       {
-         conn.close();
-       }
-       catch (SQLException eee)
-       {
-         System.out.println("error in close connection: "+eee.getMessage());
-       }
-    }//finally
-  }//main
-  
+public class JDBCTest {
 
-  /**
-   * Method to open a connection to database
-   */
-  private static Connection getConnection(String nameOfDriver) 
-                                    throws SQLException, ClassNotFoundException
-  {
-    String url = null;
-    String user = null;
-    String password = null;
-    url = MetaCatUtil.getOption("defaultDB");
-    //System.out.println("url: "+url);
-    user = MetaCatUtil.getOption("user");
-    //System.out.println("user: "+user);
-    password = MetaCatUtil.getOption("password");
-    //System.out.println("password: "+password);
-    //load Oracle dbDriver
-    Class.forName(nameOfDriver);
-    //System.out.println("after load dbDriver");
-    //open and return connection
-    return DriverManager.getConnection(url, user, password);
-  }
-  
-  
-  /**
-   * Method to run a sal insert command
-   * @param conn, the connection will be used
-   * @param i, part of docid
-   */
-  private static void insert(Connection conn, long i) throws SQLException
-  {
-   
-    int serialNumber = 0;
-    //Connection conn = null;
-    PreparedStatement pStmt = null;
-    String sql = "insert into xml_documents (docid) values (?)";
-    String docid = "jing."+i;
-    try
-    {
-      
-      pStmt = conn.prepareStatement(sql);
-      pStmt.setString(1, docid);
-      pStmt.execute();
-      System.out.println("Inserted successfully: "+i);
-     }
-     finally
-     {
-       pStmt.close();
-     }
-    
-  }//insert
-    
- 
-  /**
-   * Method to run a sql select commnad
-   * @param conn, connection will be used
-   */
-  private static void select(Connection conn) throws SQLException
-  {
-   
-    int serialNumber = 0;
-    PreparedStatement pStmt = null;
-    ResultSet rs = null;
-    String sql = "select docid from xml_documents where docid like'%jing%'";
-    
-    try
-    {
-     
-      pStmt = conn.prepareStatement(sql);
-      pStmt.execute();
-      rs = pStmt.getResultSet();
-      if (rs.next())
-      {
-        String str = rs.getString(1);
-        System.out.println("Select docid: "+str);
-      }
-    }
-    finally
-    {
-      pStmt.close();
+	/**
+	 * the main routine used to test how many sql command one connection can 
+	 * execute   
+	 * Usage: java -cp metacat.jar JDBC-diver-file  <-Driver driverName -t times>
+	 *
+	 * @param drivername, the jdbc dirver name for database
+	 * @param times, how many queries  will be run
+	 */
+	public static void main(String[] args) {
+		//instaniate a DBConnectionPool object
+		//Becuase it is singleton, we should use getInstance method
+		int loop = 10;
+		String driverName = null;
+		Connection conn = null;
+		long index = (new Double(Math.random() * 100000)).longValue();
+		System.out.println("index: " + index);
 
-    }
-    
-  }//select
-  
+		try {
+			for (int i = 0; i < args.length; ++i) {
+				if (args[i].equals("-Driver")) {
+					driverName = args[++i];
+
+				}//if
+				else if (args[i].equals("-t")) {
+					loop = Integer.parseInt(args[++i]);
+				}//else if 
+				else {
+					System.err.println("   args[" + i + "] '" + args[i] + "' ignored.");
+				}//else
+			}//for
+
+			System.out.println("Driver name: " + driverName);
+			//open and get one connection
+			conn = getConnection(driverName);
+
+			//use this connection excecute sql command
+			for (int i = 0; i < loop; i++) {
+
+				if (conn == null || conn.isClosed()) {
+					System.out.println("db conncetion is bad");
+					break;
+				}
+				//System.out.println("metadata: "+conn.getMetaData());
+				//System.out.println("warning: "+conn.getWarnings());
+				insert(conn, index);
+				select(conn);
+				index++;
+			}//for
+			System.out.println("End");
+
+		}//try
+		catch (SQLException e) {
+			System.out.println("error in sql: " + e.getMessage());
+		}//catch
+		catch (Exception ee) {
+			System.out.println("error in other: " + ee.getMessage());
+		} finally {
+			try {
+				conn.close();
+			} catch (SQLException eee) {
+				System.out.println("error in close connection: " + eee.getMessage());
+			}
+		}//finally
+	}//main
+
+	/**
+	 * Method to open a connection to database
+	 */
+	private static Connection getConnection(String nameOfDriver) throws SQLException,
+			ClassNotFoundException {
+		String url = null;
+		String user = null;
+		String password = null;
+
+		try {
+			url = PropertyService.getProperty("database.connectionURI");
+			//System.out.println("url: "+url);
+			user = PropertyService.getProperty("database.user");
+			//System.out.println("user: "+user);
+			password = PropertyService.getProperty("database.password");
+			//System.out.println("password: "+password);
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: "
+					+ pnfe.getMessage());
+		}
+
+		//load Oracle dbDriver
+		Class.forName(nameOfDriver);
+		//System.out.println("after load dbDriver");
+		//open and return connection
+		return DriverManager.getConnection(url, user, password);
+	}
+
+	/**
+	 * Method to run a sal insert command
+	 * @param conn, the connection will be used
+	 * @param i, part of docid
+	 */
+	private static void insert(Connection conn, long i) throws SQLException {
+
+		int serialNumber = 0;
+		//Connection conn = null;
+		PreparedStatement pStmt = null;
+		String sql = "insert into xml_documents (docid) values (?)";
+		String docid = "jing." + i;
+		try {
+
+			pStmt = conn.prepareStatement(sql);
+			pStmt.setString(1, docid);
+			pStmt.execute();
+			System.out.println("Inserted successfully: " + i);
+		} finally {
+			pStmt.close();
+		}
+
+	}//insert
+
+	/**
+	 * Method to run a sql select commnad
+	 * @param conn, connection will be used
+	 */
+	private static void select(Connection conn) throws SQLException {
+
+		int serialNumber = 0;
+		PreparedStatement pStmt = null;
+		ResultSet rs = null;
+		String sql = "select docid from xml_documents where docid like'%jing%'";
+
+		try {
+
+			pStmt = conn.prepareStatement(sql);
+			pStmt.execute();
+			rs = pStmt.getResultSet();
+			if (rs.next()) {
+				String str = rs.getString(1);
+				System.out.println("Select docid: " + str);
+			}
+		} finally {
+			pStmt.close();
+
+		}
+
+	}//select
+
 }//DBConnectionPoolTester
Index: test/edu/ucsb/nceas/metacatnettest/MetaCatServletNetTest.java
===================================================================
--- test/edu/ucsb/nceas/metacatnettest/MetaCatServletNetTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacatnettest/MetaCatServletNetTest.java	(revision 4080)
@@ -27,7 +27,10 @@
 package edu.ucsb.nceas.metacatnettest;
 
 import edu.ucsb.nceas.metacat.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import edu.ucsb.nceas.morpho.framework.*;
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -40,626 +43,531 @@
 
 import org.apache.log4j.Logger;
 
-
 /**
  * A JUnit test for testing Step class processing
  */
-public class MetaCatServletNetTest extends TestCase
-{
-  static
-  {
-	  try
-	  {
-		  Options.initialize(new File("build/tests/metacat.properties"));
-	  }
-	  catch(Exception e)
-	  {
-		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-	  }
-  }
-  
-  private String metacatURL=MetaCatUtil.getOption("junittesturl");
-  private String serialNumber;
-  private static Logger logMetacat = Logger.getLogger(DocumentImpl.class);
-  /**
-   * Constructor to build the test
-   *
-   * @param name the name of the test method
-   */
-  public MetaCatServletNetTest(String name)
-  {
-    super(name);
-  }
+public class MetaCatServletNetTest extends TestCase {
+	private static String metacatURL;
+	static {
+		try {
+			metacatURL = SystemUtil.getServletURL();
+			Options.initialize(new File("build/tests/metacat.properties"));
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("could not find metacat URL in MetacatServletNetTest: "
+					+ pnfe.getMessage());
+		} catch (Exception e) {
+			System.err.println("Exception in initialize option in MetacatServletNetTest: "
+					+ e.getMessage());
+		}
+	}
 
- /**
-   * Constructor to build the test
-   *
-   * @param name the name of the test method
-   */
-  public MetaCatServletNetTest(String name, String serial)
-  {
-    super(name);
-    serialNumber=serial;
-  }
-  /**
-   * Establish a testing framework by initializing appropriate objects
-   */
-  public void setUp()
- {
-    
- }
+	private String serialNumber;
+	private static Logger logMetacat = Logger.getLogger(DocumentImpl.class);
 
-  /**
-   * Release any objects after tests are complete
-   */
-  public void tearDown()
-  {
-  }
+	/**
+	 * Constructor to build the test
+	 *
+	 * @param name the name of the test method
+	 */
+	public MetaCatServletNetTest(String name) {
+		super(name);
+	}
 
-  /**
-   * Create a suite of tests to be run together
-   */
-  public static Test suite()
-  {
-    double number = 0;
-    String serial = null;
-    
-    
-    TestSuite suite = new TestSuite();
-    suite.addTest(new MetaCatServletNetTest("initialize"));
-    suite.addTest(new MetaCatServletNetTest("testNCEASLoginFail"));
-    //Should put a login successfully at the end of login test
-    //So insert or update can have cookie.
-    suite.addTest(new MetaCatServletNetTest("testNCEASLogin"));
-    
-    //create random number for docid, so it can void repeat
-    number = Math.random()*100000;
-    serial = Integer.toString(((new Double(number)).intValue()));
-    logMetacat.info("serial: "+serial);
-    suite.addTest(new MetaCatServletNetTest("testInsertXMLDocument", serial));
-    suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentXMLFormat", 
-                                                        serial));
-    suite.addTest(new MetaCatServletNetTest("testUpdateXMLDocument",serial));    
-    suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentHTMLFormat", 
-                                                        serial));
-    suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentZipFormat", 
-                                                        serial));
-    
-    suite.addTest(new MetaCatServletNetTest("testDeleteXMLDocument",serial));
-    
-    //insert invalid xml document
-    number = Math.random()*100000;
-    serial = Integer.toString(((new Double(number)).intValue()));
-    suite.addTest(new MetaCatServletNetTest("testInsertInvalidateXMLDocument",
-                                                                  serial));    
-    //insert non well formed document
-    number = Math.random()*100000;
-    serial = Integer.toString(((new Double(number)).intValue())); 
-   suite.addTest(new MetaCatServletNetTest("testInsertNonWellFormedXMLDocument",
-                                                            serial));
-    //insert data file  
-    number = Math.random()*100000;
-    serial = Integer.toString(((new Double(number)).intValue()));
-    suite.addTest(new MetaCatServletNetTest("testLogOut"));                   
-                              
-    return suite;
-  }
-  
+	/**
+	 * Constructor to build the test
+	 *
+	 * @param name the name of the test method
+	 */
+	public MetaCatServletNetTest(String name, String serial) {
+		super(name);
+		serialNumber = serial;
+	}
 
+	/**
+	 * Establish a testing framework by initializing appropriate objects
+	 */
+	public void setUp() {
 
-  /**
-   * Run an initial test that always passes to check that the test
-   * harness is working.
-   */
-  public void initialize()
-  {
-    assertTrue(1 == 1);
-  }
+	}
 
-  /**
-   * Test the login to neceas succesfully
-   */
-  public void testNCEASLogin()
-  {
-    String user="uid=john,o=NCEAS,dc=ecoinformatics,dc=org";
-    String passwd="123456";
-    assertTrue(logIn(user,passwd));
-    //assertTrue( withProtocol.getProtocol().equals("http"));
-  }
-  
-  /**
-   * Test the login to neceas failed
-   */
-  public void testNCEASLoginFail()
-  {
-    String user="uid=john,o=NCEAS,dc=ecoinformatics,dc=org";
-    String passwd="12345678";
-    assertTrue(!logIn(user,passwd));
-    
-  }
-  
+	/**
+	 * Release any objects after tests are complete
+	 */
+	public void tearDown() {
+	}
 
-  
-  /**
-   * Test the login to lter failed
-   */
-  public void testLterReferralLoginFail()
-  {
-    String user="uid=jtao,o=LTER,dc=ecoinformatics,dc=org";
-    String passwd="qVyGpveb";
-    assertTrue(!logIn(user,passwd));
-    //assertTrue( withProtocol.getProtocol().equals("http"));
-  }
-  
-  
- /**
-   * Test insert a xml document successfully
-   */
-  public void testInsertXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    logMetacat.info("insert docid: "+name);
-    String content="<?xml version=\"1.0\"?>"
-                   +"<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
-                   +"eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
-                   +"edu:8080/tao/dtd/eml-access-2.0.0beta6.dtd\">"
-                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
-                   +"<identifier>"+name+"</identifier>"
-                   +"<allow>"
-             +"<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
-                   +"<permission>all</permission>"
-                   +"</allow>"
-                   +"<allow>"
-                   +"<principal>public</principal>"
-                   +"<permission>read</permission>"
-                   +"</allow>"
-                   +"</acl>";
-    logMetacat.info("xml document: "+content);
-     assertTrue(handleXMLDocument(content, name, "insert"));
-   
-  }
-  
-  /**
-   * Test insert a invalidate xml document successfully
-   * In the String, there is no <!Doctype ... Public/System/>
-   */
-  public void testInsertInvalidateXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    logMetacat.info("insert docid: "+name);
-    String content="<?xml version=\"1.0\"?>"
-                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
-                   +"<identifier>"+name+"</identifier>"
-                   +"<allow>"
-             +"<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
-                   +"<permission>all</permission>"
-                   +"</allow>"
-                   +"<allow>"
-                   +"<principal>public</principal>"
-                   +"<permission>read</permission>"
-                   +"</allow>"
-                   +"</acl>";
-    logMetacat.info("xml document: "+content);
-     assertTrue(handleXMLDocument(content, name, "insert"));
-  }
-  
-   /**
-   * Test insert a non well-formed xml document successfully
-   * There is no </acl> in this string
-   */
-  public void testInsertNonWellFormedXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    logMetacat.info("insert non well-formed docid: "+name);
-    String content="<?xml version=\"1.0\"?>"
-                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
-                   +"<identifier>"+name+"</identifier>"
-                   +"<allow>"
-             +"<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
-                   +"<permission>all</permission>"
-                   +"</allow>"
-                   +"<allow>"
-                   +"<principal>public</principal>"
-                   +"<permission>read</permission>"
-                   +"</allow>";
-  
-     logMetacat.info("xml document: "+content);
-     assertTrue(!handleXMLDocument(content, name, "insert"));
-  } 
+	/**
+	 * Create a suite of tests to be run together
+	 */
+	public static Test suite() {
+		double number = 0;
+		String serial = null;
 
-  /**
-   * Test read a xml document  in xml format successfully
-   */
-  public void testReadXMLDocumentXMLFormat()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    assertTrue(handleReadAction(name, "xml"));
-   
-  } 
+		TestSuite suite = new TestSuite();
+		suite.addTest(new MetaCatServletNetTest("initialize"));
+		suite.addTest(new MetaCatServletNetTest("testNCEASLoginFail"));
+		//Should put a login successfully at the end of login test
+		//So insert or update can have cookie.
+		suite.addTest(new MetaCatServletNetTest("testNCEASLogin"));
 
-  /**
-   * Test read a xml document  in html format successfully
-   */
-  public void testReadXMLDocumentHTMLFormat()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    assertTrue(handleReadAction(name, "html"));
-   
-  }
+		//create random number for docid, so it can void repeat
+		number = Math.random() * 100000;
+		serial = Integer.toString(((new Double(number)).intValue()));
+		logMetacat.info("serial: " + serial);
+		suite.addTest(new MetaCatServletNetTest("testInsertXMLDocument", serial));
+		suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentXMLFormat", serial));
+		suite.addTest(new MetaCatServletNetTest("testUpdateXMLDocument", serial));
+		suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentHTMLFormat", serial));
+		suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentZipFormat", serial));
 
- 
-  /**
-   * Test read a xml document  in zip format successfully
-   */
-  public void testReadXMLDocumentZipFormat()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    assertTrue(handleReadAction(name, "zip"));
-   
-  }
-  
-  /**
-   * Test insert a xml document successfully
-   */
-  public void testUpdateXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"2";
-    logMetacat.info("update docid: "+name);
-    String content="<?xml version=\"1.0\"?>"
-                   +"<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
-                   +"eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
-                   +"edu:8080/tao/dtd/eml-access-2.0.0beta6.dtd\">"
-                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
-                   +"<identifier>"+name+"</identifier>"
-                   +"<allow>"
-             +"<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
-                   +"<permission>all</permission>"
-                   +"</allow>"
-                   +"<allow>"
-                   +"<principal>public</principal>"
-                   +"<permission>read</permission>"
-                   +"</allow>"
-                   +"</acl>";
-     logMetacat.info("xml document: "+content);
-     assertTrue(handleXMLDocument(content, name, "update"));
-   
-  }
-  
-  /**
-   * Test insert a data file successfully
-   */
-  public void testInertDataFile()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    logMetacat.info("insert data file docid: "+name);
-    logMetacat.info("insert data file ");
-    File hello = new File("test/jones.204.22.xml");
-   
-    assertTrue(insertDataFile(name, hello));
-  }
-  
-  /**
-   * Test delete a xml document successfully
-   */
-  public void testDeleteXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"2";
-    logMetacat.info("delete docid: "+name);
-    assertTrue(handleDeleteFile(name));
-   
-  }
-  
-  
-       
-  /**
-   * Test logout action
-   */
-  public void testLogOut()
-  {
-    
-    assertTrue(handleLogOut());
-   
-  }
-  
- /**
-   * Method to hanld login action
-   *
-   * @param usrerName, the DN name of the test method
-   * @param passWord, the passwd of the user
-   */
-  
-  public boolean logIn(String userName, String passWord)
-  {
-    Properties prop = new Properties();
-    prop.put("action", "login");
-    prop.put("qformat", "xml");
-    prop.put("username", userName);
-    prop.put("password", passWord);
+		suite.addTest(new MetaCatServletNetTest("testDeleteXMLDocument", serial));
 
-    // Now contact metacat
-    String response = getMetacatString(prop);
-    logMetacat.info("Login Message: "+response);
-    boolean connected = false;
-    if (response.indexOf("<login>") != -1) {
-      connected = true;
-    } else {
-      
-      connected = false;
-    }
+		//insert invalid xml document
+		number = Math.random() * 100000;
+		serial = Integer.toString(((new Double(number)).intValue()));
+		suite
+				.addTest(new MetaCatServletNetTest("testInsertInvalidateXMLDocument",
+						serial));
+		//insert non well formed document
+		number = Math.random() * 100000;
+		serial = Integer.toString(((new Double(number)).intValue()));
+		suite.addTest(new MetaCatServletNetTest("testInsertNonWellFormedXMLDocument",
+				serial));
+		//insert data file  
+		number = Math.random() * 100000;
+		serial = Integer.toString(((new Double(number)).intValue()));
+		suite.addTest(new MetaCatServletNetTest("testLogOut"));
 
-    return connected;
-  }
-  
-  /**
-   * Method to hanld logout action
-   *
-   * @param usrerName, the DN name of the test method
-   * @param passWord, the passwd of the user
-   */
-  
-  public boolean handleLogOut()
-  {
-    boolean disConnected =false;
-    Properties prop = new Properties();
-    prop.put("action", "logout");
-    prop.put("qformat", "xml");
-  
-    String response = getMetacatString(prop);
-    logMetacat.info("Logout Message: "+response);
-    edu.ucsb.nceas.morpho.framework.HttpMessage.setCookie(null);
-     
-    if (response.indexOf("<logout>") != -1) 
-    {
-      disConnected = true;
-    } 
-    else 
-    {
-      disConnected = false;
-    }
+		return suite;
+	}
 
-    return disConnected;
-  }
-  
-  /**
-   * Method to hanld read both xml and data file
-   *
-   * @param docid, the docid of the document want to read
-   * @param qformat, the format of document user want to get
-   */
-  public boolean handleReadAction(String docid, String qformat)
-  {
-    Properties prop = new Properties();
-    String message ="";
-    prop.put("action", "read");
-    prop.put("qformat", qformat);
-    prop.put("docid", docid);
-    
-    message = getMetacatString(prop);
-    message = message.trim();
-    //MetaCatUtil.debugMessage("Read Message: "+message, 30);
-    if (message==null || message.equals("")||message.indexOf("<error>") != -1 )
-    {//there was an error
-      
-      return false;
-    }
-    else
-    {//successfully
-      return true;
-    } 
-    
-  }
-  
-  
-  /**
-   * Method to hanld inset or update xml document
-   *
-   * @param xmlDocument, the content of xml qformat
-   * @param docid, the docid of the document
-   * @param action, insert or update
-   */
-  public boolean handleXMLDocument(String xmlDocument, String docid, 
-                                                              String action)
- 
-  { //-attempt to write file to metacat
-    String access = "no";
-    StringBuffer fileText = new StringBuffer();
-    StringBuffer messageBuf = new StringBuffer();
-    String accessFileId = null;
-    Properties prop = new Properties();
-    prop.put("action", action);
-    prop.put("public", access);  //This is the old way of controlling access
-    prop.put("doctext", xmlDocument);
-    prop.put("docid", docid);
-    
-    String message = getMetacatString(prop);
-    logMetacat.info("Insert or Update Message: "+message);
-    if(message.indexOf("<error>") != -1)
-    {//there was an error
-      
-      return false;
-    }
-    else if(message.indexOf("<success>") != -1)
-    {//the operation worked
-     //write the file to the cache and return the file object
-     return true;
-       
-    }
-    else
-    {//something weird happened.
-      return false;
-    } 
-   
-   
-  }
-  
-   public boolean handleDeleteFile(String name)
-  {
-    
-    Properties prop = new Properties();
-    prop.put("action", "delete");
-    prop.put("docid", name);
- 
-    String message = getMetacatString(prop);
-    logMetacat.info("Delete Message: "+message);
-    if(message.indexOf("<error>") != -1)
-    {//there was an error
-      
-      return false;
-    }
-    else if(message.indexOf("<success>") != -1)
-    {//the operation worked
-     //write the file to the cache and return the file object
-     return true;
-       
-    }
-    else
-    {//something weird happened.
-      return false;
-    } 
-  }
-  
-  
-  /**
-   * sends a data file to the metacat using "multipart/form-data" encoding
-   *
-   * @param id the id to assign to the file on metacat (e.g., knb.1.1)
-   * @param file the file to send
-   */
-  public boolean insertDataFile(String id, File file)
-  {
-    String response = null;
-    //Get response for calling sendDataFile function
-    response = sendDataFile(id, file);
-    
-    if (response.indexOf("success") != -1)
-    {
-      //insert successfully
-      return true;
-    }
-    else
-    {
-      return false;
-    }
-  }
-  
-  /**
-   * sends a data file to the metacat using "multipart/form-data" encoding
-   *
-   * @param id the id to assign to the file on metacat (e.g., knb.1.1)
-   * @param file the file to send
-   */
-  public String sendDataFile(String id, File file) 
-  {
-    String response = "";
-    InputStream returnStream = null;
+	/**
+	 * Run an initial test that always passes to check that the test
+	 * harness is working.
+	 */
+	public void initialize() {
+		assertTrue(1 == 1);
+	}
 
-    // Now contact metacat and send the request
-    try
-    {
-      //FileInputStream data = new FileInputStream(file);
-      System.setProperty("java.protocol.handler.pkgs","HTTPClient");
-      URL url = new URL(metacatURL);
-      edu.ucsb.nceas.morpho.framework.HttpMessage msg = 
-                        new edu.ucsb.nceas.morpho.framework.HttpMessage(url);
-      Properties args = new Properties();
-      args.put("action", "upload");
-      args.put("docid", id);
+	/**
+	 * Test the login to neceas succesfully
+	 */
+	public void testNCEASLogin() {
+		String user = "uid=john,o=NCEAS,dc=ecoinformatics,dc=org";
+		String passwd = "123456";
+		assertTrue(logIn(user, passwd));
+		//assertTrue( withProtocol.getProtocol().equals("http"));
+	}
 
-      Properties dataStreams = new Properties();
-      String filename = file.getAbsolutePath();
-      System.out.println("the absolute path is "+filename);
-      dataStreams.put("datafile", filename);
-       
-  
-    
-      returnStream = msg.sendPostData(args, dataStreams);
-        
-      InputStreamReader returnStreamReader = 
-                        new InputStreamReader(returnStream);
-      StringWriter sw = new StringWriter();
-      int len;
-      char[] characters = new char[512];
-      while ((len = returnStreamReader.read(characters, 0, 512)) != -1)
-      {
-        sw.write(characters, 0, len);
-      }
-      returnStreamReader.close();
-      response = sw.toString();
-      sw.close();
-   
-    } 
-    catch(Exception e) 
-    {
-      e.printStackTrace(System.err);
-    }
-    return response;
-  }
-  
-  public String getMetacatString(Properties prop)
-  {
-    String response = null;
+	/**
+	 * Test the login to neceas failed
+	 */
+	public void testNCEASLoginFail() {
+		String user = "uid=john,o=NCEAS,dc=ecoinformatics,dc=org";
+		String passwd = "12345678";
+		assertTrue(!logIn(user, passwd));
 
-    // Now contact metacat and send the request
-    try
-    {
-      InputStreamReader returnStream = 
-                        new InputStreamReader(getMetacatInputStream(prop));
-      StringWriter sw = new StringWriter();
-      int len;
-      char[] characters = new char[512];
-      while ((len = returnStream.read(characters, 0, 512)) != -1)
-      {
-        sw.write(characters, 0, len);
-      }
-      returnStream.close();
-      response = sw.toString();
-      sw.close();
-    }
-    catch(Exception e)
-    {
-      return null;
-    }
-  
-    return response;
-  }
-  
-   /**
-   * Send a request to Metacat
-   *
-   * @param prop the properties to be sent to Metacat
-   * @return InputStream as returned by Metacat
-   */
-  public InputStream getMetacatInputStream(Properties prop)
-  {
-    InputStream returnStream = null;
-    // Now contact metacat and send the request
-    try
-    {
-     
-      URL url = new URL(metacatURL);
-      edu.ucsb.nceas.morpho.framework.HttpMessage msg = 
-              new edu.ucsb.nceas.morpho.framework.HttpMessage(url);
-      returnStream = msg.sendPostMessage(prop);
-      return returnStream;
-    }
-    catch(Exception e)
-    {
-      e.printStackTrace(System.err);
-     
-    }
-    return returnStream;
-   
-  }
+	}
 
- 
+	/**
+	 * Test the login to lter failed
+	 */
+	public void testLterReferralLoginFail() {
+		String user = "uid=jtao,o=LTER,dc=ecoinformatics,dc=org";
+		String passwd = "qVyGpveb";
+		assertTrue(!logIn(user, passwd));
+		//assertTrue( withProtocol.getProtocol().equals("http"));
+	}
 
+	/**
+	 * Test insert a xml document successfully
+	 */
+	public void testInsertXMLDocument() throws PropertyNotFoundException {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		logMetacat.info("insert docid: " + name);
+		String content = "<?xml version=\"1.0\"?>"
+				+ "<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
+				+ "eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
+				+ "edu:8080/tao/dtd/eml-access-2.0.0beta6.dtd\">"
+				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
+				+ "</identifier>" + "<allow>"
+				+ "<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
+				+ "<permission>all</permission>" + "</allow>" + "<allow>"
+				+ "<principal>public</principal>" + "<permission>read</permission>"
+				+ "</allow>" + "</acl>";
+		logMetacat.info("xml document: " + content);
+		assertTrue(handleXMLDocument(content, name, "insert"));
+
+	}
+
+	/**
+	 * Test insert a invalidate xml document successfully
+	 * In the String, there is no <!Doctype ... Public/System/>
+	 */
+	public void testInsertInvalidateXMLDocument() throws PropertyNotFoundException  {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		logMetacat.info("insert docid: " + name);
+		String content = "<?xml version=\"1.0\"?>"
+				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
+				+ "</identifier>" + "<allow>"
+				+ "<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
+				+ "<permission>all</permission>" + "</allow>" + "<allow>"
+				+ "<principal>public</principal>" + "<permission>read</permission>"
+				+ "</allow>" + "</acl>";
+		logMetacat.info("xml document: " + content);
+		assertTrue(handleXMLDocument(content, name, "insert"));
+	}
+
+	/**
+	 * Test insert a non well-formed xml document successfully
+	 * There is no </acl> in this string
+	 */
+	public void testInsertNonWellFormedXMLDocument() throws PropertyNotFoundException  {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		logMetacat.info("insert non well-formed docid: " + name);
+		String content = "<?xml version=\"1.0\"?>"
+				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
+				+ "</identifier>" + "<allow>"
+				+ "<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
+				+ "<permission>all</permission>" + "</allow>" + "<allow>"
+				+ "<principal>public</principal>" + "<permission>read</permission>"
+				+ "</allow>";
+
+		logMetacat.info("xml document: " + content);
+		assertTrue(!handleXMLDocument(content, name, "insert"));
+	}
+
+	/**
+	 * Test read a xml document  in xml format successfully
+	 */
+	public void testReadXMLDocumentXMLFormat() throws PropertyNotFoundException  {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		assertTrue(handleReadAction(name, "xml"));
+
+	}
+
+	/**
+	 * Test read a xml document  in html format successfully
+	 */
+	public void testReadXMLDocumentHTMLFormat() throws PropertyNotFoundException {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		assertTrue(handleReadAction(name, "html"));
+
+	}
+
+	/**
+	 * Test read a xml document  in zip format successfully
+	 */
+	public void testReadXMLDocumentZipFormat() throws PropertyNotFoundException {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		assertTrue(handleReadAction(name, "zip"));
+
+	}
+
+	/**
+	 * Test insert a xml document successfully
+	 */
+	public void testUpdateXMLDocument() throws PropertyNotFoundException {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "2";
+		logMetacat.info("update docid: " + name);
+		String content = "<?xml version=\"1.0\"?>"
+				+ "<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
+				+ "eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
+				+ "edu:8080/tao/dtd/eml-access-2.0.0beta6.dtd\">"
+				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
+				+ "</identifier>" + "<allow>"
+				+ "<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
+				+ "<permission>all</permission>" + "</allow>" + "<allow>"
+				+ "<principal>public</principal>" + "<permission>read</permission>"
+				+ "</allow>" + "</acl>";
+		logMetacat.info("xml document: " + content);
+		assertTrue(handleXMLDocument(content, name, "update"));
+
+	}
+
+	/**
+	 * Test insert a data file successfully
+	 */
+	public void testInertDataFile() throws PropertyNotFoundException {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		logMetacat.info("insert data file docid: " + name);
+		logMetacat.info("insert data file ");
+		File hello = new File("test/jones.204.22.xml");
+
+		assertTrue(insertDataFile(name, hello));
+	}
+
+	/**
+	 * Test delete a xml document successfully
+	 */
+	public void testDeleteXMLDocument() throws PropertyNotFoundException {
+		String name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "2";
+		logMetacat.info("delete docid: " + name);
+		assertTrue(handleDeleteFile(name));
+
+	}
+
+	/**
+	 * Test logout action
+	 */
+	public void testLogOut() {
+
+		assertTrue(handleLogOut());
+
+	}
+
+	/**
+	 * Method to hanld login action
+	 *
+	 * @param usrerName, the DN name of the test method
+	 * @param passWord, the passwd of the user
+	 */
+
+	public boolean logIn(String userName, String passWord) {
+		Properties prop = new Properties();
+		prop.put("action", "login");
+		prop.put("qformat", "xml");
+		prop.put("username", userName);
+		prop.put("password", passWord);
+
+		// Now contact metacat
+		String response = getMetacatString(prop);
+		logMetacat.info("Login Message: " + response);
+		boolean connected = false;
+		if (response.indexOf("<login>") != -1) {
+			connected = true;
+		} else {
+
+			connected = false;
+		}
+
+		return connected;
+	}
+
+	/**
+	 * Method to hanld logout action
+	 *
+	 * @param usrerName, the DN name of the test method
+	 * @param passWord, the passwd of the user
+	 */
+
+	public boolean handleLogOut() {
+		boolean disConnected = false;
+		Properties prop = new Properties();
+		prop.put("action", "logout");
+		prop.put("qformat", "xml");
+
+		String response = getMetacatString(prop);
+		logMetacat.info("Logout Message: " + response);
+		edu.ucsb.nceas.morpho.framework.HttpMessage.setCookie(null);
+
+		if (response.indexOf("<logout>") != -1) {
+			disConnected = true;
+		} else {
+			disConnected = false;
+		}
+
+		return disConnected;
+	}
+
+	/**
+	 * Method to hanld read both xml and data file
+	 *
+	 * @param docid, the docid of the document want to read
+	 * @param qformat, the format of document user want to get
+	 */
+	public boolean handleReadAction(String docid, String qformat) {
+		Properties prop = new Properties();
+		String message = "";
+		prop.put("action", "read");
+		prop.put("qformat", qformat);
+		prop.put("docid", docid);
+
+		message = getMetacatString(prop);
+		message = message.trim();
+		//MetaCatUtil.debugMessage("Read Message: "+message, 30);
+		if (message == null || message.equals("") || message.indexOf("<error>") != -1) {//there was an error
+
+			return false;
+		} else {//successfully
+			return true;
+		}
+
+	}
+
+	/**
+	 * Method to hanld inset or update xml document
+	 *
+	 * @param xmlDocument, the content of xml qformat
+	 * @param docid, the docid of the document
+	 * @param action, insert or update
+	 */
+	public boolean handleXMLDocument(String xmlDocument, String docid, String action)
+
+	{ //-attempt to write file to metacat
+		String access = "no";
+		StringBuffer fileText = new StringBuffer();
+		StringBuffer messageBuf = new StringBuffer();
+		String accessFileId = null;
+		Properties prop = new Properties();
+		prop.put("action", action);
+		prop.put("public", access); //This is the old way of controlling access
+		prop.put("doctext", xmlDocument);
+		prop.put("docid", docid);
+
+		String message = getMetacatString(prop);
+		logMetacat.info("Insert or Update Message: " + message);
+		if (message.indexOf("<error>") != -1) {//there was an error
+
+			return false;
+		} else if (message.indexOf("<success>") != -1) {//the operation worked
+			//write the file to the cache and return the file object
+			return true;
+
+		} else {//something weird happened.
+			return false;
+		}
+
+	}
+
+	public boolean handleDeleteFile(String name) {
+
+		Properties prop = new Properties();
+		prop.put("action", "delete");
+		prop.put("docid", name);
+
+		String message = getMetacatString(prop);
+		logMetacat.info("Delete Message: " + message);
+		if (message.indexOf("<error>") != -1) {//there was an error
+
+			return false;
+		} else if (message.indexOf("<success>") != -1) {//the operation worked
+			//write the file to the cache and return the file object
+			return true;
+
+		} else {//something weird happened.
+			return false;
+		}
+	}
+
+	/**
+	 * sends a data file to the metacat using "multipart/form-data" encoding
+	 *
+	 * @param id the id to assign to the file on metacat (e.g., knb.1.1)
+	 * @param file the file to send
+	 */
+	public boolean insertDataFile(String id, File file) {
+		String response = null;
+		//Get response for calling sendDataFile function
+		response = sendDataFile(id, file);
+
+		if (response.indexOf("success") != -1) {
+			//insert successfully
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	/**
+	 * sends a data file to the metacat using "multipart/form-data" encoding
+	 *
+	 * @param id the id to assign to the file on metacat (e.g., knb.1.1)
+	 * @param file the file to send
+	 */
+	public String sendDataFile(String id, File file) {
+		String response = "";
+		InputStream returnStream = null;
+
+		// Now contact metacat and send the request
+		try {
+			//FileInputStream data = new FileInputStream(file);
+			System.setProperty("java.protocol.handler.pkgs", "HTTPClient");
+			URL url = new URL(metacatURL);
+			edu.ucsb.nceas.morpho.framework.HttpMessage msg = new edu.ucsb.nceas.morpho.framework.HttpMessage(
+					url);
+			Properties args = new Properties();
+			args.put("action", "upload");
+			args.put("docid", id);
+
+			Properties dataStreams = new Properties();
+			String filename = file.getAbsolutePath();
+			System.out.println("the absolute path is " + filename);
+			dataStreams.put("datafile", filename);
+
+			returnStream = msg.sendPostData(args, dataStreams);
+
+			InputStreamReader returnStreamReader = new InputStreamReader(returnStream);
+			StringWriter sw = new StringWriter();
+			int len;
+			char[] characters = new char[512];
+			while ((len = returnStreamReader.read(characters, 0, 512)) != -1) {
+				sw.write(characters, 0, len);
+			}
+			returnStreamReader.close();
+			response = sw.toString();
+			sw.close();
+
+		} catch (Exception e) {
+			e.printStackTrace(System.err);
+		}
+		return response;
+	}
+
+	public String getMetacatString(Properties prop) {
+		String response = null;
+
+		// Now contact metacat and send the request
+		try {
+			InputStreamReader returnStream = new InputStreamReader(
+					getMetacatInputStream(prop));
+			StringWriter sw = new StringWriter();
+			int len;
+			char[] characters = new char[512];
+			while ((len = returnStream.read(characters, 0, 512)) != -1) {
+				sw.write(characters, 0, len);
+			}
+			returnStream.close();
+			response = sw.toString();
+			sw.close();
+		} catch (Exception e) {
+			return null;
+		}
+
+		return response;
+	}
+
+	/**
+	 * Send a request to Metacat
+	 *
+	 * @param prop the properties to be sent to Metacat
+	 * @return InputStream as returned by Metacat
+	 */
+	public InputStream getMetacatInputStream(Properties prop) {
+		InputStream returnStream = null;
+		// Now contact metacat and send the request
+		try {
+
+			URL url = new URL(metacatURL);
+			edu.ucsb.nceas.morpho.framework.HttpMessage msg = new edu.ucsb.nceas.morpho.framework.HttpMessage(
+					url);
+			returnStream = msg.sendPostMessage(prop);
+			return returnStream;
+		} catch (Exception e) {
+			e.printStackTrace(System.err);
+
+		}
+		return returnStream;
+
+	}
+
 }
Index: test/edu/ucsb/nceas/metacattest/OnlineDataAccessTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/OnlineDataAccessTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/OnlineDataAccessTest.java	(revision 4080)
@@ -33,7 +33,6 @@
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
 import edu.ucsb.nceas.metacat.client.Metacat;
 import edu.ucsb.nceas.metacat.client.MetacatAuthException;
@@ -40,8 +39,10 @@
 import edu.ucsb.nceas.metacat.client.MetacatException;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.IOUtil;
-import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -52,25 +53,25 @@
  */
 public class OnlineDataAccessTest
     extends TestCase {
-	 /* Initialize Options*/
-    static
-    {
-  	  try
-  	  {
-  		  Options.initialize(new File("build/tests/metacat.properties"));
-  		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
-  	  }
-  	  catch(Exception e)
-  	  {
-  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-  	  }
-    }
-    private String metacatUrl = MetaCatUtil.getOption("metacatUrl");
-    private String username = MetaCatUtil.getOption("mcuser");
-    private String password = MetaCatUtil.getOption("mcpassword");
-    private String anotheruser = MetaCatUtil.getOption("mcanotheruser");
-    private String anotherpassword = MetaCatUtil.getOption("mcanotherpassword");
+
+    private static String metacatUrl;
+    private static String username;
+	private static String password;
+	private static String anotheruser;
+	private static String anotherpassword;
+	static {
+		try {
+		    metacatUrl = SystemUtil.getServletURL();
+			username = PropertyService.getProperty("mcuser");
+			password = PropertyService.getProperty("mcpassword");
+			anotheruser = PropertyService.getProperty("mcanotheruser");
+			anotherpassword = PropertyService.getProperty("mcanotherpassword");
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+		}
+	}
+
     private String prefix = "test";
     private String newdocid = null;
     private String onlineDocid = null;
Index: test/edu/ucsb/nceas/metacattest/AccessControlTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/AccessControlTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/AccessControlTest.java	(revision 4080)
@@ -34,7 +34,6 @@
 import java.util.TimeZone;
 import java.util.Vector;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
 import edu.ucsb.nceas.metacat.client.Metacat;
 import edu.ucsb.nceas.metacat.client.MetacatAuthException;
@@ -41,8 +40,10 @@
 import edu.ucsb.nceas.metacat.client.MetacatException;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.IOUtil;
-import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -51,27 +52,27 @@
 /**
  * A JUnit test for testing Access Control in Metacat
  */
-public class AccessControlTest extends TestCase {
-	 /* Initialize Options*/
-    static
-    {
-  	  try
-  	  {
-  		  Options.initialize(new File("build/tests/metacat.properties"));
-  		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
-  	  }
-  	  catch(Exception e)
-  	  {
-  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-  	  }
-    }
+public class AccessControlTest
+    extends TestCase {
 
-    private String metacatUrl = MetaCatUtil.getOption("metacatUrl");
-    private String username = MetaCatUtil.getOption("mcuser");
-    private String password = MetaCatUtil.getOption("mcpassword");
-    private String anotheruser = MetaCatUtil.getOption("mcanotheruser");
-    private String anotherpassword = MetaCatUtil.getOption("mcanotherpassword");
+    private static String metacatUrl;
+    private static String username;
+	private static String password;
+	private static String anotheruser;
+	private static String anotherpassword;
+	static {
+		try {
+		    metacatUrl = SystemUtil.getServletURL();
+			username = PropertyService.getProperty("mcuser");
+			password = PropertyService.getProperty("mcpassword");
+			anotheruser = PropertyService.getProperty("mcanotheruser");
+			anotherpassword = PropertyService.getProperty("mcanotherpassword");
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+		}
+	}
+
     private String prefix = "test";
     private String newdocid = null;
     private String testdocument = "";
Index: test/edu/ucsb/nceas/metacattest/AuthLdapTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/AuthLdapTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/AuthLdapTest.java	(revision 4080)
@@ -27,7 +27,7 @@
 import java.io.File;
 
 import edu.ucsb.nceas.metacat.AuthLdap;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -92,11 +92,12 @@
     
     public void getPrincipals()
     {
-    	//System.out.println("before initilizing authldap object");
-    	AuthLdap ldap = new AuthLdap();
-    	//System.out.println("after initilizing authldap object");
     	try
     	{
+        	//System.out.println("before initilizing authldap object");
+        	AuthLdap ldap = new AuthLdap();
+        	//System.out.println("after initilizing authldap object");
+    		
     		//System.out.println("before calling the getPrincipals method");
     	    String response = ldap.getPrincipals(USER, PASS);
     	    //System.out.println("after calling the getPrincipals method \n"+response);
Index: test/edu/ucsb/nceas/metacattest/SitemapTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/SitemapTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/SitemapTest.java	(revision 4080)
@@ -31,9 +31,10 @@
 import java.io.IOException;
 
 import edu.ucsb.nceas.metacat.DBConnectionPool;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.Sitemap;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 import junit.framework.TestCase;
 
@@ -43,24 +44,17 @@
  * @author Matt Jones
  */
 public class SitemapTest extends TestCase {
-	 /* Initialize Options*/
-    static
-    {
-  	  try
-  	  {
-  		  Options.initialize(new File("build/tests/metacat.properties"));
-  		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
-  	  }
-  	  catch(Exception e)
-  	  {
-  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-  	  }
-    }
-    private String propertyFileName = 
-    	MetaCatUtil.getOption("installDir") + "/WEB-INF/metacat.properties";
-        // "/usr/share/tomcat5.5/webapps/knb/WEB-INF/metacat.properties";
+	
+	private static String propertyFileName;
+	static {
+		try {
+			propertyFileName = SystemUtil.getContextDir() + "/WEB-INF/metacat.properties";
+			// "/usr/share/tomcat5.5/webapps/knb/WEB-INF/metacat.properties";
+		} catch (PropertyNotFoundException pnfe) {
 
+		}
+	}
+
     private String directoryName = "/tmp/sitemaps";
 
     /**
@@ -71,7 +65,6 @@
         try {
             File propertyFile = new File(propertyFileName);
             Options options = Options.initialize(propertyFile);
-            MetaCatUtil util = new MetaCatUtil();
             DBConnectionPool pool = DBConnectionPool.getInstance();
         } catch (FileNotFoundException e) {
             fail(e.getMessage());
Index: test/edu/ucsb/nceas/metacattest/QuerySpecificationTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/QuerySpecificationTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/QuerySpecificationTest.java	(revision 4080)
@@ -33,9 +33,11 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.QuerySpecification;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /**
  * @author jones
@@ -48,7 +50,6 @@
     private FileReader xml;
     
     /** The utilities object for accessing property values */
-    private MetaCatUtil util;
     
     private static String selectionQuery = "SELECT docid,docname,doctype,date_created, date_updated, rev " +
     		"FROM xml_documents WHERE docid IN (((((SELECT DISTINCT docid FROM xml_nodes " +
@@ -97,7 +98,7 @@
   	  {
   		  Options.initialize(new File("build/tests/metacat.properties"));
   		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+  		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
   	  }
   	  catch(Exception e)
   	  {
@@ -124,7 +125,6 @@
         try {
             File propertyFile = new File("./lib/metacat.properties");
             Options options = Options.initialize(propertyFile);
-            util = new MetaCatUtil();
             String xmlfile = "./test/query.xml";
             xml = new FileReader(new File(xmlfile));
         } catch (FileNotFoundException e) {
@@ -153,12 +153,14 @@
         try {
             System.out.println("---- SQL ------------------");
             QuerySpecification qspec = new QuerySpecification(xml, 
-                    MetaCatUtil.getOption("saxparser"), 
-                    MetaCatUtil.getOption("accNumberSeparator"));
+                    PropertyService.getProperty("saxparser"), 
+                    PropertyService.getProperty("accNumberSeparator"));
             String query = qspec.printSQL(false);
            assertTrue(selectionQuery.equals(query.trim()));
         } catch (IOException e) {
             fail(e.getMessage());
+        } catch (PropertyNotFoundException pnfe) {
+            fail(pnfe.getMessage());
         }
     }
 
@@ -170,8 +172,8 @@
         try {
             System.out.println("---- orginal EXT SQL  ------------------\n"+extendedQuery);
             QuerySpecification qspec = new QuerySpecification(xml, 
-                    MetaCatUtil.getOption("saxparser"), 
-                    MetaCatUtil.getOption("accNumberSeparator"));
+                    PropertyService.getProperty("saxparser"), 
+                    PropertyService.getProperty("accNumberSeparator"));
             String query = 
                     qspec.printExtendedSQL(
                             "'obfs.45337', 'obfs.45338', 'obfs.45346'", true);
@@ -179,6 +181,8 @@
             assertTrue(extendedQuery.equals(query));
         } catch (IOException e) {
             fail(e.getMessage());
+        } catch (PropertyNotFoundException pnfe) {
+            fail(pnfe.getMessage());
         }
     }
 
Index: test/edu/ucsb/nceas/metacattest/SubTreeTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/SubTreeTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/SubTreeTest.java	(revision 4080)
@@ -27,6 +27,8 @@
 package edu.ucsb.nceas.metacattest;
 
 import edu.ucsb.nceas.metacat.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 //import edu.ucsb.nceas.morpho.framework.*;
 import junit.framework.Test;
@@ -55,7 +57,7 @@
 	  {
 		  Options.initialize(new File("build/tests/metacat.properties"));
 		  MetaCatUtil.pathsForIndexing 
-		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
 	  }
 	  catch(Exception e)
 	  {
Index: lib/admin/admin-login.jsp
===================================================================
--- lib/admin/admin-login.jsp	(nonexistent)
+++ lib/admin/admin-login.jsp	(revision 4080)
@@ -0,0 +1,121 @@
+<%@ page    language="java" import="java.util.Vector,edu.ucsb.nceas.metacat.util.LDAPUtil,edu.ucsb.nceas.metacat.service.PropertyService" %>
+<% 
+/**
+ *  '$RCSfile$'
+ *    Copyright: 2008 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+
+<% 
+	Vector<String> organizationList = LDAPUtil.getOrganizations();
+%>
+
+<html>
+<head>
+
+<title>Database Install/Upgrade Utility</title>
+<link rel="stylesheet" type="text/css" 
+        href="<%= request.getContextPath() %>/admin/admin.css"></link>
+
+<script type="text/javascript">
+
+function validate_form() {
+    j = document.configuration_form.length
+    for (i = 0; i < j; i++) {
+        if (document.configuration_form.elements[i].value == "") {
+            alert("All form fields must be populated");
+            return false;
+        }
+    }
+    return true;
+}
+
+</script>
+
+</head>
+<body>
+<img src="<%= request.getContextPath() %>/metacat-logo.png"
+	width="100px" align="right" />
+<h2>Administrator Login</h2>
+
+Account login page.
+<br class="ldap-header">
+
+<%@ include file="./page-message-section.jsp"%>
+<hr class=config>
+<br>
+
+<form name="loginform" method="post" action="<%= request.getContextPath() %>/admin"
+	target="_top" onsubmit="return submitform(this);" id="loginform">
+
+<table class="admin-login">
+	<tr>
+		<td>username:</td>
+		<td><input class="login-input" name="username" type="text" value=""></td>
+	</tr>
+
+	<tr>
+		<td>organization:</td>
+		<td><select class="login-input"
+			name="organization">
+			<option value="" selected>&#8212; choose one &#8212;</option>
+<%
+			for (String orgName : organizationList) {
+%>
+			<option value="<%= orgName %>"
+<%
+			if (PropertyService.getProperty("ldap.base." + orgName) == null || PropertyService.getProperty("ldap.base." + orgName).equals("")) {
+%>
+			disabled="disabled"
+<%
+			}
+%>			
+			><%= orgName %></option>
+<%
+			}
+%>
+		</select></td>
+	</tr>
+	<tr>
+		<td>password:</td>
+		<td><input class="login-input" name="password" type="password" maxlength="50" value=""></td>
+	</tr>
+</table>
+
+<br>
+<hr class=config>
+
+<table class="admin-login">
+	<tr>
+		<td class="button"><input type="submit"
+				name="loginAction" value="Login" class="button_login"></td>
+	</tr>
+</table>
+
+<input type="hidden" name="configureType" value="login"/>
+<input type="hidden" name="processForm" value="true"/>
+
+</form>
+
+</body>
+</html>

Property changes on: lib/admin/admin-login.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/configure-restart.jsp
===================================================================
--- lib/admin/configure-restart.jsp	(nonexistent)
+++ lib/admin/configure-restart.jsp	(revision 4080)
@@ -0,0 +1,97 @@
+<%@ page    language="java" %>
+<% 
+/**
+ *  '$RCSfile$'
+ *    Copyright: 2006 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+<html>
+<head>
+<title>Metacat Configuration Succeeded</title>
+<style language="Javascript">
+body {
+    font-family: Arial, sans-serif;
+    font-size: 12pt;
+    margin-left: 30px;
+    margin-right: 30px;
+    width: 700px;
+}
+.section {
+    font-size: 16pt;
+    font-weight: bold;
+    border-bottom: solid #dddddd 1px;
+}
+</style>
+</head>
+<body>
+<p><img src="metacat-logo.png" width="100px" align="right"/> 
+<h2>Metacat Configuration Succeeded</h2>
+</p>
+
+<p>Congratulations!</p>
+<p>You have now successfully configured this installation of Metacat. All that
+   remains is to configure geoserver and restart the metacat servlet for the changes to take effect.
+</p>
+
+<br clear="right"/>
+<p class="section">Configuring Geoserver</p>
+<p>Metacat ships with <a href="http://docs.codehaus.org/display/GEOS/Home">Geoserver</a> to handle the spatial functionality.
+   Regardless of whether you plan on using the spatial functionality you should,
+   for security purposes, configure geoserver initially so that it doesn't use
+   the default password.
+   To configure geoserver with a new admin password:
+   <ol>
+    <li> Point your browser to 
+     <a href="<%= request.getScheme() + "://" +
+       request.getServerName() + ":" + request.getServerPort() +
+              request.getContextPath() %>/geoserver.jsp"><%= request.getScheme() + "://" +
+	                      request.getServerName() + ":" + request.getServerPort() +
+			                      request.getContextPath() %>/geoserver.jsp</a>. </li>
+     <li> Login using the default username and password ( <em>admin</em> / <em>geoserver</em> ) </li>
+    <li> Point your browser to 
+     <a href="<%= request.getScheme() + "://" +
+       request.getServerName() + ":" + request.getServerPort() +
+              request.getContextPath() %>/config/loginEdit.do"><%= request.getScheme() + "://" +
+	                      request.getServerName() + ":" + request.getServerPort() +
+			                      request.getContextPath() %>/config/loginEdit.do</a>, enter a new user and password then submit. </li>
+     <li> In the upper-left, click <em>Apply</em> then <em>Save</em> to save your new password.
+
+
+    </ol>
+</p>
+
+<br clear="right"/>
+<p class="section">Restarting Metacat</p>
+<p>The simplest way to restart metacat is to restart the entire servlet engine.
+   For Tomcat, this would mean calling "$TOMCAT_HOME/bin/tomcat.sh restart" or
+   an equivalent command appropriate to your operating system. After restarting,
+   you can access your new Metacat server at the URL:
+   <a href="<%= request.getScheme() + "://" + 
+       request.getServerName() + ":" + request.getServerPort() +
+       request.getContextPath() %>"><%= request.getScheme() + "://" + 
+                request.getServerName() + ":" + request.getServerPort() +
+                request.getContextPath() %></a>
+</p>
+
+</body>
+</html>

Property changes on: lib/admin/configure-restart.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/images/question-mark.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/style/images/question-mark.gif
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/style/skins/sanparks/footer.jspx
===================================================================
--- lib/style/skins/sanparks/footer.jspx	(revision 4079)
+++ lib/style/skins/sanparks/footer.jspx	(revision 4080)
@@ -12,7 +12,7 @@
 				<jsp:attribute name="rel">stylesheet</jsp:attribute>
 				<jsp:attribute name="type">text/css</jsp:attribute>
 				<jsp:attribute name="href">
-					<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/sanparks.css"</jsp:expression>
+					<jsp:expression>CONTEXT_URL + "/style/skins/sanparks/sanparks.css"</jsp:expression>
 				</jsp:attribute>
 			</jsp:element>
 		</head>
Index: lib/style/skins/sanparks/settings.jsp
===================================================================
--- lib/style/skins/sanparks/settings.jsp	(revision 4079)
+++ lib/style/skins/sanparks/settings.jsp	(revision 4080)
@@ -30,6 +30,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <% 
 	
Index: lib/style/skins/sanparks/SaeonDelete.jspx
===================================================================
--- lib/style/skins/sanparks/SaeonDelete.jspx	(revision 4079)
+++ lib/style/skins/sanparks/SaeonDelete.jspx	(revision 4080)
@@ -17,7 +17,7 @@
 				<jsp:attribute name="rel">stylesheet</jsp:attribute>
 				<jsp:attribute name="type">text/css</jsp:attribute>
 				<jsp:attribute name="href">
-					<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/sanparks.css"</jsp:expression>
+					<jsp:expression>CONTEXT_URL + "/style/skins/sanparks/sanparks.css"</jsp:expression>
 				</jsp:attribute>
 			</jsp:element>
         </head>
Index: lib/style/skins/kepler/searchform.jsp
===================================================================
--- lib/style/skins/kepler/searchform.jsp	(revision 4079)
+++ lib/style/skins/kepler/searchform.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <form method="POST" action="<%=SERVLET_URL%>" target="_top">
 Search for: 
Index: lib/style/skins/sanparks/sanparks.js
===================================================================
--- lib/style/skins/sanparks/sanparks.js	(revision 4079)
+++ lib/style/skins/sanparks/sanparks.js	(revision 4080)
@@ -150,7 +150,7 @@
 var IFRAME_MAP_CLASS       = "mapFrame";
 
 //footer iframe class
-var IFRAME_FOOTER_CLASS         = "iframefooterclass";
+var IFRAME_FOOTER_CLASS         = "iframefooterclass2";
 
 //(metacat only) login box iframe class
 var IFRAME_LOGINBOX_CLASS      = "iframeloginboxclass";
Index: lib/style/skins/sanparks/sanparks.properties
===================================================================
--- lib/style/skins/sanparks/sanparks.properties	(nonexistent)
+++ lib/style/skins/sanparks/sanparks.properties	(revision 4080)
@@ -0,0 +1,48 @@
+#
+# General configuration parameters
+#
+registry.config.username=uid=nceasadmin,o=NCEAS,dc=ecoinformatics,dc=org
+registry.config.password=your-pw-goes-here
+registry.config.scope=nceas
+registry.config.organization=National Center for Ecological Analysis and Synthesis
+registry.config.abbrev=NCEAS
+#registry.config.url=http://www.nceas.ucsb.edu/
+registry.config.site=project
+registry.config.type=Repository
+registry.config.debug=1
+
+# NCEAS custom theme sans-iframe
+registry.templates.header=nceasHeader.tmpl
+registry.templates.footer=nceasFooter.tmpl
+
+# email settings
+email.sender=NCEAS Data Repository <help@nceas.ucsb.edu>
+email.recipient=help@nceas.ucsb.edu
+email.admin=the repository administrator
+
+# registry display settings
+registry.show.siteList=false
+registry.show.wgList=true
+registry.show.organization=false
+# registry module display
+registry.modules.taxonomic=true
+registry.modules.method=true
+registry.modules.spatial=true
+registry.modules.keyword=true
+registry.modules.temporal=true
+registry.modules.upload=true
+
+registry.required.temporal=
+registry.required.spatial=
+registry.required.contactEmailAddress=
+
+# NCEAS specific
+registry.db.connection=//hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu
+registry.db.user= admowner
+registry.db.password= your-pw-goes-here
+
+# imported properties from lib/skin.configs/nceas/nceas.properties
+# java code usage
+lsidauthority=knb.ecoinformatics.org
+registryurl=http://knb.ecoinformatics.org
+registryname=KNB Data Registry

Property changes on: lib/style/skins/sanparks/sanparks.properties
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/default/index.jsp
===================================================================
--- lib/style/skins/default/index.jsp	(revision 4079)
+++ lib/style/skins/default/index.jsp	(revision 4080)
@@ -1,4 +1,4 @@
-<%@ page    language="java" %>
+<%@ page    language="java" import="edu.ucsb.nceas.metacat.service.PropertyService"%>
 <% 
  /**
   *  '$RCSfile$'
@@ -31,7 +31,6 @@
 %>
 <%@ include file="settings.jsp"%>
 <%@ include file="session_vars.jsp"%>
-<%@ page import="edu.ucsb.nceas.metacat.MetaCatUtil" %>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
@@ -43,23 +42,23 @@
 </head>
 <body>
   <script language="javascript">
-	  insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-	  insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertTemplateOpening("<%=CONTEXT_URL%>");
+	  insertSearchBox("<%=CONTEXT_URL%>");
   </script>
   <br/>
 
-  <% if ( MetaCatUtil.getOption("runSpatialOption").equals("true") ) { %>
+  <% if ( PropertyService.getProperty("runSpatialOption").equals("true") ) { %>
   <script language="javascript">
-	  insertMap("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertMap("<%=CONTEXT_URL%>");
   </script>
   <br/>
   <% } %>
 
   <script language="javascript">
-	  insertLoginBox("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertLoginBox("<%=CONTEXT_URL%>");
   </script>
   <script language="javascript">
-	  insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertTemplateClosing("<%=CONTEXT_URL%>");
   </script>
 </body>
 </html>
Index: lib/style/skins/default/settings.jsp
===================================================================
--- lib/style/skins/default/settings.jsp	(revision 4079)
+++ lib/style/skins/default/settings.jsp	(revision 4080)
@@ -30,6 +30,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <%
 
Index: lib/style/skins/ltss/index.jsp
===================================================================
--- lib/style/skins/ltss/index.jsp	(revision 4079)
+++ lib/style/skins/ltss/index.jsp	(revision 4080)
@@ -29,6 +29,7 @@
  %>
 
  <%@ include file="../../common/common-settings.jsp"%>
+ <%@ include file="../../common/configure-check.jsp"%>
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -43,8 +44,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 <table width="760" border="0" cellspacing="0" cellpadding="0">
   <tr><td colspan="5">
@@ -166,7 +167,7 @@
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/ltss/searchform.jsp
===================================================================
--- lib/style/skins/ltss/searchform.jsp	(revision 4079)
+++ lib/style/skins/ltss/searchform.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <form method="POST" action="<%=SERVLET_URL%>" target="_top">
 Search for: 
Index: lib/style/skins/knp/header.jsp
===================================================================
--- lib/style/skins/knp/header.jsp	(revision 4079)
+++ lib/style/skins/knp/header.jsp	(revision 4080)
@@ -24,6 +24,7 @@
 */
 %>
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 <!--____________________________max_width____________________________________-->
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Index: lib/style/skins/obfs/index.jsp
===================================================================
--- lib/style/skins/obfs/index.jsp	(revision 4079)
+++ lib/style/skins/obfs/index.jsp	(revision 4080)
@@ -30,6 +30,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
   
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -168,8 +169,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 <table width="760" border="0" cellspacing="0" cellpadding="0">
   <tr><td colspan="5">
@@ -269,7 +270,7 @@
 </table>
 <p>&nbsp;</p>
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/obfs/obfs.properties
===================================================================
--- lib/style/skins/obfs/obfs.properties	(nonexistent)
+++ lib/style/skins/obfs/obfs.properties	(revision 4080)
@@ -0,0 +1,48 @@
+#
+# General configuration parameters
+#
+registry.config.username=uid=nceasadmin,o=NCEAS,dc=ecoinformatics,dc=org
+registry.config.password=your-pw-goes-here
+registry.config.scope=nceas
+registry.config.organization=National Center for Ecological Analysis and Synthesis
+registry.config.abbrev=NCEAS
+#registry.config.url=http://www.nceas.ucsb.edu/
+registry.config.site=project
+registry.config.type=Repository
+registry.config.debug=1
+
+# NCEAS custom theme sans-iframe
+registry.templates.header=nceasHeader.tmpl
+registry.templates.footer=nceasFooter.tmpl
+
+# email settings
+email.sender=NCEAS Data Repository <help@nceas.ucsb.edu>
+email.recipient=help@nceas.ucsb.edu
+email.admin=the repository administrator
+
+# registry display settings
+registry.show.siteList=false
+registry.show.wgList=true
+registry.show.organization=false
+# registry module display
+registry.modules.taxonomic=true
+registry.modules.method=true
+registry.modules.spatial=true
+registry.modules.keyword=true
+registry.modules.temporal=true
+registry.modules.upload=true
+
+registry.required.temporal=
+registry.required.spatial=
+registry.required.contactEmailAddress=
+
+# NCEAS specific
+registry.db.connection=//hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu
+registry.db.user= admowner
+registry.db.password= your-pw-goes-here
+
+# imported properties from lib/skin.configs/nceas/nceas.properties
+# java code usage
+lsidauthority=knb.ecoinformatics.org
+registryurl=http://knb.ecoinformatics.org
+registryname=KNB Data Registry

Property changes on: lib/style/skins/obfs/obfs.properties
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/obfs/obfs.properties.metadata.xml
===================================================================
--- lib/style/skins/obfs/obfs.properties.metadata.xml	(nonexistent)
+++ lib/style/skins/obfs/obfs.properties.metadata.xml	(revision 4080)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<metadataConfig>
+	<group>
+		<index>1</index>
+		<name>Skins Configuration</name>
+		<comment>Choose configure the skins that will be available in this instance of MetaCat.</comment> 
+		<description>Skin Configuration Values.</description>
+	</group>
+
+	<config>
+		<key>registry.db.connection</key>
+		<label>Database Connection</label>
+		<group>1</group>
+		<index>1</index>
+		<description>Local database connection string.</description>
+	</config>
+	
+	<config>
+		<key>registry.db.user</key>
+		<label>Database Username</label>
+		<group>1</group>
+		<index>2</index>
+		<description>Local database user name.</description>
+	</config>
+
+	<config>
+		<key>registry.db.password</key>
+		<label>Database Password</label>
+		<group>1</group>
+		<fieldType>password</fieldType>
+		<index>3</index>
+		<description>Local database password.</description>
+	</config>
+
+</metadataConfig>
\ No newline at end of file

Property changes on: lib/style/skins/obfs/obfs.properties.metadata.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/obfs/map.jsp
===================================================================
--- lib/style/skins/obfs/map.jsp	(revision 4079)
+++ lib/style/skins/obfs/map.jsp	(revision 4080)
@@ -30,12 +30,13 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
   
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 <title>OBFS Data Registry Interactive Map</title>
-<link rel="stylesheet" href="<%=SERVER_URL_WITH_CONTEXT%>/style/default.css" type="text/css">
+<link rel="stylesheet" href="<%=CONTEXT_URL%>/style/default.css" type="text/css">
   <link rel="stylesheet" type="text/css" 
         href="<%=STYLE_SKINS_URL%>/obfs/obfs.css"></link>
   <script language="JavaScript" type="text/JavaScript"
@@ -45,8 +46,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          //insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          //insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 
 <iframe scrolling="no" frameborder="0" width="750" height="520" src="spatial/map.jsp">
@@ -55,7 +56,7 @@
 
 <p>&nbsp;</p>
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/sanparks/sanparks.properties.metadata.xml
===================================================================
--- lib/style/skins/sanparks/sanparks.properties.metadata.xml	(nonexistent)
+++ lib/style/skins/sanparks/sanparks.properties.metadata.xml	(revision 4080)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<metadataConfig>
+	<group>
+		<index>1</index>
+		<name>Skins Configuration</name>
+		<comment>Choose configure the skins that will be available in this instance of MetaCat.</comment> 
+		<description>Skin Configuration Values.</description>
+	</group>
+
+	<config>
+		<key>registry.db.connection</key>
+		<label>Database Connection</label>
+		<group>1</group>
+		<index>1</index>
+		<description>Local database connection string.</description>
+	</config>
+	
+	<config>
+		<key>registry.db.user</key>
+		<label>Database Username</label>
+		<group>1</group>
+		<index>2</index>
+		<description>Local database user name.</description>
+	</config>
+
+	<config>
+		<key>registry.db.password</key>
+		<label>Database Password</label>
+		<group>1</group>
+		<fieldType>password</fieldType>
+		<index>3</index>
+		<description>Local database password.</description>
+	</config>
+
+</metadataConfig>
\ No newline at end of file

Property changes on: lib/style/skins/sanparks/sanparks.properties.metadata.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/sanparks/sanparks.css
===================================================================
--- lib/style/skins/sanparks/sanparks.css	(revision 4079)
+++ lib/style/skins/sanparks/sanparks.css	(revision 4080)
@@ -97,6 +97,16 @@
   color: #FFFFFF;
 }
 
+.iframefooterclass2   {
+  height:   150px; 
+  width: 100%;
+  min-width: 623px;
+  /* margin-left: 20px; */
+  border:   0px;
+  background: #124325;
+  color: #FFFFFF;
+}
+
 .iframerightcolclass   { 
 	background: #FFFFFF;
 }
Index: lib/style/skins/kepler/header.jsp
===================================================================
--- lib/style/skins/kepler/header.jsp	(revision 4079)
+++ lib/style/skins/kepler/header.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <!--____________________________max_width____________________________________-->
 
Index: lib/style/skins/default/index_advanced.jsp
===================================================================
--- lib/style/skins/default/index_advanced.jsp	(revision 4079)
+++ lib/style/skins/default/index_advanced.jsp	(revision 4080)
@@ -45,9 +45,9 @@
 
 <body>
   <script language="javascript">
-	  insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-	  insertAdvancedSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
-      insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertTemplateOpening("<%=CONTEXT_URL%>");
+	  insertAdvancedSearchBox("<%=CONTEXT_URL%>");
+      insertTemplateClosing("<%=CONTEXT_URL%>");
   </script>
 </body>
 
Index: lib/style/skins/ltss/ltss.xml
===================================================================
--- lib/style/skins/ltss/ltss.xml	(revision 4079)
+++ lib/style/skins/ltss/ltss.xml	(revision 4080)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <style-set name="ltss">
 <!-- general login & search -->
-  <default-style>/style/common/ascii-treeview.xsl</default-style>
+  <default-style>style/common/ascii-treeview.xsl</default-style>
 
   <doctype publicid="-//NCEAS//resultset//EN">
     <target publicid="-//W3C//HTML//EN">/style/common/resultset.xsl</target>
Index: lib/style/skins/knp/index.jsp
===================================================================
--- lib/style/skins/knp/index.jsp	(revision 4079)
+++ lib/style/skins/knp/index.jsp	(revision 4080)
@@ -25,6 +25,7 @@
  */
 %>
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -40,9 +41,9 @@
             function getMapFrame() {
                 return document.getElementById('mapFrame');
             }
-            insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-            insertLoginBox("<%=SERVER_URL_WITH_CONTEXT%>");
-            insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateOpening("<%=CONTEXT_URL%>");
+            insertLoginBox("<%=CONTEXT_URL%>");
+            insertTemplateClosing("<%=CONTEXT_URL%>");
         </script>
     </body>
 </html>
Index: lib/style/skins/obfs/searchform.jsp
===================================================================
--- lib/style/skins/obfs/searchform.jsp	(revision 4079)
+++ lib/style/skins/obfs/searchform.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <form method="POST" action="<%=SERVLET_URL%>" target="_top">
 Search for: 
Index: test/edu/ucsb/nceas/metacattest/QueryResultBuilderTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/QueryResultBuilderTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/QueryResultBuilderTest.java	(revision 4080)
@@ -34,8 +34,8 @@
 
 import edu.ucsb.nceas.metacat.DBConnection;
 import edu.ucsb.nceas.metacat.DBConnectionPool;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.Version;
+import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.utilities.Options;
 
 import junit.framework.Test;
@@ -239,7 +239,7 @@
         	String   createDate = result.getString(5);
         	String updateDate = result.getString(6);
         	String completeDocid = docid
-                             + MetaCatUtil.getOption("accNumSeparator");
+                             + PropertyService.getProperty("accNumSeparator");
             completeDocid += rev;
             // Put everything into a string buffer
             StringBuffer document = new StringBuffer();
Index: test/edu/ucsb/nceas/metacattest/UploadIPCCDataTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/UploadIPCCDataTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/UploadIPCCDataTest.java	(revision 4080)
@@ -29,6 +29,8 @@
 import edu.ucsb.nceas.metacat.*;
 import edu.ucsb.nceas.metacat.client.Metacat;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.IOUtil;
 import edu.ucsb.nceas.utilities.Options;
 import edu.ucsb.nceas.utilities.XMLUtilities;
@@ -82,7 +84,7 @@
 		  {
 			  Options.initialize(new File("build/tests/metacat.properties"));
 			  MetaCatUtil.pathsForIndexing 
-			         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+			         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
 		  }
 		  catch(Exception e)
 		  {
Index: test/edu/ucsb/nceas/metacattest/NonAsciiCharacterTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/NonAsciiCharacterTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/NonAsciiCharacterTest.java	(revision 4080)
@@ -33,7 +33,6 @@
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
 import edu.ucsb.nceas.metacat.client.Metacat;
 import edu.ucsb.nceas.metacat.client.MetacatAuthException;
@@ -40,8 +39,10 @@
 import edu.ucsb.nceas.metacat.client.MetacatException;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.IOUtil;
-import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -52,25 +53,25 @@
  */
 public class NonAsciiCharacterTest
     extends TestCase {
-	 /* Initialize Options*/
-    static
-    {
-  	  try
-  	  {
-  		  Options.initialize(new File("build/tests/metacat.properties"));
-  		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
-  	  }
-  	  catch(Exception e)
-  	  {
-  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-  	  }
-    }
-    private String metacatUrl = MetaCatUtil.getOption("metacatUrl");;
-    private String username = MetaCatUtil.getOption("mcuser");
-    private String password = MetaCatUtil.getOption("mcpassword");
-    private String anotheruser = MetaCatUtil.getOption("mcanotheruser");
-    private String anotherpassword = MetaCatUtil.getOption("mcanotherpassword");
+
+    private static String metacatUrl;
+    private static String username;
+	private static String password;
+	private static String anotheruser;
+	private static String anotherpassword;
+	static {
+		try {
+		    metacatUrl = SystemUtil.getServletURL();
+			username = PropertyService.getProperty("mcuser");
+			password = PropertyService.getProperty("mcpassword");
+			anotheruser = PropertyService.getProperty("mcanotheruser");
+			anotherpassword = PropertyService.getProperty("mcanotherpassword");
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+		}
+	}
+
     private String prefix = "test";
     private String newdocid = null;
     private String testdocument = "";
Index: test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDetailLogTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDetailLogTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDetailLogTest.java	(revision 4080)
@@ -27,11 +27,12 @@
 
 package edu.ucsb.nceas.metacattest.harvesterClient;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestDetailLog;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestDocument;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 
 import java.io.File;
@@ -58,7 +59,7 @@
 	  {
 		  Options.initialize(new File("build/tests/metacat.properties"));
 		  MetaCatUtil.pathsForIndexing 
-		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
 	  }
 	  catch(Exception e)
 	  {
Index: test/edu/ucsb/nceas/metacattest/harvesterClient/HarvesterTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/harvesterClient/HarvesterTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/harvesterClient/HarvesterTest.java	(revision 4080)
@@ -27,8 +27,9 @@
 
 package edu.ucsb.nceas.metacattest.harvesterClient;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 import java.io.File;
 import java.io.FileInputStream;
@@ -52,7 +53,7 @@
 	  {
 		  Options.initialize(new File("build/tests/metacat.properties"));
 		  MetaCatUtil.pathsForIndexing 
-		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
 	  }
 	  catch(Exception e)
 	  {
Index: test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDocumentTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDocumentTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDocumentTest.java	(revision 4080)
@@ -27,10 +27,11 @@
 
 package edu.ucsb.nceas.metacattest.harvesterClient;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestDocument;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
 import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 
 import java.io.File;
@@ -57,7 +58,7 @@
 	  {
 		  Options.initialize(new File("build/tests/metacat.properties"));
 		  MetaCatUtil.pathsForIndexing 
-		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
 	  }
 	  catch(Exception e)
 	  {
Index: test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestLogTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestLogTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestLogTest.java	(revision 4080)
@@ -27,7 +27,6 @@
 
 package edu.ucsb.nceas.metacattest.harvesterClient;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
 import java.io.File;
 import java.sql.Connection;
@@ -39,6 +38,8 @@
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestDetailLog;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestDocument;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestLog;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -64,7 +65,7 @@
 	  {
 		  Options.initialize(new File("build/tests/metacat.properties"));
 		  MetaCatUtil.pathsForIndexing 
-		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
 	  }
 	  catch(Exception e)
 	  {
Index: test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestSiteScheduleTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestSiteScheduleTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestSiteScheduleTest.java	(revision 4080)
@@ -27,9 +27,10 @@
 
 package edu.ucsb.nceas.metacattest.harvesterClient;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
 import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 
 import java.io.File;
@@ -56,7 +57,7 @@
 	  {
 		  Options.initialize(new File("build/tests/metacat.properties"));
 		  MetaCatUtil.pathsForIndexing 
-		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
 	  }
 	  catch(Exception e)
 	  {
Index: test/edu/ucsb/nceas/metacattest/QueryGroupTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/QueryGroupTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/QueryGroupTest.java	(revision 4080)
@@ -33,9 +33,10 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.QueryGroup;
 import edu.ucsb.nceas.metacat.QueryTerm;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 
 /**
@@ -53,7 +54,7 @@
   	  {
   		  Options.initialize(new File("build/tests/metacat.properties"));
   		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+  		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
   	  }
   	  catch(Exception e)
   	  {
Index: test/edu/ucsb/nceas/metacattest/EventLogTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/EventLogTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/EventLogTest.java	(revision 4080)
@@ -32,7 +32,7 @@
 
 import edu.ucsb.nceas.metacat.DBConnectionPool;
 import edu.ucsb.nceas.metacat.EventLog;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.Options;
 
 import junit.framework.TestCase;
@@ -44,31 +44,16 @@
  */
 public class EventLogTest extends TestCase
 {
-	 /* Initialize Options*/
-    static
-    {
-  	  try
-  	  {
-  		  Options.initialize(new File("build/tests/metacat.properties"));
-  		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
-  	  }
-  	  catch(Exception e)
-  	  {
-  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-  	  }
-    }
-	
-    private String propertyFileName = 
-    	MetaCatUtil.getOption("installDir") + "/WEB-INF/metacat.properties";
+    private String propertyFileName = null;
 
     protected void setUp() throws Exception
     {
+    	propertyFileName = SystemUtil.getContextDir() + "/WEB-INF/metacat.properties";
+    	
         super.setUp();
         try {
             File propertyFile = new File(propertyFileName);
             Options options = Options.initialize(propertyFile);
-            MetaCatUtil util = new MetaCatUtil();
             DBConnectionPool pool = DBConnectionPool.getInstance();
         } catch (FileNotFoundException e) {
             fail(e.getMessage());
Index: test/edu/ucsb/nceas/metacattest/MetaCatServletTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/MetaCatServletTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/MetaCatServletTest.java	(revision 4080)
@@ -27,9 +27,11 @@
 package edu.ucsb.nceas.metacattest;
 
 import edu.ucsb.nceas.metacat.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.HttpMessage;
-import edu.ucsb.nceas.utilities.Options;
-//import edu.ucsb.nceas.morpho.framework.*;
+import edu.ucsb.nceas.utilities.Options; //import edu.ucsb.nceas.morpho.framework.*;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestResult;
@@ -41,569 +43,534 @@
 import java.net.*;
 import java.util.*;
 
-
 /**
  * A JUnit test for testing Step class processing
  */
-public class MetaCatServletTest extends TestCase
-{
+public class MetaCatServletTest extends TestCase {
+	private static String metacatURL;
+	private String serialNumber;
+	private static final Log log = LogFactory
+			.getLog("edu.ucsb.nceas.metacattest.MetaCatServletTest");
 	/* Initialize Options*/
-	  static
-	  {
-		  try
-		  {
-			  Options.initialize(new File("build/tests/metacat.properties"));
-		  }
-		  catch(Exception e)
-		  {
-			  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-		  }
-	  }
-  private String metacatURL=MetaCatUtil.getOption("junittesturl");
-  private String serialNumber;
-  private static final Log log = LogFactory.getLog("edu.ucsb.nceas.metacattest.MetaCatServletTest");
-  
-  
-  /**
-   * Constructor to build the test
-   *
-   * @param name the name of the test method
-   */
-  public MetaCatServletTest(String name)
-  {
-    super(name);
-  }
+	static {
+		try {
+			metacatURL = SystemUtil.getServletURL();
+			Options.initialize(new File("build/tests/metacat.properties"));
+		} catch (Exception e) {
+			System.err.println("Exception in initialize option in MetacatServletNetTest "
+					+ e.getMessage());
+		}
+	}
 
- /**
-   * Constructor to build the test
-   *
-   * @param name the name of the test method
-   */
-  public MetaCatServletTest(String name, String serial)
-  {
-    super(name);
-    serialNumber=serial;
-  }
-  /**
-   * Establish a testing framework by initializing appropriate objects
-   */
-  public void setUp()
- {
-    
- }
+	/**
+	 * Constructor to build the test
+	 *
+	 * @param name the name of the test method
+	 */
+	public MetaCatServletTest(String name) {
+		super(name);
+	}
 
-  /**
-   * Release any objects after tests are complete
-   */
-  public void tearDown()
-  {
-  }
+	/**
+	 * Constructor to build the test
+	 *
+	 * @param name the name of the test method
+	 */
+	public MetaCatServletTest(String name, String serial) {
+		super(name);
+		serialNumber = serial;
+	}
 
-  /**
-   * Create a suite of tests to be run together
-   */
-  public static Test suite()
-  {
-    double number = 0;
-    String serial = null;
-    
-    
-    TestSuite suite = new TestSuite();
-    suite.addTest(new MetaCatServletTest("initialize"));
-    suite.addTest(new MetaCatServletTest("testLterReferralLogin"));
-    suite.addTest(new MetaCatServletTest("testLterReferralLoginFail"));
-    suite.addTest(new MetaCatServletTest("testPiscoReferralLogin"));
-    suite.addTest(new MetaCatServletTest("testPiscoReferralLoginFail"));
-    suite.addTest(new MetaCatServletTest("testNCEASLoginFail"));
-    //Should put a login successfully at the end of login test
-    //So insert or update can have cookie.
-    suite.addTest(new MetaCatServletTest("testNCEASLogin"));
-    
-    //create random number for docid, so it can void repeat
-    number = Math.random()*100000;
-    serial = Integer.toString(((new Double(number)).intValue()));
-    log.debug("serial: "+serial);
-    suite.addTest(new MetaCatServletTest("testInsertXMLDocument", serial));
-    suite.addTest(new MetaCatServletTest("testReadXMLDocumentXMLFormat", 
-                                                        serial));
-    suite.addTest(new MetaCatServletTest("testUpdateXMLDocument",serial));
-        
-    suite.addTest(new MetaCatServletTest("testReadXMLDocumentHTMLFormat", 
-                                                        serial));
-    suite.addTest(new MetaCatServletTest("testReadXMLDocumentZipFormat", 
-                                                        serial));
-    
-    suite.addTest(new MetaCatServletTest("testDeleteXMLDocument",serial));
-    
-    //insert invalid xml document
-    number = Math.random()*100000;
-    serial = Integer.toString(((new Double(number)).intValue()));
-    suite.addTest(new MetaCatServletTest("testInsertInvalidateXMLDocument",
-                                                                  serial));    
-    //insert non well formed document
-    number = Math.random()*100000;
-    serial = Integer.toString(((new Double(number)).intValue())); 
-    suite.addTest(new MetaCatServletTest("testInsertNonWellFormedXMLDocument",
-                                                            serial));
-    
-    suite.addTest(new MetaCatServletTest("testLogOut"));                   
-                              
-    return suite;
-  }
-  
+	/**
+	 * Establish a testing framework by initializing appropriate objects
+	 */
+	public void setUp() {
 
+	}
 
-  /**
-   * Run an initial test that always passes to check that the test
-   * harness is working.
-   */
-  public void initialize()
-  {
-    assertTrue(1 == 1);
-  }
+	/**
+	 * Release any objects after tests are complete
+	 */
+	public void tearDown() {
+	}
 
-  /**
-   * Test the login to neceas succesfully
-   */
-  public void testNCEASLogin()
-  {
-    String user="uid=john,o=NCEAS,dc=ecoinformatics,dc=org";
-    String passwd="123456";
-    assertTrue(logIn(user,passwd));
-    //assertTrue( withProtocol.getProtocol().equals("http"));
-  }
-  
-  /**
-   * Test the login to neceas failed
-   */
-  public void testNCEASLoginFail()
-  {
-    String user="uid=john,o=NCEAS,dc=ecoinformatics,dc=org";
-    String passwd="12345678";
-    assertTrue(!logIn(user,passwd));
-    
-  }
-  
-  /**
-   * Test the login to lter succesfully
-   */
-  public void testLterReferralLogin()
-  {
-    String user=MetaCatUtil.getOption("lteruser");
-    String passwd=MetaCatUtil.getOption("lterpassword");
-    assertTrue(logIn(user,passwd));
-    
-  }
-  
-  /**
-   * Test the login to lter failed
-   */
-  public void testLterReferralLoginFail()
-  {
-    String user="uid=jtao,o=LTER,dc=ecoinformatics,dc=org";
-    String passwd="qVyGpveb";
-    assertTrue(!logIn(user,passwd));
-    //assertTrue( withProtocol.getProtocol().equals("http"));
-  }
-  
- /**
-   * Test the login to pisco succesfully
-   */
-   public void testPiscoReferralLogin()
-  {
-	String user=MetaCatUtil.getOption("piscouser");
-	String passwd=MetaCatUtil.getOption("piscopassword");
-    assertTrue(logIn(user,passwd));
-    //assertTrue( withProtocol.getProtocol().equals("http"));
-  }
-  
- /**
-   * Test the login to pisco failed
-   */
-  public void testPiscoReferralLoginFail()
-  {
-    String user="uid=tao,o=PISCO,dc=ecoinformatics,dc=org";
-    String passwd="hello";
-    assertTrue(!logIn(user,passwd));
-    //assertTrue( withProtocol.getProtocol().equals("http"));
-  }
-  
- /**
-   * Test insert a xml document successfully
-   */
-  public void testInsertXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    log.debug("insert docid: "+name);
-    String content="<?xml version=\"1.0\"?>"
-                   +"<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
-                   +"eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
-                   +"edu:8080/tao/dtd/eml-access-2.0.0beta6.dtd\">"
-                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
-                   +"<identifier>"+name+"</identifier>"
-                   +"<allow>"
-             +"<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
-                   +"<permission>all</permission>"
-                   +"</allow>"
-                   +"<allow>"
-                   +"<principal>public</principal>"
-                   +"<permission>read</permission>"
-                   +"</allow>"
-                   +"</acl>";
-    log.debug("xml document: "+content);
-     assertTrue(handleXMLDocument(content, name, "insert"));
-   
-  }
-  
-  /**
-   * Test insert a invalidate xml document successfully
-   * In the String, there is no <!Doctype ... Public/System/>
-   */
-  public void testInsertInvalidateXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    log.debug("insert docid: "+name);
-    String content="<?xml version=\"1.0\"?>"
-                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
-                   +"<identifier>"+name+"</identifier>"
-                   +"<allow>"
-             +"<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
-                   +"<permission>all</permission>"
-                   +"</allow>"
-                   +"<allow>"
-                   +"<principal>public</principal>"
-                   +"<permission>read</permission>"
-                   +"</allow>"
-                   +"</acl>";
-    log.debug("xml document: "+content);
-     assertTrue(handleXMLDocument(content, name, "insert"));
-  }
-  
-   /**
-   * Test insert a non well-formed xml document successfully
-   * There is no </acl> in this string
-   */
-  public void testInsertNonWellFormedXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    log.debug("insert non well-formed docid: "+name);
-    String content="<?xml version=\"1.0\"?>"
-                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
-                   +"<identifier>"+name+"</identifier>"
-                   +"<allow>"
-             +"<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
-                   +"<permission>all</permission>"
-                   +"</allow>"
-                   +"<allow>"
-                   +"<principal>public</principal>"
-                   +"<permission>read</permission>"
-                   +"</allow>";
-  
-    log.debug("xml document: "+content);
-     assertTrue(!handleXMLDocument(content, name, "insert"));
-  } 
+	/**
+	 * Create a suite of tests to be run together
+	 */
+	public static Test suite() {
+		double number = 0;
+		String serial = null;
 
-  /**
-   * Test read a xml document  in xml format successfully
-   */
-  public void testReadXMLDocumentXMLFormat()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    assertTrue(handleReadAction(name, "xml"));
-   
-  } 
+		TestSuite suite = new TestSuite();
+		suite.addTest(new MetaCatServletTest("initialize"));
+		suite.addTest(new MetaCatServletTest("testLterReferralLogin"));
+		suite.addTest(new MetaCatServletTest("testLterReferralLoginFail"));
+		suite.addTest(new MetaCatServletTest("testPiscoReferralLogin"));
+		suite.addTest(new MetaCatServletTest("testPiscoReferralLoginFail"));
+		suite.addTest(new MetaCatServletTest("testNCEASLoginFail"));
+		//Should put a login successfully at the end of login test
+		//So insert or update can have cookie.
+		suite.addTest(new MetaCatServletTest("testNCEASLogin"));
 
-  /**
-   * Test read a xml document  in html format successfully
-   */
-  public void testReadXMLDocumentHTMLFormat()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    assertTrue(handleReadAction(name, "html"));
-   
-  }
+		//create random number for docid, so it can void repeat
+		number = Math.random() * 100000;
+		serial = Integer.toString(((new Double(number)).intValue()));
+		log.debug("serial: " + serial);
+		suite.addTest(new MetaCatServletTest("testInsertXMLDocument", serial));
+		suite.addTest(new MetaCatServletTest("testReadXMLDocumentXMLFormat", serial));
+		suite.addTest(new MetaCatServletTest("testUpdateXMLDocument", serial));
 
- 
-  /**
-   * Test read a xml document  in zip format successfully
-   */
-  public void testReadXMLDocumentZipFormat()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
-    assertTrue(handleReadAction(name, "zip"));
-   
-  }
-  
-  /**
-   * Test insert a xml document successfully
-   */
-  public void testUpdateXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"2";
-    log.debug("update docid: "+name);
-    String content="<?xml version=\"1.0\"?>"
-                   +"<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
-                   +"eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
-                   +"edu:8080/tao/dtd/eml-access-2.0.0beta6.dtd\">"
-                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
-                   +"<identifier>"+name+"</identifier>"
-                   +"<allow>"
-             +"<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
-                   +"<permission>all</permission>"
-                   +"</allow>"
-                   +"<allow>"
-                   +"<principal>public</principal>"
-                   +"<permission>read</permission>"
-                   +"</allow>"
-                   +"</acl>";
-    log.debug("xml document: "+content);
-     assertTrue(handleXMLDocument(content, name, "update"));
-   
-  }
-  
-  /**
-   * Test delete a xml document successfully
-   */
-  public void testDeleteXMLDocument()
-  {
-    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
-                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"2";
-    log.debug("delete docid: "+name);
-    assertTrue(handleDeleteFile(name));
-   
-  }
-       
-  /**
-   * Test logout action
-   */
-  public void testLogOut()
-  {
-    
-    assertTrue(handleLogOut());
-   
-  }
-  
- /**
-   * Method to hanld login action
-   *
-   * @param usrerName, the DN name of the test method
-   * @param passWord, the passwd of the user
-   */
-  
-  public boolean logIn(String userName, String passWord)
-  {
-    Properties prop = new Properties();
-    prop.put("action", "login");
-    prop.put("qformat", "xml");
-    prop.put("username", userName);
-    prop.put("password", passWord);
+		suite.addTest(new MetaCatServletTest("testReadXMLDocumentHTMLFormat", serial));
+		suite.addTest(new MetaCatServletTest("testReadXMLDocumentZipFormat", serial));
 
-    // Now contact metacat
-    String response = getMetacatString(prop);
-    log.debug("Login Message: "+response);
-    boolean connected = false;
-    if (response.indexOf("<login>") != -1) {
-      connected = true;
-    } else {
-      
-      connected = false;
-    }
+		suite.addTest(new MetaCatServletTest("testDeleteXMLDocument", serial));
 
-    return connected;
-  }
-  
-  /**
-   * Method to hanld logout action
-   *
-   * @param usrerName, the DN name of the test method
-   * @param passWord, the passwd of the user
-   */
-  
-  public boolean handleLogOut()
-  {
-    boolean disConnected =false;
-    Properties prop = new Properties();
-    prop.put("action", "logout");
-    prop.put("qformat", "xml");
-  
-    String response = getMetacatString(prop);
-    log.debug("Logout Message: "+response);
-    HttpMessage.setCookie(null);
-     
-    if (response.indexOf("<logout>") != -1) 
-    {
-      disConnected = true;
-    } 
-    else 
-    {
-      disConnected = false;
-    }
+		//insert invalid xml document
+		number = Math.random() * 100000;
+		serial = Integer.toString(((new Double(number)).intValue()));
+		suite.addTest(new MetaCatServletTest("testInsertInvalidateXMLDocument", serial));
+		//insert non well formed document
+		number = Math.random() * 100000;
+		serial = Integer.toString(((new Double(number)).intValue()));
+		suite
+				.addTest(new MetaCatServletTest("testInsertNonWellFormedXMLDocument",
+						serial));
 
-    return disConnected;
-  }
-  
-  /**
-   * Method to hanld read both xml and data file
-   *
-   * @param docid, the docid of the document want to read
-   * @param qformat, the format of document user want to get
-   */
-  public boolean handleReadAction(String docid, String qformat)
-  {
-    Properties prop = new Properties();
-    String message ="";
-    prop.put("action", "read");
-    prop.put("qformat", qformat);
-    prop.put("docid", docid);
-    
-    message = getMetacatString(prop);
-    message = message.trim();
-    if (message==null || message.equals("")||message.indexOf("<error>") != -1 )
-    {//there was an error
-      
-      return false;
-    }
-    else
-    {//successfully
-      return true;
-    } 
-    
-  }
-  
-  
-  /**
-   * Method to hanld inset or update xml document
-   *
-   * @param xmlDocument, the content of xml qformat
-   * @param docid, the docid of the document
-   * @param action, insert or update
-   */
-  public boolean handleXMLDocument(String xmlDocument, String docid, 
-                                                              String action)
- 
-  { //-attempt to write file to metacat
-    String access = "no";
-    StringBuffer fileText = new StringBuffer();
-    StringBuffer messageBuf = new StringBuffer();
-    String accessFileId = null;
-    Properties prop = new Properties();
-    prop.put("action", action);
-    prop.put("public", access);  //This is the old way of controlling access
-    prop.put("doctext", xmlDocument);
-    prop.put("docid", docid);
-    
-    String message = getMetacatString(prop);
-    log.debug("Insert or Update Message: "+message);
-    if(message.indexOf("<error>") != -1)
-    {//there was an error
-      
-      return false;
-    }
-    else if(message.indexOf("<success>") != -1)
-    {//the operation worked
-     //write the file to the cache and return the file object
-     return true;
-       
-    }
-    else
-    {//something weird happened.
-      return false;
-    } 
-   
-   
-  }
-  
-   public boolean handleDeleteFile(String name)
-  {
-    
-    Properties prop = new Properties();
-    prop.put("action", "delete");
-    prop.put("docid", name);
- 
-    String message = getMetacatString(prop);
-    log.debug("Delete Message: "+message);
-    if(message.indexOf("<error>") != -1)
-    {//there was an error
-      
-      return false;
-    }
-    else if(message.indexOf("<success>") != -1)
-    {//the operation worked
-     //write the file to the cache and return the file object
-     return true;
-       
-    }
-    else
-    {//something weird happened.
-      return false;
-    } 
-  }
-  
-  
- 
-  
-   public String getMetacatString(Properties prop)
-  {
-    String response = null;
+		suite.addTest(new MetaCatServletTest("testLogOut"));
 
-    // Now contact metacat and send the request
-    try
-    {
-      InputStreamReader returnStream = 
-                        new InputStreamReader(getMetacatInputStream(prop));
-      StringWriter sw = new StringWriter();
-      int len;
-      char[] characters = new char[512];
-      while ((len = returnStream.read(characters, 0, 512)) != -1)
-      {
-        sw.write(characters, 0, len);
-      }
-      returnStream.close();
-      response = sw.toString();
-      sw.close();
-    }
-    catch(Exception e)
-    {
-      return null;
-    }
-  
-    return response;
-  }
-  
-   /**
-   * Send a request to Metacat
-   *
-   * @param prop the properties to be sent to Metacat
-   * @return InputStream as returned by Metacat
-   */
-  public InputStream getMetacatInputStream(Properties prop)
-  {
-    InputStream returnStream = null;
-    // Now contact metacat and send the request
-    try
-    {
-     
-      URL url = new URL(metacatURL);
-      HttpMessage msg = new HttpMessage(url);
-      returnStream = msg.sendPostMessage(prop);
-      return returnStream;
-    }
-    catch(Exception e)
-    {
-      e.printStackTrace(System.err);
-     
-    }
-    return returnStream;
-   
-  }
+		return suite;
+	}
 
- 
+	/**
+	 * Run an initial test that always passes to check that the test
+	 * harness is working.
+	 */
+	public void initialize() {
+		assertTrue(1 == 1);
+	}
 
+	/**
+	 * Test the login to neceas succesfully
+	 */
+	public void testNCEASLogin() {
+		String user = "uid=john,o=NCEAS,dc=ecoinformatics,dc=org";
+		String passwd = "123456";
+		assertTrue(logIn(user, passwd));
+		//assertTrue( withProtocol.getProtocol().equals("http"));
+	}
+
+	/**
+	 * Test the login to neceas failed
+	 */
+	public void testNCEASLoginFail() {
+		String user = "uid=john,o=NCEAS,dc=ecoinformatics,dc=org";
+		String passwd = "12345678";
+		assertTrue(!logIn(user, passwd));
+
+	}
+
+	/**
+	 * Test the login to lter succesfully
+	 */
+	public void testLterReferralLogin() {
+		String user = null;
+		String passwd = null;
+		try {
+			user = PropertyService.getProperty("lteruser");
+			passwd = PropertyService.getProperty("lterpassword");
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}
+		assertTrue(logIn(user, passwd));
+
+	}
+
+	/**
+	 * Test the login to lter failed
+	 */
+	public void testLterReferralLoginFail() {
+		String user = "uid=jtao,o=LTER,dc=ecoinformatics,dc=org";
+		String passwd = "qVyGpveb";
+		assertTrue(!logIn(user, passwd));
+		//assertTrue( withProtocol.getProtocol().equals("http"));
+	}
+
+	/**
+	 * Test the login to pisco succesfully
+	 */
+	public void testPiscoReferralLogin() {
+		String user = null;
+		String passwd = null;
+		try {
+			user = PropertyService.getProperty("piscouser");
+			passwd = PropertyService.getProperty("piscopassword");
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}
+		assertTrue(logIn(user, passwd));
+		// assertTrue( withProtocol.getProtocol().equals("http"));
+	}
+
+	/**
+	 * Test the login to pisco failed
+	 */
+	public void testPiscoReferralLoginFail() {
+		String user = "uid=tao,o=PISCO,dc=ecoinformatics,dc=org";
+		String passwd = "hello";
+		assertTrue(!logIn(user, passwd));
+		//assertTrue( withProtocol.getProtocol().equals("http"));
+	}
+
+	/**
+	 * Test insert a xml document successfully
+	 */
+	public void testInsertXMLDocument() {
+		String name = null;
+		try {
+			name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+					+ PropertyService.getProperty("accNumSeparator") + "1";
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}
+		log.debug("insert docid: " + name);
+		String content = "<?xml version=\"1.0\"?>"
+				+ "<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
+				+ "eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
+				+ "edu:8080/tao/dtd/eml-access-2.0.0beta6.dtd\">"
+				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
+				+ "</identifier>" + "<allow>"
+				+ "<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
+				+ "<permission>all</permission>" + "</allow>" + "<allow>"
+				+ "<principal>public</principal>" + "<permission>read</permission>"
+				+ "</allow>" + "</acl>";
+		log.debug("xml document: " + content);
+		assertTrue(handleXMLDocument(content, name, "insert"));
+
+	}
+
+	/**
+	 * Test insert a invalidate xml document successfully
+	 * In the String, there is no <!Doctype ... Public/System/>
+	 */
+	public void testInsertInvalidateXMLDocument() {
+		String name = null;
+		try {
+			name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}
+		log.debug("insert docid: " + name);
+		String content = "<?xml version=\"1.0\"?>"
+				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
+				+ "</identifier>" + "<allow>"
+				+ "<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
+				+ "<permission>all</permission>" + "</allow>" + "<allow>"
+				+ "<principal>public</principal>" + "<permission>read</permission>"
+				+ "</allow>" + "</acl>";
+		log.debug("xml document: " + content);
+		assertTrue(handleXMLDocument(content, name, "insert"));
+	}
+
+	/**
+	 * Test insert a non well-formed xml document successfully
+	 * There is no </acl> in this string
+	 */
+	public void testInsertNonWellFormedXMLDocument() {
+		String name = null;
+		try {
+			name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}
+		log.debug("insert non well-formed docid: " + name);
+		String content = "<?xml version=\"1.0\"?>"
+				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
+				+ "</identifier>" + "<allow>"
+				+ "<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
+				+ "<permission>all</permission>" + "</allow>" + "<allow>"
+				+ "<principal>public</principal>" + "<permission>read</permission>"
+				+ "</allow>";
+
+		log.debug("xml document: " + content);
+		assertTrue(!handleXMLDocument(content, name, "insert"));
+	}
+
+	/**
+	 * Test read a xml document  in xml format successfully
+	 */
+	public void testReadXMLDocumentXMLFormat() {
+		String name = null;
+		try {
+			name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}
+		assertTrue(handleReadAction(name, "xml"));
+
+	}
+
+	/**
+	 * Test read a xml document  in html format successfully
+	 */
+	public void testReadXMLDocumentHTMLFormat() {
+		String name = null;
+		try {
+			name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}	
+		assertTrue(handleReadAction(name, "html"));
+
+	}
+
+	/**
+	 * Test read a xml document  in zip format successfully
+	 */
+	public void testReadXMLDocumentZipFormat() {
+		String name = null;
+		try {
+			name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "1";
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}	
+		assertTrue(handleReadAction(name, "zip"));
+
+	}
+
+	/**
+	 * Test insert a xml document successfully
+	 */
+	public void testUpdateXMLDocument() {
+		String name = null;
+		try {
+			name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "2";
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}		
+		log.debug("update docid: " + name);
+		String content = "<?xml version=\"1.0\"?>"
+				+ "<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
+				+ "eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
+				+ "edu:8080/tao/dtd/eml-access-2.0.0beta6.dtd\">"
+				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
+				+ "</identifier>" + "<allow>"
+				+ "<principal>uid=john,o=NCEAS,dc=ecoinformatics,dc=org</principal>"
+				+ "<permission>all</permission>" + "</allow>" + "<allow>"
+				+ "<principal>public</principal>" + "<permission>read</permission>"
+				+ "</allow>" + "</acl>";
+		log.debug("xml document: " + content);
+		assertTrue(handleXMLDocument(content, name, "update"));
+
+	}
+
+	/**
+	 * Test delete a xml document successfully
+	 */
+	public void testDeleteXMLDocument() {
+		String name = null;
+		try {
+			name = "john" + PropertyService.getProperty("accNumSeparator") + serialNumber
+				+ PropertyService.getProperty("accNumSeparator") + "2";
+		} catch (PropertyNotFoundException pnfe) {
+			fail("Could not find property: " + pnfe.getMessage());
+		}
+		log.debug("delete docid: " + name);
+		assertTrue(handleDeleteFile(name));
+
+	}
+
+	/**
+	 * Test logout action
+	 */
+	public void testLogOut() {
+
+		assertTrue(handleLogOut());
+
+	}
+
+	/**
+	 * Method to hanld login action
+	 *
+	 * @param usrerName, the DN name of the test method
+	 * @param passWord, the passwd of the user
+	 */
+
+	public boolean logIn(String userName, String passWord) {
+		Properties prop = new Properties();
+		prop.put("action", "login");
+		prop.put("qformat", "xml");
+		prop.put("username", userName);
+		prop.put("password", passWord);
+
+		// Now contact metacat
+		String response = getMetacatString(prop);
+		log.debug("Login Message: " + response);
+		boolean connected = false;
+		if (response.indexOf("<login>") != -1) {
+			connected = true;
+		} else {
+
+			connected = false;
+		}
+
+		return connected;
+	}
+
+	/**
+	 * Method to hanld logout action
+	 *
+	 * @param usrerName, the DN name of the test method
+	 * @param passWord, the passwd of the user
+	 */
+
+	public boolean handleLogOut() {
+		boolean disConnected = false;
+		Properties prop = new Properties();
+		prop.put("action", "logout");
+		prop.put("qformat", "xml");
+
+		String response = getMetacatString(prop);
+		log.debug("Logout Message: " + response);
+		HttpMessage.setCookie(null);
+
+		if (response.indexOf("<logout>") != -1) {
+			disConnected = true;
+		} else {
+			disConnected = false;
+		}
+
+		return disConnected;
+	}
+
+	/**
+	 * Method to hanld read both xml and data file
+	 *
+	 * @param docid, the docid of the document want to read
+	 * @param qformat, the format of document user want to get
+	 */
+	public boolean handleReadAction(String docid, String qformat) {
+		Properties prop = new Properties();
+		String message = "";
+		prop.put("action", "read");
+		prop.put("qformat", qformat);
+		prop.put("docid", docid);
+
+		message = getMetacatString(prop);
+		message = message.trim();
+		if (message == null || message.equals("") || message.indexOf("<error>") != -1) {//there was an error
+
+			return false;
+		} else {//successfully
+			return true;
+		}
+
+	}
+
+	/**
+	 * Method to hanld inset or update xml document
+	 *
+	 * @param xmlDocument, the content of xml qformat
+	 * @param docid, the docid of the document
+	 * @param action, insert or update
+	 */
+	public boolean handleXMLDocument(String xmlDocument, String docid, String action)
+
+	{ //-attempt to write file to metacat
+		String access = "no";
+		StringBuffer fileText = new StringBuffer();
+		StringBuffer messageBuf = new StringBuffer();
+		String accessFileId = null;
+		Properties prop = new Properties();
+		prop.put("action", action);
+		prop.put("public", access); //This is the old way of controlling access
+		prop.put("doctext", xmlDocument);
+		prop.put("docid", docid);
+
+		String message = getMetacatString(prop);
+		log.debug("Insert or Update Message: " + message);
+		if (message.indexOf("<error>") != -1) {//there was an error
+
+			return false;
+		} else if (message.indexOf("<success>") != -1) {//the operation worked
+			//write the file to the cache and return the file object
+			return true;
+
+		} else {//something weird happened.
+			return false;
+		}
+
+	}
+
+	public boolean handleDeleteFile(String name) {
+
+		Properties prop = new Properties();
+		prop.put("action", "delete");
+		prop.put("docid", name);
+
+		String message = getMetacatString(prop);
+		log.debug("Delete Message: " + message);
+		if (message.indexOf("<error>") != -1) {//there was an error
+
+			return false;
+		} else if (message.indexOf("<success>") != -1) {//the operation worked
+			//write the file to the cache and return the file object
+			return true;
+
+		} else {//something weird happened.
+			return false;
+		}
+	}
+
+	public String getMetacatString(Properties prop) {
+		String response = null;
+
+		// Now contact metacat and send the request
+		try {
+			InputStreamReader returnStream = new InputStreamReader(
+					getMetacatInputStream(prop));
+			StringWriter sw = new StringWriter();
+			int len;
+			char[] characters = new char[512];
+			while ((len = returnStream.read(characters, 0, 512)) != -1) {
+				sw.write(characters, 0, len);
+			}
+			returnStream.close();
+			response = sw.toString();
+			sw.close();
+		} catch (Exception e) {
+			return null;
+		}
+
+		return response;
+	}
+
+	/**
+	 * Send a request to Metacat
+	 *
+	 * @param prop the properties to be sent to Metacat
+	 * @return InputStream as returned by Metacat
+	 */
+	public InputStream getMetacatInputStream(Properties prop) {
+		InputStream returnStream = null;
+		// Now contact metacat and send the request
+		try {
+
+			URL url = new URL(metacatURL);
+			HttpMessage msg = new HttpMessage(url);
+			returnStream = msg.sendPostMessage(prop);
+			return returnStream;
+		} catch (Exception e) {
+			e.printStackTrace(System.err);
+
+		}
+		return returnStream;
+
+	}
+
 }
Index: test/edu/ucsb/nceas/metacattest/VersionTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/VersionTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/VersionTest.java	(revision 4080)
@@ -27,9 +27,10 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
-import edu.ucsb.nceas.metacat.Version;
+import edu.ucsb.nceas.metacat.MetaCatVersion;
+import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 import junit.framework.TestCase;
 
@@ -50,7 +51,6 @@
         try {
             File propertyFile = new File("./lib/metacat.properties");
             Options options = Options.initialize(propertyFile);
-            MetaCatUtil util = new MetaCatUtil();
         } catch (FileNotFoundException e) {
             fail(e.getMessage());
         } catch (IOException e) {
@@ -63,8 +63,13 @@
      */
     public void testGetVersion()
     {
-        assertTrue(MetaCatUtil.getOption("version").equals(Version.getVersion()));
-        System.out.println(Version.getVersion());
+    	try {
+            assertTrue(PropertyService.getProperty("application.metacatVersion").equals(MetaCatVersion.getVersionID()));
+            System.out.println(MetaCatVersion.getVersionID());
+    	} catch (PropertyNotFoundException pnfe) {
+    		fail ("Could not get metacat version property; " + pnfe.getMessage());
+    	}
+
     }
 
     /**
@@ -72,9 +77,13 @@
      */
     public void testPrintVersionAsXml()
     {
-        System.out.println(Version.getVersionAsXml());
-        assertTrue(Version.getVersionAsXml().indexOf(
-                MetaCatUtil.getOption("version")) != -1);
+    	try {
+        System.out.println(MetaCatVersion.getVersionAsXml());
+        assertTrue(MetaCatVersion.getVersionAsXml().indexOf(
+                PropertyService.getProperty("application.metacatVersion")) != -1);
+    	} catch (PropertyNotFoundException pnfe) {
+    		fail ("Could not get metacat version property; " + pnfe.getMessage());
+    	}
     }
 
 }
Index: test/edu/ucsb/nceas/metacattest/BuildIndexTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/BuildIndexTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/BuildIndexTest.java	(revision 4080)
@@ -37,7 +37,6 @@
 import java.util.TimeZone;
 
 import edu.ucsb.nceas.metacat.DocumentImpl;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.McdbException;
 import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
 import edu.ucsb.nceas.metacat.client.Metacat;
@@ -45,8 +44,12 @@
 import edu.ucsb.nceas.metacat.client.MetacatException;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.IOUtil;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -56,7 +59,31 @@
  */
 public class BuildIndexTest extends TestCase
 {
-	 /* Initialize Options*/
+    private static String metacatUrl;
+    private static String propertyFileName;
+    private static String username;
+	private static String password;
+	private static String anotheruser;
+	private static String anotherpassword;
+	static {
+		try {
+		    metacatUrl = SystemUtil.getServletURL();
+		    propertyFileName = SystemUtil.getContextDir()
+			+ "/WEB-INF/metacat.properties";
+			username = PropertyService.getProperty("mcuser");
+			password = PropertyService.getProperty("mcpassword");
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+		}
+	}
+
+	private String prefix = "test";
+	private String newdocid = null;
+	private String testfile = "test/eml-sample.xml";
+	private String testdocument = "";
+	private Metacat m;
+    /* Initialize Options */
     static
     {
   	  try
@@ -63,7 +90,7 @@
   	  {
   		  Options.initialize(new File("build/tests/metacat.properties"));
   		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+  		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
   	  }
   	  catch(Exception e)
   	  {
@@ -70,19 +97,6 @@
   		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
   	  }
     }
-    
-    private String metacatUrl = MetaCatUtil.getOption("metacatUrl");;
-    private String propertyFileName = 
-    	MetaCatUtil.getOption("installDir") + "/WEB-INF/metacat.properties";
-    private String username = MetaCatUtil.getOption("mcuser");
-    private String password = MetaCatUtil.getOption("mcpassword");
-    private String prefix = "test";
-    private String newdocid = null;
-    private String testfile = "test/eml-sample.xml";
-    private String testdocument = "";
-    private Metacat m;
-    private MetaCatUtil util;
-   
 
     /**
      * Constructor to build the test
@@ -103,12 +117,13 @@
         try {
             File propertyFile = new File(propertyFileName);
             Options options = Options.initialize(propertyFile);
-            util = new MetaCatUtil();
-            metacatUrl = MetaCatUtil.getOption("junittesturl");
+            metacatUrl = SystemUtil.getServletURL();
         } catch (FileNotFoundException e) {
             fail(e.getMessage());
         } catch (IOException e) {
             fail(e.getMessage());
+        } catch (PropertyNotFoundException pnfe) {
+        	fail (pnfe.getMessage());
         }
 
         try {
Index: test/edu/ucsb/nceas/metacattest/InlineDataAccessTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/InlineDataAccessTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/InlineDataAccessTest.java	(revision 4080)
@@ -33,7 +33,6 @@
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
 import edu.ucsb.nceas.metacat.client.Metacat;
 import edu.ucsb.nceas.metacat.client.MetacatAuthException;
@@ -40,8 +39,10 @@
 import edu.ucsb.nceas.metacat.client.MetacatException;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.IOUtil;
-import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -50,27 +51,27 @@
 /**
  * A JUnit test for testing Access Control for Inline data in Metacat
  */
-public class InlineDataAccessTest extends TestCase {
-	 
-	/* Initialize Options*/
-    static
-    {
-  	  try
-  	  {
-  		  Options.initialize(new File("build/tests/metacat.properties"));
-  		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
-  	  }
-  	  catch(Exception e)
-  	  {
-  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-  	  }
-    }
-    private String metacatUrl = MetaCatUtil.getOption("metacatUrl");;
-    private String username = MetaCatUtil.getOption("mcuser");
-    private String password = MetaCatUtil.getOption("mcpassword");
-    private String anotheruser = MetaCatUtil.getOption("mcanotheruser");
-    private String anotherpassword = MetaCatUtil.getOption("mcanotherpassword");
+public class InlineDataAccessTest
+    extends TestCase {
+
+    private static String metacatUrl;
+    private static String username;
+	private static String password;
+	private static String anotheruser;
+	private static String anotherpassword;
+	static {
+		try {
+		    metacatUrl = SystemUtil.getServletURL();
+			username = PropertyService.getProperty("mcuser");
+			password = PropertyService.getProperty("mcpassword");
+			anotheruser = PropertyService.getProperty("mcanotheruser");
+			anotherpassword = PropertyService.getProperty("mcanotherpassword");
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+		}
+	}
+
     private String prefix = "test";
     private String newdocid = null;
     private String testdocument = "";
Index: test/edu/ucsb/nceas/metacattest/ReplicationServerListTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/ReplicationServerListTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/ReplicationServerListTest.java	(revision 4080)
@@ -27,6 +27,8 @@
 package edu.ucsb.nceas.metacattest;
 
 import edu.ucsb.nceas.metacat.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.Options;
 //import edu.ucsb.nceas.morpho.framework.*;
 import junit.framework.Test;
@@ -46,14 +48,17 @@
  */
 public class ReplicationServerListTest extends TestCase
 {
+    private static String metacatReplicationURL;
 	 /* Initialize Options*/
 	  static
 	  {
 		  try
 		  {
+			 metacatReplicationURL=
+                     PropertyService.getProperty("junitreplicationurl");
 			  Options.initialize(new File("build/tests/metacat.properties"));
 			  MetaCatUtil.pathsForIndexing 
-			         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
+			         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
 		  }
 		  catch(Exception e)
 		  {
@@ -60,8 +65,7 @@
 			  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
 		  }
 	  }
-     private static String metacatReplicationURL=
-                                   MetaCatUtil.getOption("junitreplicationurl");
+
      private ReplicationServerList serverList = null;
      private static final Log log = LogFactory.getLog("edu.ucsb.nceas.metacattest.ReplicationServerListTest");
  
Index: test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java	(revision 4079)
+++ test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java	(revision 4080)
@@ -39,7 +39,6 @@
 import java.util.TimeZone;
 
 import edu.ucsb.nceas.metacat.DocumentImpl;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.client.DocumentNotFoundException;
 import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
 import edu.ucsb.nceas.metacat.client.Metacat;
@@ -47,8 +46,11 @@
 import edu.ucsb.nceas.metacat.client.MetacatException;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.IOUtil;
-import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -61,27 +63,27 @@
  */
 public class MetacatClientTest extends TestCase
 {
-	 /* Initialize Options*/
-    static
-    {
-  	  try
-  	  {
-  		  Options.initialize(new File("build/tests/metacat.properties"));
-  		  MetaCatUtil.pathsForIndexing 
-  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
-  	  }
-  	  catch(Exception e)
-  	  {
-  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
-  	  }
-    }
-    private String metacatUrl = MetaCatUtil.getOption("metacatUrl");
+
     private String wrongMetacatUrl=
-                    "http://somepalce.somewhere.com/some/servlet/metacat";
-    private String username = MetaCatUtil.getOption("mcuser");
-    private String password = MetaCatUtil.getOption("mcpassword");
-    private String anotheruser = MetaCatUtil.getOption("mcanotheruser");
-    private String anotherpassword = MetaCatUtil.getOption("mcanotherpassword");
+    	"http://somepalce.somewhere.com/some/servlet/metacat";
+  
+    private static String metacatUrl;
+    private static String username;
+	private static String password;
+	private static String anotheruser;
+	private static String anotherpassword;
+	static {
+		try {
+		    metacatUrl = SystemUtil.getServletURL();
+			username = PropertyService.getProperty("mcuser");
+			password = PropertyService.getProperty("mcpassword");
+			anotheruser = PropertyService.getProperty("mcanotheruser");
+			anotherpassword = PropertyService.getProperty("mcanotherpassword");
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+		}
+	}
     private String failpass = "uidfnkj43987yfdn";
     private String prefix = "test";
     private String newdocid = null;
Index: lib/spatial/kml.jsp
===================================================================
--- lib/spatial/kml.jsp	(revision 4079)
+++ lib/spatial/kml.jsp	(revision 4080)
@@ -1,7 +1,7 @@
-<%@ page import="edu.ucsb.nceas.metacat.MetaCatUtil" %>
+<%@ page import="edu.ucsb.nceas.metacat.util.SystemUtil" %>
 <%
 
-String url = MetaCatUtil.getOption("baseUrl");
+String url = SystemUtil.getContextURL();
 String layerName = "metacat:data_points";
 
 String redirectURL = url + "/wms?service=WMS&request=GetMap&format=application/vnd.google-earth.kml+XML&width=1024&height=1024&srs=EPSG:4326&layers=" + layerName + "&styles=&bbox=-180,-90,180,90";
Index: lib/metacat.properties.metadata.xml
===================================================================
--- lib/metacat.properties.metadata.xml	(nonexistent)
+++ lib/metacat.properties.metadata.xml	(revision 4080)
@@ -0,0 +1,220 @@
+<?xml version="1.0"?>
+
+<metadataConfig>
+	<group>
+		<index>1</index>
+		<name>Database</name>
+		<description>Database Configuration Values.</description>
+	</group>
+	<group>
+		<index>2</index>
+		<name>Server Configuration</name>
+		<description>Server Configuration Values.</description>
+	</group>
+	<group>
+		<index>3</index>
+		<name>Application Configuration</name>
+		<description>Application Configuration Values.</description>
+	</group>
+
+	<config>
+		<key>database.user</key>
+		<label>Database Username</label>
+		<group>1</group>
+		<index>1</index>
+		<description>
+			Name of database user to own all tables.
+		</description>
+	</config>
+
+	<config>
+		<key>database.password</key>
+		<label>Database Password</label>
+		<group>1</group>
+		<fieldType>password</fieldType>
+		<index>2</index>
+		<description>Password for database user.</description>
+	</config>
+
+	<config>
+		<key>database.type</key>
+		<label>Database Type</label>
+		<group>1</group>
+		<fieldType>select</fieldType>
+		<option>
+			<name>PostgreSQL</name>
+		</option>
+		<option>
+			<name>Oracle</name>
+		</option>
+		<option>
+			<name>SQL Server</name>
+		</option>
+		<index>3</index>
+		<description>What kind of database is running.</description>
+	</config>
+
+	<config>
+		<key>database.driver</key>
+		<label>Database Driver</label>
+		<group>1</group>
+		<fieldType>select</fieldType>
+		<option>
+			<name>org.postgresql.Driver</name>
+		</option>
+		<option>
+			<name>oracle.jdbc.driver.OracleDriver</name>
+		</option>
+		<option>
+			<name>com.microsoft.jdbc.sqlserver.SQLServerDriver</name>
+		</option>
+		<index>4</index>
+		<description>
+			Which driver is required. This should conform to your
+			database type.
+		</description>
+	</config>
+
+	<config>
+		<key>database.adapter</key>
+		<label>Database Adapter</label>
+		<group>1</group>
+		<fieldType>select</fieldType>
+		<option>
+			<name>edu.ucsb.nceas.dbadapter.PostgresqlAdapter</name>
+		</option>
+		<option>
+			<name>edu.ucsb.nceas.dbadapter.OracleAdapter</name>
+		</option>
+		<option>
+			<name>edu.ucsb.nceas.dbadapter.SqlserverAdapter</name>
+		</option>
+		<index>5</index>
+		<description>
+			Which adapter is required. This should conform to your
+			database type.
+		</description>
+	</config>
+
+	<config>
+		<key>database.connectionURI</key>
+		<label>JDBC Connection String</label>
+		<group>1</group>
+		<index>6</index>
+		<description>Database connection string.</description>
+	</config>
+
+	<config>
+		<key>server.name</key>
+		<label>Server Name</label>
+		<group>2</group>
+		<index>1</index>
+		<description>
+			Name of the server where Metacat will be available.
+		</description>
+	</config>
+
+	<config>
+		<key>server.httpPort</key>
+		<label>HTTP Port</label>
+		<group>2</group>
+		<index>2</index>
+		<description>
+			Non secure port where Metacat will be available.
+		</description>
+	</config>
+
+	<config>
+		<key>server.httpSSLPort</key>
+		<label>HTTP SSL Port</label>
+		<group>2</group>
+		<index>3</index>
+		<description>
+			Secure port where Metacat will be available.
+		</description>
+	</config>
+
+	<config>
+		<key>application.tomcatDir</key>
+		<label>Tomcat Location</label>
+		<group>3</group>
+		<index>1</index>
+		<description>
+			The directory where Tomcat is deployed.
+		</description>
+	</config>
+
+	<config>
+		<key>application.context</key>
+		<label>Metacat Context</label>
+		<group>3</group>
+		<index>2</index>
+		<description>
+			Name of the context under which Metacat will run. This is
+			the directory in which the Metacat war file is deployed.
+		</description>
+	</config>
+
+	<config>
+		<key>application.default-style</key>
+		<label>Application Style</label>
+		<group>3</group>
+		<index>3</index>
+		<description>
+			Custom display style for Metacat. Use default if there is no
+			custom style.
+		</description>
+	</config>
+
+	<config>
+		<key>application.knbSiteURL</key>
+		<label>KNB Site URL</label>
+		<group>3</group>
+		<index>4</index>
+		<description>
+			Location of KNB website. Usually left as
+			http://knb.ecoinformatics.org
+		</description>
+	</config>
+
+	<config>
+		<key>application.datafilepath</key>
+		<label>Data File Path</label>
+		<group>3</group>
+		<index>5</index>
+		<description>
+			Where to store data. This should be some location outside
+			the knb install direcories.
+		</description>
+	</config>
+
+	<config>
+		<key>application.inlinedatafilepath</key>
+		<label>Inline Data File Path</label>
+		<group>3</group>
+		<index>6</index>
+		<description>
+			Where to store inline data. This should be some location
+			outside the knb install direcories.
+		</description>
+	</config>
+
+	<!--  
+		<config>
+		<key>application.cgiDir</key>
+		<label>Relative CGI Directory</label>
+		<group>Application Configuration</group>
+		<index>7</index>
+		<description>Relative path to the CGI bin directory.  For instance /cgi-bin.</description>
+		</config>
+		
+		<config>
+		<key>application.eml-version</key>
+		<label>EML Version</label>
+		<group>Application Configuration</group>
+		<index>8</index>
+		<description>Which version of EML is in use.</description>
+		</config>
+	-->
+
+</metadataConfig>
\ No newline at end of file

Property changes on: lib/metacat.properties.metadata.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/admin.css
===================================================================
--- lib/admin/admin.css	(nonexistent)
+++ lib/admin/admin.css	(revision 4080)
@@ -0,0 +1,230 @@
+ /*
+  *   '$RCSfile$'
+  *     Purpose: Default style sheet for KNB project web pages 
+  *              Using this stylesheet rather than placing styles directly in 
+  *              the KNB web documents allows us to globally change the 
+  *              formatting styles of the entire site in one easy place.
+  *   Copyright: 2008 Regents of the University of California and the
+  *               National Center for Ecological Analysis and Synthesis
+  *     Authors: Michael Daigle
+  *
+  *    '$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
+  */
+body {
+	font-family: Arial, sans-serif;
+	font-size: 11pt;
+	margin-left: 30px;
+	margin-right: 30px;
+	width: 700px;
+}
+
+h2 {
+	margin-top: 30px;
+	margin-bottom: 10px;
+}
+
+h3 {
+	margin-top: 8px;
+	margin-bottom: 8px;
+}
+
+input {
+	padding-left: 4px;
+	width: 400px;
+}
+
+input[type="submit"] {
+	width: 100px;
+	margin-right: 5px;
+	margin-top: 20px;
+}
+
+input[type="radio"] {
+	margin-bottom: 4px;
+}
+
+label {
+	font-size: 12pt;
+}
+
+table {
+	margin-left: auto;
+	margin-right: auto;
+}
+
+.config-section {
+	display: table;
+	width: 100%
+}
+
+.config-section-hiding {
+	display: none;
+	width: 100%
+}
+
+.config-checkbox {
+	width: 25px;
+	vertical-align: middle;
+}
+
+.config-checkbox-label {
+	text-align: left;
+	vertical-align: middle;
+	width: 600px;
+}
+
+.config-property-label {
+	text-align: right;
+	vertical-align: middle;
+	width: 200px;
+	padding-right: 8px;
+}
+
+.config-property-input {
+	text-align: left;
+	vertical-align: middle;
+	width: 400px;
+}
+
+.config-question-mark {
+	text-align: left;
+	vertical-align: middle;
+}
+
+.section {
+	font-size: 16pt;
+	font-weight: bold;
+	border-bottom: solid #dddddd 1px;
+}
+
+.login-input {
+	width: 150px;
+}
+
+br {
+	clear: left;
+}
+
+br.ldap-header {
+	margin-bottom: 80px;
+}
+
+br.main-header {
+	margin-bottom: 70px;
+}
+
+br.skins-header {
+	margin-bottom: 50px;
+}
+
+.button {
+	width: 100px;
+	margin-right: 5px;
+	margin-top: 20px;
+}
+
+.left-button {
+	width: 100px;
+	margin-left: 275px;
+	margin-right: 5px;
+	margin-top: 20px;
+}
+
+.warning {
+	color: red;
+}
+
+.heading-comment {
+	margin-bottom: 0px;
+}
+
+.small-message {
+	margin-top: 10px;
+	font-size: 11px;
+}
+
+.message-text {
+	font-size: 9pt;
+	font-weight: bold;
+	color: blue;
+	margin-bottom: 5px;
+}
+
+.success-text {
+	font-size: 9pt;
+	font-weight: bold;
+	color: green;
+		margin-bottom: 5px;
+}
+
+.error-text {
+	font-size: 9pt;
+	color: red;
+	margin-bottom: 5px;
+}
+
+.error-header {
+	font-size: 9pt;
+	font-weight: bold;
+	color: red;
+}
+
+.formfield-error-text {
+	font-size: 9pt;
+	color: red;
+	margin-bottom: 5px;
+}
+
+.formfield-error-header {
+	font-size: 9pt;
+	font-weight: bold;
+	color: red;
+}
+
+.configured-tag {
+	color: green;
+	width: 115px;
+	height: 30px;
+}
+
+.unconfigured-tag {
+	color: red;
+	width: 125px;
+	height: 30px;
+}
+
+.property-title {
+	font-weight: bolder;
+	font-size: 12pt;
+	width: 300px;
+}
+
+.skin-name {
+        font-size: 14pt;
+        width: 300px;
+}
+
+.smaller-text {
+        font-size: smaller;
+        display: inline;
+}
+
+.configure-link {
+	font-size: 11pt;
+}
\ No newline at end of file

Property changes on: lib/admin/admin.css
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/login-footer-section.jsp
===================================================================
--- lib/admin/login-footer-section.jsp	(nonexistent)
+++ lib/admin/login-footer-section.jsp	(revision 4080)
@@ -0,0 +1,45 @@
+<%@ page    language="java" import="java.util.Vector" %>
+<% 
+/**
+ *  '$RCSfile$'
+ *    Copyright: 2008 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+
+<%
+if( request.getSession().getAttribute("userId") != null) {  
+%>
+  <div class=small-message>
+    You are logged in as: <%= request.getSession().getAttribute("userId") %><br>
+    <a href="<%= request.getContextPath() %>/admin?configureType=login">log in as different user</a>
+  </div>
+<% 
+} else {
+%>
+  <div class=small-message>
+    You are not logged in. %><br>
+    <a href="<%= request.getContextPath() %>/admin?configureType=login">log in as different user</a>
+  </div>
+<%
+}
+%>
\ No newline at end of file

Property changes on: lib/admin/login-footer-section.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/database-configuration.jsp
===================================================================
--- lib/admin/database-configuration.jsp	(nonexistent)
+++ lib/admin/database-configuration.jsp	(revision 4080)
@@ -0,0 +1,106 @@
+<%@ page    language="java" import="java.util.Vector,edu.ucsb.nceas.metacat.admin.DBAdmin,edu.ucsb.nceas.metacat.service.PropertyService" %>
+<%@ page    language="java" import="edu.ucsb.nceas.metacat.DBVersion,edu.ucsb.nceas.metacat.MetaCatVersion" %>
+
+<% 
+/**
+ *  '$RCSfile$'
+ *    Copyright: 2008 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+
+<% 
+	MetaCatVersion metacatVersion = (MetaCatVersion)request.getAttribute("metaCatVersion"); 	
+	DBVersion databaseVersion = (DBVersion)request.getAttribute("databaseVersion");
+	Vector<String> updateScriptList = (Vector<String> )request.getAttribute("updateScriptList");
+%>
+
+<html>
+<head>
+
+<title>Database Install/Upgrade Utility</title>
+<link rel="stylesheet" type="text/css" 
+        href="<%= request.getContextPath() %>/admin/admin.css"></link>
+<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
+<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/help/help.js"></script>
+
+</head>
+<body>
+<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
+<h2>Database Install/Upgrade Utility</h2>
+
+<%@ include file="page-message-section.jsp"%>
+
+<%
+if (databaseVersion != null && databaseVersion.getVersionString().equals("0.0.0")) {
+%>
+    <p>The system has detected that this is a new database. <br><br>
+     Please hit the Continue button to upgrade your database to version: <%= metacatVersion %>. <br><br>
+     <div class=warning>Warning: this will reinitialize your database.  If this is not a new database, hit the Cancel button and contact support at blah@blah.com </div><br><br>
+     The following scripts will be run: </p>
+
+        <ul>
+<%
+        for (int i = 0; i < updateScriptList.size(); i++) {
+%>
+                <li>
+                	<%= updateScriptList.elementAt(i) %>
+                </li>
+<%
+        }
+%>
+        </ul>
+        <input class=button type="button" value="Continue" onClick="forward('./admin?configureType=database&processForm=true')">
+		<input class=button type="button" value="Cancel" onClick="forward('./admin?configureType=configure&processForm=false')"> 
+<%
+} else if (databaseVersion != null) {
+%>
+    <p>The system has detected the following database version: <%= databaseVersion.getVersionString() %> <br><br>
+     Please hit the Continue button to upgrade your database to version: <%= metacatVersion.getVersionString() %> <br>
+    <div class=warning>Warning: this will update your database.  If the detected versions do not seem correct, hit the Cancel button and contact support at blah@blah.com </div><br><br> 
+     The following scripts will be run: </p> <br>
+        <ul>
+<%
+        for (int i = 0; i < updateScriptList.size(); i++) {
+%>
+                <li>
+                	<%= updateScriptList.elementAt(i) %>
+                </li>
+<%
+        }
+%>
+        </ul>
+		<input class=button type="button" value="Continue" onClick="forward('./admin?configureType=database&processForm=true')">
+		<input class=button type="button" value="Cancel" onClick="forward('./admin?configureType=configure&processForm=false')"> 
+<%
+} else {
+%>
+	<input class=button disabled type="button" value="Continue" onClick="forward('./admin?configureType=database&processForm=true')">
+	<input class=button type="button" value="Cancel" onClick="forward('./admin?configureType=configure&processForm=false')"> 
+<%
+} 
+%>
+
+<br clear="right"/>
+
+</body>
+</html>

Property changes on: lib/admin/database-configuration.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/page-message-section.jsp
===================================================================
--- lib/admin/page-message-section.jsp	(nonexistent)
+++ lib/admin/page-message-section.jsp	(revision 4080)
@@ -0,0 +1,93 @@
+<%@ page    language="java" import="java.util.Vector" %>
+<% 
+/**
+ *  '$RCSfile$'
+ *    Copyright: 2008 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+
+<%  
+   if (request.getAttribute("processingSuccess") != null && ((Vector<String>)request.getAttribute("processingSuccess")).size() > 0) { 
+%> 
+   <div class=success-text>
+<%     
+      Vector<String> processingSuccesses = (Vector<String>)request.getAttribute("processingSuccess");
+      for (String processingSuccess : processingSuccesses) { 
+%>
+    	  -- &nbsp;<%= processingSuccess %> <br> 
+<%     
+       }   
+   }
+%>      
+   </div>
+
+<% 
+   if (request.getAttribute("processingMessage") != null && ((Vector<String>)request.getAttribute("processingMessage")).size() > 0) { 
+%> 
+   <div class=message-text>
+<%     
+      Vector<String> processingMessages = (Vector<String>)request.getAttribute("processingMessage");
+      for (String processingMessage : processingMessages) { 
+%>
+    	   -- &nbsp;<%= processingMessage %> <br> 
+<%     
+       }  
+   }
+%>      
+   </div>
+<% 
+   if (request.getAttribute("formFieldErrors") != null && ((Vector<String>)request.getAttribute("formFieldErrors")).size() > 0) { 
+%>
+   <div class=formfield-error-header>
+      Please correct the following form errors and resubmit: <br><br>
+   </div>  
+   <div class=formfield-error-text>
+<%     
+      Vector<String> formErrors = (Vector<String>)request.getAttribute("formFieldErrors");
+      for (String formError : formErrors) { 
+%>
+    	  -- &nbsp;<%= formError %> <br> 
+<%     
+       }     
+%>      
+   </div>
+<% 
+   } else if (request.getAttribute("processingErrors") != null && ((Vector<String>)request.getAttribute("processingErrors")).size() > 0) { 
+%>
+   <div class=error-header>
+      The following errors occurred.  Please correct errors if possible or contact your system adminstrator or contact support at blah@blah.com <br><br>
+   </div>  
+   <div class=error-text>
+<%     
+      Vector<String> processingErrors = (Vector<String>)request.getAttribute("processingErrors");
+      for (String processingError : processingErrors) { 
+%>
+    	  -- &nbsp;<%= processingError %> <br> 
+<%     
+       }     
+%>      
+   </div>
+
+<%
+   }
+%>
\ No newline at end of file

Property changes on: lib/admin/page-message-section.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/admin/metacat-configuration.jsp
===================================================================
--- lib/admin/metacat-configuration.jsp	(nonexistent)
+++ lib/admin/metacat-configuration.jsp	(revision 4080)
@@ -0,0 +1,201 @@
+<%@ page language="java" import="edu.ucsb.nceas.metacat.DBVersion,edu.ucsb.nceas.metacat.MetaCatVersion" %>
+
+<%
+	/**
+ *  '$RCSfile$'
+ *    Copyright: 2008 Regents of the University of California and the
+ *               National Center for Ecological Analysis and Synthesis
+ *  For Details: http://www.nceas.ucsb.edu/
+ *
+ *   '$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
+ */
+%>
+
+<%
+	MetaCatVersion metacatVersion = (MetaCatVersion)request.getAttribute("metaCatVersion"); 	
+	DBVersion databaseVersion = (DBVersion)request.getAttribute("databaseVersion");		
+    Boolean propsConfigured = (Boolean)request.getAttribute("propsConfigured");	
+    Boolean ldapConfigured = (Boolean)request.getAttribute("ldapConfigured");	
+    Boolean skinsConfigured = (Boolean)request.getAttribute("skinsConfigured");	
+    Boolean dbConfigured = (Boolean)request.getAttribute("dbConfigured");
+    Boolean metacatConfigured = (Boolean)request.getAttribute("metacatConfigured");
+%>
+
+<html>
+<head>
+<title>Metacat Configuration</title>
+<link rel="stylesheet" type="text/css" 
+        href="<%= request.getContextPath() %>/admin/admin.css"></link>
+</head>
+
+<body>
+<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
+<h2>MetaCat Configuration</h2>
+
+All of the following sections must be in a configured state for Metacat to run properly:
+<br class="main-header">
+
+<%@ include file="page-message-section.jsp"%>
+<hr class=config>
+
+<table class=configuration-table>
+<%
+	if (ldapConfigured != null && ldapConfigured) {
+%>
+        <tr>
+        <td class=configured-tag>[configured] </td>
+		<td class=property-title> LDAP Configuration </td> 
+		<td class=configure-link> <a href="<%= request.getContextPath() %>/admin?configureType=ldap">Reconfigure Now</a> </td>
+        </tr>
+<%
+	} else {
+%>    		
+        <tr>
+ 		<td class=unconfigured-tag>[unconfigured] </td>  
+ 		<td class=property-title> LDAP Configuration </td>
+		<td class=configure-link> <a href="<%= request.getContextPath() %>/admin?configureType=ldap">Configure Now</a> </td>			
+    	</tr>
+<%
+	}
+%>
+
+<%
+	if (propsConfigured != null && propsConfigured) {
+%>
+        <tr>
+        <td class=configured-tag>[configured] </td>
+		<td class=property-title> Metacat System Properties </td> 
+		<td class=configure-link> <a href="<%= request.getContextPath() %>/admin?configureType=properties">Reconfigure Now</a> </td>
+        </tr>
+<%
+	} else {
+%>    		
+        <tr>
+ 		<td class=unconfigured-tag>[unconfigured] </td>  
+ 		<td class=property-title> Metacat System Properties </td>
+		<td class=configure-link> <a href="<%= request.getContextPath() %>/admin?configureType=properties">Configure Now</a> </td>			
+    	</tr>
+<%
+	}
+
+    if (skinsConfigured != null && skinsConfigured) {
+%>
+        <tr>
+        <td class=configured-tag>[configured] </td>
+		<td class=property-title> Skins Specific Properties </td> 
+		<td class=configure-link> <a href="<%= request.getContextPath() %>/admin?configureType=skins">Reconfigure Now</a> </td>
+        </tr>
+<%
+	} else {
+%>    		
+        <tr>
+ 		<td class=unconfigured-tag>[unconfigured] </td>  
+ 		<td class=property-title> Skins Specific Properties </td>
+		<td class=configure-link> <a href="<%= request.getContextPath() %>/admin?configureType=skins">Configure Now</a> </td>			
+    	</tr>
+<%
+	}
+    
+    if ((dbConfigured != null && dbConfigured) ||
+    		(metacatVersion != null && databaseVersion != null && 
+    				metacatVersion.compareTo(databaseVersion) == 0)) {
+%>
+    	<tr>
+    	<td class=configured-tag>[configured] </td>
+    	<td class=property-title> Database Installation/Upgrade </td> 
+		<td class=configure-link> Version: <%= databaseVersion.getVersionString() %> </td>    		
+    	</tr>
+<%
+	} else {
+%>    		
+    	<tr>
+    	<td class=unconfigured-tag>[unconfigured] </td>  
+    	<td class=property-title> Database Installation/Upgrade </td>
+<%
+	if (propsConfigured != null && propsConfigured) {
+%>
+        	
+		<td class=configure-link> <a href="<%= request.getContextPath() %>/admin?configureType=database">Configure Now</a> </td>			
+        	
+<%
+	} else {
+%> 
+		<td class=configure-link> Configure System Properties First </td>
+<%
+				}
+			%>     	
+    	</tr>
+<%
+	}
+%>
+</table>
+<hr class=config>
+
+<%
+	if (metacatConfigured != null && metacatConfigured) {
+%>
+	<br>
+	<h3>Configuring Geoserver</h3>
+	<p>Metacat ships with <a href="http://docs.codehaus.org/display/GEOS/Home">Geoserver</a> to handle the spatial functionality.
+	   Regardless of whether you plan on using the spatial functionality you should,
+	   for security purposes, configure geoserver initially so that it doesn't use
+	   the default password.
+	   To configure geoserver with a new admin password:
+	   <ol>
+	    <li> Point your browser to 
+	     <a href="<%= request.getScheme() + "://" +
+	       request.getServerName() + ":" + request.getServerPort() +
+              request.getContextPath() %>/geoserver.jsp"><%= request.getScheme() + "://" +
+	                      request.getServerName() + ":" + request.getServerPort() +
+			                      request.getContextPath() %>/geoserver.jsp</a>. </li>
+	     <li> Login using the default username and password ( <em>admin</em> / <em>geoserver</em> ) </li>
+	    <li> Point your browser to 
+	     <a href="<%= request.getScheme() + "://" +
+	       request.getServerName() + ":" + request.getServerPort() +
+              request.getContextPath() %>/config/loginEdit.do"><%= request.getScheme() + "://" +
+	                      request.getServerName() + ":" + request.getServerPort() +
+			                      request.getContextPath() %>/config/loginEdit.do</a>, enter a new user and password then submit. </li>
+	     <li> In the upper-left, click <em>Apply</em> then <em>Save</em> to save your new password.
+
+
+	    </ol>
+	</p>
+	
+	<hr class=config>
+	<br clear="right"/>
+	<h3>Restarting Metacat</h3>
+	<p>The simplest way to restart metacat is to restart the entire servlet engine.
+	   For Tomcat, this would mean calling "$TOMCAT_HOME/bin/tomcat.sh restart" or
+	   an equivalent command appropriate to your operating system. After restarting,
+	   you can access your new Metacat server at the URL:
+ 	  <a href="<%= request.getScheme() + "://" + 
+	       request.getServerName() + ":" + request.getServerPort() +
+	       request.getContextPath() %>"><%= request.getScheme() + "://" + 
+                request.getServerName() + ":" + request.getServerPort() +
+                request.getContextPath() %></a>
+	</p>
+
+	<hr class=config>
+	<%@ include file="./login-footer-section.jsp"%>
+
+	</body>
+	</html>
+<%  	
+    }
+%>

Property changes on: lib/admin/metacat-configuration.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/sanparks/upload.jsp
===================================================================
--- lib/style/skins/sanparks/upload.jsp	(revision 4079)
+++ lib/style/skins/sanparks/upload.jsp	(revision 4080)
@@ -39,7 +39,7 @@
             function getMapFrame() {
                 return document.getElementById('mapFrame');
             }
-            insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateOpening("<%=CONTEXT_URL%>");
         </script>
         
         <jsp:include page="SaeonUpload.jspx" />
@@ -47,7 +47,7 @@
         <script language="JavaScript">
             //insertLoginBox();
             //insertSearchBox();
-            insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateClosing("<%=CONTEXT_URL%>");
         </script>
     </body>
 </html>
Index: lib/style/skins/sanparks/confirm.jsp
===================================================================
--- lib/style/skins/sanparks/confirm.jsp	(revision 4079)
+++ lib/style/skins/sanparks/confirm.jsp	(revision 4080)
@@ -36,7 +36,7 @@
     </head>
     <body>
         <script language="JavaScript">
-            insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateOpening("<%=CONTEXT_URL%>");
         </script>
         
         <!-- Main content -->
@@ -44,7 +44,7 @@
         
         <!-- wrap it up with the closing -->
         <script language="JavaScript">
-            insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateClosing("<%=CONTEXT_URL%>");
         </script>
     </body>
 </html>
Index: lib/style/skins/sanparks/index.jsp
===================================================================
--- lib/style/skins/sanparks/index.jsp	(revision 4079)
+++ lib/style/skins/sanparks/index.jsp	(revision 4080)
@@ -36,7 +36,7 @@
     </head>
     <body>
         <script language="JavaScript">
-            insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateOpening("<%=CONTEXT_URL%>");
         </script>
         
         <!-- Main content -->
@@ -44,7 +44,7 @@
         
         <!-- wrap it up with the closing -->
         <script language="JavaScript">
-            insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateClosing("<%=CONTEXT_URL%>");
         </script>
     </body>
 </html>
Index: lib/style/skins/kepler/index.jsp
===================================================================
--- lib/style/skins/kepler/index.jsp	(revision 4079)
+++ lib/style/skins/kepler/index.jsp	(revision 4080)
@@ -30,6 +30,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
   
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -44,8 +45,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 <table width="760" border="0" cellspacing="0" cellpadding="0">
   <tr><td colspan="5">
@@ -158,7 +159,7 @@
 </table>
 <p>&nbsp;</p>
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/default/include_login.jsp
===================================================================
--- lib/style/skins/default/include_login.jsp	(revision 4079)
+++ lib/style/skins/default/include_login.jsp	(revision 4080)
@@ -1,4 +1,4 @@
-<%@ page     language="java" %>
+<%@ page     language="java"  import="java.util.Vector,edu.ucsb.nceas.metacat.util.LDAPUtil"%>
 <!--
 /**
   *  '$RCSfile$'
@@ -30,6 +30,11 @@
 
 <%@ include file="settings.jsp"%>
 <%@ include file="session_vars.jsp"%>
+
+<% 
+	Vector<String> organizationList = LDAPUtil.getOrganizations();
+%>
+
 <!-- *********************** START LOGIN TABLE ************************* -->
 <html>
 <head>
@@ -97,7 +102,7 @@
                 <p>
                   Logging into your account enables you to search any 
                   additional, non-public data for which you may have access 
-                  priviliges:
+                  privileges:
                 </p>
                 <%= loginStatus %>
             </td>
@@ -142,13 +147,14 @@
                     style="padding-top: 2px; padding-bottom: 2px;">
                     <select name="organization" style="width:140px;" 
                       <%=loginEnabledDisabled%> >
-                      <option value="" <%=((posted_organization.length()<1)?                 "selected":"")%>>&#8212; choose one &#8212;</option>
-                      <option value="NCEAS" <%=((posted_organization.equalsIgnoreCase("NCEAS"))?        "selected":"")%>>NCEAS</option>
-                      <option value="LTER"         <%=((posted_organization.equalsIgnoreCase("LTER"))?         "selected":"")%>>LTER</option>
-                      <option value="NRS"          <%=((posted_organization.equalsIgnoreCase("NRS"))?          "selected":"")%>>NRS</option>
-                      <option value="PISCO"        <%=((posted_organization.equalsIgnoreCase("PISCO"))?        "selected":"")%>>PISCO</option>
-                      <option value="OBFS"         <%=((posted_organization.equalsIgnoreCase("OBFS"))?         "selected":"")%>>OBFS</option>
-                      <option value="unaffiliated" <%=((posted_organization.equalsIgnoreCase("unaffiliated"))? "selected":"")%>>unaffiliated</option>
+                      <option value="" <%=((posted_organization.length()<1)?     "selected":"")%>>&#8212; choose one &#8212;</option>
+<%
+			for (String orgName : organizationList) {
+%>         
+                      <option value="<%= orgName %>"   <%=((posted_organization.equalsIgnoreCase(orgName))?     "selected":"")%>><%= orgName %></option>
+<%
+			}
+%>                      
                     </select>
                   </td>
                   <td width="10px">
Index: lib/style/skins/ltss/header.jsp
===================================================================
--- lib/style/skins/ltss/header.jsp	(revision 4079)
+++ lib/style/skins/ltss/header.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
  
 <!--____________________________max_width____________________________________-->
Index: lib/style/skins/knp/searchform.jsp
===================================================================
--- lib/style/skins/knp/searchform.jsp	(revision 4079)
+++ lib/style/skins/knp/searchform.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <form method="POST" action="<%=SERVLET_URL%>" target="_top">
 Search for: 
Index: lib/style/skins/obfs/header.jsp
===================================================================
--- lib/style/skins/obfs/header.jsp	(revision 4079)
+++ lib/style/skins/obfs/header.jsp	(revision 4080)
@@ -26,6 +26,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <!--____________________________max_width____________________________________-->
 
Index: lib/style/skins/nceas/settings.jsp
===================================================================
--- lib/style/skins/nceas/settings.jsp	(revision 4079)
+++ lib/style/skins/nceas/settings.jsp	(revision 4080)
@@ -30,6 +30,7 @@
  %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <% 
 
Index: lib/style/skins/nceas/nceas.properties
===================================================================
--- lib/style/skins/nceas/nceas.properties	(nonexistent)
+++ lib/style/skins/nceas/nceas.properties	(revision 4080)
@@ -0,0 +1,48 @@
+#
+# General configuration parameters
+#
+registry.config.username=uid=nceasadmin,o=NCEAS,dc=ecoinformatics,dc=org
+registry.config.password=your-pw-goes-here
+registry.config.scope=nceas
+registry.config.organization=National Center for Ecological Analysis and Synthesis
+registry.config.abbrev=NCEAS
+#registry.config.url=http://www.nceas.ucsb.edu/
+registry.config.site=project
+registry.config.type=Repository
+registry.config.debug=1
+
+# NCEAS custom theme sans-iframe
+registry.templates.header=nceasHeader.tmpl
+registry.templates.footer=nceasFooter.tmpl
+
+# email settings
+email.sender=NCEAS Data Repository <help@nceas.ucsb.edu>
+email.recipient=help@nceas.ucsb.edu
+email.admin=the repository administrator
+
+# registry display settings
+registry.show.siteList=false
+registry.show.wgList=true
+registry.show.organization=false
+# registry module display
+registry.modules.taxonomic=true
+registry.modules.method=true
+registry.modules.spatial=true
+registry.modules.keyword=true
+registry.modules.temporal=true
+registry.modules.upload=true
+
+registry.required.temporal=
+registry.required.spatial=
+registry.required.contactEmailAddress=
+
+# NCEAS specific
+registry.db.connection=//hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu
+registry.db.user= admowner
+registry.db.password= your-pw-goes-here
+
+# imported properties from lib/skin.configs/nceas/nceas.properties
+# java code usage
+lsidauthority=knb.ecoinformatics.org
+registryurl=http://knb.ecoinformatics.org
+registryname=KNB Data Registry

Property changes on: lib/style/skins/nceas/nceas.properties
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/obfs/spatial/map.jsp
===================================================================
--- lib/style/skins/obfs/spatial/map.jsp	(revision 4079)
+++ lib/style/skins/obfs/spatial/map.jsp	(revision 4080)
@@ -29,6 +29,7 @@
 %>
 
 <%@ include file="../../../common/common-settings.jsp"%>
+<%@ include file="../../../common/configure-check.jsp"%>
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
Index: lib/style/skins/nceas/index.jsp
===================================================================
--- lib/style/skins/nceas/index.jsp	(revision 4079)
+++ lib/style/skins/nceas/index.jsp	(revision 4080)
@@ -138,7 +138,7 @@
       <p align="center"></p>
       <table width="100%"  border="0" align="center" >
         <tr>
-          <td width="110" class="templatecontentareaclass"><a href="http://knb.ecoinformatics.org/morphoportal.jsp"><img src="<%=SERVER_URL_WITH_CONTEXT%>/style/images/MorphoButterfly.jpg" alt="Morpho Software Butterfly" width="100" height="100" border="0" ></a></td>
+          <td width="110" class="templatecontentareaclass"><a href="http://knb.ecoinformatics.org/morphoportal.jsp"><img src="<%=CONTEXT_URL%>/style/images/MorphoButterfly.jpg" alt="Morpho Software Butterfly" width="100" height="100" border="0" ></a></td>
           <td width="550" valign="top" class="templateleftcolclass"><p >Use <a href="http://knb.ecoinformatics.org/morphoportal.jsp"><span class="style2">Morpho</span></a> software to register, document and upload data sets. </p>
               <p>Morpho is a data management tool for ecologists. It was created to provide an easy-to-use, cross-platform application for accessing and manipulating metadata (e.g. documentation) and data (both locally and on the network). Morpho allows ecologists to create metadata, (i.e. describe their data in a standardized format), and create a catalog of data and metadata upon which to query, edit and view data collections. In addition, Morpho provides the means to access network servers, in order to query, view and retrieve relevant, public ecological data!</p></td>
         </tr>
Index: lib/style/skins/knb2/harvesterRegistrationLogin.jsp
===================================================================
--- lib/style/skins/knb2/harvesterRegistrationLogin.jsp	(revision 4079)
+++ lib/style/skins/knb2/harvesterRegistrationLogin.jsp	(revision 4080)
@@ -1,4 +1,4 @@
-<%@ page    language="java" %>
+<%@ page    language="java" import="java.util.Vector,edu.ucsb.nceas.metacat.util.LDAPUtil"%>
 <%
 /**
  * '$RCSfile$'
@@ -24,7 +24,11 @@
  */
  %>
 
- <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/common-settings.jsp"%>
+ 
+<% 
+	Vector<String> organizationList = LDAPUtil.getOrganizations();
+%> 
 
 <html> 
 <head>
@@ -41,7 +45,7 @@
 
 <form name="myform" 
       method="POST" 
-      action="<%=SERVER_URL_WITH_CONTEXT%>/harvesterRegistrationLogin">
+      action="<%=CONTEXT_URL%>/harvesterRegistrationLogin">
 
 <table width=400 align=center cellspacing=1 cellpadding=1 
        border=0 bgcolor="#333366">
@@ -75,13 +79,13 @@
             </font>
           </td>
           <td>
-            <input type="radio" name="o" value="NCEAS">NCEAS
-            <input type="radio" name="o" value="LTER">LTER
-            <input type="radio" name="o" value="NRS">NRS
-            <br>
-            <input type="radio" name="o" value="PISCO">PISCO
-            <input type="radio" name="o" value="OBFS">OBFS
-            <input type="radio" name="o" value="Unaffiliated">Unaffiliated
+<%
+		for (String orgName : organizationList) {
+%>  
+            <input type="radio" name="o" value="<%= orgName %>"><%= orgName %>
+<%
+			}
+%> 
         </tr>
         <tr>
           <td width='10%'> &nbsp;</td>
Index: lib/style/skins/specnet/index.jsp
===================================================================
--- lib/style/skins/specnet/index.jsp	(revision 4079)
+++ lib/style/skins/specnet/index.jsp	(revision 4080)
@@ -30,6 +30,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
  
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -44,8 +45,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 <table width="760" border="0" cellspacing="0" cellpadding="0">
   <tr><td colspan="5">
@@ -101,7 +102,7 @@
 </table>
 <p>&nbsp;</p>
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/nrs/header.jsp
===================================================================
--- lib/style/skins/nrs/header.jsp	(revision 4079)
+++ lib/style/skins/nrs/header.jsp	(revision 4080)
@@ -25,6 +25,7 @@
  %>
 
  <%@ include file="../../common/common-settings.jsp"%>
+ <%@ include file="../../common/configure-check.jsp"%>
 
 <!--____________________________max_width____________________________________-->
 
Index: lib/style/skins/nrs/spatial/map.jsp
===================================================================
--- lib/style/skins/nrs/spatial/map.jsp	(revision 4079)
+++ lib/style/skins/nrs/spatial/map.jsp	(revision 4080)
@@ -29,6 +29,7 @@
 %>
 
 <%@ include file="../../../common/common-settings.jsp"%>
+<%@ include file="../../../common/configure-check.jsp"%>
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
Index: lib/style/skins/saeon/confirm.jsp
===================================================================
--- lib/style/skins/saeon/confirm.jsp	(revision 4079)
+++ lib/style/skins/saeon/confirm.jsp	(revision 4080)
@@ -36,7 +36,7 @@
     </head>
     <body>
         <script language="JavaScript">
-            insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateOpening("<%=CONTEXT_URL%>");
         </script>
         
         <!-- Main content -->
@@ -44,7 +44,7 @@
         
         <!-- wrap it up with the closing -->
         <script language="JavaScript">
-            insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateClosing("<%=CONTEXT_URL%>");
         </script>
     </body>
 </html>
Index: lib/style/skins/lter/index_login.jsp
===================================================================
--- lib/style/skins/lter/index_login.jsp	(revision 4079)
+++ lib/style/skins/lter/index_login.jsp	(revision 4080)
@@ -55,9 +55,9 @@
 
   <body>
     <script language="javascript">
-	  insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertTemplateOpening("<%=CONTEXT_URL%>");
     insertLoginBox("<%= loginFailure %>");
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
   </script>
   </body>
 
Index: lib/style/skins/lter/index.jsp
===================================================================
--- lib/style/skins/lter/index.jsp	(revision 4079)
+++ lib/style/skins/lter/index.jsp	(revision 4080)
@@ -51,9 +51,9 @@
 
   <body>
     <script language="javascript">
-	  insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-	  insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
-      insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertTemplateOpening("<%=CONTEXT_URL%>");
+	  insertSearchBox("<%=CONTEXT_URL%>");
+      insertTemplateClosing("<%=CONTEXT_URL%>");
     </script>
   </body>
 </html>
Index: lib/style/skins/esa/header.jsp
===================================================================
--- lib/style/skins/esa/header.jsp	(revision 4079)
+++ lib/style/skins/esa/header.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <html>
 <head>
Index: lib/style/skins/esa/index.jsp
===================================================================
--- lib/style/skins/esa/index.jsp	(revision 4079)
+++ lib/style/skins/esa/index.jsp	(revision 4080)
@@ -29,6 +29,7 @@
  %>
 
  <%@ include file="../../common/common-settings.jsp"%>
+ <%@ include file="../../common/configure-check.jsp"%>
  
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -126,8 +127,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 <table width="760" border="0" cellspacing="0" cellpadding="0">
   <tr><td colspan="5">
@@ -276,7 +277,7 @@
 </table>
 
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/account/index.jsp
===================================================================
--- lib/style/skins/account/index.jsp	(revision 4079)
+++ lib/style/skins/account/index.jsp	(revision 4080)
@@ -29,6 +29,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
    
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -43,8 +44,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 <table width="760" border="0" cellspacing="0" cellpadding="0">
   <tr><td colspan="5">
@@ -74,7 +75,7 @@
 </table>
 
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/knb2/index.jsp
===================================================================
--- lib/style/skins/knb2/index.jsp	(revision 4079)
+++ lib/style/skins/knb2/index.jsp	(revision 4080)
@@ -1,4 +1,4 @@
-<%@ page    language="java" %>
+<%@ page    language="java"  import="java.util.Vector,edu.ucsb.nceas.metacat.util.LDAPUtil"%>
 <%
  /**
   *  '$RCSfile$'
@@ -32,8 +32,12 @@
 %>
 <%@ include file="PORTAL_SETTINGS.jsp"%>
 <%@ include file="include_session_vars.jsp"%>
-<%@ page import="edu.ucsb.nceas.metacat.MetaCatUtil" %>
+<%@ page import="edu.ucsb.nceas.metacat.service.PropertyService" %>
 
+<% 
+	Vector<String> organizationList = LDAPUtil.getOrganizations();
+%>
+
 <%
 ///////////////////////////////////////////////////////////////////////////////
 //
@@ -112,7 +116,7 @@
           <td class="text_plain"><%@ include file="include_searchbox.jsp" %></td>
         </tr>
 
-	<% if ( MetaCatUtil.getOption("runSpatialOption").equals("true") ) { %>
+	<% if ( PropertyService.getProperty("runSpatialOption").equals("true") ) { %>
         <tr>
           <td class="text_plain"><%@ include file="include_map.jsp" %></td>
         </tr>
@@ -163,14 +167,13 @@
                                 <select name="organization" style="width:140px;" <%=loginEnabledDisabled%>>
                                   <option value=""       <%=((posted_organization.length()<1)?                 "selected":"")%>>&#8212;
                                   choose one &#8212;</option>
-                                  <option value="NCEAS"        <%=((posted_organization.equalsIgnoreCase("NCEAS"))?        "selected":"")%>>NCEAS</option>
-                                  <option value="LTER"         <%=((posted_organization.equalsIgnoreCase("LTER"))?         "selected":"")%>>LTER</option>
-                                  <option value="UCNRS"          <%=((posted_organization.equalsIgnoreCase("UCNRS"))?          "selected":"")%>>UCNRS</option>
-                                  <option value="PISCO"        <%=((posted_organization.equalsIgnoreCase("PISCO"))?        "selected":"")%>>PISCO</option>
-                                  <option value="OBFS"         <%=((posted_organization.equalsIgnoreCase("OBFS"))?         "selected":"")%>>OBFS</option>
-                                  <option value="SDSC"         <%=((posted_organization.equalsIgnoreCase("SDSC"))?         "selected":"")%>>SDSC</option>
-                                  <option value="KU"         <%=((posted_organization.equalsIgnoreCase("KU"))?         "selected":"")%>>KU</option>
-                                  <option value="unaffiliated" <%=((posted_organization.equalsIgnoreCase("unaffiliated"))? "selected":"")%>>unaffiliated</option>
+<%
+							for (String orgName : organizationList) {
+%> 
+                                  <option value="<%= orgName %>"        <%=((posted_organization.equalsIgnoreCase(orgName))?        "selected":"")%>><%= orgName %></option>
+<%
+							}
+%> 
                                 </select></td>
                             </tr>
                             <tr valign="middle">
Index: lib/style/skins/nrs/index.jsp
===================================================================
--- lib/style/skins/nrs/index.jsp	(revision 4079)
+++ lib/style/skins/nrs/index.jsp	(revision 4080)
@@ -30,6 +30,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
   
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -167,8 +168,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 <table width="760" border="0" cellspacing="0" cellpadding="0">
   <tr><td colspan="5">
@@ -269,7 +270,7 @@
 </table>
 <p>&nbsp;</p>
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/nrs/nrs.properties.metadata.xml
===================================================================
--- lib/style/skins/nrs/nrs.properties.metadata.xml	(nonexistent)
+++ lib/style/skins/nrs/nrs.properties.metadata.xml	(revision 4080)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<metadataConfig>
+	<group>
+		<index>1</index>
+		<name>Skins Configuration</name>
+		<comment>Choose configure the skins that will be available in this instance of MetaCat.</comment> 
+		<description>Skin Configuration Values.</description>
+	</group>
+
+	<config>
+		<key>registry.db.connection</key>
+		<label>Database Connection</label>
+		<group>1</group>
+		<index>1</index>
+		<description>Local database connection string.</description>
+	</config>
+	
+	<config>
+		<key>registry.db.user</key>
+		<label>Database Username</label>
+		<group>1</group>
+		<index>2</index>
+		<description>Local database user name.</description>
+	</config>
+
+	<config>
+		<key>registry.db.password</key>
+		<label>Database Password</label>
+		<group>1</group>
+		<fieldType>password</fieldType>
+		<index>3</index>
+		<description>Local database password.</description>
+	</config>
+
+</metadataConfig>
\ No newline at end of file

Property changes on: lib/style/skins/nrs/nrs.properties.metadata.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/saeon/SaeonLogin.jspx
===================================================================
--- lib/style/skins/saeon/SaeonLogin.jspx	(revision 4079)
+++ lib/style/skins/saeon/SaeonLogin.jspx	(revision 4080)
@@ -22,7 +22,7 @@
 	<jsp:element name="script">
 		<jsp:attribute name="language">JavaScript</jsp:attribute>
 		<jsp:attribute name="src">
-			<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/saeon/searchPathQuery.js"</jsp:expression>
+			<jsp:expression>CONTEXT_URL + "/style/skins/saeon/searchPathQuery.js"</jsp:expression>
 		</jsp:attribute>
 	</jsp:element>
 	<script type="text/javascript" language="JavaScript">
@@ -63,7 +63,7 @@
 		<jsp:attribute name="rel">stylesheet</jsp:attribute>
 		<jsp:attribute name="type">text/css</jsp:attribute>
 		<jsp:attribute name="href">
-			<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/saeon/saeon.css"</jsp:expression>
+			<jsp:expression>CONTEXT_URL + "/style/skins/saeon/saeon.css"</jsp:expression>
 		</jsp:attribute>
 	</jsp:element>
 </head>
@@ -273,7 +273,7 @@
 				</jsp:attribute>
 				<jsp:element name="img">
 					<jsp:attribute name="src">
-						<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/saeon/images/user.gif"</jsp:expression>
+						<jsp:expression>CONTEXT_URL + "/style/skins/saeon/images/user.gif"</jsp:expression>
 					</jsp:attribute>
 					<jsp:attribute name="alt">New User?</jsp:attribute>
 					<jsp:attribute name="title">User</jsp:attribute>
@@ -321,11 +321,11 @@
 			<jsp:element name="a">
 				<jsp:attribute name="target">_top</jsp:attribute>
 				<jsp:attribute name="href">
-					<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/saeon/index.jsp?action=Logout&amp;qformat=saeon"</jsp:expression>
+					<jsp:expression>CONTEXT_URL + "/style/skins/saeon/index.jsp?action=Logout&amp;qformat=saeon"</jsp:expression>
 				</jsp:attribute>
 				<jsp:element name="img">
 					<jsp:attribute name="src">
-						<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/saeon/images/user.gif"</jsp:expression>
+						<jsp:expression>CONTEXT_URL + "/style/skins/saeon/images/user.gif"</jsp:expression>
 					</jsp:attribute>
 					<jsp:attribute name="alt">logout</jsp:attribute>
 					<jsp:attribute name="title">User</jsp:attribute>
@@ -343,7 +343,7 @@
 				</jsp:attribute>
 				<jsp:element name="img">
 					<jsp:attribute name="src">
-						<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/saeon/images/user.gif"</jsp:expression>
+						<jsp:expression>CONTEXT_URL + "/style/skins/saeon/images/user.gif"</jsp:expression>
 					</jsp:attribute>
 					<jsp:attribute name="alt">reset password</jsp:attribute>
 					<jsp:attribute name="title">User</jsp:attribute>
@@ -361,7 +361,7 @@
 				</jsp:attribute>
 				<jsp:element name="img">
 					<jsp:attribute name="src">
-						<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/saeon/images/user.gif"</jsp:expression>
+						<jsp:expression>CONTEXT_URL + "/style/skins/saeon/images/user.gif"</jsp:expression>
 					</jsp:attribute>
 					<jsp:attribute name="alt">change password</jsp:attribute>
 					<jsp:attribute name="title">User</jsp:attribute>
@@ -392,7 +392,7 @@
 						<jsp:element name="form">
 							<jsp:attribute name="method">post</jsp:attribute>
 							<jsp:attribute name="action">
-								<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/saeon/upload.jsp"</jsp:expression>
+								<jsp:expression>CONTEXT_URL + "/style/skins/saeon/upload.jsp"</jsp:expression>
 							</jsp:attribute>
 							<input type="submit" value="Go >" class="button_login" />
 						</jsp:element>
@@ -429,7 +429,7 @@
 		<div style="padding-left: 100px">
 		<!-- map frame -->
         <script language="JavaScript">
-            insertMap("<jsp:expression>SERVER_URL_WITH_CONTEXT</jsp:expression>");
+            insertMap("<jsp:expression>CONTEXT_URL</jsp:expression>");
         </script>
         </div>
 	</td>
Index: lib/style/skins/lter/advancedsearch.jsp
===================================================================
--- lib/style/skins/lter/advancedsearch.jsp	(revision 4079)
+++ lib/style/skins/lter/advancedsearch.jsp	(revision 4080)
@@ -236,7 +236,7 @@
           <td>&nbsp;</td>
           <td>
             <applet
-              CODEBASE="<%=SERVER_URL_WITH_CONTEXT%>/LiveMap_30"
+              CODEBASE="<%=CONTEXT_URL%>/LiveMap_30"
               CODE="LiveMap_30.class"
               ARCHIVE="LiveMap_30.jar"
               NAME="map" 
Index: lib/style/skins/lter/metacatlogin.jsp
===================================================================
--- lib/style/skins/lter/metacatlogin.jsp	(revision 4079)
+++ lib/style/skins/lter/metacatlogin.jsp	(revision 4080)
@@ -1,4 +1,4 @@
-<%@ page language="java"%>
+<%@ page language="java"  import="java.util.Vector,edu.ucsb.nceas.metacat.util.LDAPUtil"%>
 
 <!--
 /**
@@ -33,6 +33,10 @@
 <%@ include file="settings.jsp"%>
 <%@ include file="session_vars.jsp"%>
 
+<% 
+	Vector<String> organizationList = LDAPUtil.getOrganizations();
+%>
+
 <html>
 
   <head>
@@ -90,33 +94,13 @@
           </td>
           <td align="left">
             <select name="organization">
-              <option value="KU">
-                KU
-              </option>
-              <option value="LTER" selected="selected">
-                LTER
-              </option>
-              <option value="NCEAS">
-                NCEAS
-              </option>
-              <option value="OBFS">
-                OBFS
-              </option>
-              <option value="OSUBS">
-                OSUBS
-              </option>
-              <option value="PISCO">
-                PISCO
-              </option>
-              <option value="SDSC">
-                SDSC
-              </option>
-              <option value="UCNRS">
-                UCNRS
-              </option>
-              <option value="unaffiliated">
-                unaffiliated
-              </option>
+<%
+			for (String orgName : organizationList) {
+%>  
+              <option value="<%= orgName %>"><%= orgName %></option>
+<%
+			}
+%> 
             </select>
           </td>
           <td>
Index: lib/style/skins/esa/esa.properties.metadata.xml
===================================================================
--- lib/style/skins/esa/esa.properties.metadata.xml	(nonexistent)
+++ lib/style/skins/esa/esa.properties.metadata.xml	(revision 4080)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<metadataConfig>
+	<group>
+		<index>1</index>
+		<name>Skins Configuration</name>
+		<comment>Choose configure the skins that will be available in this instance of MetaCat.</comment> 
+		<description>Skin Configuration Values.</description>
+	</group>
+
+	<config>
+		<key>registry.db.connection</key>
+		<label>Database Connection</label>
+		<group>1</group>
+		<index>1</index>
+		<description>Local database connection string.</description>
+	</config>
+	
+	<config>
+		<key>registry.db.user</key>
+		<label>Database Username</label>
+		<group>1</group>
+		<index>2</index>
+		<description>Local database user name.</description>
+	</config>
+
+	<config>
+		<key>registry.db.password</key>
+		<label>Database Password</label>
+		<group>1</group>
+		<fieldType>password</fieldType>
+		<index>3</index>
+		<description>Local database password.</description>
+	</config>
+
+</metadataConfig>
\ No newline at end of file

Property changes on: lib/style/skins/esa/esa.properties.metadata.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/esa/spatial/map.jsp
===================================================================
--- lib/style/skins/esa/spatial/map.jsp	(revision 4079)
+++ lib/style/skins/esa/spatial/map.jsp	(revision 4080)
@@ -29,6 +29,7 @@
 %>
 
 <%@ include file="../../../common/common-settings.jsp"%>
+<%@ include file="../../../common/configure-check.jsp"%>
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
Index: lib/style/skins/nceas/nceas.properties.metadata.xml
===================================================================
--- lib/style/skins/nceas/nceas.properties.metadata.xml	(nonexistent)
+++ lib/style/skins/nceas/nceas.properties.metadata.xml	(revision 4080)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<metadataConfig>
+	<group>
+		<index>1</index>
+		<name>Skins Configuration</name>
+		<comment>Choose configure the skins that will be available in this instance of MetaCat.</comment> 
+		<description>Skin Configuration Values.</description>
+	</group>
+
+	<config>
+		<key>registry.db.connection</key>
+		<label>Database Connection</label>
+		<group>1</group>
+		<index>1</index>
+		<description>Local database connection string.</description>
+	</config>
+	
+	<config>
+		<key>registry.db.user</key>
+		<label>Database Username</label>
+		<group>1</group>
+		<index>2</index>
+		<description>Local database user name.</description>
+	</config>
+
+	<config>
+		<key>registry.db.password</key>
+		<label>Database Password</label>
+		<group>1</group>
+		<fieldType>password</fieldType>
+		<index>3</index>
+		<description>Local database password.</description>
+	</config>
+
+</metadataConfig>
\ No newline at end of file

Property changes on: lib/style/skins/nceas/nceas.properties.metadata.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/knb2/index_map_only.jsp
===================================================================
--- lib/style/skins/knb2/index_map_only.jsp	(revision 4079)
+++ lib/style/skins/knb2/index_map_only.jsp	(revision 4080)
@@ -32,7 +32,7 @@
 %>
 <%@ include file="PORTAL_SETTINGS.jsp"%>
 <%@ include file="include_session_vars.jsp"%>
-<%@ page import="edu.ucsb.nceas.metacat.MetaCatUtil" %>
+<%@ page import="edu.ucsb.nceas.metacat.service.PropertyService" %>
 
 <%
 ///////////////////////////////////////////////////////////////////////////////
@@ -94,7 +94,7 @@
             </table></td>
         </tr>
 
-	<% if ( MetaCatUtil.getOption("runSpatialOption").equals("true") ) { %>
+	<% if ( PropertyService.getProperty("runSpatialOption").equals("true") ) { %>
         <tr>
           <td class="text_plain"><%@ include file="include_map.jsp" %></td>
         </tr>
Index: lib/style/skins/specnet/searchform.jsp
===================================================================
--- lib/style/skins/specnet/searchform.jsp	(revision 4079)
+++ lib/style/skins/specnet/searchform.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <form method="POST" action="<%=SERVLET_URL%>" target="_top">
 Search for: 
Index: lib/style/skins/nrs/map.jsp
===================================================================
--- lib/style/skins/nrs/map.jsp	(revision 4079)
+++ lib/style/skins/nrs/map.jsp	(revision 4080)
@@ -30,12 +30,13 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
    
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 <title>UCNRS Data Registry Interactive Map</title>
-<link rel="stylesheet" href="<%=SERVER_URL_WITH_CONTEXT%>/style/default.css" type="text/css">
+<link rel="stylesheet" href="<%=CONTEXT_URL%>/style/default.css" type="text/css">
   <link rel="stylesheet" type="text/css" 
         href="<%=STYLE_SKINS_URL%>/nrs/nrs.css"></link>
   <script language="JavaScript" type="text/JavaScript"
@@ -45,8 +46,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          //insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          //insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 
 <iframe scrolling="no" frameborder="0" width="750" height="520" src="spatial/map.jsp">
@@ -54,7 +55,7 @@
 </iframe>
 
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/saeon/upload.jsp
===================================================================
--- lib/style/skins/saeon/upload.jsp	(revision 4079)
+++ lib/style/skins/saeon/upload.jsp	(revision 4080)
@@ -40,13 +40,13 @@
             function getMapFrame() {
                 return document.getElementById('mapFrame');
             }
-            insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateOpening("<%=CONTEXT_URL%>");
         </script>
         
         <jsp:include page="SaeonUpload.jspx" />
         
         <script language="JavaScript">
-            insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateClosing("<%=CONTEXT_URL%>");
         </script>
     </body>
 </html>
Index: lib/style/skins/saeon/index.jsp
===================================================================
--- lib/style/skins/saeon/index.jsp	(revision 4079)
+++ lib/style/skins/saeon/index.jsp	(revision 4080)
@@ -36,7 +36,7 @@
     </head>
     <body>
         <script language="JavaScript">
-            insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateOpening("<%=CONTEXT_URL%>");
         </script>
         
         <!-- Main content -->
@@ -44,7 +44,7 @@
         
         <!-- wrap it up with the closing -->
         <script language="JavaScript">
-            insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+            insertTemplateClosing("<%=CONTEXT_URL%>");
         </script>
     </body>
 </html>
Index: lib/style/skins/lter/index_document.jsp
===================================================================
--- lib/style/skins/lter/index_document.jsp	(revision 4079)
+++ lib/style/skins/lter/index_document.jsp	(revision 4080)
@@ -53,9 +53,9 @@
 
 <body>
   <script language="javascript">
-	insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
+	insertTemplateOpening("<%=CONTEXT_URL%>");
     insertDocument("<%=SERVLET_URL%>,<%= docid %>");
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
   </script>
 </body>
 
Index: lib/style/skins/lter/index_advancedsearch.jsp
===================================================================
--- lib/style/skins/lter/index_advancedsearch.jsp	(revision 4079)
+++ lib/style/skins/lter/index_advancedsearch.jsp	(revision 4080)
@@ -49,10 +49,10 @@
 
 <body>
   <script language="javascript">
-	  insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-      // insertLoginBox("<%=SERVER_URL_WITH_CONTEXT%>");
-	  insertAdvancedSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertTemplateOpening("<%=CONTEXT_URL%>");
+      // insertLoginBox("<%=CONTEXT_URL%>");
+	  insertAdvancedSearchBox("<%=CONTEXT_URL%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
   </script>
 </body>
 
Index: lib/style/skins/esa/moderator.jsp
===================================================================
--- lib/style/skins/esa/moderator.jsp	(revision 4079)
+++ lib/style/skins/esa/moderator.jsp	(revision 4080)
@@ -1,4 +1,4 @@
-<%@ page    language="java" %>
+<%@ page    language="java" import="java.util.Vector,edu.ucsb.nceas.metacat.util.LDAPUtil"%>
 <%
 /*
  *  '$RCSfile$'
@@ -29,12 +29,17 @@
  */
 %>
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
+<% 
+	Vector<String> organizationList = LDAPUtil.getOrganizations();
+%>
+
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 <title>ESA Data Repository</title>
-<link rel="stylesheet" href="<%=SERVER_URL_WITH_CONTEXT%>/style/default.css" type="text/css">
+<link rel="stylesheet" href="<%=CONTEXT_URL%>/style/default.css" type="text/css">
   <link rel="stylesheet" type="text/css" 
         href="<%=STYLE_SKINS_URL%>/esa/esa.css"></link>
   <script language="JavaScript" type="text/JavaScript"
@@ -82,8 +87,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          insertSearchBox("<%=CONTEXT_URL%>");
       </script>
   <b>Login Page for Moderators</b>
   <br />
@@ -113,15 +118,13 @@
         "padding-top: 2px; padding-bottom: 2px;"><select name=
         "organization" style="width:140px;">
           <option value=""    selected>&#8212; choose one &#8212;</option>
-          <option value="NCEAS"       >NCEAS</option>
-          <option value="LTER"        >LTER</option>
-          <option value="KU"          >KU</option>
-          <option value="OBFS"        >OBFS</option>
-          <option value="OSUSB"       >OSUSB</option>
-          <option value="PISCO"       >PISCO</option>
-          <option value="SDSC"        >SDSC</option>
-          <option value="UCNRS"       >UCNRS</option>
-          <option value="unaffiliated">unaffiliated</option>
+<%
+		for (String orgName : organizationList) {
+%>      
+          <option value="<%= orgName %>"><%= orgName %></option>
+<%
+		}
+%>  
         </select></td>
       </tr>
 
@@ -154,7 +157,7 @@
   </li>
   <p>&nbsp;</p>
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/knb2/index2.jsp
===================================================================
--- lib/style/skins/knb2/index2.jsp	(revision 4079)
+++ lib/style/skins/knb2/index2.jsp	(revision 4080)
@@ -1,4 +1,4 @@
-<%@ page    language="java" %>
+<%@ page    language="java"  import="java.util.Vector,edu.ucsb.nceas.metacat.util.LDAPUtil"%>
 <%
  /**
   *  '$RCSfile$'
@@ -32,8 +32,12 @@
 %>
 <%@ include file="PORTAL_SETTINGS.jsp"%>
 <%@ include file="include_session_vars.jsp"%>
-<%@ page import="edu.ucsb.nceas.metacat.MetaCatUtil" %>
+<%@ page import="edu.ucsb.nceas.metacat.service.PropertyService" %>
 
+<% 
+	Vector<String> organizationList = LDAPUtil.getOrganizations();
+%>
+
 <%
 ///////////////////////////////////////////////////////////////////////////////
 //
@@ -106,7 +110,7 @@
 		</div>
 	</td>
 	<td align="center" width="33%">
-	<% if ( MetaCatUtil.getOption("runSpatialOption").equals("true") ) { %>
+	<% if ( PropertyService.getProperty("runSpatialOption").equals("true") ) { %>
 	  <a href="./index_map_only.jsp" style="border:none"><img height="120" width="240" style="background-color: #C8E5F5; border: 1px solid #ccc" src="http://indus.msi.ucsb.edu:8180/knb/wms?VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=metacat:world_borders,metacat:data_bounds,metacat:data_points&SRS=EPSG:4326&BBOX=-180,-90,180,90&WIDTH=240&HEIGHT=120&FORMAT=image/gif&STYLES=&TRANSPARENT=TRUE&UNIQUEID="> <br/> <span style="font-size:8pt"> Click to View Interactive Map </span> </a>
 	<% } %>
 	</td>
@@ -169,14 +173,13 @@
                                 <select name="organization" style="width:140px;" <%=loginEnabledDisabled%>>
                                   <option value=""       <%=((posted_organization.length()<1)?                 "selected":"")%>>&#8212;
                                   choose one &#8212;</option>
-                                  <option value="NCEAS"        <%=((posted_organization.equalsIgnoreCase("NCEAS"))?        "selected":"")%>>NCEAS</option>
-                                  <option value="LTER"         <%=((posted_organization.equalsIgnoreCase("LTER"))?         "selected":"")%>>LTER</option>
-                                  <option value="UCNRS"          <%=((posted_organization.equalsIgnoreCase("UCNRS"))?          "selected":"")%>>UCNRS</option>
-                                  <option value="PISCO"        <%=((posted_organization.equalsIgnoreCase("PISCO"))?        "selected":"")%>>PISCO</option>
-                                  <option value="OBFS"         <%=((posted_organization.equalsIgnoreCase("OBFS"))?         "selected":"")%>>OBFS</option>
-                                  <option value="SDSC"         <%=((posted_organization.equalsIgnoreCase("SDSC"))?         "selected":"")%>>SDSC</option>
-                                  <option value="KU"         <%=((posted_organization.equalsIgnoreCase("KU"))?         "selected":"")%>>KU</option>
-                                  <option value="unaffiliated" <%=((posted_organization.equalsIgnoreCase("unaffiliated"))? "selected":"")%>>unaffiliated</option>
+<%
+							for (String orgName : organizationList) {
+%> 
+                                  <option value="<%= orgName %>"        <%=((posted_organization.equalsIgnoreCase(orgName))?    "selected":"")%>><%= orgName %></option>
+<%
+							}
+%> 
                                 </select></td>
                             </tr>
                             <tr valign="middle">
Index: lib/style/skins/specnet/header.jsp
===================================================================
--- lib/style/skins/specnet/header.jsp	(revision 4079)
+++ lib/style/skins/specnet/header.jsp	(revision 4080)
@@ -25,6 +25,7 @@
  %>
 
  <%@ include file="../../common/common-settings.jsp"%>
+ <%@ include file="../../common/configure-check.jsp"%>
 
 <!--____________________________max_width____________________________________-->
 
Index: lib/style/skins/nrs/searchform.jsp
===================================================================
--- lib/style/skins/nrs/searchform.jsp	(revision 4079)
+++ lib/style/skins/nrs/searchform.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <form method="POST" action="<%=SERVLET_URL%>" target="_top">
 Search for: 
Index: lib/style/skins/nrs/nrs.properties
===================================================================
--- lib/style/skins/nrs/nrs.properties	(nonexistent)
+++ lib/style/skins/nrs/nrs.properties	(revision 4080)
@@ -0,0 +1,48 @@
+#
+# General configuration parameters
+#
+registry.config.username=uid=nceasadmin,o=NCEAS,dc=ecoinformatics,dc=org
+registry.config.password=your-pw-goes-here
+registry.config.scope=nceas
+registry.config.organization=National Center for Ecological Analysis and Synthesis
+registry.config.abbrev=NCEAS
+#registry.config.url=http://www.nceas.ucsb.edu/
+registry.config.site=project
+registry.config.type=Repository
+registry.config.debug=1
+
+# NCEAS custom theme sans-iframe
+registry.templates.header=nceasHeader.tmpl
+registry.templates.footer=nceasFooter.tmpl
+
+# email settings
+email.sender=NCEAS Data Repository <help@nceas.ucsb.edu>
+email.recipient=help@nceas.ucsb.edu
+email.admin=the repository administrator
+
+# registry display settings
+registry.show.siteList=false
+registry.show.wgList=true
+registry.show.organization=false
+# registry module display
+registry.modules.taxonomic=true
+registry.modules.method=true
+registry.modules.spatial=true
+registry.modules.keyword=true
+registry.modules.temporal=true
+registry.modules.upload=true
+
+registry.required.temporal=
+registry.required.spatial=
+registry.required.contactEmailAddress=
+
+# NCEAS specific
+registry.db.connection=//hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu
+registry.db.user= admowner
+registry.db.password= your-pw-goes-here
+
+# imported properties from lib/skin.configs/nceas/nceas.properties
+# java code usage
+lsidauthority=knb.ecoinformatics.org
+registryurl=http://knb.ecoinformatics.org
+registryname=KNB Data Registry

Property changes on: lib/style/skins/nrs/nrs.properties
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/saeon/settings.jsp
===================================================================
--- lib/style/skins/saeon/settings.jsp	(revision 4079)
+++ lib/style/skins/saeon/settings.jsp	(revision 4080)
@@ -30,6 +30,7 @@
  %>
 
  <%@ include file="../../common/common-settings.jsp"%>
+ <%@ include file="../../common/configure-check.jsp"%>
 
  <% 
 	
Index: lib/style/skins/lter/settings.jsp
===================================================================
--- lib/style/skins/lter/settings.jsp	(revision 4079)
+++ lib/style/skins/lter/settings.jsp	(revision 4080)
@@ -31,6 +31,7 @@
  %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <%
 //Global settings for metacat are in common-settings.jsp.  Use this file to
Index: lib/style/skins/lter/index_advancedbrowse.jsp
===================================================================
--- lib/style/skins/lter/index_advancedbrowse.jsp	(revision 4079)
+++ lib/style/skins/lter/index_advancedbrowse.jsp	(revision 4080)
@@ -49,9 +49,9 @@
 
 <body>
   <script language="javascript">
-	  insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-    insertAdvancedBrowseBox("<%=SERVER_URL_WITH_CONTEXT%>");
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+	  insertTemplateOpening("<%=CONTEXT_URL%>");
+    insertAdvancedBrowseBox("<%=CONTEXT_URL%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
   </script>
 </body>
 
Index: lib/style/skins/esa/searchform.jsp
===================================================================
--- lib/style/skins/esa/searchform.jsp	(revision 4079)
+++ lib/style/skins/esa/searchform.jsp	(revision 4080)
@@ -25,6 +25,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <form method="POST" action="<%=SERVLET_URL%>" target="_top">
 Search for: 
Index: lib/style/skins/esa/esa.properties
===================================================================
--- lib/style/skins/esa/esa.properties	(nonexistent)
+++ lib/style/skins/esa/esa.properties	(revision 4080)
@@ -0,0 +1,48 @@
+#
+# General configuration parameters
+#
+registry.config.username=uid=nceasadmin,o=NCEAS,dc=ecoinformatics,dc=org
+registry.config.password=your-pw-goes-here
+registry.config.scope=nceas
+registry.config.organization=National Center for Ecological Analysis and Synthesis
+registry.config.abbrev=NCEAS
+#registry.config.url=http://www.nceas.ucsb.edu/
+registry.config.site=project
+registry.config.type=Repository
+registry.config.debug=1
+
+# NCEAS custom theme sans-iframe
+registry.templates.header=nceasHeader.tmpl
+registry.templates.footer=nceasFooter.tmpl
+
+# email settings
+email.sender=NCEAS Data Repository <help@nceas.ucsb.edu>
+email.recipient=help@nceas.ucsb.edu
+email.admin=the repository administrator
+
+# registry display settings
+registry.show.siteList=false
+registry.show.wgList=true
+registry.show.organization=false
+# registry module display
+registry.modules.taxonomic=true
+registry.modules.method=true
+registry.modules.spatial=true
+registry.modules.keyword=true
+registry.modules.temporal=true
+registry.modules.upload=true
+
+registry.required.temporal=
+registry.required.spatial=
+registry.required.contactEmailAddress=
+
+# NCEAS specific
+registry.db.connection=//hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu
+registry.db.user= admowner
+registry.db.password= your-pw-goes-here
+
+# imported properties from lib/skin.configs/nceas/nceas.properties
+# java code usage
+lsidauthority=knb.ecoinformatics.org
+registryurl=http://knb.ecoinformatics.org
+registryname=KNB Data Registry

Property changes on: lib/style/skins/esa/esa.properties
___________________________________________________________________
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/edu/ucsb/nceas/metacat/MetaCatUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatUtil.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/MetaCatUtil.java	(nonexistent)
@@ -1,1134 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that implements utility methods for a metadata catalog
- *  Copyright: 2000 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Matt Jones, Jivka Bojilova
- *
- *   '$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 java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.SimpleDateFormat;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.regex.PatternSyntaxException;
-
-import org.apache.log4j.Logger;
-
-import com.oreilly.servlet.multipart.FilePart;
-
-import edu.ucsb.nceas.dbadapter.AbstractDatabase;
-import edu.ucsb.nceas.utilities.Options;
-
-/**
- * A suite of utility classes for the metadata catalog server
- */
-public class MetaCatUtil
-{
-
-    public static AbstractDatabase dbAdapter;
-
-    public static Vector pathsForIndexing;
-    
-    private static HashMap skinconfigs = new HashMap();
-
-    private static edu.ucsb.nceas.utilities.Options options = null;
-
-    private static boolean debug = true;
-    
-    private static String[] administrators;
-    
-    private static String[] moderators;
-
-    private static String[] allowedSubmitters;
-
-    private static String[] deniedSubmitters;
-    
-    private static Logger logMetacat = Logger.getLogger(MetaCatUtil.class);
-
-    static {
-    	// Determine our db adapter class and create an instance of that class
-        try {
-            dbAdapter = (AbstractDatabase) createObject(getOption("dbAdapter"));
-        } catch (Exception e) {
-            System.err.println("Error in MetaCatUtil static block:"
-                    + e.getMessage());
-            e.printStackTrace();
-        }
-
-        // read administrator and moderator lists from metacat.properties
-        getUserAccessControlLists();
-    }
-    
-    /**
-     * Instantiate a class using the name of the class at runtime
-     *
-     * @param className the fully qualified name of the class to instantiate
-     */
-    public static Object createObject(String className) throws Exception
-    {
-
-        Object object = null;
-        try {
-            Class classDefinition = Class.forName(className);
-            object = classDefinition.newInstance();
-        } catch (InstantiationException e) {
-            throw e;
-        } catch (IllegalAccessException e) {
-            throw e;
-        } catch (ClassNotFoundException e) {
-            throw e;
-        }
-        return object;
-    }
-
-    /**
-     * Utility method to get an option value from the properties file
-     *
-     * @param optionName the name of the option requested
-     * @return the String value for the option, or null if not set
-     */
-    public static String getOption(String optionName)
-    {
-        if (options == null) {
-            options = edu.ucsb.nceas.utilities.Options.getInstance();
-        }
-        if (options == null) {
-            Logger logMetacat = Logger.getLogger(MetaCatUtil.class);
-        	logMetacat.info("options is null");
-        }
-        String value = options.getOption(optionName);
-        if (value == null) {
-        	logMetacat.warn("Value for key: " + optionName + 
-        			  " could not be retrieved from metacat properties.");
-        }
-        return value;
-    }
-    
-    /**
-     * Utility method to set an option value from the properties file
-     *
-     * @param optionName the name of the option requested
-     */
-    public static void setOption(String optionName, String newValue)
-    {
-        if (options == null) {
-            options = edu.ucsb.nceas.utilities.Options.getInstance();
-        }
-        options.setOption(optionName, newValue);
-        
-    }
-
-    /** Utility method to convert a file handle into a URL */
-    public static URL fileToURL(File file)
-    {
-        String path = file.getAbsolutePath();
-        String fSep = System.getProperty("file.separator");
-        if (fSep != null && fSep.length() == 1)
-                path = path.replace(fSep.charAt(0), '/');
-        if (path.length() > 0 && path.charAt(0) != '/') path = '/' + path;
-        try {
-            return new URL("file", null, path);
-        } catch (java.net.MalformedURLException e) {
-            /*
-             * According to the spec this could only happen if the file
-             */
-            throw new Error("unexpected MalformedURLException");
-        }
-    }
-
-    /**
-     * 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
-     * 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.
-     */
-    public static Hashtable parseQuery(String query)
-            throws MalformedURLException
-    {
-        String[][] params = new String[200][2];
-        Hashtable parameters = new Hashtable();
-
-        String temp = "";
-        boolean ampflag = true;
-        boolean poundflag = false;
-        int arrcount = 0;
-
-        if (query != null) {
-            for (int i = 0; i < query.length(); i++) {
-
-                // go throught the remainder of the query one character at a
-                // time.
-                if (query.charAt(i) == '=') {
-                    // if the current char is a # then the preceding should be
-                    // a name
-                    if (!poundflag && ampflag) {
-                        params[arrcount][0] = temp.trim();
-                        temp = "";
-                    } else {
-                        //if there are two #s or &s in a row throw an
-                        // exception.
-                        throw new MalformedURLException(
-                                "metacatURL: Two parameter names "
-                                        + "not allowed in sequence");
-                    }
-                    poundflag = true;
-                    ampflag = false;
-                } else if (query.charAt(i) == '&' || i == query.length() - 1) {
-                    //the text preceding the & should be the param value.
-                    if (i == query.length() - 1) {
-                        //if at the end of the string grab the last value and
-                        // append it.
-                        if (query.charAt(i) != '=') {
-                            //ignore an extra & on the end of the string
-                            temp += query.charAt(i);
-                        }
-                    }
-
-                    if (!ampflag && poundflag) {
-                        params[arrcount][1] = temp.trim();
-                        parameters
-                                .put(params[arrcount][0], params[arrcount][1]);
-                        temp = "";
-                        arrcount++; //increment the array to the next row.
-                    } else {
-                        //if there are two =s or &s in a row through an
-                        // exception
-                        throw new MalformedURLException(
-                                "metacatURL: Two parameter values "
-                                        + "not allowed in sequence");
-                    }
-                    poundflag = false;
-                    ampflag = true;
-                } else {
-                    //get the next character in the string
-                    temp += query.charAt(i);
-                }
-            }
-        }
-        return parameters;
-    }
-  
-    public static Vector getOptionList(String optiontext)
-    {
-        Vector optionsVector = new Vector();
-        if (optiontext.indexOf(",") == -1) {
-            optionsVector.addElement(optiontext);
-            return optionsVector;
-        }
-
-        while (optiontext.indexOf(",") != -1) {
-            String s = optiontext.substring(0, optiontext.indexOf(","));
-            optionsVector.addElement(s.trim());
-            optiontext = optiontext.substring(optiontext.indexOf(",") + 1,
-                    optiontext.length());
-            if (optiontext.indexOf(",") == -1) { //catch the last list entry
-                optionsVector.addElement(optiontext.trim());
-            }
-        }
-        return optionsVector;
-    }
-
-    /** Normalizes a string read from DB. So it will be compatible to HTML */
-    public static String normalize(String s)
-    {
-        StringBuffer str = new StringBuffer();
-
-             int len = (s != null) ? s.length() : 0;
-             for (int i = 0; i < len; i++) {
-                 char ch = s.charAt(i);
-                 switch (ch) {
-                     case '<': {
-                         str.append("&lt;");
-                         break;
-                     }
-                     case '>': {
-                         str.append("&gt;");
-                         break;
-                     }
-                     case '&': {
-                         /*
-                          * patch provided by Johnoel Ancheta from U of Hawaii
-                          */
-                         // check if & is for a character reference &#xnnnn;
-                         if (i + 1 < len - 1 && s.charAt(i + 1) == '#') {
-                             str.append("&#");
-                             i += 2;
-
-                             ch = s.charAt(i);
-                             while (i < len && ch != ';') {
-                                 str.append(ch);
-                                 i++;
-                                 ch = s.charAt(i);
-                             }
-                             str.append(';');
-                         } else 
-                         // check if & is in front of amp; 
-                         // (we dont yet check for other HTML 4.0 Character entities) 
-                         if (i + 4 < len  && s.charAt(i + 1) == 'a' 
-                        	 && s.charAt(i + 2) == 'm' 
-                        		 && s.charAt(i + 3) == 'p' 
-                        			 && s.charAt(i + 4) == ';'){
-                             str.append("&amp;");
-                             i += 4;                        	 
-                         }
-                         else  if (i + 3 < len && s.charAt(i + 1) == 'l' 
-                        	 && s.charAt(i + 2) == 't' 
-                        		 && s.charAt(i + 3) == ';' ){
-                    	  // check if & is in front of it; 
-                             str.append("&lt;");
-                             i += 3;                        	 
-                         } 
-                         else  if (i + 3 < len && s.charAt(i + 1) == 'g' 
-                        	 && s.charAt(i + 2) == 't' 
-                        		 && s.charAt(i + 3) == ';' ){
-                    	  // check if & is in front of gt; 
-                           // (we dont yet check for other HTML 4.0 Character entities) 
-                             str.append("&gt;");
-                             i += 3;                        	 
-                         } 
-                         else  if (i + 5 < len && s.charAt(i + 1) == 'q' 
-                        	 && s.charAt(i + 2) == 'u' 
-                        		 && s.charAt(i + 3) == 'o' 
-                        	 && s.charAt(i + 4) == 't'
-                        	 && s.charAt(i + 5) == ';')
-                             {
-                    	   // check if & is in front of quot; 
-                           // (we dont yet check for other HTML 4.0 Character entities) 
-                             str.append("&quot;");
-                             i += 5;                        	 
-                         } 
-                         else  if (i + 5 < len && s.charAt(i + 1) == 'a' 
-                        	 && s.charAt(i + 2) == 'p' 
-                        		 && s.charAt(i + 3) == 'o' 
-                        	 && s.charAt(i + 4) == 's'
-                        	 && s.charAt(i + 5) == ';')
-                             {
-                    	   // check if & is in front of apostrophe; 
-                           // (we dont yet check for other HTML 4.0 Character entities) 
-                             str.append("&apos;");
-                             i += 5;                        	 
-                         } 
-                         else{
-                             str.append("&amp;");
-                         }
-                         /////////
-                         break;
-                     }
-                     case '"':
-                    	 str.append("&quot;");
-                         break;
-                     case '\'':
-                    	 str.append("&apos;");
-                         break;
-                    default: {
-                         if ( (ch<128) && (ch>31) ) {
-                             str.append(ch);
-                         }
-                         else if (ch<32) {
-                             if (ch == 10) { // new line
-                                 str.append(ch);
-                             }
-                             if (ch == 13) { // carriage return
-                                 str.append(ch);
-                             }
-                             if (ch == 9) {  // tab
-                                 str.append(ch);
-                             }
-                             // otherwise skip
-                         }
-                         else {
-                        	 //Don't transfer special character to numeric entity
-                             /*str.append("&#");
-                             str.append(Integer.toString(ch));
-                             str.append(';');*/
-                             str.append(ch);
-                         }
-                     }
-                 }
-             }
-             return str.toString();
-    }
-
-    /**
-     * 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;
-
-        //assume that seperator is one charactor string
-        char seperator = getOption("accNumSeparator").charAt(0);
-
-        for (int i = 0; i < str.length(); i++) {
-            if (str.charAt(i) == seperator) {
-                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;
-
-        //assume that seperator is one charactor string
-        char seperator = getOption("accNumSeparator").charAt(0);
-
-        for (int i = 0; i < str.length(); i++) {
-            if (str.charAt(i) == seperator) {
-                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;
-
-        //assume that seperator is one charactor string
-        char seperator = getOption("accNumSeparator").charAt(0);
-
-        for (int i = 0; i < str.length(); i++) {
-            if (str.charAt(i) == seperator) {
-                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; }
-        String seperator = getOption("accNumSeparator");
-        int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
-        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; }
-        String seperator = getOption("accNumSeparator");
-        int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
-        String version = accessionNumber.substring(indexOfLastSeperator,
-                                                   accessionNumber.length());
-        accessionNumber = accessionNumber.substring(0, indexOfLastSeperator);
-        indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
-        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; }
-        String seperator = getOption("accNumSeparator");
-        int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
-        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()
-    {
-        String replicationServerName = null;
-        String serverHost = null;
-        serverHost = getOption("server");
-        // append "context/servelet/replication" to the host name
-        replicationServerName = serverHost.trim() + getOption("replicationpath").trim();
-        return replicationServerName;
-
-    }
-
-    /**
-     * 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; }
-        String seperator = MetaCatUtil.getOption("accNumSeparator");
-        char charSeperator = seperator.charAt(0);
-        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 reviseStack(Stack 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)
-    {
-        StringBuffer newUrl = new StringBuffer();
-        String whiteSpaceReplace = "%20";
-        if (urlHasWhiteSpace == null || urlHasWhiteSpace.trim().equals("")) { return null; }
-
-        for (int i = 0; i < urlHasWhiteSpace.length(); i++) {
-            char ch = urlHasWhiteSpace.charAt(i);
-            if (!Character.isWhitespace(ch)) {
-                newUrl.append(ch);
-            } else {
-                //it is white sapce, replace it by %20
-                newUrl = newUrl.append(whiteSpaceReplace);
-            }
-
-        }//for
-        logMetacat.info("The new string without space is:"
-                + newUrl.toString());
-        return newUrl.toString();
-
-    }// replaceWhiteSpaceForUR
-
-    /** 
-     * A method to read administrators and moderators list from the metacat.properties 
-     **/
-    public static void getUserAccessControlLists(){
-    	administrators = getListFromOption("administrators");
-    	moderators = getListFromOption("moderators");
-    	allowedSubmitters = getListFromOption("allowedSubmitters");
-    	deniedSubmitters = getListFromOption("deniedSubmitters");
-    }
-
-    /** 
-     * A method to read value of a given option from the metacat.properties 
-     * into specified String array
-     **/
-    private static String[] getListFromOption(String optionName){
-    	String[] list = null;
-    	String listString = MetaCatUtil.getOption(optionName);
-      
-        try {
-            if ( listString != null && !listString.trim().equals("")) {
-            	list = listString.split(":");
-            } else {
-            	list = null;
-            }
-            
-        } catch (PatternSyntaxException pse) {
-        	list = null;
-            logMetacat.error("Error in MetacatServlet.init: "
-                + pse.getMessage());
-        }
-        return list;
-    }
-    
-    /** 
-     * A method to check if the specified user is part of the moderators list 
-     **/
-    private static boolean onList(String list[], String username, String[] groups){
-
-    	if(list == null){
-    		return false;
-    	}
-
-    	// Check that the user is authenticated as an administrator account
-        for (int i = 0; i < list.length; i++) {
-            // check the given admin dn is a group dn...
-        	if(groups != null && list[i].startsWith("cn=")){
-            	// is a group dn
-        		for (int j = 0; j < groups.length; j++) {
-        			if (groups[j].equals(list[i])) {
-                		return true;
-                	}	
-        		}   		
-            } else { 
-            	// is a user dn
-            	if (username != null && username.equals(list[i])) {
-    	    		return true;
-            	}	
-            }
-        }
-        return false;
-    }
-
-    /** 
-     * A method to check if the specified user is part of the administrators list 
-     **/
-    public static boolean isAdministrator(String username, String[] groups){
-    	return (onList(administrators, username, groups));
-    }
-    
-    /** 
-     * A method to check if the specified user is part of the moderators list 
-     **/
-    public static boolean isModerator(String username, String[] groups){
-    	return (onList(moderators, username, groups));
-    }
-
-    /** 
-     * A method to check if the specified user is part of the moderators list 
-     **/
-    public static boolean isAllowedSubmitter(String username, String[] groups){
-    	if(allowedSubmitters != null){
-    		return (onList(allowedSubmitters, username, groups));
-    	} else {
-    		// no allowedSubmitters list specified - 
-    		// hence everyone should be allowed
-    		return true;
-    	}
-   }
-
-    /** 
-     * A method to check if the specified user is part of the moderators list 
-     **/
-    public static boolean isDeniedSubmitter(String username, String[] groups){
-		return (onList(deniedSubmitters, username, groups));
-    }
-    
-    /** 
-     * A method to check if the specified user can insert the document 
-     **/
-    public static boolean canInsertOrUpdate(String username, String[] groups){
-    	return (isAllowedSubmitter(username, groups) 
-    			&& !isDeniedSubmitter(username, groups));
-    }
-    
-    /**
-     * Writes debug information into a file. In metacat.properties, if property writeDebugToFile is
-     * set to true, the debug information will be written to debug file, which value is the property
-     * debugOutputFile in metacat.properties.
-     *
-     */
-    public static void writeDebugToFile(String debugInfo)
-    {
-    	String debug = MetaCatUtil.getOption("writeDebugToFile");
-    	if (debug != null && debug.equalsIgnoreCase("true"))
-    	{
-    		 try
-    		 {
-    			 File outputFile = new File(MetaCatUtil.getOption("debugOutputFile"));   			 
-    			 FileOutputStream fos = new FileOutputStream(outputFile, true);
-                 PrintWriter pw = new PrintWriter(fos);
-                 pw.println(debugInfo);
-                 pw.flush();
-                 pw.close();
-    			 fos.close();
-    			 
-    		 }
-    		 catch(Exception io)
-    		 {
-    			logMetacat.warn("Eorr in MetacatUtil.writeDebugToFile "+io.getMessage()) ;
-    		 }
-    	}
-    	
-    }
-    
-   /**
-    *  Writes debug information into a file in delimitered format
-    * @param debugInfo   the debug information
-    * @param newLine    append the debug info to a line or not
-    */
-    public static void writeDebugToDelimiteredFile(String debugInfo, boolean newLine)
-    {
-    	String debug = MetaCatUtil.getOption("writeDebugToFile");
-    	if (debug != null && debug.equalsIgnoreCase("true"))
-    	{
-    		 try
-    		 {
-    			 File outputFile = new File(MetaCatUtil.getOption("delimiteredOutputFile"));   			 
-    			 FileOutputStream fos = new FileOutputStream(outputFile, true);
-                 PrintWriter pw = new PrintWriter(fos);
-                 if (newLine)
-                 {
-                     pw.println(debugInfo);
-                 }
-                 else
-                 {
-                	 pw.print(debugInfo);
-                 }
-                 pw.flush();
-                 pw.close();
-    			 fos.close();
-    			 
-    		 }
-    		 catch(Exception io)
-    		 {
-    			logMetacat.warn("Eorr in writeDebugToDelimiteredFile "+io.getMessage()) ;
-    		 }
-    	}
-    	
-    }
-
-		/**
-     * Write the uploaded file to disk for temporary storage before moving it 
-     * to its final Metacat location.
-     *
-     * @param  filePart          the FilePart object containing the file form element
-     * @param  fileName          the name of the file to be written to disk
-     * @return tempFilePath      a String containing location of temporary file
-     */
-    public static String writeTempFile (FilePart filePart, String fileName) {
-        Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
-        String tempFilePath = null;
-        String tempDirPath = getOption("temp-dir");
-        long fileSize;
-        File tempFile;
-        File tempDir;
-
-        if ((fileName == null) || fileName.equals("")) {
-            return tempFilePath;
-        }
-				
-        // the tempfilepath token isn't set, use Java default
-        if (tempDirPath == null) {
-						String javaTempDir = System.getProperty("java.io.tempdir");
-						if (javaTempDir == null) {
-							  // no paths set, use unix default
-								tempDirPath = "/tmp";
-						} else {
-								tempDirPath = javaTempDir;
-						}
-        }
-
-        tempDir = new File(tempDirPath);
-
-        // Create the temporary directory if it doesn't exist
-        try {
-            if (!tempDir.exists()) {
-                tempDir.mkdirs();
-            }
-        } catch (SecurityException e) {
-            logMetacat.error("Can't create directory: " + tempDir.getPath() +
-                             ". Error: " + e.getMessage());
-        }
-        try {
-            tempFile = new File(tempDirPath, fileName);
-            fileSize = filePart.writeTo(tempFile);
-            tempFilePath = tempDirPath + File.separator + fileName;
-
-            if (fileSize == 0) {
-                logMetacat.error("Uploaded file '" + fileName + "'is empty!");
-            }
-        } catch (IOException e) {
-            logMetacat.error("IO exception which writing temporary file: " +
-                             tempFilePath + " " + e.getMessage());
-        }
-
-        logMetacat.info("Temporary file is: " + tempFilePath);
-
-        return tempFilePath;
-    }
-		
-		/**
-		 *
-		 * Copy a file between two locations specified as strings.  Fails
-     * if either path cannot be created. Based on the public domain
-     * FileCopy class in _Java in a Nutshell_.
-     *
-		 * @param sourceName		the source file to read from disk
-     * @param destName  		the destination file on disk
-     */
-    public static void copyFile(String sourceName, String destName) throws IOException {
-        Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
-
-        File sourceFile = new File(sourceName);
-        File destFile = new File(destName);
-        FileInputStream source = null;
-        FileOutputStream dest = null;
-        byte[] buffer;
-        int bytesRead;
-
-        try {
-            if (!sourceFile.exists() || !sourceFile.isFile()) {
-                logMetacat.error("File copy: no such source" +
-                                 " file: " + sourceName);
-            }
-            if (!sourceFile.canRead()) {
-                logMetacat.error("File copy: source file " +
-                                 "is unreadable: " + sourceName);
-            }
-
-            if (destFile.exists()) {
-                if (destFile.isFile()) {
-                    if (!destFile.canWrite()) {
-                        logMetacat.error("File copy: destination " +
-                                         "file is unwriteable: " + destFile);
-                    }
-                } else {
-                    logMetacat.error("File copy: destination file " +
-                                     "is not a file: " + destFile);
-                }
-            } else {
-                File parentDir = parent(destFile);
-
-                if (!parentDir.exists())
-                {
-                    logMetacat.error("File copy: destination diretory " +
-                                     " doesn't exist: " + destName);
-                }
-                if (!parentDir.canWrite()) {
-                    logMetacat.error("File copy: destination directory " +
-                                     " is unwritable: " + destName);
-                }
-            }
-
-            // Verbose error checking done, copy the file object
-            source = new FileInputStream(sourceFile);
-            dest = new FileOutputStream(destFile);
-            buffer = new byte[1024];
-
-            while (true) {
-                bytesRead = source.read(buffer);
-                if (bytesRead == -1) {
-                    break;
-                }
-                dest.write(buffer, 0, bytesRead);
-            }
-        }
-        finally {
-            if (source != null) {
-                try { source.close(); } catch (IOException e) { ; }
-            }
-            if (dest != null) {
-                try { dest.close(); } catch (IOException e) { ; }
-            }
-        }
-    }
-
-    private static File parent(File f) {
-        String dirname = f.getParent();
-        if (dirname == null) {
-            if (f.isAbsolute()) return new File(File.separator);
-            else return new File(System.getProperty("user.dir"));
-        }
-        return new File(dirname);
-    }
-
-    /**
-     * Adds the Properties and skin to the list of skin configurations.
-     * @param skinName String qformat
-     * @param skinProperties Properties instance
-     */
-    public static void addSkinConfig(String skinName, Properties skinProperties) {
-        skinconfigs.put(skinName, skinProperties);
-    }
-
-    /**
-     * Return the Properties for a given skin name.
-     * @param skinName String qformat
-     * @return Properties, or null if none exist for the skin.
-     */
-    public static Properties getSkinConfig(String skinName) {
-        Properties                      result;
-        
-        result = (Properties) skinconfigs.get(skinName);
-        return(result);
-    }
-    
-    /**
-     * Returns true if Properties exist for a given skin name, false otherwise.
-     * @param skinName String qformat
-     * @return boolean
-     */
-    public static boolean hasSkinConfig(String skinName) {
-        boolean                     result;
-        
-        result = skinconfigs.containsKey(skinName);
-        return(result);
-    }
-}

Property changes on: src/edu/ucsb/nceas/metacat/MetaCatUtil.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: lib/style/skins/knb/harvesterRegistrationLogin.jsp
===================================================================
--- lib/style/skins/knb/harvesterRegistrationLogin.jsp	(revision 4079)
+++ lib/style/skins/knb/harvesterRegistrationLogin.jsp	(revision 4080)
@@ -1,4 +1,4 @@
-<%@ page    language="java" %>
+<%@ page    language="java" import="java.util.Vector,edu.ucsb.nceas.metacat.util.LDAPUtil"%>
 <%
 /**
  * '$RCSfile$'
@@ -24,7 +24,11 @@
  */
  %>
 
- <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/common-settings.jsp"%>
+ 
+<% 
+	Vector<String> organizationList = LDAPUtil.getOrganizations();
+%> 
 
 <html> 
 <head>
@@ -41,7 +45,7 @@
 
 <form name="myform" 
       method="POST" 
-      action="<%=SERVER_URL_WITH_CONTEXT%>/harvesterRegistrationLogin">
+      action="<%=CONTEXT_URL%>/harvesterRegistrationLogin">
 
 <table width=400 align=center cellspacing=1 cellpadding=1 
        border=0 bgcolor="#333366">
@@ -75,13 +79,13 @@
             </font>
           </td>
           <td>
-            <input type="radio" name="o" value="NCEAS">NCEAS
-            <input type="radio" name="o" value="LTER">LTER
-            <input type="radio" name="o" value="NRS">NRS
-            <br>
-            <input type="radio" name="o" value="PISCO">PISCO
-            <input type="radio" name="o" value="OBFS">OBFS
-            <input type="radio" name="o" value="Unaffiliated">Unaffiliated
+<%
+		for (String orgName : organizationList) {
+%>       
+            <input type="radio" name="o" value="<%= orgName %>"><%= orgName %>
+<%
+			}
+%> 
         </tr>
         <tr>
           <td width='10%'> &nbsp;</td>
Index: lib/style/skins/esa/ESAHeader.jsp
===================================================================
--- lib/style/skins/esa/ESAHeader.jsp	(revision 4079)
+++ lib/style/skins/esa/ESAHeader.jsp	(revision 4080)
@@ -1,6 +1,8 @@
 <%@page contentType="text/html"%>
 <%@page pageEncoding="UTF-8"%>
-<%@page import="edu.ucsb.nceas.metacat.MetaCatUtil"%>
+<%@page import="edu.ucsb.nceas.metacat.util.MetaCatUtil"%>
+<%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
@@ -67,7 +69,7 @@
             <tr>
                 <td><a href="http://www.esa.org/" target="_top" onMouseOut="MM_swapImgRestore();" onMouseOver="MM_swapImage('ESAHome2','','ESAHeaderSlices/ESAHome2_f2.gif','ESAHome2','','ESAHeaderSlices/RollOvers/ESAHomeR.gif',1);"><img name="ESAHome2" src="ESAHeaderSlices/ESAHome2.gif" width="78" height="17" border="0" alt="ESA Home"></a></td>
                 <td colspan="2"><a href="./index.jsp" target="_top" onMouseOut="MM_swapImgRestore();" onMouseOver="MM_swapImage('ESARegistry2','','ESAHeaderSlices/RollOvers/ESARegistryR.gif',1);"><img name="ESARegistry2" src="ESAHeaderSlices/ESARegistry2.gif" width="102" height="17" border="0" alt="Registry Home"></a></td>
-                <td><a href="<%= MetaCatUtil.getOption("cgi-prefix") %>/register-dataset.cgi?cfg=esa" target="_top" onMouseOut="MM_swapImgRestore();" onMouseOver="MM_swapImage('ESARegisterNewData','','ESAHeaderSlices/RollOvers/ESANewDataSetR.gif',1);"><img name="ESARegisterNewData" src="ESAHeaderSlices/ESARegisterNewData.gif" width="154" height="17" border="0" alt="Register a New Data Set"></a></td>
+                <td><a href="<%= CGI_URL %>/register-dataset.cgi?cfg=esa" target="_top" onMouseOut="MM_swapImgRestore();" onMouseOver="MM_swapImage('ESARegisterNewData','','ESAHeaderSlices/RollOvers/ESANewDataSetR.gif',1);"><img name="ESARegisterNewData" src="ESAHeaderSlices/ESARegisterNewData.gif" width="154" height="17" border="0" alt="Register a New Data Set"></a></td>
                 <td colspan="2"><a href="./index.jsp#search" target="_top" onMouseOut="MM_swapImgRestore();" onMouseOver="MM_swapImage('ESASearch','','ESAHeaderSlices/RollOvers/ESASearchR.gif',1);"><img name="ESASearch" src="ESAHeaderSlices/ESASearch.gif" width="102" height="17" border="0" alt="Search for Data"></a></td>
                 <td><a href="#" target="_top" onMouseOut="MM_swapImgRestore();" onMouseOver="MM_swapImage('ESALogin','','ESAHeaderSlices/RollOvers/ESALoginR.gif',1);"><img name="ESALogin" src="ESAHeaderSlices/ESALogin.gif" width="57" height="17" border="0" alt="Login"></a></td>
                 <td rowspan="4"><img name="ESAHeader_r4_c10" src="ESAHeaderSlices/ESAHeader_r4_c10.gif" width="48" height="51" border="0" alt=""></td>
Index: lib/style/skins/esa/map.jsp
===================================================================
--- lib/style/skins/esa/map.jsp	(revision 4079)
+++ lib/style/skins/esa/map.jsp	(revision 4080)
@@ -29,12 +29,13 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
     
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 <title>ESA Data Registry Interactive Map</title>
-<link rel="stylesheet" href="<%=SERVER_URL_WITH_CONTEXT%>/style/default.css" type="text/css">
+<link rel="stylesheet" href="<%=CONTEXT_URL%>/style/default.css" type="text/css">
   <link rel="stylesheet" type="text/css" 
         href="<%=STYLE_SKINS_URL%>/esa/esa.css"></link>
   <script language="JavaScript" type="text/JavaScript"
@@ -44,8 +45,8 @@
 </head>
 <body>
       <script language="JavaScript">
-          insertTemplateOpening("<%=SERVER_URL_WITH_CONTEXT%>");
-          //insertSearchBox("<%=SERVER_URL_WITH_CONTEXT%>");
+          insertTemplateOpening("<%=CONTEXT_URL%>");
+          //insertSearchBox("<%=CONTEXT_URL%>");
       </script>
 
 <iframe scrolling="no" frameborder="0" width="750" height="520" src="spatial/map.jsp">
@@ -53,7 +54,7 @@
 </iframe>
 
 <script language="JavaScript">          
-    insertTemplateClosing("<%=SERVER_URL_WITH_CONTEXT%>");
+    insertTemplateClosing("<%=CONTEXT_URL%>");
 </script>
 </body>
 </html>
Index: lib/style/skins/knb/knb.properties.metadata.xml
===================================================================
--- lib/style/skins/knb/knb.properties.metadata.xml	(nonexistent)
+++ lib/style/skins/knb/knb.properties.metadata.xml	(revision 4080)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<metadataConfig>
+	<group>
+		<index>1</index>
+		<name>Skins Configuration</name>
+		<comment>Choose configure the skins that will be available in this instance of MetaCat.</comment> 
+		<description>Skin Configuration Values.</description>
+	</group>
+
+	<config>
+		<key>registry.db.connection</key>
+		<label>Database Connection</label>
+		<group>1</group>
+		<index>1</index>
+		<description>Local database connection string.</description>
+	</config>
+	
+	<config>
+		<key>registry.db.user</key>
+		<label>Database Username</label>
+		<group>1</group>
+		<index>2</index>
+		<description>Local database user name.</description>
+	</config>
+
+	<config>
+		<key>registry.db.password</key>
+		<label>Database Password</label>
+		<group>1</group>
+		<fieldType>password</fieldType>
+		<index>3</index>
+		<description>Local database password.</description>
+	</config>
+
+</metadataConfig>
\ No newline at end of file

Property changes on: lib/style/skins/knb/knb.properties.metadata.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/dev/settings.jsp
===================================================================
--- lib/style/skins/dev/settings.jsp	(revision 4079)
+++ lib/style/skins/dev/settings.jsp	(revision 4080)
@@ -1,37 +1,36 @@
 <%@ page errorPage="jsperrorpage.html" %>
-<%@ page import="edu.ucsb.nceas.metacat.MetaCatUtil" %>
+<%@ page import="edu.ucsb.nceas.metacat.util.SystemUtil" %>
 <%
-/*
- *   '$RCSfile$'
- *     Authors: Matthew Brooke
- *   Copyright: 2000 Regents of the University of California and the
- *              National Center for Ecological Analysis and Synthesis
- * For Details: http://www.nceas.ucsb.edu/
- *
- *    '$Author$'
- *      '$Date$'
- *  '$Revision$'
- *
- * Settings file for the default metacat skin
- *
- * 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
- */
+	 /*
+	 *   '$RCSfile$'
+	 *     Authors: Matthew Brooke
+	 *   Copyright: 2000 Regents of the University of California and the
+	 *              National Center for Ecological Analysis and Synthesis
+	 * For Details: http://www.nceas.ucsb.edu/
+	 *
+	 *    '$Author$'
+	 *      '$Date$'
+	 *  '$Revision$'
+	 *
+	 * Settings file for the default metacat skin
+	 *
+	 * 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 a special case where we do not include style/common/common-settings.jsp  
-  String  LOCAL_SERVLET_URL  = 
-     MetaCatUtil.getOption("httpserver") + "/" + MetaCatUtil.getOption("context") + "/metacat";
+<%
+	// This is a special case where we do not include style/common/common-settings.jsp  
+	String LOCAL_SERVLET_URL = SystemUtil.getServletURL();
 %>
\ No newline at end of file
Index: lib/style/common/ClientViewHelper.jspx
===================================================================
--- lib/style/common/ClientViewHelper.jspx	(revision 4079)
+++ lib/style/common/ClientViewHelper.jspx	(revision 4080)
@@ -3,7 +3,7 @@
     
     <jsp:directive.page contentType="text/html;charset=UTF-8"/>
     <jsp:directive.page import="com.oreilly.servlet.multipart.MultipartParser"/>
-    <jsp:directive.page import="edu.ucsb.nceas.metacat.MetaCatUtil"/>
+    <jsp:directive.page import="edu.ucsb.nceas.metacat.service.PropertyService"/>
     <jsp:directive.page import="java.io.*"/>
     <jsp:directive.page import="javax.servlet.*"/>
     <jsp:directive.page import="javax.servlet.http.*"/>
@@ -24,7 +24,7 @@
         if (contentType != null &amp;&amp; (contentType.indexOf("multipart/form-data") > -1)) {
             //*** Process request here if a file update.
             //*** Init the MultipartParser.
-            sizeLimit = (new Integer(MetaCatUtil.getOption("datafilesizelimit"))).intValue();
+            sizeLimit = (new Integer(PropertyService.getProperty("datafilesizelimit"))).intValue();
             multipartParser = new MultipartParser(request, sizeLimit * 1024 * 1024);
             message = clientHelper.handleFileUpdate(multipartParser);
         } else {
Index: src/upgrade-db-to-1.4.sql
===================================================================
--- src/upgrade-db-to-1.4.sql	(revision 4079)
+++ src/upgrade-db-to-1.4.sql	(revision 4080)
@@ -101,10 +101,10 @@
  * Update the XML_CATALOG table with new entries, and change old ones
  */
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', '@eml2_0_1namespace@', '@systemidserver@@html-path@/schema/eml-2.0.1/eml.xsd');
+  VALUES ('Schema', '@eml2_0_1namespace@', '/schema/eml-2.0.1/eml.xsd');
 UPDATE xml_catalog
-  SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/eml.xsd'
+  SET system_id = '/schema/eml-2.0.0/eml.xsd'
   WHERE public_id = '@eml2_0_0namespace@';
 UPDATE xml_catalog
-  SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/stmml.xsd'
+  SET system_id = '/schema/eml-2.0.0/stmml.xsd'
   WHERE public_id = '@stmmlnamespace@';
Index: src/upgrade-db-to-1.5-postgres.sql
===================================================================
--- src/upgrade-db-to-1.5-postgres.sql	(revision 4079)
+++ src/upgrade-db-to-1.5-postgres.sql	(revision 4080)
@@ -30,49 +30,49 @@
  * to local schema or dtd file.
  */
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-access-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-access-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-access-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-attribute-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-attribute-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-attribute-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-constraint-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-constraint-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-constraint-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-coverage-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-coverage-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-coverage-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-coverage-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-coverage-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-coverage-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-dataset-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-dataset-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-dataset-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-entity-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-entity-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-entity-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-literature-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-literature-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-literature-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-physical-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-physical-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-physical-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-project-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-project-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-project-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-protocol-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-protocol-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-protocol-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-software-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-software-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-software-@eml-version@//EN';
 UPDATE xml_catalog
-  SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/eml.xsd'
+  SET system_id = '/schema/eml-2.0.0/eml.xsd'
   WHERE public_id = '@eml2_0_0namespace@';
 UPDATE xml_catalog
-  SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.1/eml.xsd'
+  SET system_id = '/schema/eml-2.0.1/eml.xsd'
   WHERE public_id = '@eml2_0_1namespace@';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/stmml.xsd'
+   SET system_id = '/schema/eml-2.0.0/stmml.xsd'
    WHERE public_id = '@stmmlnamespace@';
    
 /*
@@ -84,8 +84,8 @@
     WHERE docid IN (SELECT docid from xml_documents WHERE doctype LIKE 'eml://ecoinformatics.org/eml-2.0.1');
 
 
+CREATE SEQUENCE xml_returnfield_id_seq;
 
-
 /*
  * Returnfields -- table to store combinations of returnfields requested
  *                  and the number of times this table is accessed
@@ -96,10 +96,11 @@
         usage_count        INT8,                                             -- the number of times this string has been requested
         CONSTRAINT xml_returnfield_pk PRIMARY KEY (returnfield_id)
 );
-CREATE INDEX xml_returnfield_idx1 ON xml_returnfield(returnfield_string);
-                                                                                  
-CREATE SEQUENCE xml_returnfield_id_seq;
-                                                                                  
+CREATE INDEX xml_returnfield_idx1 ON xml_returnfield(returnfield_string);                                                                                 
+ 
+
+CREATE SEQUENCE xml_queryresult_id_seq;
+
 /*
  * Queryresults -- table to store queryresults for a given docid
  * and returnfield_id
@@ -115,7 +116,6 @@
                FOREIGN KEY (returnfield_id) REFERENCES xml_returnfield
 );
 
-CREATE SEQUENCE xml_queryresult_id_seq;
 
 ALTER TABLE xml_nodes ADD nodedatanumerical FLOAT8;
 
Index: src/xmltables.sql
===================================================================
--- src/xmltables.sql	(revision 4079)
+++ src/xmltables.sql	(revision 4080)
@@ -37,6 +37,7 @@
 DROP SEQUENCE xml_returnfield_id_seq;
 DROP SEQUENCE xml_queryresult_id_seq;
 DROP SEQUENCE xml_path_index_id_seq;
+DROP SEQUENCE db_version_id_seq;
 
 /* Drop triggers are not necessary */
 DROP TRIGGER xml_nodes_before_insert;
@@ -48,6 +49,7 @@
 DROP TRIGGER access_log_before_insert;
 DROP TRIGGER xml_returnfield_before_insert;
 DROP TRIGGER xml_queryresult_before_insert;
+DROP TRIGGER db_version_before_insert;
 
 
 DROP TABLE xml_index;
@@ -68,6 +70,7 @@
 DROP TABLE xml_queryresult;
 DROP TABLE xml_returnfield;
 DROP TABLE xml_path_index;
+DROP TABLE db_version;
 
 /*
  *Replication -- table to store servers that metacat is replicated to
@@ -547,3 +550,24 @@
         FOREIGN KEY (harvest_log_id) REFERENCES harvest_log
 );
 
+/*
+ * db_version -- table to store the version history of this database
+ */
+CREATE TABLE db_version (
+  db_version_id   NUMBER(20),       -- the identifier for the version
+  version         VARCHAR(250),     -- the version number
+  status          NUMBER(20),       -- status of the version
+  date_created    DATE,             -- the datetime on which the version was created
+  CONSTRAINT db_version_pk PRIMARY KEY (db_version_id)
+);
+
+CREATE SEQUENCE db_version_id_seq;
+CREATE TRIGGER db_version_before_insert
+BEFORE INSERT ON db_version FOR EACH ROW
+BEGIN
+  SELECT db_version_id_seq.nextval
+    INTO :new.db_version_id
+    FROM dual;
+END;
+/
+
Index: src/loaddtdschema-postgres.sql
===================================================================
--- src/loaddtdschema-postgres.sql	(nonexistent)
+++ src/loaddtdschema-postgres.sql	(revision 4080)
@@ -0,0 +1,50 @@
+DELETE FROM xml_catalog 
+      WHERE entry_type LIKE 'DTD'
+        AND public_id LIKE '%@eml-version@%';
+DELETE FROM xml_catalog 
+      WHERE entry_type LIKE 'Schema'
+        AND system_id LIKE '%eml%';
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-access-@eml-version@//EN',
+         '/dtd/eml-access-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-attribute-@eml-version@//EN',
+          '/dtd/eml-attribute-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-constraint-@eml-version@//EN',
+          '/dtd/eml-constraint-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-coverage-@eml-version@//EN',
+          '/dtd/eml-coverage-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-dataset-@eml-version@//EN',
+          '/dtd/eml-dataset-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-entity-@eml-version@//EN',
+          '/dtd/eml-entity-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-literature-@eml-version@//EN',
+          '/dtd/eml-literature-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-physical-@eml-version@//EN',
+          '/dtd/eml-physical-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-project-@eml-version@//EN',
+          '/dtd/eml-project-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-protocol-@eml-version@//EN',
+          '/dtd/eml-protocol-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('DTD', '-//ecoinformatics.org//eml-software-@eml-version@//EN',
+          '/dtd/eml-software-@eml-version@.dtd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('Schema', '@eml2_0_1namespace@', '/schema/eml-2.0.1/eml.xsd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('Schema', '@eml2_0_0namespace@', '/schema/eml-2.0.0/eml.xsd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('Schema', '@stmmlnamespace@', '/schema/eml-2.0.1/stmml.xsd');
+INSERT INTO xml_catalog (entry_type, public_id, system_id)
+  VALUES ('Schema', 'metadata', '/schema/fgdc-std-001/fgdc-std-001-1998.xsd');
+
+INSERT INTO db_version (version, status, date_created) 
+  VALUES ('1.9.0',1,CURRENT_DATE);

Property changes on: src/loaddtdschema-postgres.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/edu/ucsb/nceas/metacat/DBValidate.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBValidate.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBValidate.java	(revision 4080)
@@ -38,11 +38,12 @@
 
 import org.w3c.dom.*;
 import org.xml.sax.*;
-import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderFactory;
 
 import com.arbortext.catalog.*;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+
 /**
  * Name: DBValidate.java
  *       Purpose: A Class that validates XML documents
@@ -70,7 +71,7 @@
     alreadyHandle = false;
     try {
       // Get an instance of the parser
-      String parserName = MetaCatUtil.getOption("saxparser");
+      String parserName = PropertyService.getProperty("saxparser");
       parser = XMLReaderFactory.createXMLReader(parserName);
       parser.setFeature("http://xml.org/sax/features/validation",true);
       //parser.setValidationMode(true);     // Oracle
@@ -227,7 +228,6 @@
 
     String doc = args[0];
 
-    MetaCatUtil util = new MetaCatUtil();
     DBConnection conn = null;
     int serailNumber = -1;
     try {
Index: src/edu/ucsb/nceas/metacat/SubTree.java
===================================================================
--- src/edu/ucsb/nceas/metacat/SubTree.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/SubTree.java	(revision 4080)
@@ -36,6 +36,8 @@
 import org.apache.log4j.Logger;
 import org.xml.sax.SAXException;
 
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+
 /**
  * A Class that represents an XML Subtree
  */
Index: src/edu/ucsb/nceas/metacat/advancedsearch/BrowseServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/advancedsearch/BrowseServlet.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/advancedsearch/BrowseServlet.java	(revision 4080)
@@ -37,7 +37,10 @@
 import javax.servlet.http.HttpSession;
 
 import edu.ucsb.nceas.metacat.client.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /** 
  * @author dcosta
@@ -107,28 +110,28 @@
   }
   
   /**
-   * Initializes the servlet. Reads properties and initializes object fields.
-   * 
-   * @throws ServletException
-   */
-  public void init(ServletConfig config) throws ServletException {
-	ServletContext context = null;
-    String dirPath;
-    Options options = null;
+	 * Initializes the servlet. Reads properties and initializes object fields.
+	 * 
+	 * @throws ServletException
+	 */
+	public void init(ServletConfig config) throws ServletException {
+		ServletContext context = null;
+		String dirPath;
+		Options options = null;
 
-    super.init(config);
-    context = config.getServletContext();
-    dirPath = context.getRealPath(CONFIG_DIR);
-    File propertyFile = new File(dirPath, CONFIG_NAME);
-    
-    try {
-      options = Options.initialize(propertyFile);
-    }
-    catch (IOException e) {
-      System.err.println("Error in loading options: " + e.getMessage());
-    }
-    
-    this.contextString = options.getOption("context");
-  }
+		super.init(config);
+		context = config.getServletContext();
+		dirPath = context.getRealPath(CONFIG_DIR);
+		File propertyFile = new File(dirPath, CONFIG_NAME);
 
+		try {
+			options = Options.initialize(propertyFile);
+			this.contextString = PropertyService.getProperty("application.context");
+		} catch (IOException e) {
+			System.err.println("Error in loading options: " + e.getMessage());
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("couldn't read property during initialization: "
+					+ pnfe.getMessage());
+		}
+	}
 }
Index: lib/style/skins/pisco/templates/jsp/portal_settings.jsp
===================================================================
--- lib/style/skins/pisco/templates/jsp/portal_settings.jsp	(revision 4079)
+++ lib/style/skins/pisco/templates/jsp/portal_settings.jsp	(revision 4080)
@@ -30,6 +30,7 @@
 %>
 
 <%@ include file="../../../../common/common-settings.jsp"%>
+<%@ include file="../../../../common/configure-check.jsp"%>
 
 <% 
 // Global settings for metacat are in common-settings.jsp.  Use this file to
Index: lib/style/common/configure-check.jsp
===================================================================
--- lib/style/common/configure-check.jsp	(nonexistent)
+++ lib/style/common/configure-check.jsp	(revision 4080)
@@ -0,0 +1,36 @@
+<%@ page errorPage="jsperrorpage.html"%>
+<%@page import="edu.ucsb.nceas.metacat.util.MetaCatUtil"%>
+<%
+	 /**
+	 *   '$RCSfile$'
+	 *   Copyright: 2008 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
+	 */
+%>
+
+<%
+if (!MetaCatUtil.isMetacatConfigured()) {
+%>
+	<jsp:forward page="/metacat" />
+<%
+}
+%>
+

Property changes on: lib/style/common/configure-check.jsp
___________________________________________________________________
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/upgrade_db_to_1_5.java
===================================================================
--- src/upgrade_db_to_1_5.java	(revision 4079)
+++ src/upgrade_db_to_1_5.java	(revision 4080)
@@ -33,14 +33,27 @@
 import java.sql.SQLException;
 import java.sql.DriverManager;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 public class upgrade_db_to_1_5{
 
-    static String database = MetaCatUtil.getOption("databaseType");
-    static String url = MetaCatUtil.getOption("defaultDB");
-    static String user = MetaCatUtil.getOption("user");
-    static String password = MetaCatUtil.getOption("password");
+    static String database = null;
+    static String url = null;
+    static String user = null;
+    static String password = null;
+    static {
+    	try {
+    	    database = PropertyService.getProperty("database.type");
+    	    url = PropertyService.getProperty("database.connectionURI");
+    	    user = PropertyService.getProperty("database.user");
+    	    password = PropertyService.getProperty("database.password");
+    	} catch (PropertyNotFoundException pnfe) {
+            System.err.println("Error in upgrade_db_to_1_5 static block:"
+                    + pnfe.getMessage());
+            pnfe.printStackTrace();
+    	}
+     }
 
     public static void upgrade_xml_nodes(Connection sqlca) throws SQLException{
         Statement sqlStatement = null;
@@ -134,7 +147,7 @@
             Connection sqlca = null;
 
             // Create a JDBC connection to the database
-            if (database.equals("oracle") {
+            if (database.equals("oracle")) {
             	DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
             } 
             else if (database.equals("postgresql")) {
Index: src/upgrade-db-to-1.9.sql
===================================================================
--- src/upgrade-db-to-1.9.sql	(nonexistent)
+++ src/upgrade-db-to-1.9.sql	(revision 4080)
@@ -0,0 +1,23 @@
+/*
+ * db_version -- table to store the version history of this database
+ */
+CREATE TABLE db_version (
+  db_version_id   NUMBER(20),       -- the identifier for the version
+  version         VARCHAR(250),     -- the version number
+  status          NUMBER(20),       -- status of the version
+  date_created    DATE,             -- the datetime on which the version was created
+  CONSTRAINT db_version_pk PRIMARY KEY (db_version_id)
+);
+
+CREATE SEQUENCE db_version_id_seq;
+CREATE TRIGGER db_version_before_insert
+BEFORE INSERT ON db_version FOR EACH ROW
+BEGIN
+  SELECT db_version_id_seq.nextval
+    INTO :new.db_version_id
+    FROM dual;
+END;
+/
+
+INSERT INTO db_version (version, status, date_created) 
+  VALUES ('1.8.0', 1, CURRENT_DATE);

Property changes on: src/upgrade-db-to-1.9.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/loaddtd.sql
===================================================================
--- src/loaddtd.sql	(revision 4079)
+++ src/loaddtd.sql	(revision 4080)
@@ -3,34 +3,34 @@
         AND public_id LIKE '%@eml-version@%';
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-access-@eml-version@//EN',
-         '@systemidserver@@html-path@/dtd/eml-access-@eml-version@.dtd');
+         '/dtd/eml-access-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-attribute-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-attribute-@eml-version@.dtd');
+          '/dtd/eml-attribute-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-constraint-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-constraint-@eml-version@.dtd');
+          '/dtd/eml-constraint-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-coverage-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-coverage-@eml-version@.dtd');
+          '/dtd/eml-coverage-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-dataset-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-dataset-@eml-version@.dtd');
+          '/dtd/eml-dataset-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-entity-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-entity-@eml-version@.dtd');
+          '/dtd/eml-entity-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-literature-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-literature-@eml-version@.dtd');
+          '/dtd/eml-literature-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-physical-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-physical-@eml-version@.dtd');
+          '/dtd/eml-physical-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-project-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-project-@eml-version@.dtd');
+          '/dtd/eml-project-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-protocol-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-protocol-@eml-version@.dtd');
+          '/dtd/eml-protocol-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-software-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-software-@eml-version@.dtd');
+          '/dtd/eml-software-@eml-version@.dtd');
Index: src/upgrade-db-to-1.6-postgres.sql
===================================================================
--- src/upgrade-db-to-1.6-postgres.sql	(revision 4079)
+++ src/upgrade-db-to-1.6-postgres.sql	(revision 4080)
@@ -120,7 +120,7 @@
  * Delete the records from xml_index table which point to old revisions in xml_index
  * This is possible for documents for which the indexing thread failed during UPDATE
  */
-DELETE FROM xml_index WHERE nodeid = xml_nodes_revisions.nodeid;
+DELETE FROM xml_index WHERE nodeid IN (SELECT nodeid FROM xml_nodes_revisions);
 
 
 
Index: src/edu/ucsb/nceas/dbadapter/AbstractDatabase.java
===================================================================
--- src/edu/ucsb/nceas/dbadapter/AbstractDatabase.java	(revision 4079)
+++ src/edu/ucsb/nceas/dbadapter/AbstractDatabase.java	(revision 4080)
@@ -29,8 +29,9 @@
 package edu.ucsb.nceas.dbadapter;
 
 import java.sql.*;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+
 /**
  * Java offers uniform database access through the use of JDBC.
  * But many databases still use different SQL implementations and 
@@ -136,7 +137,7 @@
     // Determine our db adapter class and
     // create an instance of that class
     try {
-      String dbAdapter = MetaCatUtil.getOption("dbAdapter");
+      String dbAdapter = PropertyService.getProperty("database.adapter");
       AbstractDatabase dbAdapterObj = (AbstractDatabase)createObject(dbAdapter);
       
       // test if they work correctly
Index: src/edu/ucsb/nceas/metacat/MetacatReplication.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetacatReplication.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/MetacatReplication.java	(revision 4080)
@@ -26,17 +26,25 @@
 
 package edu.ucsb.nceas.metacat;
 
-import edu.ucsb.nceas.dbadapter.AbstractDatabase;
 import java.util.*;
 import java.util.Date;
 import java.io.*;
 import java.sql.*;
 import java.net.*;
-import java.lang.*;
 import java.text.*;
+
 import javax.servlet.*;
 import javax.servlet.http.*;
 
+import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.service.SessionService;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SessionData;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 import org.apache.log4j.Logger;
 import org.xml.sax.*;
 
@@ -46,7 +54,6 @@
   private Date firstTime;
   private boolean timedReplicationIsOn = false;
   Timer replicationDaemon;
-  private static MetaCatUtil util = new MetaCatUtil();
   private Vector fileLocks = new Vector();
   private Thread lockThread = null;
   private static final AbstractDatabase dbAdapter = MetaCatUtil.dbAdapter;
@@ -64,18 +71,17 @@
   public void init(ServletConfig config) throws ServletException
   {
      //initialize db connections to handle any update requests
-    MetaCatUtil util = new MetaCatUtil();
-    //deltaT = util.getOption("deltaT");
+    //deltaT = util.getProperty("deltaT");
     //the default deltaT can be set from metacat.properties
     //create a thread to do the delta-T check but don't execute it yet
     replicationDaemon = new Timer(true);
     try
     {
-       timedReplicationIsOn = (new Boolean(util.getOption(TIMEREPLICATION ).trim())).booleanValue();
+       timedReplicationIsOn = (new Boolean(PropertyService.getProperty(TIMEREPLICATION ).trim())).booleanValue();
        logMetacat.info("The timed replication on is"+timedReplicationIsOn);
-       timeInterval = (new Long(util.getOption(TIMEREPLICATIONINTERVAl).trim())).longValue();
+       timeInterval = (new Long(PropertyService.getProperty(TIMEREPLICATIONINTERVAl).trim())).longValue();
        logMetacat.warn("The timed replication time Inerval is "+ timeInterval);
-       String firstTimeStr = util.getOption(FIRSTTIME);
+       String firstTimeStr = PropertyService.getProperty(FIRSTTIME);
        logMetacat.warn("first replication time form property is "+firstTimeStr);
        firstTime = ReplicationHandler.combinateCurrentDateAndGivenTime(firstTimeStr);
        logMetacat.warn("After combine current time, the real first time is "
@@ -171,24 +177,32 @@
           // start, stop, getall and servercontrol need to check
           // if user is administor
           HttpSession sess = request.getSession(true);
+          SessionData sessionData = null;
           String sess_id = "";
           String username = "";
           String[] groupnames = {""};
-          Hashtable sessionHash = MetaCatServlet.getSessionHash();
+
           if (params.containsKey("sessionid")) 
           {
              sess_id = ((String[]) params.get("sessionid"))[0];
              logMetacat.info("in has sessionid "+ sess_id);
-             if (sessionHash.containsKey(sess_id)) 
+             if (SessionService.isSessionRegistered(sess_id)) 
              {
                   logMetacat.info("find the id " + sess_id + " in hash table");
-                  sess = (HttpSession) sessionHash.get(sess_id);
+                  sessionData = SessionService.getRegisteredSession(sess_id);
              }
            } 
-           username = (String) sess.getAttribute("username");
+          if (sessionData == null) {
+        	  sessionData = new SessionData(sess.getId(), 
+					(String) sess.getAttribute("username"), 
+					(String[]) sess.getAttribute("groups"),
+					(String) sess.getAttribute("password"));
+          }
+          
+           username = sessionData.getUserName();
            logMetacat.warn("The user name from session is: "+ username);
-           groupnames = (String[]) sess.getAttribute("groupnames");
-           if (!MetaCatUtil.isAdministrator(username, groupnames)) 
+           groupnames = sessionData.getGroupNames();
+           if (!LDAPUtil.isAdministrator(username, groupnames)) 
            {
                PrintWriter out = response.getWriter();
                out.print("<error>");
@@ -231,7 +245,7 @@
       replicationDaemon.cancel();
       replicationDaemon = new Timer(true);
       timedReplicationIsOn = false;
-      MetaCatUtil.setOption(TIMEREPLICATION, (new Boolean(timedReplicationIsOn)).toString());
+      PropertyService.setProperty(TIMEREPLICATION, (new Boolean(timedReplicationIsOn)).toString());
       out.println("Replication Handler Stopped");
       MetacatReplication.replLog("deltaT handler stopped");
 
@@ -278,11 +292,11 @@
       
       timedReplicationIsOn = true;
       // save settings to property file
-      MetaCatUtil.setOption(TIMEREPLICATION, (new Boolean(timedReplicationIsOn)).toString());
+      PropertyService.setProperty(TIMEREPLICATION, (new Boolean(timedReplicationIsOn)).toString());
       // note we couldn't use firstTime object because it has date info
       // we only need time info such as 10:00 PM
-      MetaCatUtil.setOption(FIRSTTIME, firstTimeStr);
-      MetaCatUtil.setOption(TIMEREPLICATIONINTERVAl, (new Long(timeInterval)).toString());
+      PropertyService.setProperty(FIRSTTIME, firstTimeStr);
+      PropertyService.setProperty(TIMEREPLICATIONINTERVAl, (new Long(timeInterval)).toString());
       replicationDaemon.cancel();
       replicationDaemon = new Timer(true);
       replicationDaemon.scheduleAtFixedRate(new ReplicationHandler(), firstTime,
@@ -511,70 +525,73 @@
 
   }
 
-  // download certificate with the public key from certURL and
-  // upload it onto this server; it then must be imported as a
-  // trusted certificate
-  private void downloadCertificate (String certURL)
-                throws FileNotFoundException, IOException, MalformedURLException
-  {
-    MetaCatUtil util = new MetaCatUtil();
-    String certPath = util.getOption("certPath"); //the path to be uploaded to
+   	// download certificate with the public key from certURL and
+	// upload it onto this server; it then must be imported as a
+	// trusted certificate
+	private void downloadCertificate(String certURL) throws FileNotFoundException,
+			IOException, MalformedURLException, PropertyNotFoundException {
+		
+		// the path to be uploaded to
+		String certPath = PropertyService.getProperty("application.tomcatDir")
+				+ "/webapps/" + PropertyService.getProperty("application.context"); 
 
-    // get filename from the URL of the certificate
-    String filename = certURL;
-    int slash = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
-    if ( slash > -1 ) {
-      filename = filename.substring(slash + 1);
-    }
+		// get filename from the URL of the certificate
+		String filename = certURL;
+		int slash = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
+		if (slash > -1) {
+			filename = filename.substring(slash + 1);
+		}
 
-    // open file output strem to write the input into it
-    File f = new File(certPath, filename);
-    synchronized (f) {
-      try {
-        if ( f.exists() ) {
-          throw new IOException("File already exist: " + f.getCanonicalFile());
-          //if ( f.exists() && !f.canWrite() ) {
-          //  throw new IOException("Not writable: " + f.getCanonicalFile());
-        }
-      } catch (SecurityException se) {
-        // if a security manager exists,
-        // its checkRead method is called for f.exist()
-        // or checkWrite method is called for f.canWrite()
-        throw se;
-      }
+		// open file output strem to write the input into it
+		File f = new File(certPath, filename);
+		synchronized (f) {
+			try {
+				if (f.exists()) {
+					throw new IOException("File already exist: " + f.getCanonicalFile());
+					// if ( f.exists() && !f.canWrite() ) {
+					// throw new IOException("Not writable: " +
+					// f.getCanonicalFile());
+				}
+			} catch (SecurityException se) {
+				// if a security manager exists,
+				// its checkRead method is called for f.exist()
+				// or checkWrite method is called for f.canWrite()
+				throw se;
+			}
 
-      // create a buffered byte output stream
-      // that uses a default-sized output buffer
-      FileOutputStream fos = new FileOutputStream(f);
-      BufferedOutputStream out = new BufferedOutputStream(fos);
+			// create a buffered byte output stream
+			// that uses a default-sized output buffer
+			FileOutputStream fos = new FileOutputStream(f);
+			BufferedOutputStream out = new BufferedOutputStream(fos);
 
-      // this should be http url
-      URL url = new URL(certURL);
-      BufferedInputStream bis = null;
-      try {
-        bis = new BufferedInputStream(url.openStream());
-        byte[] buf = new byte[4 * 1024]; // 4K buffer
-        int b = bis.read(buf);
-        while (b != -1) {
-          out.write(buf, 0, b);
-          b = bis.read(buf);
-        }
-      } finally {
-        if (bis != null) bis.close();
-      }
-      // the input and the output streams must be closed
-      bis.close();
-            out.flush();
-            out.close();
-            fos.close();
-    } // end of synchronized(f)
-  }
+			// this should be http url
+			URL url = new URL(certURL);
+			BufferedInputStream bis = null;
+			try {
+				bis = new BufferedInputStream(url.openStream());
+				byte[] buf = new byte[4 * 1024]; // 4K buffer
+				int b = bis.read(buf);
+				while (b != -1) {
+					out.write(buf, 0, b);
+					b = bis.read(buf);
+				}
+			} finally {
+				if (bis != null)
+					bis.close();
+			}
+			// the input and the output streams must be closed
+			bis.close();
+			out.flush();
+			out.close();
+			fos.close();
+		} // end of synchronized(f)
+	}
 
   /**
-   * when a forcereplication request comes in, local host sends a read request
-   * to the requesting server (remote server) for the specified docid.
-   * Then store it in local database.
-   */
+	 * when a forcereplication request comes in, local host sends a read request
+	 * to the requesting server (remote server) for the specified docid. Then
+	 * store it in local database.
+	 */
   private void handleForceReplicateRequest(PrintWriter out, Hashtable params,
                                            HttpServletResponse response, HttpServletRequest request)
   {
@@ -599,13 +616,13 @@
       logMetacat.info("Force replication action: "+dbaction);
       // sending back read request to remote server
       URL u = new URL("https://" + server + "?server="
-                +util.getLocalReplicationServerName()
+                +MetaCatUtil.getLocalReplicationServerName()
                 +"&action=read&docid=" + docid);
       String xmldoc = MetacatReplication.getURLContent(u);
 
       // get the document info from server
       URL docinfourl = new URL("https://" + server +
-                               "?server="+util.getLocalReplicationServerName()
+                               "?server="+MetaCatUtil.getLocalReplicationServerName()
                                +"&action=getdocumentinfo&docid=" + docid);
 
       String docInfoStr = MetacatReplication.getURLContent(docinfourl);
@@ -759,7 +776,7 @@
       logMetacat.info("Force replication action: "+dbaction);
       // get the document info from server
       URL docinfourl = new URL("https://" + server +
-                               "?server="+util.getLocalReplicationServerName()
+                               "?server="+MetaCatUtil.getLocalReplicationServerName()
                                +"&action=getdocumentinfo&docid=" + docid);
 
       String docInfoStr = MetacatReplication.getURLContent(docinfourl);
@@ -798,9 +815,9 @@
         //Get data file and store it into local file system.
         // sending back readdata request to server
         URL url = new URL("https://" + server + "?server="
-                +util.getLocalReplicationServerName()
+                +MetaCatUtil.getLocalReplicationServerName()
                 +"&action=readdata&docid=" + docid);
-        String datafilePath = util.getOption("datafilepath");
+        String datafilePath = PropertyService.getProperty("application.datafilepath");
         //register data file into xml_documents table and wite data file
         //into file system
         DocumentImpl.writeDataFileInReplication(url.openStream(), datafilePath,
@@ -941,7 +958,7 @@
 
   {
     // File path for data file
-    String filepath = util.getOption("datafilepath");
+    String filepath;
     // Request docid
     String docId = ((String[])(params.get("docid")))[0];
     //check if the doicd is null
@@ -955,9 +972,10 @@
     //in the key store, this is security issue
     try
     {
+      filepath = PropertyService.getProperty("application.datafilepath");
       String server = ((String[])params.get("server"))[0];
       URL u = new URL("https://" + server + "?server="
-                +util.getLocalReplicationServerName()
+                +MetaCatUtil.getLocalReplicationServerName()
                 +"&action=test");
       String test = MetacatReplication.getURLContent(u);
       //couldn't pass the test
@@ -1062,7 +1080,7 @@
       //in the key store, this is security issue
       String server = ((String[])params.get("server"))[0];
       URL u = new URL("https://" + server + "?server="
-                +util.getLocalReplicationServerName()
+                +MetaCatUtil.getLocalReplicationServerName()
                 +"&action=test");
       String test = MetacatReplication.getURLContent(u);
       //couldn't pass the test
@@ -1144,7 +1162,7 @@
       //try to open a https stream to test if the request server's public key
       //in the key store, this is security issue
       URL u = new URL("https://" + server + "?server="
-                +util.getLocalReplicationServerName()
+                +MetaCatUtil.getLocalReplicationServerName()
                 +"&action=test");
       String test = MetacatReplication.getURLContent(u);
       //couldn't pass the test
@@ -1180,8 +1198,8 @@
 
       // Append local server's name and replication servlet to doclist
       doclist.append("<?xml version=\"1.0\"?><replication>");
-      doclist.append("<server>").append(util.getLocalReplicationServerName());
-      //doclist.append(util.getOption("replicationpath"));
+      doclist.append("<server>").append(MetaCatUtil.getLocalReplicationServerName());
+      //doclist.append(util.getProperty("replicationpath"));
       doclist.append("</server><updates>");
 
       // Get correct docid that reside on this server according the requesting
@@ -1220,7 +1238,7 @@
       ResultSet rs = pstmt.getResultSet();
       boolean tablehasrows = rs.next();
       //If metacat configed to replicate data file
-      //if ((util.getOption("replicationsenddata")).equals("on"))
+      //if ((util.getProperty("replicationsenddata")).equals("on"))
       boolean replicateData = serverList.getDataReplicationValue(server);
       if (replicateData)
       {
@@ -1228,7 +1246,7 @@
         {
           String recordDoctype = rs.getString(3);
           Vector packagedoctypes = MetaCatUtil.getOptionList(
-                                     MetaCatUtil.getOption("packagedoctype"));
+                                     PropertyService.getProperty("packagedoctype"));
           //if this is a package file, put it at the end
           //because if a package file is read before all of the files it
           //refers to are loaded then there is an error
@@ -1253,7 +1271,7 @@
                 doclist.append("</docid><rev>").append(rs.getInt(2));
                 doclist.append("</rev>");
                 doclist.append("<datafile>");
-                doclist.append(MetaCatUtil.getOption("datafileflag"));
+                doclist.append(PropertyService.getProperty("datafileflag"));
                 doclist.append("</datafile>");
                 doclist.append("</updatedDocument>");
               }//else
@@ -1276,7 +1294,7 @@
           if(!recordDoctype.equals("BIN"))
           { //don't replicate data files
             Vector packagedoctypes = MetaCatUtil.getOptionList(
-                                     MetaCatUtil.getOption("packagedoctype"));
+                                     PropertyService.getProperty("packagedoctype"));
             if(recordDoctype != null && !packagedoctypes.contains(recordDoctype))
             {   //if this is a package file, put it at the end
               //because if a package file is read before all of the files it
@@ -1400,7 +1418,7 @@
             if (recordDoctype.equals("BIN"))
             {
                 revDocList.append("<datafile>");
-                revDocList.append(MetaCatUtil.getOption("datafileflag"));
+                revDocList.append(PropertyService.getProperty("datafileflag"));
                 revDocList.append("</datafile>");
             }
             revDocList.append("</revisionDocument>");
@@ -1459,7 +1477,12 @@
         sb.append("</entry_type><source_doctype>").append(rs.getString(2));
         sb.append("</source_doctype><target_doctype>").append(rs.getString(3));
         sb.append("</target_doctype><public_id>").append(rs.getString(4));
-        sb.append("</public_id><system_id>").append(rs.getString(5));
+        // system id may not have server url on front.  Add it if not.
+        String systemID = rs.getString(5);
+        if (!systemID.startsWith("http://")) {
+        	systemID = SystemUtil.getServerURL() + systemID;
+        }
+        sb.append("</public_id><system_id>").append(systemID);
         sb.append("</system_id></row>");
 
         tablehasrows = rs.next();
@@ -1674,7 +1697,6 @@
     Hashtable sl = new Hashtable();
     DBConnection dbConn = null;
     int serialNumber = -1;
-    //MetaCatUtil ut=new MetaCatUtil();
     docId=MetaCatUtil.getDocIdFromString(docId);
     PreparedStatement pstmt=null;
     int serverLocation;
@@ -1766,7 +1788,6 @@
     int serialNumber = -1;
     PreparedStatement pstmt = null;
     int serverCode = 1;
-    //MetaCatUtil ut = new MetaCatUtil();
     String docId=MetaCatUtil.getDocIdFromString(accNum);
 
     try
@@ -1855,42 +1876,39 @@
   }
 
   /**
-   * Method for writing replication messages to a log file specified in
-   * metacat.properties
-   */
-  public static void replLog(String message)
-  {
-    try
-    {
-      FileOutputStream fos = new FileOutputStream(
-                                 util.getOption("replicationlog"), true);
-      PrintWriter pw = new PrintWriter(fos);
-      SimpleDateFormat formatter = new SimpleDateFormat ("yy-MM-dd HH:mm:ss");
-      java.util.Date localtime = new java.util.Date();
-      String dateString = formatter.format(localtime);
-      dateString += " :: " + message;
-      //time stamp each entry
-      pw.println(dateString);
-      pw.flush();
-    }
-    catch(Exception e)
-    {
-      System.out.println("error writing to replication log from " +
-                         "MetacatReplication.replLog: " + e.getMessage());
-      //e.printStackTrace(System.out);
-    }
-  }
+	 * Method for writing replication messages to a log file specified in
+	 * metacat.properties
+	 */
+	public static void replLog(String message) {
+		try {
+			FileOutputStream fos = 
+				new FileOutputStream(PropertyService.getProperty("application.tomcatDir")
+					+ "/logs/metacatreplication.log", true);
+			PrintWriter pw = new PrintWriter(fos);
+			SimpleDateFormat formatter = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
+			java.util.Date localtime = new java.util.Date();
+			String dateString = formatter.format(localtime);
+			dateString += " :: " + message;
+			// time stamp each entry
+			pw.println(dateString);
+			pw.flush();
+		} catch (Exception e) {
+			System.out.println("error writing to replication log from "
+					+ "MetacatReplication.replLog: " + e.getMessage());
+			// e.printStackTrace(System.out);
+		}
+	}
 
   /**
-   * Method for writing replication messages to a log file specified in
-   * metacat.properties
-   */
+	 * Method for writing replication messages to a log file specified in
+	 * metacat.properties
+	 */
   public static void replErrorLog(String message)
   {
     try
     {
       FileOutputStream fos = new FileOutputStream(
-                                 util.getOption("replicationerrorlog"), true);
+                                 PropertyService.getProperty("replicationerrorlog"), true);
       PrintWriter pw = new PrintWriter(fos);
       SimpleDateFormat formatter = new SimpleDateFormat ("yy-MM-dd HH:mm:ss");
       java.util.Date localtime = new java.util.Date();
Index: src/edu/ucsb/nceas/metacat/advancedsearch/Stylizer.java
===================================================================
--- src/edu/ucsb/nceas/metacat/advancedsearch/Stylizer.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/advancedsearch/Stylizer.java	(revision 4080)
@@ -34,7 +34,8 @@
 
 import org.apache.log4j.Logger;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /**
  * @author dcosta
@@ -44,96 +45,80 @@
  */
 public class Stylizer {
 
-  private Logger logMetacat = Logger.getLogger(Stylizer.class);
-	
-  /**
-   * Applies the resultset.xsl stylesheet to the pathquery result string
-   * returned by Metacat.
-   * 
-   * @param resultset       the pathquery result string from Metacat
-   * @param sessionId       the user's session id
-   * @param metacatURL      the URL to the Metacat server
-   * @param qformat         The qformat (skin) to use when displaying results.
-   * @param xslPath         File path to the resultset.xsl stylesheet.
-   * 
-   * @return htmlString     the result of the transformation from XML to HTML
-   */
-  public String resultsetToHTML(final String resultset, 
-                                final String sessionId,
-                                final String metacatURL,
-                                final String qformat,
-                                final String xslPath) {
-    String htmlString = "";
-    Result result;
-    StringWriter stringWriter = new StringWriter();
-    Transformer transformer;
-    TransformerFactory transformerFactory;
-    Source xmlSource;
-    File xsltFile = new File(xslPath);            
-    Source xsltSource;
-    StringReader stringReader = new StringReader(resultset);
-    
-    xmlSource = new javax.xml.transform.stream.StreamSource(stringReader);
-    xsltSource = new javax.xml.transform.stream.StreamSource(xsltFile);
-    result = new javax.xml.transform.stream.StreamResult(stringWriter);
+	private Logger logMetacat = Logger.getLogger(Stylizer.class);
 
-    // create an instance of TransformerFactory
-    transformerFactory = TransformerFactory.newInstance();
+	/**
+	 * Applies the resultset.xsl stylesheet to the pathquery result string
+	 * returned by Metacat.
+	 * 
+	 * @param resultset       the pathquery result string from Metacat
+	 * @param sessionId       the user's session id
+	 * @param metacatURL      the URL to the Metacat server
+	 * @param qformat         The qformat (skin) to use when displaying results.
+	 * @param xslPath         File path to the resultset.xsl stylesheet.
+	 * 
+	 * @return htmlString     the result of the transformation from XML to HTML
+	 */
+	public String resultsetToHTML(final String resultset, final String sessionId,
+			final String metacatURL, final String qformat, final String xslPath) {
+		String htmlString = "";
+		Result result;
+		StringWriter stringWriter = new StringWriter();
+		Transformer transformer;
+		TransformerFactory transformerFactory;
+		Source xmlSource;
+		File xsltFile = new File(xslPath);
+		Source xsltSource;
+		StringReader stringReader = new StringReader(resultset);
 
-    try {
-      transformer = transformerFactory.newTransformer(xsltSource);
-      
-      MetaCatUtil metaCatUtil = new MetaCatUtil();
-      
-      String httpServer = MetaCatUtil.getOption("httpserver");
-      String context = MetaCatUtil.getOption("context");
-      
-      // Log error if httpserver or context are not set in metacat
-      // configuration, but allow transform to proceed.  User will
-      // see data, albeit without pretty formatting.
-      if (httpServer == null || context == null) {
-    	logMetacat.error("httpserver and context values must be set in " +
-    			"metacat configuration for advanced search formatting to " +
-    			"work properly");
-      } else {
-        transformer.setParameter("contextURL", httpServer+"/"+context+"/");
-      }
+		xmlSource = new javax.xml.transform.stream.StreamSource(stringReader);
+		xsltSource = new javax.xml.transform.stream.StreamSource(xsltFile);
+		result = new javax.xml.transform.stream.StreamResult(stringWriter);
 
-      if (sessionId != null) {
-        transformer.setParameter("sessid", sessionId);
-      }
+		// create an instance of TransformerFactory
+		transformerFactory = TransformerFactory.newInstance();
 
-      transformer.setParameter("metacatURL", metacatURL);
-      
-      if ((qformat != null) && (!qformat.equals(""))) {
-        transformer.setParameter("qformat", qformat);
-      }
-      
-      transformer.transform(xmlSource, result);
-      htmlString = stringWriter.toString();
-    }
-    catch (TransformerConfigurationException tce) {
-      // Error generated by the parser
-      Throwable x = tce;  // Use the contained exception, if any
-        
-      if (tce.getException() != null) {
-        x = tce.getException();    
-      }
+		try {
+			transformer = transformerFactory.newTransformer(xsltSource);
 
-      x.printStackTrace();   
-    }
-    catch (TransformerException te) {
-      // Error generated by the parser
-      Throwable x = te;  // Use the contained exception, if any
-        
-      if (te.getException() != null) {
-        x = te.getException();    
-      }
+			String contextURL = SystemUtil.getContextURL();
+			transformer.setParameter("contextURL", contextURL);
 
-      x.printStackTrace(); 
-    }
-      
-    return htmlString;
-  }
-  
+			if (sessionId != null) {
+				transformer.setParameter("sessid", sessionId);
+			}
+
+			transformer.setParameter("metacatURL", metacatURL);
+
+			if ((qformat != null) && (!qformat.equals(""))) {
+				transformer.setParameter("qformat", qformat);
+			}
+
+			transformer.transform(xmlSource, result);
+			htmlString = stringWriter.toString();
+		} catch (TransformerConfigurationException tce) {
+			// Error generated by the parser
+			Throwable x = tce; // Use the contained exception, if any
+
+			if (tce.getException() != null) {
+				x = tce.getException();
+			}
+
+			x.printStackTrace();
+		} catch (TransformerException te) {
+			// Error generated by the parser
+			Throwable x = te; // Use the contained exception, if any
+
+			if (te.getException() != null) {
+				x = te.getException();
+			}
+
+			x.printStackTrace();
+		} catch (PropertyNotFoundException pnfe) {
+			pnfe.printStackTrace();
+		}
+
+		return htmlString;
+	}
+
 }
\ No newline at end of file
Index: src/edu/ucsb/nceas/metacat/spatial/SpatialHarvester.java
===================================================================
--- src/edu/ucsb/nceas/metacat/spatial/SpatialHarvester.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/spatial/SpatialHarvester.java	(revision 4080)
@@ -31,8 +31,9 @@
 
 import org.apache.log4j.Logger;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.DBConnection;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+
 import org.geotools.feature.Feature;
 
 /** 
Index: lib/style/skins/knb/knb.properties
===================================================================
--- lib/style/skins/knb/knb.properties	(nonexistent)
+++ lib/style/skins/knb/knb.properties	(revision 4080)
@@ -0,0 +1,48 @@
+#
+# General configuration parameters
+#
+registry.config.username=uid=nceasadmin,o=NCEAS,dc=ecoinformatics,dc=org
+registry.config.password=your-pw-goes-here
+registry.config.scope=nceas
+registry.config.organization=National Center for Ecological Analysis and Synthesis
+registry.config.abbrev=NCEAS
+#registry.config.url=http://www.nceas.ucsb.edu/
+registry.config.site=project
+registry.config.type=Repository
+registry.config.debug=1
+
+# NCEAS custom theme sans-iframe
+registry.templates.header=nceasHeader.tmpl
+registry.templates.footer=nceasFooter.tmpl
+
+# email settings
+email.sender=NCEAS Data Repository <help@nceas.ucsb.edu>
+email.recipient=help@nceas.ucsb.edu
+email.admin=the repository administrator
+
+# registry display settings
+registry.show.siteList=false
+registry.show.wgList=true
+registry.show.organization=false
+# registry module display
+registry.modules.taxonomic=true
+registry.modules.method=true
+registry.modules.spatial=true
+registry.modules.keyword=true
+registry.modules.temporal=true
+registry.modules.upload=true
+
+registry.required.temporal=
+registry.required.spatial=
+registry.required.contactEmailAddress=
+
+# NCEAS specific
+registry.db.connection=//hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu
+registry.db.user= admowner
+registry.db.password= your-pw-goes-here
+
+# imported properties from lib/skin.configs/nceas/nceas.properties
+# java code usage
+lsidauthority=knb.ecoinformatics.org
+registryurl=http://knb.ecoinformatics.org
+registryname=KNB Data Registry

Property changes on: lib/style/skins/knb/knb.properties
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/common/common-settings.jsp
===================================================================
--- lib/style/common/common-settings.jsp	(revision 4079)
+++ lib/style/common/common-settings.jsp	(revision 4080)
@@ -1,88 +1,82 @@
-<%@ page errorPage="jsperrorpage.html" %>
-<%@page import="edu.ucsb.nceas.metacat.MetaCatUtil"%>
+<%@ page errorPage="jsperrorpage.html"%>
+<%@page import="edu.ucsb.nceas.metacat.service.PropertyService,edu.ucsb.nceas.metacat.util.SystemUtil"%>
 <%
- /**
-  *   '$RCSfile$'
-  *   Copyright: 2006 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
-  */
+	 /**
+	 *   '$RCSfile$'
+	 *   Copyright: 2006 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
+	 */
 %>
 
-<% 
+<%
+	// GLOBAL CONSTANTS FOR ALL METACAT SKINS
+	// These can be overridden by individual javascripts in each skin
+	String COMMON_SEARCH_METACAT_POST_FIELDS = "<input type=\"hidden\" name=\"action\"        value=\"query\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returnfield\"   value=\"originator/individualName/surName\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returnfield\"   value=\"originator/individualName/givenName\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returnfield\"   value=\"originator/organizationName\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returnfield\"   value=\"creator/individualName/surName\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returnfield\"   value=\"creator/organizationName\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returnfield\"   value=\"dataset/title\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returnfield\"   value=\"keyword\"\\>\n"
+			+ "<input name=\"returnfield\" value=\"creator/individualName/givenName\" type=\"hidden\">\n"
+			+ "<input name=\"returnfield\" value=\"idinfo/citation/citeinfo/title\" type=\"hidden\">\n"
+			+ "<input name=\"returnfield\" value=\"idinfo/citation/citeinfo/origin\" type=\"hidden\">\n"
+			+ "<input name=\"returnfield\" value=\"idinfo/keywords/theme/themekey\" type=\"hidden\">\n"
+			+ "<input name=\"returndoctype\" value=\"metadata\" type=\"hidden\">\n"
+			+ "<input type=\"hidden\" name=\"returndoctype\" value=\"-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returndoctype\" value=\"-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returndoctype\" value=\"eml://ecoinformatics.org/eml-2.0.1\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returndoctype\" value=\"eml://ecoinformatics.org/eml-2.0.0\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returndoctype\" value=\"-//NCEAS//eml-dataset-2.0//EN\"\\>\n"
+			+ "<input type=\"hidden\" name=\"returndoctype\" value=\"-//NCEAS//resource//EN\"\\>\n";
 
-// GLOBAL CONSTANTS FOR ALL METACAT SKINS
-// These can be overridden by individual javascripts in each skin
+	String SIMPLE_SEARCH_METACAT_POST_FIELDS = "<input type=\"hidden\" name=\"operator\"      value=\"UNION\"\\>\n"
+			+ COMMON_SEARCH_METACAT_POST_FIELDS;
 
-String COMMON_SEARCH_METACAT_POST_FIELDS   =
-    "<input type=\"hidden\" name=\"action\"        value=\"query\"\\>\n"
-    +"<input type=\"hidden\" name=\"returnfield\"   value=\"originator/individualName/surName\"\\>\n"
-    +"<input type=\"hidden\" name=\"returnfield\"   value=\"originator/individualName/givenName\"\\>\n"
-    +"<input type=\"hidden\" name=\"returnfield\"   value=\"originator/organizationName\"\\>\n"
-    +"<input type=\"hidden\" name=\"returnfield\"   value=\"creator/individualName/surName\"\\>\n"
-    +"<input type=\"hidden\" name=\"returnfield\"   value=\"creator/organizationName\"\\>\n"
-    +"<input type=\"hidden\" name=\"returnfield\"   value=\"dataset/title\"\\>\n"
-    +"<input type=\"hidden\" name=\"returnfield\"   value=\"keyword\"\\>\n"
-    +"<input name=\"returnfield\" value=\"creator/individualName/givenName\" type=\"hidden\">\n"
-    +"<input name=\"returnfield\" value=\"idinfo/citation/citeinfo/title\" type=\"hidden\">\n"
-    +"<input name=\"returnfield\" value=\"idinfo/citation/citeinfo/origin\" type=\"hidden\">\n"
-    +"<input name=\"returnfield\" value=\"idinfo/keywords/theme/themekey\" type=\"hidden\">\n"
-    +"<input name=\"returndoctype\" value=\"metadata\" type=\"hidden\">\n"
-    +"<input type=\"hidden\" name=\"returndoctype\" value=\"-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN\"\\>\n"
-    +"<input type=\"hidden\" name=\"returndoctype\" value=\"-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN\"\\>\n"
-    +"<input type=\"hidden\" name=\"returndoctype\" value=\"eml://ecoinformatics.org/eml-2.0.1\"\\>\n"
-    +"<input type=\"hidden\" name=\"returndoctype\" value=\"eml://ecoinformatics.org/eml-2.0.0\"\\>\n"
-    +"<input type=\"hidden\" name=\"returndoctype\" value=\"-//NCEAS//eml-dataset-2.0//EN\"\\>\n"
-    +"<input type=\"hidden\" name=\"returndoctype\" value=\"-//NCEAS//resource//EN\"\\>\n";
-    
-    
+	String ADVANCED_SEARCH_METACAT_POST_FIELDS = "<input type=\"hidden\" name=\"operator\"      value=\"INTERSECT\"\\>\n"
+			+ COMMON_SEARCH_METACAT_POST_FIELDS;
 
-String SIMPLE_SEARCH_METACAT_POST_FIELDS   =
-    "<input type=\"hidden\" name=\"operator\"      value=\"UNION\"\\>\n"
-    +COMMON_SEARCH_METACAT_POST_FIELDS;
+	// if true, POST variables echoed at bottom of client's browser window in a big yellow box
+	boolean DEBUG_TO_BROWSER = false;
 
-String ADVANCED_SEARCH_METACAT_POST_FIELDS   =
-    "<input type=\"hidden\" name=\"operator\"      value=\"INTERSECT\"\\>\n"
-    +COMMON_SEARCH_METACAT_POST_FIELDS;
+	// label for logout form button when user *is* logged in:
+	String LOGOUT_LABEL = "Logout";
 
-// if true, POST variables echoed at bottom of client's browser window in a big yellow box
-boolean     DEBUG_TO_BROWSER      = false;    
+	// label for login form button when user is *not* logged in:
+	String LOGIN_LABEL = "Login";
 
-// label for logout form button when user *is* logged in:
-String      LOGOUT_LABEL          = "Logout";
+	// last part of LDAP username to be appended after organization
+	String LDAP_DOMAIN = ",dc=ecoinformatics,dc=org";
 
-// label for login form button when user is *not* logged in:
-String      LOGIN_LABEL           = "Login";
+	String KNB_SITE_URL = PropertyService.getProperty("application.knbSiteURL");
+	String CONTEXT_NAME = PropertyService.getProperty("application.context");
+	String DEFAULT_STYLE = PropertyService.getProperty("application.default-style");
+	String SERVER_URL = SystemUtil.getServerURL();
+	String CGI_URL = SystemUtil.getCGI_URL();
+	String CONTEXT_URL = SystemUtil.getContextURL();
+	String SERVLET_URL = SystemUtil.getServletURL();
+	String STYLE_SKINS_URL = SystemUtil.getStyleSkinsURL();
+	String STYLE_COMMON_URL = SystemUtil.getStyleCommonURL();
+	String DEFAULT_STYLE_URL = SystemUtil.getDefaultStyleURL();
 
-// last part of LDAP username to be appended after organization
-String      LDAP_DOMAIN           = ",dc=ecoinformatics,dc=org";
-
-String      KNB_SITE_URL            = MetaCatUtil.getOption("knbSiteURL");
-String      SERVER_URL              = MetaCatUtil.getOption("httpserver");
-String      CONTEXT_NAME            = MetaCatUtil.getOption("context"); 
-String      DEFAULT_STYLE           = MetaCatUtil.getOption("default-style");
-String      CGI_URL                 = SERVER_URL + "/cgi-bin";
-String      SERVER_URL_WITH_CONTEXT = SERVER_URL + "/" + CONTEXT_NAME;
-String      SERVLET_URL             = SERVER_URL_WITH_CONTEXT + "/metacat";
-String      STYLE_SKINS_URL         = SERVER_URL_WITH_CONTEXT + "/style/skins";
-String      STYLE_COMMON_URL        = SERVER_URL_WITH_CONTEXT + "/style/common";
-String      DEFAULT_STYLE_URL       = SERVER_URL_WITH_CONTEXT + "/style/skins/" + DEFAULT_STYLE;
 %>
 
Index: lib/metacat.properties
===================================================================
--- lib/metacat.properties	(revision 4079)
+++ lib/metacat.properties	(revision 4080)
@@ -1,4 +1,3 @@
-#
 # Properties file defining options for the MetaCatServlet.java servlet
 #
 # Matt Jones, Dan Higgins, Jivka Bojilova
@@ -5,186 +4,289 @@
 # '$Id$'
 #
 
-######## Configuration section        #########################################
-# This flag indicates whether configuration information has been collected from
-# the user installing metacat yet.
-configured=true
+######## Configuration utility section        #########################################
 
-configurationPage=/configure.jsp
+configutil.propertiesConfigured=false
+configutil.ldapConfigured=false
+configutil.skinsConfigured=false
+configutil.databaseConfigured=false
 
-configurationSuccessPage=/configure-restart.jsp
+############### Server Values #################
 
-version=1.8.1
+server.name=localhost
+server.httpPort=80
+server.httpSSLPort=443
 
-######## Database section             #########################################
-user=@user@
+############### Application Values ############
 
-password=@password@
+## one of the few places where we use ANT tokens
+application.metacatVersion=@metacatVersion@
+## This is autodiscovered and populated by the config utility
+application.tomcatDir=
+## This is autodiscovered and populated by the config utility
+application.context=
+application.default-style=default
+application.knbSiteURL=http://knb.ecoinformatics.org
+application.datafilepath=/var/metacat/data
+application.inlinedatafilepath=/var/metacat/inline-data
+application.cgiDir=/cgi-bin
 
-databaseType=@database@
+############### Database Values ###############
 
-defaultDB=@jdbc-connect@
+database.user=
+database.password=
+database.type=
+database.connectionURI=jdbc:postgresql://localhost/metacat
+database.driver=  
+database.adapter=
+#database.upgradeVersions=0.0.0,1.2.0,1.3.0,1.4.0,1.5.0,1.6.0,1.7.0,1.8.0,1.9.0
+database.upgradeVersion.0.0.0=xmltables,loaddtdschema
+database.upgradeVersion.1.2.0=upgrade-db-to-1.2
+database.upgradeVersion.1.3.0=upgrade-db-to-1.3
+database.upgradeVersion.1.4.0=upgrade-db-to-1.4
+database.upgradeVersion.1.5.0=upgrade-db-to-1.5
+database.upgradeVersion.1.6.0=upgrade-db-to-1.6
+database.upgradeVersion.1.7.0=upgrade-db-to-1.7
+database.upgradeVersion.1.8.0=upgrade-db-to-1.8
+database.upgradeVersion.1.9.0=upgrade-db-to-1.9
+database.initialConnections=5
+database.incrementConnections=5
+database.maximumConnections=25
+database.maximumConnectionAge=120000
+database.maximumConnectionTime=60000
+database.maximumUsageNumber=100
+database.numberOfIndexingThreads=5
+database.indexingTimerTaskTime=604800000
+database.indexingInitialDelay=3600000
+database.maximumIndexDelay=5000
+database.runDBConnectionRecycleThread=off
+database.cycleTimeOfDBConnection=30000
 
-dbDriver=@dbDriver@
+######## LDAP ##############################################
 
-dbAdapter=@dbAdapter@
+auth.class=edu.ucsb.nceas.metacat.AuthLdap
+auth.timeoutMinutes=180
 
-initialConnections=5
+ldap.administrators=uid=jones,o=NCEAS,dc=ecoinformatics,dc=org
+ldap.url=ldap://ldap.ecoinformatics.org:389/
+ldap.surl=ldap://ldap.ecoinformatics.org:389/
+ldap.allowedSubmitters=
+ldap.deniedSubmitters=
+# time in milliseconds allowed for ldap server connections
+ldap.connectTimeLimit=5000
+# time in milliseconds allowed for ldap server searches
+ldap.searchTimeLimit=30000
+# count of return entries allowed for ldap server searches
+ldap.searchCountLimit=30000
+ldap.referral=follow
+ldap.onlySecureConnection=false
+ldap.onlySecureReferalsConnection=false
 
-incrementConnections=5
+# TODO MCD move this to skins
+ldap.moderators=cn=knb-prod,o=NCEAS,dc=ecoinformatics,dc=org
 
-maximumConnections=25
+# LDAP supported organization list
+# ldap.organizations=OBFS,OSUSB,UCNRS,KU,LTER,UVM,NCEAS,SDSC,MSU,NAPIER,SANPARKS,SAEON,UNAFFILIATED
 
-maximumConnectionAge=120000
+# custom organization parameters
+#ldap.NCEAS.dn=o=NCEAS,dc=ecoinformatics,dc=org
+ldap.configured.NCEAS=false
+ldap.base.NCEAS=dc=ecoinformatics,dc=org
+ldap.org.NCEAS=o=NCEAS
+ldap.user.NCEAS=cn=Manager
+ldap.password.NCEAS=
+#ldap.OBFS.dn=o=OBFS,dc=ecoinformatics,dc=org
+ldap.configured.OBFS=false
+ldap.base.OBFS=dc=ecoinformatics,dc=org
+ldap.org.OBFS=o=OBFS
+ldap.user.OBFS=cn=Manager
+ldap.password.OBFS=
+#ldap.OSUSB.dn=o=OSUSB,dc=ecoinformatics,dc=org
+ldap.configured.OSUSB=false
+ldap.base.OSUSB=dc=ecoinformatics,dc=org
+ldap.org.OSUSB=o=OSUSB
+ldap.user.OSUSB=cn=Manager
+ldap.password.OSUSB=
+#ldap.UCNRS.dn=ou=people,O=ucnrs.org
+ldap.configured.UCNRS=false
+ldap.base.UCNRS=ou=people,O=ucnrs.org
+ldap.org.UCNRS=
+ldap.user.UCNRS=cn=Manager
+ldap.password.UCNRS=
+#ldap.KU.dn=o=KU,dc=ecoinformatics,dc=org
+ldap.configured.KU=false
+ldap.base.KU=dc=ecoinformatics,dc=org
+ldap.org.KU=o=KU
+ldap.user.KU=cn=Manager
+ldap.password.KU=
+#ldap.LTER.dn=o=LTER,dc=ecoinformatics,dc=org
+ldap.configured.LTER=false
+ldap.base.LTER=dc=ecoinformatics,dc=org
+ldap.org.LTER=o=LTER
+ldap.user.LTER=cn=Manager
+ldap.password.LTER=
+#ldap.UVM.dn=o=UVM,dc=ecoinformatics,dc=org
+ldap.configured.UVM=false
+ldap.base.UVM=dc=ecoinformatics,dc=org
+ldap.org.UVM=o=UVM
+ldap.user.UVM=cn=Manager
+ldap.password.UVM=
+#ldap.SDSC.dn=o=SDSC,dc=ecoinformatics,dc=org
+ldap.configured.SDSC=false
+ldap.base.SDSC=dc=ecoinformatics,dc=org
+ldap.org.SDSC=o=SDSC
+ldap.user.SDSC=cn=Manager
+ldap.password.SDSC=
+#ldap.MSU.dn=o=MSU,dc=ecoinformatics,dc=org
+ldap.configured.MSU=false
+ldap.base.MSU=dc=ecoinformatics,dc=org
+ldap.org.MSU=
+ldap.user.MSU=cn=Manager,dc=ecoinformatics,dc=org
+ldap.password.MSU=
+#ldap.NAPIER.dn=o=NAPIER,dc=ecoinformatics,dc=org
+ldap.configured.NAPIER=false
+ldap.base.NAPIER=dc=ecoinformatics,dc=org
+ldap.org.NAPIER=o=NAPIER
+ldap.user.NAPIER=cn=Manager
+ldap.password.NAPIER=
+#ldap.SANPARKS.dn=o=SANParks,dc=ecoinformatics,dc=org
+ldap.configured.SANPARKS=false
+ldap.base.SANPARKS=dc=ecoinformatics,dc=org
+ldap.org.SANPARKS=
+ldap.user.SANPARKS=cn=Manager
+ldap.password.SANPARKS=
+#ldap.SAEON.dn=o=SAEON,dc=ecoinformatics,dc=org
+ldap.configured.SAEON=false
+ldap.base.SAEON=dc=ecoinformatics,dc=org
+ldap.org.SAEON=
+ldap.user.SAEON=cn=Manager
+ldap.password.SAEON=
+#ldap.UNAFFILIATED.dn=o=unaffiliated,dc=ecoinformatics,dc=org
+ldap.configured.UNAFFILIATED=false
+ldap.base.UNAFFILIATED=dc=ecoinformatics,dc=org
+ldap.org.UNAFFILIATED=o=unaffiliated
+ldap.user.UNAFFILIATED=cn=Manager
+ldap.password.UNAFFILIATED=
 
-maximumConnectionTime=60000
+# LDAP templates 
+ldap.templates.stage=initregister
+ldap.templates.header=genericHeader.tmpl
+ldap.templates.footer=genericFooter.tmpl
+ldap.templates.changePass=ldapChangePass.tmpl
+ldap.templates.changePassSuccess=ldapChangePassSuccess.tmpl
+ldap.templates.resetPass=ldapResetPass.tmpl
+ldap.templates.resetPassSuccess=ldapResetPassSuccess.tmpl
+ldap.templates.register=ldapRegister.tmpl
+ldap.templates.registerFailed=ldapRegisterFailed.tmpl
+ldap.templates.registerMatch=ldapRegisterMatch.tmpl
+ldap.templates.registerSuccess=ldapRegisterSuccess.tmpl
+ldap.templates.registerLter=ldapRegisterLter.tmpl
+ldap.templates.success=ldapRegisterSuccess.tmpl
+ldap.templates.failed=ldapRegisterFailed.tmpl
+ldap.templates.mainServerFailure=ldapMainServerFailure.tmpl
+ldap.templates.searchResults=searchResults.tmpl
 
-maximumUsageNumber=100
-
-numberOfIndexingThreads=5
-
-indexingTimerTaskTime=604800000
-
-indexingInitialDelay=3600000
-
-maximumIndexDelay=5000
-
-runDBConnectionRecycleThread=off
-
-cycleTimeOfDBConnection=30000
-
 ######## Access section               #########################################
-administrators=@administrators@
 
-moderators=@moderators@
+timedreplication=false
+firsttimedreplication=10:00 PM
+timedreplicationinterval=172800000
+forcereplicationwaitingtime=30000
 
-allowedSubmitters=@allowedSubmitters@
+######## Log Paths  ##############################################
 
-deniedSubmitters=@deniedSubmitters@
-
-timedreplication=@timedreplication@
-
-firsttimedreplication=@firsttimedreplication@
-
-timedreplicationinterval=@timedreplicationinterval@
-
-forcereplicationwaitingtime=@forcereplicationwaitingtime@
-
-config-dir=@config-dir@
-
-default-style=@default-style@
-
-xmlcatalogfile=/opt/tomcat/webapps/xmltodb/catalog.txt
-
 sitecode=nceas
-
 accNumSeparator=.
 
+######## XML / EML  #########################################
+
 saxparser=org.apache.xerces.parsers.SAXParser
-
-servletpath=@servlet-path@
-
-htmlpath=@html-path@
-
-knbSiteURL=@knb-site-url@
-
-eml2_0_0namespace=@eml2_0_0namespace@
-
-eml2_0_1namespace=@eml2_0_1namespace@
-
-eml2_1_0namespace=@eml2_1_0namespace@
-
+eml2_0_0namespace="eml://ecoinformatics.org/eml-2.0.0"
+eml2_0_1namespace="eml://ecoinformatics.org/eml-2.0.1"
+eml2_1_0namespace="eml://ecoinformatics.org/eml-2.1.0"
 packagedoctype=-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN, -//ecoinformatics.org//eml-dataset-2.0.0beta4//EN
-
 accessdoctype=-//ecoinformatics.org//eml-access-2.0.0beta6//EN, -//ecoinformatics.org//eml-access-2.0.0beta4//EN
-
 physicaldoctype=-//ecoinformatics.org//eml-physical-2.0.0beta6//EN, -//ecoinformatics.org//eml-physical-2.0.0beta4//EN
-
 entitydoctype=-//ecoinformatics.org//eml-entity-2.0.0beta6//EN, -//ecoinformatics.org//eml-entity-2.0.0beta4//EN
-
 packagedoctypeset=BIN,-//ecoinformatics.org//eml-access-2.0.0beta6//EN,-//ecoinformatics.org//eml-access-2.0.0beta4//EN,-//ecoinformatics.org//eml-attribute-2.0.0beta6//EN,-//ecoinformatics.org//eml-attribute-2.0.0beta4//EN,-//ecoinformatics.org//eml-constraint-2.0.0beta6//EN,-//ecoinformatics.org//eml-constraint-2.0.0beta4//EN,-//ecoinformatics.org//eml-coverage-2.0.0beta6//EN,-//ecoinformatics.org//eml-coverage-2.0.0beta4//EN,-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN,-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN,-//ecoinformatics.org//eml-entity-2.0.0beta6//EN,-//ecoinformatics.org//eml-entity-2.0.0beta4//EN,-//ecoinformatics.org//eml-literature-2.0.0beta6//EN,-//ecoinformatics.org//eml-literature-2.0.0beta4//EN,-//ecoinformatics.org//eml-physical-2.0.0beta6//EN,-//ecoinformatics.org//eml-physical-2.0.0beta4//EN,-//ecoinformatics.org//eml-project-2.0.0beta6//EN,-//ecoinformatics.org//eml-project-2.0.0beta4//EN,-//ecoinformatics.org//eml-protocol-2.0.0beta6//EN,-//ecoinformatics.org//eml-protocol-2.0.0beta4//EN,-//ecoinformatics.org//eml-software-2.0.0beta6//EN,-//ecoinformatics.org//eml-software-2.0.0beta4//EN
-
-indexNamespaces=@eml2_0_0namespace@,@eml2_0_1namespace@
-
-indexPaths=@indexPaths@
-
-server=@server@
-
-httpserver=@systemidserver@
-
-cgi-prefix=@cgi-prefix@
-
+indexNamespaces="eml://ecoinformatics.org/eml-2.0.0","eml://ecoinformatics.org/eml-2.0.1"
+indexPaths=organizationName,originator/individualName/surName,originator/individualName/givenName,originator/organizationName,creator/individualName/surName,creator/individualName/givenName,creator/organizationName,dataset/title,keyword,geographicCoverage/boundingCoordinates/northBoundingCoordinate,geographicCoverage/boundingCoordinates/southBoundingCoordinate,geographicCoverage/boundingCoordinates/westBoundingCoordinate,geographicCoverage/boundingCoordinates/eastBoundingCoordinate,eastBoundingCoordinate,title,entityName,individualName/surName,abstract/para,surName,givenName,para,geographicDescription,literalLayout,eastbc,northbc,westbc,southbc,dataset/access/allow/principal,entityName,taxonRankValue,dataset/dataTable/physical/distribution/online/url,dataset/spatialRaster/physical/distribution/online/url,@packageId,/reviewHistory/review/packageId,EcogridRegEntry/description,EcogridRegEntry/serviceName,EcogridRegEntry/endPoint,associatedParty/individualName/surName,associatedParty/organizationName,coverage/temporalCoverage/singleDateTime/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/endDate/alternativeTimeScale/timeScaleName,placekey,idinfo/citation/citeinfo/title,idinfo/citation/citeinfo/origin,idinfo/keywords/theme/themekey,abstract
 junittesturl=@systemidserver@@servlet-path@
 
-authclass=edu.ucsb.nceas.metacat.AuthLdap
+######## Outgoing email  #########################################
 
-ldapurl=ldap://ldap.ecoinformatics.org:389/
+email.mailhost=localhost
+email.sender=knb-software@nceas.ucsb.edu
+email.admin=KNB Support
+email.recipient=knb-software@nceas.ucsb.edu
 
-ldapsurl=ldap://ldap.ecoinformatics.org:389/
+######## Registry properties #########################################
 
-ldapbase=dc=ecoinformatics,dc=org
+cgi-user=@cgi-user@
 
-# time in milliseconds allowed for ldap server connections
-ldapconnecttimelimit=5000
+# TODO SCW should obfs still be the default?
+registry.config.scope=obfs
+registry.config.username=uid=knbadmin,o=NCEAS,dc=ecoinformatics,dc=org
+registry.config.password=your-pw-goes-here
+registry.config.site=station
+registry.config.type=Registry
+registry.config.publicReadable=true
+registry.config.adminIsDocOwner=false
+registry.config.organization=
+registry.config.abbrev=
+registry.config.debug=false
 
-# time in milliseconds allowed for ldap server searches
-ldapsearchtimelimit=30000
+# registry modules: parts of the form we should be display
+registry.modules.taxonomic=true
+registry.modules.method=true
+registry.modules.spatial=true
+registry.modules.keyword=true
+registry.modules.temporal=true
+registry.modules.upload=false
 
-# count of return entries allowed for ldap server searches
-ldapsearchcountlimit=30000
+# skin-specific display settings
+registry.required.siteList=true
+registry.required.wgList=false
+registry.required.organization=true
+registry.required.temporal=true
+registry.required.spatial=true
+registry.required.contactEmail=false
 
-referral=follow
+registry.templates.response=genericResponse.tmpl
+registry.templates.entry=entryForm.tmpl
+registry.templates.guide=genericGuide.tmpl
+registry.templates.login=loginForm.tmpl
+registry.templates.confirmData=confirmData.tmpl
+registry.templates.deleteData=deleteData.tmpl
+registry.templates.header=genericHeader.tmpl
+registry.templates.footer=genericFooter.tmpl
+# ESA-skin specific templates
+registry.templates.modEmailNotification=
+registry.templates.modResult=
+registry.templates.getReviews=
 
-#ldapurl=ldap://ldap.nceas.ucsb.edu:389/
+# Replication properties
 
-#ldapsurl=ldap://ldap.nceas.ucsb.edu:389/
-
-#ldapbase=o=NCEAS,c=US
-
-onlySecureLDAPConnection=false
-
-onlySecureLDAPReferalsConnection=false
-
 deltaT=60
 
-replicationpath=@replication-path@
+debuglevel=55
 
-replicationlog=@replication-log@
-
-replicationerrorlog=@replicationerrorlog@
-
-installDir=@install-dir@
-
-dtdPath=@install-dir@/dtd/
-
-schemaPath=@install-dir@/schema/
-
-dtdURL=@systemidserver@@html-path@/dtd/
-
-schemaURL=@systemidserver@@html-path@/schema/
-
-datafilepath=@datafilepath@
-
-inlinedatafilepath=@inlinedatafilepath@
-
-certPath=@install-dir@/
-
-context=@context@
-
-debuglevel=@debuglevel@
-
 datafileflag=datafile
 
 datafilesizelimit=1000
 
-defaultcontenttype=@defaultcontenttype@
+defaultcontenttype=application/octet-stream
 
 query.ignored.params=enableediting,foo
 
 usexmlindex=true
 
-skinconfigfiles=esa,nceas,knb,obfs,nrs,sanparks
+######## Skins  #########################################
+skin.names=esa,nceas,knb,obfs,nrs,sanparks
 
+#move this to skin config
+skin.esa.moderators=cn=knb-prod,o=NCEAS,dc=ecoinformatics,dc=org
+
 # used for the setting the size of resultset for applications like morpho
 app_resultsetsize=7000
 
@@ -207,30 +309,24 @@
 #turn on or off the query result cache
 query_cache_on=true
 
-#The flag to indicate if invalidated eml 201 documents were corrected.
-#Before Metacat 1.8.1, metacat uses tag RELEASE_EML_2_0_1_UPDATE_6 as eml
-#schema, which accidentily points to wrong version of eml-resource.xsd.
-#If this value is false, metacat will run a class to correct eml201 doucment.
-eml201_document_corrected=false
-
 #used for writing debug info into a anouther out file
 writeDebugToFile=true
 #output file name where debug info will written
+# TODO SCW: these should be using the temp-dir property for their paths (change in code)
 debugOutputFile=/tmp/metacat.debug
 #delimitered text output file name where debug info will be written
 delimiteredOutputFile=/tmp/metacat.debug.delimitered
 
 # Used for client testing and typically don't need to be changed
-mcuser=uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org
-mcpassword=kepler
-mcanotheruser=uid=tao,o=NCEAS,dc=ecoinformatics,dc=org
-mcanotherpassword=yourpass
-piscouser=uid=tao,o=PISCO,dc=ecoinformatics,dc=org
-piscopassword=yourpass
-lteruser=uid=jtao,o=LTER,dc=ecoinformatics,dc=org
-lterpassword=yourpass
+mcuser="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org"
+mcpassword="kepler"
+mcanotheruser="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org"
+mcanotherpassword="yourpass"
+piscouser="uid=tao,o=PISCO,dc=ecoinformatics,dc=org"/>
+piscopassword="yourpass"/>
+lteruser="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
+lterpassword="yourpass"/>
 
-
 ######## Harvester section            #########################################
 connectToMetacat=true
 
@@ -276,9 +372,8 @@
 
 ValidateHarvestListSuccess=Success validating harvest list,Debug
 
-# End of Harvester properties
+######## Spatial section              #########################################
 
-######## Spatial section              #########################################
 runSpatialOption=true
 regenerateCacheOnRestart=true
 
@@ -305,16 +400,12 @@
 metadata_northBoundingCoordinatePath=northbc
 
 docTitle=dataset/title
-metacatUrl=@systemidserver@@servlet-path@
-baseUrl=@systemidserver@@html-path@
-# END spatial options
 
-# START sitemap properties
+######## SiteMap section              #########################################
 
 # relative directory path in which sitemap files should be written
-sitemapDirectory=@install-dir@/sitemaps
+## sitemapDirectory=@install-dir@/sitemaps
 
 # Interval (in milliseconds) between rebuilding the sitemap
 sitemapInterval=86400000
 
-# END sitemap properties
Index: src/loaddtdschema.sql
===================================================================
--- src/loaddtdschema.sql	(revision 4079)
+++ src/loaddtdschema.sql	(revision 4080)
@@ -6,42 +6,45 @@
         AND system_id LIKE '%eml%';
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-access-@eml-version@//EN',
-         '@systemidserver@@html-path@/dtd/eml-access-@eml-version@.dtd');
+         '/dtd/eml-access-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-attribute-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-attribute-@eml-version@.dtd');
+          '/dtd/eml-attribute-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-constraint-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-constraint-@eml-version@.dtd');
+          '/dtd/eml-constraint-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-coverage-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-coverage-@eml-version@.dtd');
+          '/dtd/eml-coverage-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-dataset-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-dataset-@eml-version@.dtd');
+          '/dtd/eml-dataset-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-entity-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-entity-@eml-version@.dtd');
+          '/dtd/eml-entity-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-literature-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-literature-@eml-version@.dtd');
+          '/dtd/eml-literature-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-physical-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-physical-@eml-version@.dtd');
+          '/dtd/eml-physical-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-project-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-project-@eml-version@.dtd');
+          '/dtd/eml-project-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-protocol-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-protocol-@eml-version@.dtd');
+          '/dtd/eml-protocol-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
   VALUES ('DTD', '-//ecoinformatics.org//eml-software-@eml-version@//EN',
-          '@systemidserver@@html-path@/dtd/eml-software-@eml-version@.dtd');
+          '/dtd/eml-software-@eml-version@.dtd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', '@eml2_0_1namespace@', '@systemidserver@@html-path@/schema/eml-2.0.1/eml.xsd');
+  VALUES ('Schema', '@eml2_0_1namespace@', '/schema/eml-2.0.1/eml.xsd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', '@eml2_0_0namespace@', '@systemidserver@@html-path@/schema/eml-2.0.0/eml.xsd');
+  VALUES ('Schema', '@eml2_0_0namespace@', '/schema/eml-2.0.0/eml.xsd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', '@stmmlnamespace@', '@systemidserver@@html-path@/schema/eml-2.0.1/stmml.xsd');
+  VALUES ('Schema', '@stmmlnamespace@', '/schema/eml-2.0.1/stmml.xsd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', 'metadata', '@systemidserver@@html-path@/schema/fgdc-std-001/fgdc-std-001-1998.xsd');
+  VALUES ('Schema', 'metadata', '/schema/fgdc-std-001/fgdc-std-001-1998.xsd');
+
+INSERT INTO db_version (version, status, date_created) 
+  VALUES ('1.9.0',1,CURRENT_DATE);
Index: src/upgrade-db-to-1.9-postgres.sql
===================================================================
--- src/upgrade-db-to-1.9-postgres.sql	(nonexistent)
+++ src/upgrade-db-to-1.9-postgres.sql	(revision 4080)
@@ -0,0 +1,14 @@
+/*
+ * db_version -- table to store the version history of this database
+ */
+CREATE SEQUENCE db_version_id_seq;
+CREATE TABLE db_version (
+  db_version_id   INT8 default nextval ('db_version_id_seq'), -- the identifier for the version
+  version         VARCHAR(250),     -- the version number
+  status          INT8,             -- status of the version
+  date_created    TIMESTAMP,        -- the datetime on which the version was created
+  CONSTRAINT db_version_pk PRIMARY KEY (db_version_id)
+);
+
+INSERT INTO db_version (version, status, date_created) 
+  VALUES ('1.9.0', 1, CURRENT_DATE);

Property changes on: src/upgrade-db-to-1.9-postgres.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-postgres.sql
===================================================================
--- src/xmltables-postgres.sql	(revision 4079)
+++ src/xmltables-postgres.sql	(revision 4080)
@@ -416,4 +416,14 @@
         FOREIGN KEY (harvest_log_id) REFERENCES harvest_log
 );
 
-
+/*
+ * db_version -- table to store the version history of this database
+ */
+CREATE SEQUENCE db_version_id_seq;
+CREATE TABLE db_version (
+  db_version_id   INT8 default nextval ('db_version_id_seq'), -- the identifier for the version
+  version         VARCHAR(250),     -- the version number
+  status          INT8,             -- status of the version
+  date_created    TIMESTAMP,        -- the datetime on which the version was created
+  CONSTRAINT db_version_pk PRIMARY KEY (db_version_id)
+);
Index: src/perl/register-dataset.cgi
===================================================================
--- src/perl/register-dataset.cgi	(revision 4079)
+++ src/perl/register-dataset.cgi	(revision 4080)
@@ -30,6 +30,7 @@
 
 use Metacat;
 use AppConfig qw(:expand :argcount);
+use Config::Properties;
 use XML::LibXML;
 use XML::LibXSLT;
 use Template;
@@ -42,10 +43,26 @@
 use strict;
 
 # Global configuration paramters
-#my $cfgdir = "/usr/local/devtools/tomcat/webapps/knb/style/skins";
-my $cfgdir = "@install-dir@@style-skins-relpath@";
-my $tmpdir = "@temp-dir@";
-my $templatesdir = "@install-dir@@style-common-relpath@/templates";
+my $cgiUrl = $ENV{'SCRIPT_FILENAME'};
+my $workingDirectory = dirname($cgiUrl);
+my $metacatProps = "${workingDirectory}/../WEB-INF/metacat.properties";
+my $properties = new Config::Properties();
+unless (open (METACAT_PROPERTIES, $metacatProps)) {
+    print "Content-type: text/html\n\n";
+    print "Unable to locate Metacat properties. Working directory is set as '$workingDirectory', is this correct?";
+    exit(0);
+}
+
+$properties->load(*METACAT_PROPERTIES);
+
+# local directory configuration
+my $configDir = $properties->getProperty('config-dir'); # skins directory
+my $tmpDir = $properties->getProperty('temp-dir');
+my $xslConvDir = "$configDir/lib/style";
+
+# url configuration
+my $metacatUrl = $properties->getProperty('metacatUrl');
+
 my $now = time;
 my $xslConvDir = "$cfgdir/lib/style/";
 
@@ -57,151 +74,99 @@
 my $error = 0;
 my @errorMessages;
 
-# create a new AppConfig object and load our config parameters
-# note that this requires the form submission to have a "cfg" paramter
-# to determine which config file to load
-my $config = AppConfig->new({
-    GLOBAL => { ARGCOUNT => ARGCOUNT_ONE, } });
-
-$config->define("metacatUrl");
-$config->define("username");
-$config->define("password");
-$config->define("ldapUrl");
-$config->define("defaultScope");
-$config->define("organization");
-$config->define("orgabbrev");
-$config->define("orgurl");
-$config->define("accesspubid");
-$config->define("accesssysid");
-$config->define("datasetpubid");
-$config->define("datasetsysid");
-$config->define("showSiteList", { DEFAULT => 'true'} );
-$config->define("lsite", { DEFAULT => 'station'} );
-$config->define("usite", { DEFAULT => 'Station'} );
-$config->define("showWgList", { DEFAULT => 'true'} );
-$config->define("showOrganization", { DEFAULT => 'true'} );
-$config->define("hasKeyword", { DEFAULT => 'true'} );
-$config->define("hasTemporal", { DEFAULT => 'true'} );
-$config->define("hasSpatial", { DEFAULT => 'true'} );
-$config->define("hasTaxonomic", { DEFAULT => 'true'} );
-$config->define("hasMethod", { DEFAULT => 'true'} );
-$config->define("hasUpload", { DEFAULT => 'false'} );
-$config->define("temporalRequired", { DEFAULT => 'true'} );
-$config->define("spatialRequired", { DEFAULT => 'true'} );
-$config->define("contactEmailAddressRequired", { DEFAULT => 'false'} );
-$config->define("publicReadable", { DEFAULT => 'true'} );
-$config->define("adminIsDocOwner", { DEFAULT => 'false'} );
-$config->define("moderators", { DEFAULT => ''} );
-$config->define("mailhost");
-$config->define("sender");
-$config->define("recipient");
-$config->define("adminname");
-if ($FORM::cfg eq 'nceas') {
-    $config->define("nceas_db");
-    $config->define("nceas_db_user");
-    $config->define("nceas_db_password");
-}
-$config->define("responseTemplate", { DEFAULT => 'crap.tmpl'} );
-$config->define("entryFormTemplate", { DEFAULT => 'crap.tmpl'} );
-$config->define("guideTemplate", { DEFAULT => 'crap.tmpl'} );
-$config->define("loginFormTemplate", { DEFAULT => 'loginForm.tmpl'} );
-$config->define("confirmDataTemplate", { DEFAULT => 'crap.tmpl'} );
-$config->define("deleteDataTemplate", { DEFAULT => 'crap.tmpl'} );
-$config->define("modEmailNotificationTemplate", { DEFAULT => 'crap.tmpl'} );
-$config->define("modResultTemplate", { DEFAULT => 'crap.tmpl'} );
-$config->define("getReviewsTemplate", { DEFAULT => 'crap.tmpl'} );
-$config->define("debug", { DEFAULT => '0'} );
-$config->define("lat", { ARGCOUNT => ARGCOUNT_HASH} );
-$config->define("lon", { ARGCOUNT => ARGCOUNT_HASH} );
-
-
+my $skinProperties = new Config::Properties();
 if (! hasContent($FORM::cfg)) {
     $error = "Application misconfigured.  Please contact the administrator.";
     push(@errorMessages, $error);
 } else {
-    my $cfgfile = $cfgdir . "/" . $FORM::cfg . "/" . $FORM::cfg . ".cfg";
-    $config->file($cfgfile);
+    my $skinProps = "$configDir/$FORM::cfg/$FORM::cfg.properties";
+    unless (open (SKIN_PROPERTIES, $skinProps)) {
+        print "Content-type: text/html\n\n";
+        print "Unable to locate skin properties at $skinProps.  Is this path correct?";
+        exit(0);
+    }
+    $skinProperties->load(*SKIN_PROPERTIES);
 }
 
-my $metacatUrl = $config->metacatUrl();
-my $username = $config->username();
-my $password = $config->password();
-my $ldapUrl = $config->ldapUrl();
-my $defaultScope = $config->defaultScope();
-my $organization = $config->organization();
-my $orgabbrev = $config->orgabbrev();
-my $orgurl = $config->orgurl();
-my $orgfilter = $organization;
-      $orgfilter =~ s/ /%20/g;
-my $responseTemplate = $config->responseTemplate();
-my $entryFormTemplate = $config->entryFormTemplate();
-my $deleteDataTemplate = $config->deleteDataTemplate();
-my $guideTemplate = $config->guideTemplate();
-my $loginFormTemplate = $config->loginFormTemplate();
-my $confirmDataTemplate = $config->confirmDataTemplate();
-my $modEmailNotificationTemplate = $config->modEmailNotificationTemplate();
-my $modResultTemplate = $config->modResultTemplate();
-my $getReviewsTemplate = $config->getReviewsTemplate();
-my $accesspubid = $config->accesspubid();
-my $accesssysid = $config->accesssysid();
-my $datasetpubid = $config->datasetpubid();
-my $datasetsysid = $config->datasetsysid();
-my $showSiteList = $config->showSiteList();
-my $lsite = $config->lsite();
-my $usite = $config->usite();
-my $showWgList = $config->showWgList();
-my $showOrganization = $config->showOrganization();
-my $hasKeyword = $config->hasKeyword();
-my $hasTemporal = $config->hasTemporal();
-my $hasSpatial = $config->hasSpatial();
-my $hasTaxonomic = $config->hasTaxonomic();
-my $hasMethod = $config->hasMethod();
-my $hasUpload = $config->hasUpload();
-my $temporalRequired = $config->temporalRequired();
-my $spatialRequired = $config->spatialRequired();
-my $contactEmailAddressRequired = $config->contactEmailAddressRequired();
-my $publicReadable = $config->publicReadable();
-my $adminIsDocOwner = $config->adminIsDocOwner();
-my $moderators = $config->moderators();
-my $mailhost = $config->mailhost();
-my $sender = $config->sender();
-my $recipient = $config->recipient();
-my $adminname = $config->adminname();
-my $nceas_db;
-my $nceas_db_user;
-my $nceas_db_password;
-if ($FORM::cfg eq 'nceas') {
-    $nceas_db = $config->nceas_db();
-    $nceas_db_user = $config->nceas_db_user();
-    $nceas_db_password = $config->nceas_db_password();
+# replacements for appconfig values using properties
+my $metacatUrl = $properties->getProperty('metacatUrl');
+my $moderators = $properties->getProperty('ldap.moderators');
+my $config = $properties->splitToTree(qr/\./, 'registry.config');
+my $templates = $properties->splitToTree(qr/\./, 'registry.templates');
+my $modules = $properties->splitToTree(qr/\./, 'registry.modules');
+my $required = $properties->splitToTree(qr/\./, 'registry.required');
+my $spatial = $properties->splitToTree(qr/\./, 'registry.spatial');
+
+my $metacatUrl = $properties->getProperty('metacatUrl');
+my $username = $config->{'username'};
+my $password = $config->{'password'};
+
+# XXX replace these with the proper array versions once the templates work correctly
+my $showWgList = $required->{'wgList'};
+my $showOrganization = $required->{'organization'};
+my $hasKeyword = $required->{'keyword'};
+my $hasTemporal = $required->{'temporal'};
+my $hasSpatial = $required->{'spatial'};
+my $hasTaxonomic = $required->{'taxonomic'};
+my $hasMethod = $required->{'method'};
+my $hasUpload = $required->{'upload'};
+
+# contains sender, recipient, admin, mailhost
+my $email = $properties->splitToTree(qr/\./, 'email');
+
+# set stderr printing if configured
+my $debug_enabled = $config->{'debug'};
+if ($FORM::debug) {
+    $debug_enabled = $FORM::debug;
 }
-my $debug = $config->debug();
+my $lat = $config->get('lat');
+my $lon = $config->get('lon');
+
+my $metacatUrl = $properties->getProperty('metacatUrl');
+my $username = $config->{'username'};
+my $password = $config->{'password'};
+
+# TODO SCW replace these with the proper array versions once the templates work correctly
+my $showWgList = $required->{'wgList'};
+my $showOrganization = $required->{'organization'};
+my $hasKeyword = $required->{'keyword'};
+my $hasTemporal = $required->{'temporal'};
+my $hasSpatial = $required->{'spatial'};
+my $hasTaxonomic = $required->{'taxonomic'};
+my $hasMethod = $required->{'method'};
+my $hasUpload = $required->{'upload'};
+
+# contains sender, recipient, admin, mailhost
+my $email = $properties->splitToTree(qr/\./, 'email');
+
+# set stderr printing if configured
+my $debug_enabled = $config->{'debug'};
 if ($FORM::debug) {
-    $debug = $FORM::debug;
+    $debug_enabled = $FORM::debug;
 }
 
-# 1.8.1 temporary baseUrl fix
-my $baseUrl = $metacatUrl;
-$baseUrl =~ s/metacat$//;
+# populate db parameters for NCEAS AdminDB
+my $database = '';
+if ($FORM::cfg eq 'nceas') {
+    my $database = $properties->splitToTree(qr/\./, 'registry.db');
+}
 
-my $lat = $config->get('lat');
-my $lon = $config->get('lon');
-
-# Convert the lat and lon configs into usable data structures
+#Convert the lat and lon configs into usable data structures
 my @sitelist;
 my %siteLatDMS;
 my %siteLongDMS;
-foreach my $newsite (keys %$lat) {
-    my ($latd, $latm, $lats, $latdir) = split(':', $lat->{$newsite});
-    my ($lond, $lonm, $lons, $londir) = split(':', $lon->{$newsite});
-    push(@sitelist, $newsite);
-    $siteLatDMS{$newsite} = [ $latd, $latm, $lats, $latdir ];
-    $siteLongDMS{$newsite} = [ $lond, $lonm, $lons, $londir ];
+while ( my ($key, $value) = each (%$spatial)) {
+    my ($name, $lon, $lat) = split(",", $value);
+    my ($latd, $latm, $lats, $latdir) = split(':', $lat);
+    my ($lond, $lonm, $lons, $londir) = split(':', $lon);
+    push(@sitelist, $name);
+    $siteLatDMS{$name} = [ $latd, $latm, $lats, $latdir ];
+    $siteLongDMS{$name} = [ $lond, $lonm, $lons, $londir ];
 }
 
 # set some configuration options for the template object
 my $ttConfig = {
-             INCLUDE_PATH => $templatesdir, 
+             INCLUDE_PATH => $properties->getProperty('templates-dir'),
              INTERPOLATE  => 0,                    
              POST_CHOMP   => 1,
              #DEBUG        => 'all',
@@ -211,14 +176,16 @@
 my $template = Template->new($ttConfig) || die $Template::ERROR, "\n";
 
 # Set up the template information that is common to all forms
+$$templateVars{'styleSkinsPath'} = $properties->getProperty('style-skins-path');
+$$templateVars{'styleCommonPath'} = $properties->getProperty('style-common-path');
+$$templateVars{'servletPath'} = $properties->getProperty('servlet-path');
+$$templateVars{'metacatUrl'} = $metacatUrl;
+$$templateVars{'cgiPrefix'} = $properties->getProperty('cgi-prefix');
 $$templateVars{'cfg'} = $FORM::cfg;
-$$templateVars{'recipient'} = $recipient;
-$$templateVars{'adminname'} = $adminname;
-$$templateVars{'organization'} = $organization;
-$$templateVars{'orgabbrev'} = $orgabbrev;
-$$templateVars{'orgurl'} = $orgurl;
-$$templateVars{'orgfilter'} = $orgfilter;
-$$templateVars{'baseUrl'} = $baseUrl;
+$$templateVars{'email'} = $email;
+$$templateVars{'templates'} = $templates;
+$$templateVars{'required'} = $required;
+$$templateVars{'config'} = $config;
 
 debug("Registry: Initialized -- stage set: $FORM::stage");
 
@@ -227,7 +194,7 @@
     debug("Registry: No configuration set.");
     print "Content-type: text/html\n\n";
     $$templateVars{'message'} = 'Error: The registry requires a skin name to continue.';
-    $template->process( $loginFormTemplate, $templateVars);
+    $template->process( $templates->{'login'}, $templateVars);
     exit(0);
 }
 
@@ -240,13 +207,6 @@
     exit(0);
 }
 
-# FIXME: temporary 1.8.1 fix to prevent missing upload directory from causing errors
-if (not -W $tmpdir) {
-    debug("Registry Error: Can't write files to $tmpdir, disabling file uploads");
-    #push(@errorMessages, "Unable to write files to temporary folder. Email sysadmin.");
-    $hasUpload = 'false';
-}
-
 # Process the form based on stage parameter. 
 if ($FORM::stage =~ "loginform") {
     print "Content-type: text/html\n\n";
@@ -259,11 +219,11 @@
 
     if ( $session->is_empty ) {
 	# no session found ... redirect to login page template
-        $template->process( $loginFormTemplate, $templateVars);
+        $template->process( $templates->{'login'}, $templateVars);
     } else {
 	# session found ... delete the session....
 	$session->delete();
-	$template->process( $loginFormTemplate, $templateVars);
+	$template->process( $templates->{'login'}, $templateVars);
     }
 	exit(0);
 } elsif ($FORM::stage =~ "logout") {
@@ -294,7 +254,7 @@
 if ($FORM::stage =~ "guide") {
     # Send back the information on how to fill the form
     $$templateVars{'section'} = "Guide on How to Complete Registry Entries";
-    $template->process( $guideTemplate, $templateVars);
+    $template->process( $template->{'guide'}, $templateVars);
     exit(0);
 
 } elsif ($FORM::stage =~ "insert") {
@@ -316,7 +276,7 @@
     if ( $session->is_empty ) {
         # no session found ... redirect to login page template
     	$$templateVars{'message'} = 'You must login to modify your dataset.';
-        $template->process( $loginFormTemplate, $templateVars);
+        $template->process( $templates->{'login'}, $templateVars);
     } else {
     	# Show the form will all the values filled in.
     	my @sortedSites;
@@ -340,7 +300,7 @@
     } else {
     $$templateVars{'status'} = "Cancel";
     $$templateVars{'function'} = "cancel";
-    $template->process( $responseTemplate, $templateVars);
+    $template->process( $templates->{'response'}, $templateVars);
     exit(0);
     }
 
@@ -348,7 +308,7 @@
     # Deletion of a file has been requested. 
     # Ask for username and password using deleteDataForm
     $$templateVars{'docid'} = $FORM::docid;
-    $template->process( $deleteDataTemplate, $templateVars);
+    $template->process( $templates->{'deleteData'}, $templateVars);
     exit(0);
 
 }elsif ($FORM::stage !~ "confirmed") {
@@ -360,7 +320,7 @@
         # no session found ... redirect to login page template
         $$templateVars{'showInstructions'} = 'true';
         $$templateVars{'message'} = 'You must login to register your dataset.';
-        $template->process( $loginFormTemplate, $templateVars);
+        $template->process( $templates->{'login'}, $templateVars);
     } else {
 
     	# Hence, send back entry form for entry of data.  
@@ -369,34 +329,35 @@
     	foreach my $site (sort @sitelist) {
         	push(@sortedSites, $site);
     	}
-    
+
     	if ($FORM::cfg eq 'nceas') {
-        	my $projects = getProjectList();
+        	my $projects = getProjectList($database);
         	$$templateVars{'projects'} = $projects;
         	$$templateVars{'wg'} = \@FORM::wg;
     	}
 
-    	$$templateVars{'showSiteList'} = $showSiteList;
-    	$$templateVars{'lsite'} = $lsite;
-    	$$templateVars{'usite'} = $usite;
-    	$$templateVars{'showWgList'} = $showWgList;
-    	$$templateVars{'showOrganization'} = $showOrganization;
-    	$$templateVars{'hasKeyword'} = $hasKeyword;
-    	$$templateVars{'hasTemporal'} = $hasTemporal;
-    	$$templateVars{'hasSpatial'} = $hasSpatial;
-    	$$templateVars{'hasTaxonomic'} = $hasTaxonomic;
-    	$$templateVars{'hasMethod'} = $hasMethod;
-      $$templateVars{'hasUpload'} = $hasUpload;
-    	$$templateVars{'temporalRequired'} = $temporalRequired;
-    	$$templateVars{'spatialRequired'} = $spatialRequired;
-    	$$templateVars{'contactEmailAddressRequired'} = $contactEmailAddressRequired;
+        #$$templateVars{'required'} = $required; 
+        $$templateVars{'templates'} = $templates;
+        $$templateVars{'showSiteList'} = $required->{'siteList'};
+        $$templateVars{'site'} = $config->{'site'};
+        $$templateVars{'showWgList'} = $showWgList;
+        $$templateVars{'showOrganization'} = $showOrganization;
+        $$templateVars{'hasKeyword'} = $hasKeyword;
+        $$templateVars{'hasTemporal'} = $hasTemporal;
+        $$templateVars{'hasSpatial'} = $hasSpatial;
+        $$templateVars{'hasTaxonomic'} = $hasTaxonomic;
+        $$templateVars{'hasMethod'} = $hasMethod;
+        $$templateVars{'hasUpload'} = $hasUpload;
+        $$templateVars{'temporalRequired'} = $required->{'temporalRequired'};
+        $$templateVars{'spatialRequired'} = $required->{'spatialRequired'};
+        $$templateVars{'contactEmailAddressRequired'} = $required->{'contactEmail'};
 
-    	$$templateVars{'siteList'} = \@sortedSites;
-    	$$templateVars{'section'} = "Entry Form";
-    	$$templateVars{'docid'} = "";
-    	debug("Registry: Sending form: ready to process template");
-    	$template->process( $entryFormTemplate, $templateVars);
-    	debug("Registry: Sending form: template processed");
+        $$templateVars{'siteList'} = \@sortedSites;
+        $$templateVars{'section'} = "Entry Form";
+        $$templateVars{'docid'} = "";
+        debug("Registry: Sending form: ready to process template");
+        $template->process( $templates->{'entry'}, $templateVars);
+        debug("Registry: Sending form: template processed");
    }
    exit(0);
 }
@@ -444,12 +405,13 @@
     # Login to metacat
     my ($dname, $userPass) = getCredentials();
     my $response = $metacat->login($dname, $userPass);
+    my $errorMessage = "";
 
     # Parameters have been validated and Create the XML document
     my $xmldoc = createXMLDocument();
     
     # Write out the XML file for debugging purposes
-    #my $testFile = $tmpdir . "/test-file.xml";
+    #my $testFile = $tmpDir . "/test-file.xml";
     #open (TFILE,">$testFile") || die ("Cant open xml file...\n");
     #print TFILE $xmldoc;
     #close(TFILE);
@@ -467,11 +429,11 @@
         $$templateVars{'cfg'} = $FORM::cfg;
         $$templateVars{'function'} = "submitted";
         $$templateVars{'section'} = "Submission Status";
-        $template->process( $responseTemplate, $templateVars);
+        $template->process( $templates->{'response'}, $templateVars);
         exit(0);
     } else {
 
-    	if($adminIsDocOwner eq 'true'){
+    	if($config->{'adminIsDocOwner'} eq 'true'){
     		$response = $metacat->login($username, $password);
    	 	if (! $response) {
         		push(@errorMessages, $metacat->getMessage());
@@ -482,7 +444,7 @@
         		$$templateVars{'cfg'} = $FORM::cfg;
         		$$templateVars{'function'} = "submitted";
         		$$templateVars{'section'} = "Submission Status";
-        		$template->process( $responseTemplate, $templateVars);
+        		$template->process( $templates->{'response'}, $templateVars);
         		exit(0);
     		}
     	} 
@@ -493,7 +455,7 @@
             # document is being inserted 
             my $notunique = "NOT_UNIQUE";
             while ($notunique eq "NOT_UNIQUE") {
-                $docid = newAccessionNumber($defaultScope);
+                $docid = newAccessionNumber($config->{'scope'});
                 
                 $xmldocWithDocID = $xmldoc;
                 $xmldocWithDocID =~ s/docid/$docid/;
@@ -508,7 +470,7 @@
                 $notunique = insertMetadata($xmldocWithDocID, $docid);
                 #  if (!$notunique) {
                 # Write out the XML file for debugging purposes
-                #my $testFile = $tmpdir . "/test-new.xml";
+                #my $testFile = $tmpDir . "/test-new.xml";
                 #open (TFILE,">$testFile") || die ("Cant open xml file...\n");
                 #print TFILE $newdoc;
                 #close(TFILE);
@@ -517,7 +479,7 @@
                 # The id wasn't unique, so update our lastid file
                 if ($notunique eq "NOT_UNIQUE") {
                     debug( "Registry: Updating lastid (B1.1)");
-                    updateLastId($defaultScope);
+                    updateLastId($config->{'scope'});
                 }
             }
             debug("Registry: B2");
@@ -569,7 +531,7 @@
             # Create our HTML response and send it back
             $$templateVars{'function'} = "modified";
             $$templateVars{'section'} = "Modification Status";
-            $template->process( $responseTemplate, $templateVars);
+            $template->process( $templates->{'response'}, $templateVars);
     
             exit(0);
         }
@@ -606,7 +568,7 @@
 $$templateVars{'function'} = "submitted";
 $$templateVars{'section'} = "Submission Status";
 
-$template->process( $responseTemplate, $templateVars);
+$template->process( $templates->{'response'}, $templateVars);
 
 exit(0);
 
@@ -630,7 +592,7 @@
       (my $foundScope, my $id, my $rev) = split(/\./, $docid);
       debug("Docid is: $docid\n");
       debug("Lastid is: $id");
-      my $scopeFile = $cfgdir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
+      my $scopeFile = $configDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
       # FIXME: skins dir isn't generally writeable by the HTTP server, use tmp instead
       open(LASTID, "+>$scopeFile") or 
           die "Failed to open lastid file for writing!";
@@ -691,7 +653,7 @@
   my $docrev = 1;
   my $lastid = 1;
 
-  my $scopeFile = $cfgdir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
+  my $scopeFile = $configDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
   if (-e $scopeFile) {
     open(LASTID, "<$scopeFile") or die "Failed to generate accession number!";
     $lastid = <LASTID>;
@@ -719,7 +681,7 @@
     my @invalidParams;
 
     push(@invalidParams, "Name of the Project is not selected in the form.")
-        if (scalar(@FORM::wg) == 0 && $showWgList eq 'true');
+        if (scalar(@FORM::wg) == 0 && $required->{'wgList'} eq 'true');
     push(@invalidParams, "First name of person entering the form is missing.")
         unless hasContent($FORM::providerGivenName);
     push(@invalidParams, "Last name of person entering the form is missing.")
@@ -726,7 +688,7 @@
         unless hasContent($FORM::providerSurName);
     push(@invalidParams, "Dataset title is missing.")
         unless hasContent($FORM::title);
-    push(@invalidParams, $usite." name is missing.")
+    push(@invalidParams, ucfirst($config->{'site'})." name is missing.")
         unless ((hasContent($FORM::site) && !($FORM::site =~ /^Select/)) ||
                 $FORM::cfg eq "nceas");
     push(@invalidParams, "First name of principal data set owner is missing.")
@@ -1051,14 +1013,14 @@
     my $fileNum = shift;
     my $fileHash = param("upload_$fileNum");
     my $fileName = param("uploadname_$fileNum");
+    my $contentType = param("uploadtype_$fileNum");
     my $filePerm = param("uploadperm_$fileNum");
-    my $contentType = param("uploadtype_$fileNum");
     my $cleanName = $fileName;
 
     # normalize input filenames; Windows filenames include full paths
     $cleanName =~ s/.*[\/\\](.*)/$1/;
 
-    my $outFile = $tmpdir . "/" . $cleanName;
+    my $outFile = $tmpDir . "/" . $cleanName;
     #debug("Reading file from disk: $outFile");
 
     my $fileSize = stat($outFile)->size;
@@ -1075,15 +1037,11 @@
         return 0;
     }
 
-    #my ($dname, $userPass) = getCredentials();
-    #debug("Logging in with $dname, $userPass");
-    #$metacat->login($username, $password);
-
-    my $docid = newAccessionNumber($defaultScope);
+    my $docid = newAccessionNumber($config->{'scope'});
     my $unique = uploadData($outFile, $docid);
     if (!$unique) {
         debug( "Registry: Updating lastid file");
-        updateLastId($defaultScope);
+        updateLastId($config->{'scope'});
     }
 
     my $entityid = $fileHash."001";
@@ -1129,7 +1087,6 @@
 
     # file is in Metacat, generate the pertinent EML elements
     my $contentType = uploadInfo($fileName)->{'Content-Type'};
-
     # occasionally CGI.pm doesn't get the file info.  In this case,
     # use a default MIME type of text/plain.  Seems fixed in the newer CGI.pm:
     # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=313141
@@ -1165,7 +1122,7 @@
     $ctx->add($fileData);
     my $digest = $ctx->hexdigest;
 
-    my $outputName = $tmpdir . "/" . $cleanName;
+    my $outputName = $tmpDir . "/" . $cleanName;
     open(OUT,">$outputName") or die "Could not open: $!";
     print OUT $fileData;
     close(OUT);
@@ -1176,7 +1133,7 @@
 
 sub deleteFile {
     my $input = shift;
-    my $fileName = $tmpdir . "/" . $input;
+    my $fileName = $tmpDir . "/" . $input;
 
     if (-e $fileName) {
         unlink $fileName or
@@ -1310,6 +1267,7 @@
                   $roleName = $defaultRole;
                 }
 
+                #debug("XXXXX role name: " . $roleName);
                 push (@{$orig{$roleName}}, [$first, $last, $origRole]);
             }
         }
@@ -1439,7 +1397,7 @@
         foreach my $x (@$a_ref) {
             my ($kw, $kwType) = @$x;
             $kwElem .= "<keyword ";
-            if (hasContent($kwType) && $kwType ne "None") {
+            if (hasContent($kwType) && $kwType != "None") {
                  $kwElem.= "keywordType=\"".lc($kwType)."\"";
             }
             $kwElem .= ">$kw</keyword>\n";
@@ -1882,7 +1840,7 @@
         $access .= allowElement(getUsername(), 'read', 'write'); 
     }
 
-    if($publicReadable eq "true"){
+    if($config->{'publicReadable'} eq "true"){
         $access .= allowElement('public', 'read');
     }
     $access .= "</access>\n";
@@ -1906,7 +1864,7 @@
     my $username = '';
      
     if ($FORM::username ne '') {
-        $username = "uid=$FORM::username,o=$FORM::organization,dc=ecoinformatics,dc=org";
+        $username = "uid=$FORM::username,o=$FORM::organization,dc=ecoinformatics,dc=org";    
     } else {
         my $session = CGI::Session->load();
         if ( !$session->is_empty ) {
@@ -1955,12 +1913,12 @@
         push(@errorMessages, $error);
     } elsif ($doc=~ /<error/) {
     if ( $doc=~ /public/){
-        	$error ="Error in reading the eml document. Please check if you are logged in.";
-        	push(@errorMessages, $error);
-	} else {
-        	$error ="Error in reading the eml document. Please check if you have access to read the document";
-        	push(@errorMessages, $error);	
-	}
+          $error ="Error in reading the eml document. Please check if you are logged in.";
+          push(@errorMessages, $error);
+  } else {
+          $error ="Error in reading the eml document. Please check if you have access to read the document";
+          push(@errorMessages, $error); 
+  }
     } else {
         $findType = $xmldoc->findnodes('//dataset/identifier');
         if ($findType->size() > 0) {
@@ -1975,7 +1933,7 @@
                     # If the file is already in @fileArray then do not add it 
                     $alreadyInArray = 0;
                     foreach $element (@fileArray) {
-                        $tempfile = $tmpdir."/".$pushDoc;
+                        $tempfile = $tmpDir."/".$pushDoc;
                         if ($element eq $pushDoc) {
                             $alreadyInArray = 1;
                         }
@@ -1982,7 +1940,7 @@
                     }
             
                     if (!$alreadyInArray) {
-                        $tempfile = $tmpdir."/".$pushDoc;
+                        $tempfile = $tmpDir."/".$pushDoc;
                         $response = "";
                         $response = $metacat->read($pushDoc);    
                         if (! $response) {
@@ -2005,7 +1963,7 @@
 
             # Read the main document. 
 
-            $tempfile = $tmpdir."/".$docid;
+            $tempfile = $tmpDir."/".$docid;
             open (TFILE,">$tempfile") || die ("Cant open xml file...\n");
             print TFILE $doc;
             close(TFILE);
@@ -2018,13 +1976,13 @@
             my $resultsheet;
         
             $xslt = XML::LibXSLT->new();
-            $tempfile = $tmpdir."/"."triple_info.xsl";
+            $tempfile = $tmpDir."/"."triple_info.xsl";
     
             $triplesheet = $xslt->parse_stylesheet_file($tempfile);
 
-            $results = $triplesheet->transform($xmldoc, packageDir => "\'$tmpdir/\'", packageName => "\'$docid\'");
+            $results = $triplesheet->transform($xmldoc, packageDir => "\'$tmpDir/\'", packageName => "\'$docid\'");
 
-            $tempfile = $tmpdir."/"."emlb6toeml2.xsl";
+            $tempfile = $tmpDir."/"."emlb6toeml2.xsl";
             $stylesheet = $xslt->parse_stylesheet_file($tempfile);
             $resultsheet = $stylesheet->transform($results);
         
@@ -2051,9 +2009,9 @@
 ################################################################################
 sub modifyData {
 
-    my $xmldoc = readDocumentFromMetacat();    	
+    my $xmldoc = readDocumentFromMetacat();     
     if (!scalar(@errorMessages)) {
-    	getFormValuesFromEml2($xmldoc);
+      getFormValuesFromEml2($xmldoc);
     }
 
     if (scalar(@errorMessages)) {
@@ -2063,10 +2021,10 @@
         $error = 1;
         $$templateVars{'function'} = "modification";
         $$templateVars{'section'} = "Modification Status";
-        $template->process( $responseTemplate, $templateVars); 
+        $template->process( $templates->{'response'}, $templateVars); 
     } else {
         $$templateVars{'form'} = 're_entry';
-        $template->process( $entryFormTemplate, $templateVars);
+        $template->process( $templates->{'entry'}, $templateVars);
     }
 }
 
@@ -2088,10 +2046,10 @@
     my $foundDSO;
 
     # set variable values
-    $$templateVars{'showSiteList'} = $showSiteList;
-    $$templateVars{'lsite'} = $lsite;
-    $$templateVars{'usite'} = $usite;
-    $$templateVars{'showWgList'} = $showWgList;
+    $$templateVars{'required'} = $required;
+    $$templateVars{'showSiteList'} = $required->{'siteList'};
+    $$templateVars{'site'} = $config->{'site'};
+    #$$templateVars{'showWgList'} = $showWgList;
     $$templateVars{'showOrganization'} = $showOrganization;
     $$templateVars{'hasKeyword'} = $hasKeyword;
     $$templateVars{'hasTemporal'} = $hasTemporal;
@@ -2098,9 +2056,9 @@
     $$templateVars{'hasSpatial'} = $hasSpatial;
     $$templateVars{'hasTaxonomic'} = $hasTaxonomic;
     $$templateVars{'hasMethod'} = $hasMethod;
-    $$templateVars{'spatialRequired'} = $spatialRequired;
-    $$templateVars{'contactEmailAddressRequired'} = $contactEmailAddressRequired;
-    $$templateVars{'temporalRequired'} = $temporalRequired;
+    $$templateVars{'spatialRequired'} = $required->{'spatialRequired'};
+    $$templateVars{'contactEmailAddressRequired'} = $required->{'contactEmail'};
+    $$templateVars{'temporalRequired'} = $required->{'temporal'};
 
     # find out the tag <alternateIdentifier>. 
     $results = $doc->findnodes('//dataset/alternateIdentifier');
@@ -2200,8 +2158,6 @@
                     $aoCount++;
                 }
             }
-            $$templateVars{'origEmail'} = findValue($node, '../electronicMailAddress');
-            $$templateVars{'origNameOrg'} = findValue($node, '../organizationName');
         }
 
     $results = $doc->findnodes('//dataset/creator/organizationName');
@@ -2214,7 +2170,7 @@
         foreach $node ($results->get_nodelist) {
             my $tempValue = findValue($node,'../organizationName');
             $tempResult = $node->findnodes('../individualName');
-            if ($tempResult->size == 0 && $tempValue ne $organization) {
+            if ($tempResult->size == 0 && $tempValue ne $config->{'organization'}) {
                 $$templateVars{'site'} = $tempValue;
             }
         }
@@ -2224,7 +2180,7 @@
                 my $tempValue = findValue($node,'../organizationName');
                 $wg[scalar(@wg)] = $tempValue;
             }
-            my $projects = getProjectList();
+            my $projects = getProjectList($database);
             $$templateVars{'projects'} = $projects;
             $$templateVars{'wg'} = \@wg;
         }
@@ -2266,7 +2222,7 @@
                     $$templateVars{"origNamefirst$aoCount"} =  findValue($tempNode, './givenName');
                     $$templateVars{"origNamelast$aoCount"} =  findValue($tempNode, './surName');
                     $$templateVars{"origRole$aoCount"} = findValue($tempNode, '../role');
-                    $aoCount++;
+                    $aoCount++;           
                 }
             }
      }
@@ -2317,11 +2273,12 @@
 
     my $count = 1;
     foreach $node ($results->get_nodelist) {
-        $tempResult = $node->findnodes('./keyword');
+    $tempResult = $node->findnodes('./keyword');
+    if ($tempResult->size() > 1) {
+        errMoreThanOne("keyword");
+    } else {
         foreach $tempNode ($tempResult->get_nodelist) {
             $$templateVars{"keyword$count"} = $tempNode->textContent();
-            $$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus");
-
             if ($tempNode->hasAttributes()) {
                 my @attlist = $tempNode->attributes();
                 my $tmp = $attlist[0]->value;  #convert the first letter to upper case
@@ -2328,9 +2285,11 @@
                 $tmp =~ s/\b(\w)/\U$1/g;
                 $$templateVars{"kwType$count"} = $tmp;
             }
-            $count++;
         }
     }
+    $$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus");
+        $count++;
+    }
     $$templateVars{'keyCount'} = $count;
     if($count > 0 ){
        $$templateVars{'hasKeyword'} = "true";
@@ -2550,12 +2509,12 @@
             dontOccur($node, "../positionName|../onlineURL|../userId", 
               "positionName, onlineURL, userId in contact tag");
             dontOccur($node, "./saluation", "saluation in contact tag");                
-
+        
             $tempResult = $node->findnodes('../address|../phone|../electronicmailAddress|../organizationName');
             if ($tempResult->size > 0) {
                 $$templateVars{'origNamefirstContact'} = findValue($node, 'givenName');
                 $$templateVars{'origNamelastContact'} = findValue($node, 'surName');
-
+    
                 my $tempResult2 = $node->findnodes('../address');
                 if ($tempResult2->size > 1) {
                     errMoreThanOne("address");
@@ -2568,7 +2527,7 @@
                         $$templateVars{'origCountryContact'} = findValue($tempNode2, 'country');
                     }
                 }
-
+            
                 my $tempResult3 = $node->findnodes('../phone');
                 if ($tempResult3->size > 2) {
                     errMoreThanN("phone");
@@ -2593,9 +2552,6 @@
                 $$templateVars{'origNamelastContact'} = findValue($node, 'surName');
                 $$templateVars{'origNameOrgContact'} = findValue($node, '../organizationName');
             }
-            $$templateVars{'origEmail'} = findValue($node, '../electronicMailAddress');
-            $$templateVars{'origNameOrg'} = findValue($node, '../organizationName');
-
         }
     }
     
@@ -2708,12 +2664,12 @@
    
     ########################################################
 
+
     dontOccur($doc, "./dataTable", "dataTable");
     dontOccur($doc, "./spatialRaster", "spatialRaster");
     dontOccur($doc, "./spatialVector", "spatialVector");
     dontOccur($doc, "./storedProcedure", "storedProcedure");
     dontOccur($doc, "./view", "view");
-
     dontOccur($doc, "./otherEntity", "otherEntity");
     dontOccur($doc, "./references", "references");
     
@@ -2840,7 +2796,7 @@
 
     $$templateVars{'function'} = "deleted";
     $$templateVars{'section'} = "Deletion Status";
-    $template->process( $responseTemplate, $templateVars);
+    $template->process( $templates->{'response'}, $templateVars);
     }
 }
 
@@ -2862,47 +2818,47 @@
         my $returnVal = $metacat->login($username,$password);
         debug("Registry: Login was $returnVal for login attempt to $metacatUrl, with $username");
         if($returnVal > 0){
-		# valid username and passwd
-		# create a new session and store username and passswd
-		$session = new CGI::Session();
+            # valid username and passwd
+            # create a new session and store username and passswd
+            $session = new CGI::Session();
 
-		$session->param('username', $username);
-		$session->param('password', $password);
-		
-		if($returnVal == 2 || $returnVal == 4){
-			# is a moderator. store this information in the session
-			$session->param('moderator', 'true');	
-		}
+            $session->param('username', $username);
+            $session->param('password', $password);
+    
+            if($returnVal == 2 || $returnVal == 4){
+                # is a moderator. store this information in the session
+                $session->param('moderator', 'true'); 
+            }
 
-		# send redirect to metacat and action = login
-		my $html = "<html><head>";
-    		$html .= "</head><body onload=\"document.loginForm.submit()\">";
-		$html .= "<form name=\"loginForm\" method=\"post\" action=\"@systemidserver@@servlet-path@\">";
-		$html .= "<input type=\"hidden\" name=\"action\" value=\"login\" />";
-		$html .= "<input type=\"hidden\" name=\"username\" value=\"".$FORM::username."\" />";
-		$html .= "<input type=\"hidden\" name=\"password\" value=\"".$FORM::password."\" />";
-		$html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
-		$html .= "</form></body></html>";
-		print $session->header();
-		print $html;
-	} else {
-		# send back the error template with error message as wrong username password
-		# push(@errorMessages, $metacat->getMessage());
-		print "Content-type: text/html\n\n";
-        	push(@errorMessages, "Failed during login.\n");
-        	$$templateVars{'status'} = 'login_failure';
-        	$$templateVars{'errorMessages'} = \@errorMessages;
-        	$$templateVars{'cfg'} = $FORM::cfg;
-        	$$templateVars{'section'} = "Login Status";
-        	$template->process( $responseTemplate, $templateVars);
-	}
+            # send redirect to metacat and action = login
+            my $html = "<html><head>";
+            $html .= "</head><body onload=\"document.loginForm.submit()\">";
+            $html .= "<form name=\"loginForm\" method=\"post\" action=\"". $metacatUrl ."\">";
+            $html .= "<input type=\"hidden\" name=\"action\" value=\"login\" />";
+            $html .= "<input type=\"hidden\" name=\"username\" value=\"".$FORM::username."\" />";
+            $html .= "<input type=\"hidden\" name=\"password\" value=\"".$FORM::password."\" />";
+            $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
+            $html .= "</form></body></html>";
+            print $session->header();
+            print $html;
+        } else {
+            # send back the error template with error message as wrong username password
+            # push(@errorMessages, $metacat->getMessage());
+            print "Content-type: text/html\n\n";
+            push(@errorMessages, "Failed during login.\n");
+            $$templateVars{'status'} = 'login_failure';
+            $$templateVars{'errorMessages'} = \@errorMessages;
+            $$templateVars{'cfg'} = $FORM::cfg;
+            $$templateVars{'section'} = "Login Status";
+            $template->process( $templates->{'response'}, $templateVars);
+        }
 
-        exit(0);
+    exit(0);
     } else {
         # session found ... redirect to index page
-        my $url = "@systemidserver@@style-skins-path@/".$FORM::cfg."/index.html";
-	redirect($url);
-	exit(0);
+        my $url = "$configDir/$FORM::cfg/index.html";
+        redirect($url);
+        exit(0);
    }
 }
 
@@ -2918,25 +2874,25 @@
     my $session = CGI::Session->load();
     if ( $session->is_empty || $session->is_expired) {
         # no session found ... send back to index.html page ... 
-	    debug("Session empty or not found");
-  	    my $url = "@systemidserver@@style-skins-path@/".$FORM::cfg."/index.html";
-	    redirect($url);
+        debug("Session empty or not found");
+        my $url = "$configDir/$FORM::cfg/index.html";
+        redirect($url);
         # should logout request be sent to metacat??? 
-	} else {
-	    # get the user name and delete the session
-	    debug("Session found");
-  	    my $uname = $session->param("username");
-	    $session->delete();
-	    # send redirect to metacat and action = login
- 	    my $html = "<html><head>";
-   	    $html .= "</head><body onload=\"document.loginForm.submit()\">";
- 	    $html .= "<form name=\"loginForm\" method=\"post\" action=\"@systemidserver@@servlet-path@\">";
-	    $html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
-	    $html .= "<input type=\"hidden\" name=\"username\" value=\"".$uname."\" />";
-	    $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
-	    $html .= "</form></body></html>";
-	    print($html);
-	}
+    } else {
+        # get the user name and delete the session
+        debug("Session found");
+        my $uname = $session->param("username");
+        $session->delete();
+        # send redirect to metacat and action = login
+        my $html = "<html><head>";
+        $html .= "</head><body onload=\"document.loginForm.submit()\">";
+        $html .= "<form name=\"loginForm\" method=\"post\" action=\"". $metacatUrl ."\">";
+        $html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
+        $html .= "<input type=\"hidden\" name=\"username\" value=\"".$uname."\" />";
+        $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
+        $html .= "</form></body></html>";
+        print($html);
+    }
 }
 
 ################################################################################
@@ -2976,8 +2932,8 @@
     my $session = CGI::Session->load();
     if ( $session->is_empty || $session->is_expired) {
         # no session found ... send back to index.html page ... 
-	processResultTemplate($stage, 'failure', "Moderator is not logged in.\n");		
-	$returnValue = -1;
+        processResultTemplate($stage, 'failure', "Moderator is not logged in.\n");
+        $returnValue = -1;
     } 
 
     # check if logged in user is moderator
@@ -2984,14 +2940,14 @@
     my $moderator = $session->param("moderator");
     if ( $moderator ne 'true') {
         # no session found ... send back to index.html page ... 
-	debug("Logged in user is not moderator");
-	processResultTemplate($stage, 'failure', "Logged in user is not moderator.\n");		
-	$returnValue = -1;
+        debug("Logged in user is not moderator");
+        processResultTemplate($stage, 'failure', "Logged in user is not moderator.\n");
+        $returnValue = -1;
     } 
 
     if($returnValue eq 1){
-    	$modUsername = $session->param("username");
-    	$modPassword = $session->param("password");
+        $modUsername = $session->param("username");
+        $modPassword = $session->param("password");
     }
 
     return $returnValue;
@@ -2998,29 +2954,29 @@
 }
 
 sub handleRead {
-	my $docid = $FORM::docid;
-	my $errorMessage;
-	
-    	print "Content-type: text/html\n\n";
-		
-	# Check if the session exists
-	my $session = CGI::Session->load();
-    	if ( $session->is_empty || $session->is_expired) {
-        	# no session found ... send back the regular read page ...
-       		my $url = "@systemidserver@@style-skins-path@/".$FORM::cfg."/index.html";
-	        redirect($url);
-    	} else {
-		my $htmldoc = "";
-		$htmldoc .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
-		$htmldoc .= "<html><head><title>Dataset Description: ".$docid."</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>";
-		$htmldoc .= "<frameset rows=\"150,*\" cols=\"*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">";
-		$htmldoc .= "<frame src=\"@systemidserver@@style-skins-path@/".$FORM::cfg."/header.jsp\" marginwidth=\"40\" name=\"topFrame\" scrolling=\"NO\" noresize>";
-		$htmldoc .= "<frameset cols=\"200,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">";
-        	$htmldoc .= "<body></body><frame src=\"@cgi-prefix@/register-dataset.cgi?cfg=".$FORM::cfg."&stage=review_frame&docid=".$docid."\" name=\"rightFrame\" scrolling=\"NO\" noresize></frame>";
-        	$htmldoc .= "<frame src=\"@systemidserver@@servlet-path@?action=read&qformat=".$FORM::cfg."&docid=".$docid."&insertTemplate=0\" name=\"mainFrame\">";
-  		$htmldoc .= "</frameset></frameset></html>";
+    my $docid = $FORM::docid;
+    my $errorMessage;
 
-       		print $htmldoc;	
+    print "Content-type: text/html\n\n";
+
+    # Check if the session exists
+    my $session = CGI::Session->load();
+        if ( $session->is_empty || $session->is_expired) {
+            # no session found ... send back the regular read page ...
+       	    my $url = "$configDir/$FORM::cfg/index.html";
+       	    redirect($url);
+        } else {
+       	    my $htmldoc = "";
+       	    $htmldoc .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
+       	    $htmldoc .= "<html><head><title>Dataset Description: ".$docid."</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>";
+       	    $htmldoc .= "<frameset rows=\"150,*\" cols=\"*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">";
+       	    $htmldoc .= "<frame src=\"$configDir/$FORM::cfg/header.jsp\" marginwidth=\"40\" name=\"topFrame\" scrolling=\"NO\" noresize>";
+       	    $htmldoc .= "<frameset cols=\"200,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">";
+       	    $htmldoc .= "<body></body><frame src=\"$cgiUrl?cfg=$FORM::cfg&stage=review_frame&docid=".$docid."\" name=\"rightFrame\" scrolling=\"NO\" noresize></frame>";
+       	    $htmldoc .= "<frame src=\"". $metacatUrl ."?action=read&qformat=".$FORM::cfg."&docid=".$docid."&insertTemplate=0\" name=\"mainFrame\">";
+            $htmldoc .= "</frameset></frameset></html>";
+
+       	    print $htmldoc;	
 	}
 } 
 
@@ -3038,7 +2994,7 @@
 	if ( $moderator eq 'true') {
 		$$templateVars{'isModerator'} = "true";
 	}
-	$template->process( $getReviewsTemplate, $templateVars);
+	$template->process( $templates->{'getReviews'}, $templateVars);
 }
 
 sub getReviewHistoryHTML {
@@ -3596,35 +3552,30 @@
 #
 ################################################################################
 sub mod_sendNotification {
-    my $title = shift;
-    my $contactEmailAddress = shift;
-    my $contactName = shift;
-    my $subject = shift;
+	my $title = shift;
+	my $contactEmailAddress = shift;
+	my $contactName = shift;
+	my $subject = shift;
 
-    debug($subject);
+	debug($subject);
     # send notification to the user and the moderator
-    my $templateVars = { 'stage' => $FORM::stage };
-    $$templateVars{'recipient'} = $recipient;
-    $$templateVars{'sender'} = $sender;
-    # form doesn't handle edit without revision; append
-    #my ($x, $y, $z) = split(/\./, $FORM::docid);
-    #my $docidWithoutRev = $x.".".$y;
-    #$$templateVars{'docid'} = $docidWithoutRev;
-    $$templateVars{'docid'} = $FORM::docid;
-    $$templateVars{'comment'} = $FORM::review;
-    $$templateVars{'contactName'} = $contactName;
-    $$templateVars{'dpTitle'} = $title;
+	my $templateVars = { 'stage' => $FORM::stage };
+	my ($x, $y, $z) = split(/\./, $FORM::docid);
+        my $docidWithoutRev = $x.".".$y;
+	$$templateVars{'docid'} = $docidWithoutRev;
+	$$templateVars{'comment'} = $FORM::review;
+	$$templateVars{'contactName'} = $contactName;
+	$$templateVars{'dpTitle'} = $title;
 
-    $$templateVars{'recipient_status'} = 'moderator';
-    sendNotification($mailhost, $sender, $recipient, $subject, 
-                            $modEmailNotificationTemplate, $templateVars);
-    if($contactEmailAddress ne ''){
-        # send notification to contact email address specified in cfg   
-        $$templateVars{'recipient'} = $contactEmailAddress;
-        $$templateVars{'recipient_status'} = 'user';
-        sendNotification($mailhost, $sender, $contactEmailAddress, 
-                $subject, $modEmailNotificationTemplate, $templateVars);
-    }
+	$$templateVars{'recipient_status'} = 'moderator';
+	sendNotification($email->{'sender'}, $email->{'recipient'}, $subject, 
+							$templates->{'modEmailNotification'}, $templateVars);
+	if($contactEmailAddress ne ''){
+		# send notification to contact email address specified in cfg   
+		$$templateVars{'recipient_status'} = 'user';
+		sendNotification($email->{'sender'}, $contactEmailAddress, 
+				$subject, $templates->{'modEmailNotification'}, $templateVars);
+	}
 }
 
 ################################################################################
@@ -3633,7 +3584,6 @@
 #
 ################################################################################
 sub sendNotification {
-    my $mailhost = shift;
     my $sender = shift;
     my $recipient = shift;
     my $subject = shift;
@@ -3640,7 +3590,7 @@
     my $templateForm = shift;
     my $templateVars = shift;
 
-    my $smtp = Net::SMTP->new($mailhost);
+    my $smtp = Net::SMTP->new($email->{'mailhost'});
     $smtp->mail($sender);
     $smtp->to($recipient);
 
@@ -3686,7 +3636,7 @@
 	}
     }
     $$templateVars{'message'} = $message;
-    $template->process($modResultTemplate, $templateVars);
+    $template->process($templates->{'modResult'}, $templateVars);
 }
 
 
@@ -3697,15 +3647,15 @@
 ################################################################################
 sub toConfirmData{
     # Check if any invalid parameters
-
+ 
     my $invalidParams;
     if (! $error) {
-        $invalidParams = validateParameters(0);
-        if (scalar(@$invalidParams)) {
-            $$templateVars{'status'} = 'failure';
-            $$templateVars{'invalidParams'} = $invalidParams;
-            $error = 1;
-        }
+    	$invalidParams = validateParameters(0);
+    	if (scalar(@$invalidParams)) {
+        	$$templateVars{'status'} = 'failure';
+        	$$templateVars{'invalidParams'} = $invalidParams;
+        	$error = 1;
+    	}
     }
 
     $$templateVars{'providerGivenName'} = normalizeCD($FORM::providerGivenName);
@@ -3809,10 +3759,10 @@
             $$templateVars{"kwType".$keyCount} = normalizeCD($keywordTypeArray->[$i]);
             $$templateVars{"kwTh".$keyCount} = normalizeCD($keywordThArray->[$i]);
             $keyCount++;
-        }
-    }
+	}    
+    }    
     $$templateVars{'keyCount'} = $keyCount;
-
+    
     $$templateVars{'addComments'} = normalizeCD($FORM::addComments);
     $$templateVars{'useConstraints'} = $FORM::useConstraints;
     if($FORM::useConstraints eq "other"){
@@ -3852,7 +3802,7 @@
     my $taxonNameArray = \@FORM::taxonName;
     my $taxonCount = 1;
 
-    for (my $i = 0; $i <= $#$taxonNameArray; $i++) {
+    for(my $i = 0; $i <= $#$taxonNameArray; $i++){
         if (hasContent($taxonRankArray->[$i]) && hasContent($taxonNameArray->[$i])) {
             debug("Registry processing keyword: trv = ".$taxonRankArray->[$i]
                     ." trn = ".$taxonNameArray->[$i]);
@@ -3859,7 +3809,7 @@
             $$templateVars{"taxonRankName".$taxonCount} = normalizeCD($taxonRankArray->[$i]);
             $$templateVars{"taxonRankValue".$taxonCount} = normalizeCD($taxonNameArray->[$i]);
             $taxonCount++;
-        }
+	}    
     }
 
     $$templateVars{'taxaCount'} = $taxonCount-1;
@@ -3877,6 +3827,7 @@
                 $$templateVars{"uploadname_$upNum"} = param("uploadname_$upNum");
                 $$templateVars{"uploadtype_$upNum"} = param("uploadtype_$upNum");
                 $$templateVars{"uploadperm_$upNum"} = param("uploadperm_$upNum");
+                  
             }
         }
     }
@@ -3895,7 +3846,6 @@
             $$templateVars{"upload_$totalFileNum"} = $fileInfo->{'fileHash'};
             $$templateVars{"uploadname_$totalFileNum"} = $fileInfo->{'fileName'};
             $$templateVars{"uploadtype_$totalFileNum"} = $fileInfo->{'contentType'};
-            $$templateVars{"uploadperm_$totalFileNum"} = param("uploadperm_$totalFileNum");
             $uploadCount++;
         }
     }
@@ -3913,8 +3863,7 @@
     $$templateVars{'origStateContact'} = $FORM::origState;
 
     $$templateVars{'showSiteList'} = $FORM::showSiteList;
-    $$templateVars{'lsite'} = $FORM::lsite;
-    $$templateVars{'usite'} = $FORM::usite;
+    $$templateVars{'site'} = $FORM::site;
     $$templateVars{'showWgList'} = $FORM::showWgList;
     $$templateVars{'showOrganization'} = $FORM::showOrganization;
     $$templateVars{'hasKeyword'} = $FORM::hasKeyword;
@@ -3938,7 +3887,7 @@
     if (! $error) {
 	# If no errors, then print out data in confirm Data template
 	$$templateVars{'section'} = "Confirm Data";
-	$template->process( $confirmDataTemplate, $templateVars);
+	$template->process( $templates->{'confirmData'}, $templateVars);
 
     } else{    
     # Errors from validation function. print the errors out using the response template
@@ -3950,7 +3899,7 @@
         # Create our HTML response and send it back
     $$templateVars{'function'} = "submitted";
     $$templateVars{'section'} = "Submission Status";
-    $template->process( $responseTemplate, $templateVars);
+    $template->process( $templates->{'response'}, $templateVars);
     }
 }
 
@@ -3972,7 +3921,7 @@
     $$templateVars{'docid'} = $FORM::docid;
 
     $$templateVars{'form'} = 're_entry';
-    $template->process( $entryFormTemplate, $templateVars);
+    $template->process( $templates->{'entry'}, $templateVars);
 }
 
 
@@ -3986,7 +3935,7 @@
     $$templateVars{'providerSurName'} = $FORM::providerSurName;
     $$templateVars{'site'} = $FORM::site;
     if ($FORM::cfg eq "nceas") {
-        my $projects = getProjectList();
+        my $projects = getProjectList($database);
         $$templateVars{'projects'} = $projects;
         $$templateVars{'wg'} = \@FORM::wg;
     }
@@ -4116,8 +4065,7 @@
     $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
     
     $$templateVars{'showSiteList'} = $FORM::showSiteList;
-    $$templateVars{'lsite'} = $FORM::lsite;
-    $$templateVars{'usite'} = $FORM::usite;
+    $$templateVars{'site'} = $FORM::site;
     $$templateVars{'showWgList'} = $FORM::showWgList;
     $$templateVars{'showOrganization'} = $FORM::showOrganization;
     $$templateVars{'hasKeyword'} = $FORM::hasKeyword;
@@ -4289,7 +4237,7 @@
 sub debug {
     my $msg = shift;
     
-    if ($debug) {
+    if ($debug_enabled) {
         print STDERR "$msg\n";
     }
     else {
@@ -4306,6 +4254,7 @@
 #
 ################################################################################
 sub getProjectList {
+    my $database = shift;
     my $projects;
 
     # Check for availability AdminDB.pm, for accessing NCEAS projects
Index: src/edu/ucsb/nceas/metacat/QuerySpecification.java
===================================================================
--- src/edu/ucsb/nceas/metacat/QuerySpecification.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/QuerySpecification.java	(revision 4080)
@@ -38,6 +38,7 @@
 import java.util.Vector;
 
 import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 
 import org.apache.log4j.Logger;
 import org.xml.sax.Attributes;
Index: src/edu/ucsb/nceas/metacat/advancedsearch/AdvancedSearchServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/advancedsearch/AdvancedSearchServlet.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/advancedsearch/AdvancedSearchServlet.java	(revision 4080)
@@ -37,7 +37,9 @@
 import javax.servlet.http.HttpSession;
 
 import edu.ucsb.nceas.metacat.client.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /** 
  * @author dcosta
@@ -105,29 +107,30 @@
     dispatcher.forward(request, response);
   }
   
-  /**
-   * Initializes the servlet. Reads properties and initializes object fields.
-   * 
-   * @throws ServletException
-   */
-  public void init(ServletConfig config) throws ServletException {
-    ServletContext context = null;
-    String dirPath;
-    Options options = null;
+    /**
+	 * Initializes the servlet. Reads properties and initializes object fields.
+	 * 
+	 * @throws ServletException
+	 */
+	public void init(ServletConfig config) throws ServletException {
+		ServletContext context = null;
+		String dirPath;
+		Options options = null;
 
-    super.init(config);
-    context = config.getServletContext();
-    dirPath = context.getRealPath(CONFIG_DIR);
-    File propertyFile = new File(dirPath, CONFIG_NAME);
-    
-    try {
-      options = Options.initialize(propertyFile);
-    }
-    catch (IOException e) {
-      System.err.println("Error in loading options: " + e.getMessage());
-    }
-    
-    this.contextString = options.getOption("context");
-  }
+		super.init(config);
+		context = config.getServletContext();
+		dirPath = context.getRealPath(CONFIG_DIR);
+		File propertyFile = new File(dirPath, CONFIG_NAME);
 
+		try {
+			options = Options.initialize(propertyFile);
+			this.contextString = PropertyService.getProperty("application.context");
+		} catch (IOException e) {
+			System.err.println("Error in loading options: " + e.getMessage());
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("couldn't read property during initialization: " 
+					+ pnfe.getMessage());
+		}
+
+	}
 }
\ No newline at end of file
Index: src/edu/ucsb/nceas/metacat/advancedsearch/LoginServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/advancedsearch/LoginServlet.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/advancedsearch/LoginServlet.java	(revision 4080)
@@ -37,7 +37,10 @@
 import javax.servlet.http.HttpSession;
 
 import edu.ucsb.nceas.metacat.client.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /** 
  * @author dcosta
@@ -121,28 +124,28 @@
 
 
   /**
-   * Initializes the servlet. Reads properties and initializes object fields.
-   * 
-   * @throws ServletException
-   */
-  public void init(ServletConfig config) throws ServletException {
-	ServletContext context = null;
-    String dirPath;
-    Options options = null;
+	 * Initializes the servlet. Reads properties and initializes object fields.
+	 * 
+	 * @throws ServletException
+	 */
+	public void init(ServletConfig config) throws ServletException {
+		ServletContext context = null;
+		String dirPath;
+		Options options = null;
 
-    super.init(config);
-    context = config.getServletContext();
-    dirPath = context.getRealPath(CONFIG_DIR);
-    File propertyFile = new File(dirPath, CONFIG_NAME);
-    
-    try {
-      options = Options.initialize(propertyFile);
-    }
-    catch (IOException e) {
-      System.err.println("Error in loading options: " + e.getMessage());
-    }
-    
-    this.contextString = options.getOption("context");
-  }
+		super.init(config);
+		context = config.getServletContext();
+		dirPath = context.getRealPath(CONFIG_DIR);
+		File propertyFile = new File(dirPath, CONFIG_NAME);
 
+		try {
+			options = Options.initialize(propertyFile);
+			this.contextString = PropertyService.getProperty("application.context");
+		} catch (IOException e) {
+			System.err.println("Error in loading options: " + e.getMessage());
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("couldn't read property during initialization: "
+					+ pnfe.getMessage());
+		}
+	}
 }
Index: src/edu/ucsb/nceas/metacat/spatial/SpatialDataset.java
===================================================================
--- src/edu/ucsb/nceas/metacat/spatial/SpatialDataset.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/spatial/SpatialDataset.java	(revision 4080)
@@ -45,7 +45,7 @@
 import java.net.URL;
 import java.net.MalformedURLException;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.service.PropertyService;
 
 /**
  * Class providing direct read/write access to the
@@ -59,8 +59,8 @@
   private static FeatureStore featureStore = null;
  
   
-  //public String polygonShpUri = MetaCatUtil.getOption("certPath") + "data/metacat_shps/data_bounds.shp";
-  //public String pointShpUri = MetaCatUtil.getOption("certPath")+ "data/metacat_shps/data_points.shp";
+  //public String polygonShpUri = PropertyService.getProperty("certPath") + "data/metacat_shps/data_bounds.shp";
+  //public String pointShpUri = PropertyService.getProperty("certPath")+ "data/metacat_shps/data_points.shp";
 
   FeatureCollection polygonCollection = FeatureCollections.newCollection();
   FeatureCollection pointCollection = FeatureCollections.newCollection();
Index: src/edu/ucsb/nceas/metacat/spatial/SpatialDocument.java
===================================================================
--- src/edu/ucsb/nceas/metacat/spatial/SpatialDocument.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/spatial/SpatialDocument.java	(revision 4080)
@@ -25,7 +25,10 @@
 import java.io.File;
 
 import edu.ucsb.nceas.metacat.DBConnection;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.Point;
@@ -49,154 +52,169 @@
 import org.apache.log4j.Logger;
 
 /**
-
- * Class representing the spatial portions of an xml document
- * as a geotools Feature.
+ * 
+ * Class representing the spatial portions of an xml document as a geotools
+ * Feature.
  */
 public class SpatialDocument {
 
-  private DBConnection dbconn;
+	private DBConnection dbconn;
 
-  private static Logger log =
-      Logger.getLogger(SpatialDocument.class.getName());
+	private static Logger log = Logger.getLogger(SpatialDocument.class.getName());
 
-  private SpatialFeatureSchema featureSchema = new SpatialFeatureSchema();
+	private SpatialFeatureSchema featureSchema = new SpatialFeatureSchema();
 
-  Vector west = new Vector();
-  Vector south = new Vector();
-  Vector east = new Vector();
-  Vector north = new Vector();
+	Vector west = new Vector();
+	Vector south = new Vector();
+	Vector east = new Vector();
+	Vector north = new Vector();
 
-  String title = "";
-  String docid = null;
+	String title = "";
+	String docid = null;
 
-  /** 
-   * Constructor that queries the db 
-   *
-   * @param docid The document id to be represented spatially
-   * @param dbconn The database connection shared from the refering method.
-   */
-  public SpatialDocument( String docid , DBConnection dbconn ) {
+	/**
+	 * Constructor that queries the db
+	 * 
+	 * @param docid
+	 *            The document id to be represented spatially
+	 * @param dbconn
+	 *            The database connection shared from the refering method.
+	 */
+	public SpatialDocument(String docid, DBConnection dbconn) {
 
-    this.docid = docid;
-    PreparedStatement pstmt = null;
-    ResultSet rs = null;
-    this.dbconn = dbconn;
-    boolean isSpatialDocument = false;
-    String thisDocname = null;
-    String westPath = null;
-    String eastPath = null;
-    String northPath = null;
-    String southPath = null;
-   
-    /*
-     * Determine the docname/schema and decide how to proceed with
-     * spatial harvest
-     */
-    String query = "SELECT docname FROM xml_documents WHERE docid='" + docid.trim() + "';";
-    String docname = "";
-    try {
-      pstmt = dbconn.prepareStatement(query);
-      pstmt.execute();
-      rs = pstmt.getResultSet();
-      while (rs.next()) {
-        docname = rs.getString(1);	
-      }
-      rs.close();
-      pstmt.close();
-    }
-    catch(Exception e) {
-      log.error(" ---- Could not get docname for " + docid );
-      e.printStackTrace();
-    }      
-    if (docname == null) 
-	    docname = "";
+		this.docid = docid;
+		PreparedStatement pstmt = null;
+		ResultSet rs = null;
+		this.dbconn = dbconn;
+		boolean isSpatialDocument = false;
+		String thisDocname = null;
+		String westPath = null;
+		String eastPath = null;
+		String northPath = null;
+		String southPath = null;
 
-    // Loop through all our spatial docnames and determine if the current document matches
-    // If so, get the appropriate corner xpaths
-    Vector spatialDocnames = MetaCatUtil.getOptionList( MetaCatUtil.getOption("spatialDocnameList") );
-    for (int i = 0; i < spatialDocnames.size(); i++) {
-	    thisDocname = ((String)spatialDocnames.elementAt(i)).trim();
-	    if ( docname.trim().equals(thisDocname) ) {
-		    isSpatialDocument = true;
+		/*
+		 * Determine the docname/schema and decide how to proceed with spatial
+		 * harvest
+		 */
+		String query = "SELECT docname FROM xml_documents WHERE docid='" + docid.trim()
+				+ "';";
+		String docname = "";
+		try {
+			pstmt = dbconn.prepareStatement(query);
+			pstmt.execute();
+			rs = pstmt.getResultSet();
+			while (rs.next()) {
+				docname = rs.getString(1);
+			}
+			rs.close();
+			pstmt.close();
+		} catch (Exception e) {
+			log.error(" ---- Could not get docname for " + docid);
+			e.printStackTrace();
+		}
+		if (docname == null)
+			docname = "";
 
-    		    //  determine its east,west,north and south coord xpaths
-		    westPath = MetaCatUtil.getOption(thisDocname + "_westBoundingCoordinatePath");
-		    eastPath = MetaCatUtil.getOption(thisDocname + "_eastBoundingCoordinatePath");
-		    northPath = MetaCatUtil.getOption(thisDocname + "_northBoundingCoordinatePath");
-		    southPath = MetaCatUtil.getOption(thisDocname + "_southBoundingCoordinatePath");
-	    }
-    }
+		// Loop through all our spatial docnames and determine if the current
+		// document matches
+		// If so, get the appropriate corner xpaths
+		try {
+			Vector spatialDocnames = MetaCatUtil.getOptionList(PropertyService
+					.getProperty("spatialDocnameList"));
+			for (int i = 0; i < spatialDocnames.size(); i++) {
+				thisDocname = ((String) spatialDocnames.elementAt(i)).trim();
+				if (docname.trim().equals(thisDocname)) {
+					isSpatialDocument = true;
 
-    //  If it is a spatial document, harvest the corners and title 
-    if (isSpatialDocument) {
+					// determine its east,west,north and south coord xpaths
+					westPath = PropertyService.getProperty(thisDocname
+							+ "_westBoundingCoordinatePath");
+					eastPath = PropertyService.getProperty(thisDocname
+							+ "_eastBoundingCoordinatePath");
+					northPath = PropertyService.getProperty(thisDocname
+							+ "_northBoundingCoordinatePath");
+					southPath = PropertyService.getProperty(thisDocname
+							+ "_southBoundingCoordinatePath");
+				}
+			}
+		} catch (PropertyNotFoundException pnfe) {
+			log.error("Could not find spatialDocnameList or bounding coordinate "
+					+ "path for: " + docid);
+			pnfe.printStackTrace();
+		}
 
-	    /*
-	     * Get the bounding coordinates
-	     */
-	    query = "SELECT path, nodedatanumerical, parentnodeid FROM xml_path_index"
-	    + " WHERE docid = '" + docid.trim() + "'"
-	    + " AND docid IN (SELECT distinct docid FROM xml_access WHERE docid = '" + docid.trim() 
-	    + "' AND principal_name = 'public' AND perm_type = 'allow')"
-	    + " AND (path = '" + westPath + "'"
-	    + "  OR path = '" + southPath + "'"
-	    + "  OR path = '" +  eastPath + "'"
-	    + "  OR path = '" + northPath + "'"
-	    + " ) ORDER BY parentnodeid;";
+		// If it is a spatial document, harvest the corners and title
+		if (isSpatialDocument) {
 
-	    try {
-	      pstmt = dbconn.prepareStatement(query);
-	      pstmt.execute();
-	      rs = pstmt.getResultSet();
-	      while (rs.next()) {
-		if ( rs.getString(1).equals(westPath) )
-		    this.west.add( new Float(rs.getFloat(2)) );
-		else if ( rs.getString(1).equals(southPath) )
-		    this.south.add( new Float(rs.getFloat(2)) );
-		else if ( rs.getString(1).equals(eastPath) )
-		    this.east.add( new Float(rs.getFloat(2)) );
-		else if ( rs.getString(1).equals(northPath) )
-		    this.north.add( new Float(rs.getFloat(2)) );
-		else
-		    log.error("** An xml path not related to your bounding coordinates was returned by this query \n" + query + "\n");
-	      }
-	      rs.close();
-	      pstmt.close();
-	    }
-	    catch(Exception e) {
-	      log.error(" ---- Could not get bounding coordinates for " + docid );
-	      e.printStackTrace();
-	    }      
+			/*
+			 * Get the bounding coordinates
+			 */
+			query = "SELECT path, nodedatanumerical, parentnodeid FROM xml_path_index"
+					+ " WHERE docid = '"
+					+ docid.trim()
+					+ "'"
+					+ " AND docid IN (SELECT distinct docid FROM xml_access WHERE docid = '"
+					+ docid.trim()
+					+ "' AND principal_name = 'public' AND perm_type = 'allow')"
+					+ " AND (path = '" + westPath + "'" + "  OR path = '" + southPath
+					+ "'" + "  OR path = '" + eastPath + "'" + "  OR path = '"
+					+ northPath + "'" + " ) ORDER BY parentnodeid;";
 
-	    /*
-	     * Get the title
-	     */
-	    String docTitlePath = MetaCatUtil.getOption("docTitle");
-	    query = "select nodedata from xml_path_index where path = '" 
-		  + docTitlePath.trim() + "' and docid = '" + docid.trim() + "'";
+			try {
+				pstmt = dbconn.prepareStatement(query);
+				pstmt.execute();
+				rs = pstmt.getResultSet();
+				while (rs.next()) {
+					if (rs.getString(1).equals(westPath))
+						this.west.add(new Float(rs.getFloat(2)));
+					else if (rs.getString(1).equals(southPath))
+						this.south.add(new Float(rs.getFloat(2)));
+					else if (rs.getString(1).equals(eastPath))
+						this.east.add(new Float(rs.getFloat(2)));
+					else if (rs.getString(1).equals(northPath))
+						this.north.add(new Float(rs.getFloat(2)));
+					else
+						log.error("** An xml path not related to your bounding coordinates was returned by this query \n"
+										+ query + "\n");
+				}
+				rs.close();
+				pstmt.close();
+			} catch (Exception e) {
+				log.error(" ---- Could not get bounding coordinates for " + docid);
+				e.printStackTrace();
+			}
 
-	    try {
-	      pstmt = dbconn.prepareStatement(query);
-	      pstmt.execute();
-	      rs = pstmt.getResultSet();
-	      if (rs.next())
-		this.title = rs.getString(1);
-	      rs.close();
-	      pstmt.close();
-	    }
-	    catch(Exception e) {
-	      log.error(" **** Error getting docids from getTitle for docid = "+docid);
-	      e.printStackTrace();
-	      this.title = docid;
-	    }
-    }
+			/*
+			 * Get the title
+			 */
 
+			try {
+
+				String docTitlePath = PropertyService.getProperty("docTitle");
+				query = "select nodedata from xml_path_index where path = '"
+						+ docTitlePath.trim() + "' and docid = '" + docid.trim() + "'";
+				pstmt = dbconn.prepareStatement(query);
+				pstmt.execute();
+				rs = pstmt.getResultSet();
+				if (rs.next())
+					this.title = rs.getString(1);
+				rs.close();
+				pstmt.close();
+			} catch (Exception e) {
+				log.error(" **** Error getting docids from getTitle for docid = "
+								+ docid);
+				e.printStackTrace();
+				this.title = docid;
+			}
+		}
+
   }
 
-  /** 
-   * Returns a geotools (multi)polygon feature with geometry plus attributes
-   * ready to be inserted into our spatial dataset cache
-   */
+  /**
+	 * Returns a geotools (multi)polygon feature with geometry plus attributes
+	 * ready to be inserted into our spatial dataset cache
+	 */
   public Feature getPolygonFeature() {
       // Get polygon feature type
       FeatureType polyType = featureSchema.getPolygonFeatureType();
@@ -253,10 +271,16 @@
    * @param docid The document id for which to construct the access url.
    */
   private String getUrl( String docid ) {
-     String docUrl = MetaCatUtil.getOption("metacatUrl")  
-                    + "?action=read"
-                    + "&docid=" + docid 
-                    + "&qformat=" + MetaCatUtil.getOption("default-style");
+     String docUrl = null;
+     try {
+    	 docUrl = SystemUtil.getServletURL()
+                    + "?action=read&docid=" + docid 
+                    + "&qformat=" 
+                    + PropertyService.getProperty("default-style");
+     } catch (PropertyNotFoundException pnfe) {
+    	 log.error("Could not get access url because of unavailable property: " 
+    			 + pnfe.getMessage());
+     }
 
      return docUrl;
   }
Index: src/edu/ucsb/nceas/metacat/spatial/SpatialFeatureSchema.java
===================================================================
--- src/edu/ucsb/nceas/metacat/spatial/SpatialFeatureSchema.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/spatial/SpatialFeatureSchema.java	(revision 4080)
@@ -22,7 +22,8 @@
  */
 package edu.ucsb.nceas.metacat.spatial;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 import com.vividsolutions.jts.geom.MultiPolygon;
 import com.vividsolutions.jts.geom.MultiPoint;
@@ -40,12 +41,22 @@
  */
 public class SpatialFeatureSchema {
 
-  private static Logger log =
-      Logger.getLogger(SpatialFeatureSchema.class.getName());
+	private static Logger log = Logger.getLogger(SpatialFeatureSchema.class.getName());
 
-  public static String polygonShpUri = MetaCatUtil.getOption("certPath") + "data/metacat_shps/data_bounds.shp";
-  public static String pointShpUri = MetaCatUtil.getOption("certPath")+ "data/metacat_shps/data_points.shp";
+	private static String certPath;
+	static {
+		try {
+			certPath = SystemUtil.getContextDir();
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Error in SpatialFeatureSchema static block:"
+                    + pnfe.getMessage());
+            pnfe.printStackTrace();
+		}
+	}
+	public static String polygonShpUri = certPath + "data/metacat_shps/data_bounds.shp";
+	public static String pointShpUri = certPath + "data/metacat_shps/data_points.shp";
 
+
   // EPSG for latlong coordinate system w/ WGS84 datum
   public static int srid = 4326;
 
Index: src/edu/ucsb/nceas/metacat/spatial/SldFactory.java
===================================================================
--- src/edu/ucsb/nceas/metacat/spatial/SldFactory.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/spatial/SldFactory.java	(revision 4080)
@@ -38,7 +38,7 @@
 package edu.ucsb.nceas.metacat.spatial;
 
 import edu.ucsb.nceas.utilities.XMLUtilities;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -102,43 +102,46 @@
   }
 
   /**
-   * Control servlet response depending on the action parameter specified
-   * Modifies the original SLD according to various access contraints
-   * and sends it as the servlet response.
-   *
-   * @param request Incoming servlet request.
-   * @param response Servlet response.
-   */
-  private void handleGetOrPost(HttpServletRequest request, HttpServletResponse response)
-  throws ServletException, IOException
-  {
-    String dataset = request.getParameter("originalSld"); 
-    String filename = MetaCatUtil.getOption("certPath") + "data/styles/" + dataset;
-    try {
-	String sld = getSld(filename);
-        System.out.println(sld);
-	response.setContentType("text/xml");
-	response.getWriter().write(sld);
-    } catch (FileNotFoundException fnf) {
-	fnf.printStackTrace();
-    } catch (Exception e) {
-        e.printStackTrace();
-    }
-    
-  }
+	 * Control servlet response depending on the action parameter specified
+	 * Modifies the original SLD according to various access contraints and
+	 * sends it as the servlet response.
+	 * 
+	 * @param request
+	 *            Incoming servlet request.
+	 * @param response
+	 *            Servlet response.
+	 */
+	private void handleGetOrPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		String dataset = request.getParameter("originalSld");
+
+		try {
+			String certPath = SystemUtil.getContextDir();
+			String filename = certPath + "data/styles/" + dataset;
+			String sld = getSld(filename);
+			System.out.println(sld);
+			response.setContentType("text/xml");
+			response.getWriter().write(sld);
+		} catch (FileNotFoundException fnf) {
+			fnf.printStackTrace();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+	}
   
   /**
-   * Given a filename of an existing SLD document,
-   * reads the sld and adds an ogc:Filter to exclude/include
-   * certain docids based on user's permissions. 
-   * The sld file is specified without path and 
-   * must exist within geoserver's styles folder (context/data/styles/*)
-   * 
-   * returns SLD document as a String.
-   * 
-   * @param filename	Filename of the base sld.
-   * @todo Implement the doc id list queries for contraints.
-   */
+	 * Given a filename of an existing SLD document, reads the sld and adds an
+	 * ogc:Filter to exclude/include certain docids based on user's permissions.
+	 * The sld file is specified without path and must exist within geoserver's
+	 * styles folder (context/data/styles/*)
+	 * 
+	 * returns SLD document as a String.
+	 * 
+	 * @param filename
+	 *            Filename of the base sld.
+	 * @todo Implement the doc id list queries for contraints.
+	 */
   private String getSld(String filename) throws FileNotFoundException
   {
 	    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Index: lib/style/skins/dev/loadxml.jsp
===================================================================
--- lib/style/skins/dev/loadxml.jsp	(revision 4079)
+++ lib/style/skins/dev/loadxml.jsp	(revision 4080)
@@ -30,6 +30,7 @@
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/configure-check.jsp"%>
    
 <html>
 <head>
Index: lib/style/common/fgdc/ClientViewHelper.jspx
===================================================================
--- lib/style/common/fgdc/ClientViewHelper.jspx	(revision 4079)
+++ lib/style/common/fgdc/ClientViewHelper.jspx	(revision 4080)
@@ -3,7 +3,7 @@
     
     <jsp:directive.page contentType="text/html;charset=UTF-8"/>
     <jsp:directive.page import="com.oreilly.servlet.multipart.MultipartParser"/>
-    <jsp:directive.page import="edu.ucsb.nceas.metacat.MetaCatUtil"/>
+    <jsp:directive.page import="edu.ucsb.nceas.metacat.service.PropertyService"/>
     <jsp:directive.page import="java.io.*"/>
     <jsp:directive.page import="javax.servlet.*"/>
     <jsp:directive.page import="javax.servlet.http.*"/>
@@ -20,7 +20,7 @@
     </jsp:declaration>
     
     <jsp:scriptlet>
-        sizeLimit = (new Integer(MetaCatUtil.getOption("datafilesizelimit"))).intValue();
+        sizeLimit = (new Integer(PropertyService.getProperty("datafilesizelimit"))).intValue();
         clientHelper = ClientViewHelper.clientViewHelperInstance(request);
         
         contentType = request.getContentType();
Index: src/upgrade-db-to-1.5.sql
===================================================================
--- src/upgrade-db-to-1.5.sql	(revision 4079)
+++ src/upgrade-db-to-1.5.sql	(revision 4080)
@@ -30,49 +30,49 @@
  * to local schema or dtd file.
  */
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-access-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-access-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-access-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-attribute-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-attribute-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-attribute-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-constraint-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-constraint-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-constraint-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-coverage-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-coverage-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-coverage-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-coverage-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-coverage-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-coverage-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-dataset-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-dataset-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-dataset-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-entity-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-entity-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-entity-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-literature-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-literature-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-literature-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-physical-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-physical-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-physical-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-project-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-project-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-project-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-protocol-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-protocol-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-protocol-@eml-version@//EN';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/dtd/eml-software-@eml-version@.dtd'
+   SET system_id = '/dtd/eml-software-@eml-version@.dtd'
    WHERE public_id = '-//ecoinformatics.org//eml-software-@eml-version@//EN';
 UPDATE xml_catalog
-  SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/eml.xsd'
+  SET system_id = '/schema/eml-2.0.0/eml.xsd'
   WHERE public_id = '@eml2_0_0namespace@';
 UPDATE xml_catalog
-  SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.1/eml.xsd'
+  SET system_id = '/schema/eml-2.0.1/eml.xsd'
   WHERE public_id = '@eml2_0_1namespace@';
 UPDATE xml_catalog 
-   SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/stmml.xsd'
+   SET system_id = '/schema/eml-2.0.0/stmml.xsd'
    WHERE public_id = '@stmmlnamespace@';
 
    
Index: src/loadschema.sql
===================================================================
--- src/loadschema.sql	(revision 4079)
+++ src/loadschema.sql	(revision 4080)
@@ -1,6 +1,6 @@
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', '@eml2_0_1namespace@', '@systemidserver@@html-path@/schema/eml-2.0.1/eml.xsd');
+  VALUES ('Schema', '@eml2_0_1namespace@', '/schema/eml-2.0.1/eml.xsd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', '@eml2_0_0namespace@', '@systemidserver@@html-path@/schema/eml-2.0.1/eml.xsd');
+  VALUES ('Schema', '@eml2_0_0namespace@', '/schema/eml-2.0.1/eml.xsd');
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', '@stmmlnamespace@', '@systemidserver@@html-path@/schema/eml-2.0.1/stmml.xsd');
+  VALUES ('Schema', '@stmmlnamespace@', '/schema/eml-2.0.1/stmml.xsd');
Index: src/upgrade-db-to-1.4-postgres.sql
===================================================================
--- src/upgrade-db-to-1.4-postgres.sql	(revision 4079)
+++ src/upgrade-db-to-1.4-postgres.sql	(revision 4080)
@@ -120,10 +120,10 @@
  * Update the XML_CATALOG table with new entries, and change old ones
  */
 INSERT INTO xml_catalog (entry_type, public_id, system_id)
-  VALUES ('Schema', '@eml2_0_1namespace@', '@systemidserver@@html-path@/schema/eml-2.0.1/eml.xsd');
+  VALUES ('Schema', '@eml2_0_1namespace@', '/schema/eml-2.0.1/eml.xsd');
 UPDATE xml_catalog
-  SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/eml.xsd'
+  SET system_id = '/schema/eml-2.0.0/eml.xsd'
   WHERE public_id = '@eml2_0_0namespace@';
 UPDATE xml_catalog
-  SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/stmml.xsd'
+  SET system_id = '/schema/eml-2.0.0/stmml.xsd'
   WHERE public_id = '@stmmlnamespace@';
Index: src/perl/ldapweb.cgi
===================================================================
--- src/perl/ldapweb.cgi	(revision 4079)
+++ src/perl/ldapweb.cgi	(revision 4080)
@@ -27,32 +27,45 @@
 # account for Metacat access.  We currently only support LDAP even
 # though metacat could potentially support other types of directories.
 #
-use strict;       # turn on strict syntax checking.
-use Template;     # load the template-toolkit module.
-use CGI;          # load the CGI module. 
-use Net::LDAP;    # load the LDAP net libraries
-use Net::SMTP;    # load the SMTP net libraries
-use Digest::SHA1; # for creating the password hash
-use MIME::Base64; # for creating the password hash
-use URI;          # for parsing URL syntax
-use AppConfig qw(:expand :argcount);
+use strict;             # turn on strict syntax checking
+use Template;           # load the template-toolkit module
+use CGI;                # load the CGI module 
+use Net::LDAP;          # load the LDAP net libraries
+use Net::SMTP;          # load the SMTP net libraries
+use Digest::SHA1;       # for creating the password hash
+use MIME::Base64;       # for creating the password hash
+use URI;                # for parsing URL syntax
+use Config::Properties; # for parsing Java .properties files
+use File::Basename;     # for path name parsing
 
-# Set up our default configuration
-my $ldapurl = "@ldapurl@";
-my $mainldapurl = "@ldapurl@";
-my $root = "@user@";
-my $rootpw = "@password@";
-my $searchBase = "@ldapSearchBase@";
-my $templatesDir = "@templates.dir@";
-my $mailhost = "@mailhost@";
-my $sender = "@sender@";
-my $TIMEOUT = 20;
-my $mainldapdownmessage = "The main ldap server " . $mainldapurl . " is down!";
+# Global configuration paramters
+my $cgiUrl = $ENV{'SCRIPT_FILENAME'};
+my $workingDirectory = dirname($cgiUrl);
+my $metacatProps = "${workingDirectory}/../WEB-INF/metacat.properties";
+my $properties = new Config::Properties();
+unless (open (METACAT_PROPERTIES, $metacatProps)) {
+    #print "Content-type: text/html\n\n";
+    print "Unable to locate Metacat properties. Working directory is set as " . 
+        $workingDirectory .", is this correct?";
+    exit(0);
+}
 
-# 1.8.1 temporary baseUrl fix
-my $baseUrl = "@systemidserver@@servlet-path@";
-$baseUrl =~ s/metacat$//;
+$properties->load(*METACAT_PROPERTIES);
 
+## Set up our default configuration
+my $ldapProps = $properties->splitToTree(qr/\./, 'ldap');
+my $ldapurl = $ldapProps->{'url'};
+my $mainldapurl = $ldapProps->{'mainurl'};
+my $ldapUsername = $ldapProps->{'user'};
+my $ldapPassword = $ldapProps->{'password'};
+my $searchBase = $ldapProps->{'searchbase'};
+my $mailhost = $properties->getProperty('email.mailhost');
+my $sender = $properties->getProperty('email.sender');
+
+# Java uses miliseconds, Perl expects whole seconds
+my $TIMEOUT = $ldapProps->{'connectTimeLimit'} / 1000;
+my $mainldapdownmessage = "The main ldap server $mainldapurl is down!";
+
 # Get the CGI input variables
 my $query = new CGI;
 
@@ -61,10 +74,12 @@
 #--------------------------------------------------------------------------80c->
 # Set up the Template Toolkit to read html form templates
 
+# templates hash, imported from ldap.templates tree in metacat.properties
+my $templates = $properties->splitToTree(qr/\./, 'ldap.templates');
 
 # set some configuration options for the template object
 my $config_templates = {
-             INCLUDE_PATH => $templatesDir, 
+             INCLUDE_PATH => $properties->getProperty('templates-dir'),
              INTERPOLATE  => 0,                    
              POST_CHOMP   => 1,                   
              };
@@ -72,33 +87,26 @@
 # create an instance of the template
 my $template = Template->new($config_templates) || handleGeneralServerFailure($Template::ERROR);
 
-# Read the ldapweb.cfg file
-my $config = AppConfig->new({ 
-    GLOBAL => { ARGCOUNT => ARGCOUNT_ONE, } });
+# custom LDAP properties hash
+my $ldapCustom = $properties->splitToTree(qr/\./, 'ldap');
 
-$config->define("ldapurl", { ARGCOUNT => ARGCOUNT_HASH} );           
-$config->define("ldapsearchbase", { ARGCOUNT => ARGCOUNT_HASH} );
-$config->define("dn", { ARGCOUNT => ARGCOUNT_HASH} );
-$config->define("filter", { ARGCOUNT => ARGCOUNT_HASH} );
-$config->define("user", { ARGCOUNT => ARGCOUNT_HASH} );
-$config->define("password", { ARGCOUNT => ARGCOUNT_HASH} );
+my @orgList = split(/,/, $properties->getProperty('ldap.organizations'));
+my $ldapConfig;
 
-my $cfgfile = "ldapweb.cfg";
-$config->file($cfgfile);
-my $config_ldapurl = $config->get('ldapurl');
-my $config_ldapsearchbase = $config->get('ldapsearchbase');
-my $config_dn = $config->get('dn');
-my $config_filter = $config->get('filter');
-my $config_user = $config->get('user');
-my $config_password = $config->get('password');
+foreach my $o (@orgList) {
+    debug($o);
+    # pull the raw tree in to prevent Perl pass-by-value shenanigans
+    $ldapConfig->{$o} = $properties->splitToTree(qr/\./, 'ldap');
 
-my @orglist;
-foreach my $neworg (keys %$config_dn) {
-    push(@orglist, $neworg);
-    debug($neworg);
+    # override the defaults set in ldap with the custom values
+    if (defined $ldapCustom->{$o}) {
+        my $custom = $ldapCustom->{$o};
+        while (my ($key, $value) = each(%$custom)) {
+            $ldapConfig->{$o}{$key} = $value;
+        }
+    }
 }
 
-
 #--------------------------------------------------------------------------80c->
 # Define the main program logic that calls subroutines to do the work
 #--------------------------------------------------------------------------80c->
@@ -105,15 +113,10 @@
 
 
 # The processing step we are handling
-my $stage = $query->param('stage') || '@defaultStage@';
+my $stage = $query->param('stage') || $templates->{'stage'};
 
 my $cfg = $query->param('cfg');
 
-# 1.8.1 temporary header/footer fixder =
-
-my $header = ($cfg eq 'nceas') ? 'nceasHeader.tmpl' : '@defaultHeader@';
-my $footer = ($cfg eq 'nceas') ? 'nceasFooter.tmpl' : '@defaultFooter@';
-
 # define the possible stages
 my %stages = (
               'initregister'      => \&handleInitRegister,
@@ -149,14 +152,7 @@
 
   print "Content-type: text/html\n\n";
   # process the template files:
-  my $templateVars = { stage => "register", cfg => $cfg };
-  #$$templateVars{'orgList'} = \@orglist;
-  $$templateVars{'orgList'} = \@orglist;
-  $$templateVars{'baseUrl'} = $baseUrl;
-  $template->process( $header, $templateVars);
-  $template->process( "@register@", $templateVars);
-  $template->process( $footer, $templateVars);
-
+  fullTemplate(['register'], {stage => "register"}); 
   exit();
 }
 
@@ -183,20 +179,14 @@
     if (! paramsAreValid(@requiredParams)) {
         my $errorMessage = "Required information is missing. " .
             "Please fill in all required fields and resubmit the form.";
-        my $templateVars = { stage => "register",
-                             cfg => $cfg,
-                             allParams => $allParams,
-                             errorMessage => $errorMessage };
-        $$templateVars{'orgList'} = \@orglist;
-        $$templateVars{'baseUrl'} = $baseUrl;
-        $template->process( $header, $templateVars);
-        $template->process( "@register@", $templateVars);
-        $template->process( $footer, $templateVars);
-        exit(0);
+        fullTemplate(['register'], { stage => "register",
+                                     allParams => $allParams,
+                                     errorMessage => $errorMessage });
+        exit();
     } else {
         my $o = $query->param('o');    
-        $ldapurl = $config_ldapurl->{$o};
-        $searchBase = $config_ldapsearchbase->{$o};  
+        $ldapurl = $ldapConfig->{$o}{'url'};
+        $searchBase = $ldapConfig->{$o}{'base'};  
     }
 
     # Search LDAP for matching entries that already exist
@@ -225,17 +215,9 @@
 
     # If entries match, send back a request to confirm new-user creation
     if ($found) {
-      my $templateVars = { stage => "registerconfirmed",
-                           cfg => $cfg,
-                           allParams => $allParams,
-                           foundAccounts => $found };
-      $$templateVars{'orgList'} = \@orglist;
-      $$templateVars{'baseUrl'} = $baseUrl;
-      $template->process( $header, $templateVars);
-      $template->process( "@registerMatch@", $templateVars);
-      $template->process( "@register@", $templateVars);
-      $template->process( $footer, $templateVars);
-
+      fullTemplate( ['registerMatch', 'register'], { stage => "registerconfirmed",
+                                                     allParams => $allParams,
+                                                     foundAccounts => $found });
     # Otherwise, create a new user in the LDAP directory
     } else {
         #print("ingore create account\n");
@@ -254,8 +236,7 @@
   
     my $allParams = { 'givenName' => $query->param('givenName'), 
                       'sn' => $query->param('sn'),
-                      #'o' => $query->param('o'), 
-                      'o' => 'unaffiliated', 
+                      'o' => 'unaffiliated', # only accept unaffiliated registration
                       'mail' => $query->param('mail'), 
                       'uid' => $query->param('uid'), 
                       'userPassword' => $query->param('userPassword'), 
@@ -264,7 +245,6 @@
                       'telephoneNumber' => $query->param('telephoneNumber') };
     print "Content-type: text/html\n\n";
     createAccount($allParams);
-
     exit();
 }
 
@@ -283,8 +263,8 @@
         $$allParams{'o'} = $query->param('o');
         my $o = $query->param('o');
         
-        $ldapurl = $config_ldapurl->{$o};
-        $searchBase = $config_ldapsearchbase->{$o};
+        $ldapurl = $ldapConfig->{$o}{'url'};
+        $searchBase = $ldapConfig->{$o}{'base'};
     }
 
 
@@ -294,16 +274,10 @@
     if (! paramsAreValid(@requiredParams)) {
         my $errorMessage = "Required information is missing. " .
             "Please fill in all required fields and submit the form.";
-        my $templateVars = { stage => "changepass",
-                             cfg => $cfg,
-                             allParams => $allParams,
-                             errorMessage => $errorMessage };
-        $$templateVars{'orgList'} = \@orglist;
-        $$templateVars{'baseUrl'} = $baseUrl;
-        $template->process( $header, $templateVars);
-        $template->process( "@defaultChangePass@", $templateVars);
-        $template->process( $footer, $templateVars);
-        exit(0);
+        fullTemplate( ['changePass'], { stage => "changepass",
+                                        allParams => $allParams,
+                                        errorMessage => $errorMessage });
+        exit();
     }
 
     # We have all of the info we need, so try to change the password
@@ -310,55 +284,35 @@
     if ($query->param('userPassword') =~ $query->param('userPassword2')) {
 
         my $o = $query->param('o');
-        $ldapurl = $config_ldapurl->{$o};
-        $searchBase = $config_ldapsearchbase->{$o};
-        $root = $config_user->{$o};
-        $rootpw = $config_password->{$o};
+        $ldapurl = $ldapConfig->{$o}{'url'};
+        $searchBase = $ldapConfig->{$o}{'base'};
+        $ldapUsername = $ldapConfig->{$o}{'user'};
+        $ldapPassword = $ldapConfig->{$o}{'password'};
 
-        my $dn = "uid=" . $query->param('uid') . "," . $config_dn->{$o};;
+        my $dn = "uid=" . $query->param('uid') . "," . $ldapConfig->{$o}{'dn'};;
         if ($query->param('o') =~ "LTER") {
-            $template->process( $header);
-            $template->process( "@registerLter@");
-            $template->process( $footer);
+            fullTemplate( ['registerLter'] );
         } else {
             my $errorMessage = changePassword(
                     $dn, $query->param('userPassword'), 
                     $dn, $query->param('oldpass'), $query->param('o'));
             if ($errorMessage) {
-                my $templateVars = { stage => "changepass",
-                                     cfg => $cfg,
-                                     allParams => $allParams,
-                                     errorMessage => $errorMessage };
-                $$templateVars{'orgList'} = \@orglist;
-                $$templateVars{'baseUrl'} = $baseUrl;
-                $template->process( $header, $templateVars);
-                $template->process( "@defaultChangePass@", $templateVars);
-                $template->process( $footer, $templateVars);
-                exit(0);
+                fullTemplate( ['changePass'], { stage => "changepass",
+                                                allParams => $allParams,
+                                                errorMessage => $errorMessage });
+                exit();
             } else {
-                my $templateVars = { stage => "changepass",
-                                     cfg => $cfg,
-                                     allParams => $allParams };
-                $$templateVars{'orgList'} = \@orglist;
-                $$templateVars{'baseUrl'} = $baseUrl;
-                $template->process( $header, $templateVars);
-                $template->process( "@changePassSuccess@", $templateVars);
-                $template->process( $footer, $templateVars);
-                exit(0);
+                fullTemplate( ['changePassSuccess'], { stage => "changepass",
+                                                       allParams => $allParams });
+                exit();
             }
         }
     } else {
         my $errorMessage = "The passwords do not match. Try again.";
-        my $templateVars = { stage => "changepass",
-                             cfg => $cfg,
-                             allParams => $allParams,
-                             errorMessage => $errorMessage };
-        $$templateVars{'orgList'} = \@orglist;
-        $$templateVars{'baseUrl'} = $baseUrl;
-        $template->process( $header, $templateVars);
-        $template->process( "@defaultChangePass@", $templateVars);
-        $template->process( $footer, $templateVars);
-        exit(0);
+        fullTemplate( ['changePass'], { stage => "changepass",
+                                        allParams => $allParams,
+                                        errorMessage => $errorMessage });
+        exit();
     }
 }
 
@@ -371,16 +325,9 @@
 
     my $allParams = { 'test' => "1", };
     my $errorMessage = "";
-    my $templateVars = { stage => "changepass",
-                         cfg => $cfg,
-                         allParams => $allParams,
-                         errorMessage => $errorMessage };
-    $$templateVars{'orgList'} = \@orglist;
-    $$templateVars{'baseUrl'} = $baseUrl;
-    $template->process( $header, $templateVars);
-    $template->process( "@defaultChangePass@", $templateVars);
-    $template->process( $footer, $templateVars);
-    exit(0);
+    fullTemplate( ['changePass'], { stage => "changepass",
+                                    errorMessage => $errorMessage });
+    exit();
 }
 
 #
@@ -398,10 +345,10 @@
         $$allParams{'o'} = $query->param('o');
         my $o = $query->param('o');
         
-        $ldapurl = $config_ldapurl->{$o};
-        $searchBase = $config_ldapsearchbase->{$o};
-        $root = $config_user->{$o};
-        $rootpw = $config_password->{$o};
+        $ldapurl = $ldapConfig->{$o}{'url'};
+        $searchBase = $ldapConfig->{$o}{'base'};
+        $ldapUsername = $ldapConfig->{$o}{'user'};
+        $ldapPassword = $ldapConfig->{$o}{'password'};
     }
 
     # Check that all required fields are provided and not null
@@ -409,26 +356,18 @@
     if (! paramsAreValid(@requiredParams)) {
         my $errorMessage = "Required information is missing. " .
             "Please fill in all required fields and submit the form.";
-        my $templateVars = { stage => "resetpass",
-                             cfg => $cfg,
-                             allParams => $allParams,
-                             errorMessage => $errorMessage };
-        $$templateVars{'orgList'} = \@orglist;
-        $$templateVars{'baseUrl'} = $baseUrl;
-        $template->process( $header, $templateVars);
-        $template->process( "@defaultResetPass@", $templateVars);
-        $template->process( $footer, $templateVars);
-        exit(0);
+        fullTemplate( ['resetPass'],  { stage => "resetpass",
+                                        allParams => $allParams,
+                                        errorMessage => $errorMessage });
+        exit();
     }
 
     # We have all of the info we need, so try to change the password
     my $o = $query->param('o');
-    my $dn = "uid=" . $query->param('uid') . "," . $config_dn->{$o};
+    my $dn = "uid=" . $query->param('uid') . "," . $ldapConfig->{$o}{'dn'};
     if ($query->param('o') =~ "LTER") {
-        $template->process( $header);
-        $template->process( "@registerLter@");
-        $template->process( $footer);
-        exit(0);
+        fullTemplate( ['registerLter'] );
+        exit();
     } else {
         my $errorMessage = "";
         my $recipient;
@@ -439,35 +378,23 @@
         if ($entry) {
             $recipient = $entry->get_value('mail');
             $userPass = getRandomPassword();
-            $errorMessage = changePassword($dn, $userPass, $root, $rootpw, $query->param('o'));
+            $errorMessage = changePassword($dn, $userPass, $ldapUsername, $ldapPassword, $query->param('o'));
         } else {
             $errorMessage = "User not found in database.  Please try again.";
         }
 
         if ($errorMessage) {
-            my $templateVars = { stage => "resetpass",
-                                 cfg => $cfg,
-                                 allParams => $allParams,
-                                 errorMessage => $errorMessage };
-            $$templateVars{'orgList'} = \@orglist;
-            $$templateVars{'baseUrl'} = $baseUrl;
-            $template->process( $header, $templateVars);
-            $template->process( "@defaultResetPass@", $templateVars);
-            $template->process( $footer, $templateVars);
-            exit(0);
+            fullTemplate( ['resetPass'], { stage => "resetpass",
+                                           allParams => $allParams,
+                                           errorMessage => $errorMessage });
+            exit();
         } else {
             my $errorMessage = sendPasswordNotification($query->param('uid'),
                     $query->param('o'), $userPass, $recipient, $cfg);
-            my $templateVars = { stage => "resetpass",
-                                 cfg => $cfg,
-                                 allParams => $allParams,
-                                 errorMessage => $errorMessage };
-            $$templateVars{'orgList'} = \@orglist;
-            $$templateVars{'baseUrl'} = $baseUrl;
-            $template->process( $header, $templateVars);
-            $template->process( "@resetPassSuccess@", $templateVars);
-            $template->process( $footer, $templateVars);
-            exit(0);
+            fullTemplate( ['resetPassSuccess'], { stage => "resetpass",
+                                                  allParams => $allParams,
+                                                  errorMessage => $errorMessage });
+            exit();
         }
     }
 }
@@ -479,17 +406,9 @@
 sub handleInitialResetPassword {
     print "Content-type: text/html\n\n";
     my $errorMessage = "";
-    my $allParams = { 'test' => "1", };
-    my $templateVars = { stage => "resetpass",
-                         cfg => $cfg,
-                         allParams => $allParams,
-                         errorMessage => $errorMessage };
-    $$templateVars{'orgList'} = \@orglist;
-    $$templateVars{'baseUrl'} = $baseUrl;
-    $template->process( $header, $templateVars);
-    $template->process( "@defaultResetPass@", $templateVars);
-    $template->process( $footer, $templateVars);
-    exit(0);
+    fullTemplate( ['resetPass'], { stage => "resetpass",
+                                   errorMessage => $errorMessage });
+    exit();
 }
 
 #
@@ -517,8 +436,8 @@
     my $bindPass = shift;
     my $o = shift;
 
-    my $ldapurl = $config_ldapurl->{$o};
-    my $searchBase = $config_ldapsearchbase->{$o};
+    my $ldapurl = $ldapConfig->{$o}{'url'};
+    my $searchBase = $ldapConfig->{$o}{'base'};
     
     my $errorMessage = 0;
     my $ldap;
@@ -601,9 +520,9 @@
         return $entry;
     }
 
-    if($config_filter->{$org}){
+    if($ldapConfig->{$org}{'filter'}){
         $mesg = $ldap->search ( base   => $base,
-                filter => "(&(uid=$username)($config_filter->{$org}))");
+                filter => "(&(uid=$username)($ldapConfig->{$org}{'filter'}))");
     } else {
         $mesg = $ldap->search ( base   => $base, filter => "(uid=$username)");
     }
@@ -655,7 +574,7 @@
         This is generally done when somebody forgets their password.  Your 
         password can be changed by visiting the following URL:
 
-        @cgiurl@?stage=changepass&cfg=$cfg
+        $cgiUrl?stage=changepass&cfg=$cfg
 
             Username: $username
         Organization: $org
@@ -770,34 +689,25 @@
     my $allParams = shift;
 
     if ($query->param('o') =~ "LTER") {
-        $template->process( $header);
-        $template->process( "@registerLter@");
-        $template->process( $footer);
+        fullTemplate( ['registerLter'] );
     } else {
 
         # Be sure the passwords match
         if ($query->param('userPassword') !~ $query->param('userPassword2')) {
             my $errorMessage = "The passwords do not match. Try again.";
-            my $templateVars = { stage => "register",
-                                 cfg => $cfg,
-                                 allParams => $allParams,
-                                 errorMessage => $errorMessage };
-            $$templateVars{'orgList'} = \@orglist;
-            $$templateVars{'baseUrl'} = $baseUrl;
-            $template->process( $header, $templateVars);
-            $template->process( "@registerFailed@", $templateVars);
-            $template->process( "@register@", $templateVars);
-            $template->process( $footer, $templateVars);
-            exit(0);
+            fullTemplate( ['registerFailed', 'register'], { stage => "register",
+                                                            allParams => $allParams,
+                                                            errorMessage => $errorMessage });
+            exit();
         }
 
         my $o = $query->param('o');
 
-        my $ldapurl = $config_ldapurl->{$o};
-        my $root = $config_user->{$o};
-        my $rootpw = $config_password->{$o};
-        my $searchBase = $config_ldapsearchbase->{$o};
-        my $dnBase = $config_dn->{$o};
+        my $ldapurl = $ldapConfig->{$o}{'url'};
+        my $ldapUsername = $ldapConfig->{$o}{'user'};
+        my $ldapPassword = $ldapConfig->{$o}{'password'};
+        my $searchBase = $ldapConfig->{$o}{'base'};
+        my $dnBase = $ldapConfig->{$o}{'dn'};
 
         
         #if main ldap server is down, a html file containing warning message will be returned
@@ -805,7 +715,7 @@
         
         
         $ldap->start_tls( verify => 'none');
-        $ldap->bind( version => 3, dn => $root, password => $rootpw );
+        $ldap->bind( version => 3, dn => $ldapUsername, password => $ldapPassword );
         #print "Inserting new entry...\n";
         my $dn = 'uid=' . $query->param('uid') . ',' . $dnBase;
 
@@ -840,27 +750,15 @@
         my $result = $ldap->add ( 'dn' => $dn, 'attr' => [ @$additions ]);
     
         if ($result->code()) {
-            my $templateVars = { stage => "register",
-                                 cfg => $cfg,
-                                 allParams => $allParams,
-                                 errorMessage => $result->error };
-            $$templateVars{'orgList'} = \@orglist;
-            $$templateVars{'baseUrl'} = $baseUrl;
-            $template->process( $header, $templateVars);
-            $template->process( "@registerFailed@", $templateVars);
-            $templateVars    = { stage => "register",
-                                 cfg => $cfg,
-                                 allParams => $allParams };
-            $$templateVars{'orgList'} = \@orglist;
-            $$templateVars{'baseUrl'} = $baseUrl;
-            $template->process( "@register@", $templateVars);
-            $template->process( $footer, $templateVars);
+            fullTemplate( ['registerFailed', 'register'], { stage => "register",
+                                                            allParams => $allParams,
+                                                            errorMessage => $result->error });
+            # TODO SCW was included as separate errors, test this
+            #$templateVars    = setVars({ stage => "register",
+            #                     allParams => $allParams });
+            #$template->process( $templates->{'register'}, $templateVars);
         } else {
-            my $templateVars    = { cfg => $cfg };
-            $$templateVars{'baseUrl'} = $baseUrl;
-            $template->process( $header, $templateVars);
-            $template->process( "@registerSuccess@", $templateVars);
-            $template->process( $footer, $templateVars);
+            fullTemplate( ['success'] );
         }
 
         $ldap->unbind;   # take down session
@@ -872,14 +770,9 @@
   print "Content-type: text/html\n\n";
   my $errorMessage = "You provided invalid input to the script. " .
                      "Try again please.";
-  my $templateVars = { stage => "@defaultStage@",
-                       cfg => $cfg,
-                       errorMessage => $errorMessage };
-  $$templateVars{'orgList'} = \@orglist;
-  $$templateVars{'baseUrl'} = $baseUrl;
-  $template->process( $header, $templateVars);
-  $template->process( $footer, $templateVars);
-  exit(0);
+  fullTemplate( [], { stage => $templates->{'stage'},
+                      errorMessage => $errorMessage });
+  exit();
 }
 
 #
@@ -891,8 +784,8 @@
 
     my $o = $query->param('o');
 
-    my $ldapurl = $config_ldapurl->{$o};
-    my $searchBase = $config_ldapsearchbase->{$o};
+    my $ldapurl = $ldapConfig->{$o}{'url'};
+    my $searchBase = $ldapConfig->{$o}{'base'};
 
     print "Content-type: text/html\n\n";
 
@@ -934,29 +827,15 @@
 
     # Send back the search results
     if ($found) {
-      my $templateVars = { stage => "searchResults",
-                           cfg => $cfg,
-                           allParams => $allParams,
-                           foundAccounts => $found };
-      $$templateVars{'orgList'} = \@orglist;
-      $$templateVars{'baseUrl'} = $baseUrl;
-      $template->process( $header, $templateVars);
-      $template->process( "@searchResults@", $templateVars);
-      $template->process( $footer, $templateVars);
-
+      fullTemplate( ('searchResults'), { stage => "searchresults",
+                                         allParams => $allParams,
+                                         foundAccounts => $found });
     } else {
       $found = "No entries matched your criteria.  Please try again\n";
 
-      my $templateVars = { stage => "searchResults",
-                           cfg => $cfg,
-                           allParams => $allParams,
-                           foundAccounts => $found };
-      $$templateVars{'orgList'} = \@orglist;
-      $$templateVars{'baseUrl'} = $baseUrl;
-      $template->process( $header, $templateVars);
-      $template->process( "@searchResults@", $templateVars);
-      $template->process( $footer, $templateVars);
-
+      fullTemplate( ('searchResults'), { stage => "searchresults",
+                                         allParams => $allParams,
+                                         foundAccounts => $found });
     }
 
     exit();
@@ -1035,13 +914,36 @@
 
 sub handleGeneralServerFailure {
     my $errorMessage = shift;
-    my $templateVars = { cfg => $cfg,
-                         errorMessage => $errorMessage };
-    $$templateVars{'baseUrl'} = $baseUrl;
-    $template->process( $header, $templateVars);
-    $template->process( "@ldapMainServerFailure@", $templateVars);
-    $template->process( $footer, $templateVars);
+    fullTemplate( ('mainServerFailure'), { errorMessage => $errorMessage });
     exit(0);   
    }
     
+sub setVars {
+    my $paramVars = shift;
+    # initialize default parameters 
+    my $templateVars = { cfg => $cfg,
+                         styleSkinsPath => $properties->getProperty('style-skins-path'),
+                         styleCommonPath => $properties->getProperty('style-common-path'),
+                         baseUrl => $properties->getProperty('baseUrl'),
+                         orgList => \@orgList,
+    };
+    
+    # append customized params
+    while (my ($k, $v) = each (%$paramVars)) {
+        $templateVars->{$k} = $v;
+    }
+    
+    return $templateVars;
+} 
+    
+sub fullTemplate {
+    my $templateList = shift;
+    my $templateVars = setVars(shift);
 
+    $template->process( $templates->{'header'}, $templateVars );
+    
+    foreach my $tmpl (@{$templateList}) {
+        $template->process( $templates->{$tmpl}, $templateVars );
+    }    
+    $template->process( $templates->{'footer'}, $templateVars );
+}
Index: src/edu/ucsb/nceas/metacat/ElementNode.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ElementNode.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/ElementNode.java	(revision 4080)
@@ -53,8 +53,6 @@
    */
   public ElementNode (TreeSet nodeRecordList, long nodeid) {
 
-    MetaCatUtil util = new MetaCatUtil();
-
     // Step through all of the node records we were given
     Iterator it = nodeRecordList.iterator();
     while (it.hasNext()) {
Index: src/edu/ucsb/nceas/metacat/IndexingQueue.java
===================================================================
--- src/edu/ucsb/nceas/metacat/IndexingQueue.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/IndexingQueue.java	(revision 4080)
@@ -32,7 +32,11 @@
 import java.util.Vector;
 import java.util.HashMap;
 import java.lang.Comparable;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 import org.apache.log4j.Logger;
 
 public class IndexingQueue {
@@ -46,8 +50,20 @@
 	
 	private static IndexingQueue instance = null;
 
-	final static int NUMBEROFINDEXINGTHREADS = 
-		Integer.parseInt(MetaCatUtil.getOption("numberOfIndexingThreads"));
+	final static int NUMBEROFINDEXINGTHREADS;
+	static {
+		int numIndexingThreads = 0;
+		try {
+			numIndexingThreads = 
+				Integer.parseInt(PropertyService.getProperty("database.numberOfIndexingThreads"));
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+		}
+		NUMBEROFINDEXINGTHREADS = numIndexingThreads;
+	}
+
+	
 	private int sleepTime = 2000; 
 
     private IndexingQueue() {
@@ -124,8 +140,21 @@
 
 class IndexingTask extends Thread {
   	  private Logger logMetacat = Logger.getLogger(IndexingTask.class);
-      protected final long MAXIMUMINDEXDELAY = Integer.
-      	parseInt(MetaCatUtil.getOption("maximumIndexDelay"));;
+  	  
+  	  
+      protected final static long MAXIMUMINDEXDELAY;
+      static {
+    	  long maxIndexDelay = 0;
+    	  try {
+    		  maxIndexDelay = 
+    			  Integer.parseInt(PropertyService.getProperty("database.maximumIndexDelay")); 
+    	  } catch (PropertyNotFoundException pnfe) {
+    		  System.err.println("Could not get property in static block: " 
+  					+ pnfe.getMessage());
+    	  }
+    	  MAXIMUMINDEXDELAY = maxIndexDelay;
+      }
+      
       protected boolean metacatRunning = true;
       	
 	  public void run() {
Index: src/edu/ucsb/nceas/metacat/advancedsearch/SearchServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/advancedsearch/SearchServlet.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/advancedsearch/SearchServlet.java	(revision 4080)
@@ -36,7 +36,10 @@
 import javax.servlet.http.HttpSession;
 
 import edu.ucsb.nceas.metacat.client.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /** 
  * @author dcosta
@@ -108,28 +111,28 @@
   
 
   /**
-   * Initializes the servlet. Reads properties and initializes object fields.
-   * 
-   * @throws ServletException
-   */
-  public void init(ServletConfig config) throws ServletException {
-	ServletContext context = null;
-    String dirPath;
-    Options options = null;
+	 * Initializes the servlet. Reads properties and initializes object fields.
+	 * 
+	 * @throws ServletException
+	 */
+	public void init(ServletConfig config) throws ServletException {
+		ServletContext context = null;
+		String dirPath;
+		Options options = null;
 
-    super.init(config);
-    context = config.getServletContext();
-    dirPath = context.getRealPath(CONFIG_DIR);
-    File propertyFile = new File(dirPath, CONFIG_NAME);
-    
-    try {
-      options = Options.initialize(propertyFile);
-    }
-    catch (IOException e) {
-      System.err.println("Error in loading options: " + e.getMessage());
-    }
-    
-    this.contextString = options.getOption("context");
-  }
+		super.init(config);
+		context = config.getServletContext();
+		dirPath = context.getRealPath(CONFIG_DIR);
+		File propertyFile = new File(dirPath, CONFIG_NAME);
 
+		try {
+			options = Options.initialize(propertyFile);
+			this.contextString = PropertyService.getProperty("application.context");
+		} catch (IOException e) {
+			System.err.println("Error in loading options: " + e.getMessage());
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("couldn't read property during initialization: "
+					+ pnfe.getMessage());
+		}
+	}
 }
Index: src/edu/ucsb/nceas/metacat/spatial/SpatialQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/spatial/SpatialQuery.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/spatial/SpatialQuery.java	(revision 4080)
@@ -59,7 +59,7 @@
 
 import org.apache.log4j.Logger;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 
 /** 
  * Class to query the persistent spatial cache
@@ -85,8 +85,8 @@
    * @param n North bounding coordinate 
    *
    */
-  public Vector filterByBbox( float w, float s, float e, float n ) {
-      Vector docids = new Vector();
+  public Vector<String> filterByBbox( float w, float s, float e, float n ) {
+      Vector<String> docids = new Vector<String>();
       SpatialFeatureSchema featureSchema = new SpatialFeatureSchema();
       
       ShapefileDataStore store = null;
Index: src/edu/ucsb/nceas/metacat/AssociateAccessPolicy.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AssociateAccessPolicy.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/AssociateAccessPolicy.java	(revision 4080)
@@ -68,8 +68,7 @@
   private Vector docIdWithoutAccessEntry=null;
   private Vector notFoundDataSetId=null;
   private Vector itsDataSetIdWithouAccessEntry=null;
-  private Hashtable docIdMapDataSetId=null;
-  private MetaCatUtil util=null;
+  private Hashtable docIdMapDataSetId=null; 
   private Logger logMetacat = Logger.getLogger(AssociateAccessPolicy.class);
   
   /**
@@ -79,7 +78,6 @@
   {
      DBConnection localConn=null;
      int serialNumber = -1;
-     //MetaCatUtil localUtil=new MetaCatUtil();
      AssociateAccessPolicy policy=null;
      try
      {
@@ -145,7 +143,6 @@
     this.notFoundDataSetId=new Vector();
     this.itsDataSetIdWithouAccessEntry=new Vector();
     this.docIdMapDataSetId=new Hashtable();
-    this.util=new MetaCatUtil();
     getDocIdInAccessTable();
     getDocIdWithoutAccessEntry();
     getDocIdMapDataSetId();
Index: src/edu/ucsb/nceas/metacat/Version.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Version.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/Version.java	(revision 4080)
@@ -23,38 +23,72 @@
  */
 package edu.ucsb.nceas.metacat;
 
+import java.util.Vector;
 
+import edu.ucsb.nceas.utilities.StringUtil;
+
+
 /**
  * @author jones
  *
  * Version represents the current version information for this Metacat instance.
  */
-public class Version
+public class Version implements Comparable<Version>
 {
+	protected static int allowedVersionLevels = 4;
+	protected int[] subversions = {0, 0, 0, 0}; 
+	protected String versionString = null;
+	
+	/**
+	 * Create a Version object, setting sub version levels based on the given
+	 * version id.
+	 * 
+	 * @param versionID
+	 */
+    public Version(String versionID) {
+    	setSubversions(versionID);
+    	versionString = 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 getVersion()
-    {
-        String version = MetaCatUtil.getOption("version");
-        return version;
+	 * Compare this Version object to another. Use the sub version levels to do
+	 * the comparison. In that way, we can make sure that something like version
+	 * 1.0.0.1 is less than 2.0.1.
+	 * 
+	 * @param anotherVersion
+	 * @return -1 if this version is less than given version, 0 if they are
+	 *         equal and 1 if this version is greater than given version.
+	 */
+	public int compareTo(Version anotherVersion) {
+    	for (int i = 0; i < allowedVersionLevels; i++) {
+    		if (this.getSubversion(i) < ((Version)anotherVersion).getSubversion(i)) {
+    			return -1;
+    		} else if (this.getSubversion(i) > ((Version)anotherVersion).getSubversion(i)) {
+    			return 1;
+    		}
+    	}	
+		return 0;
     }
+	
+	public int getSubversion(int level) {
+		return subversions[level];
+	}
+	  
+	/**
+	 * Set each level (up to 4) of sub version based on the given version id.
+	 * 
+	 * @param versionID
+	 *            a string representing a dotted version notation
+	 */
+    private void setSubversions(String versionID) throws NumberFormatException {
+    	Vector<String> subversionStrings = StringUtil.toVector(versionID, '.');
+    	for (int i = 0; i < subversionStrings.size() && i < allowedVersionLevels; i++) {
+    		int subversion = Integer.parseInt(subversionStrings.elementAt(i));
+    		this.subversions[i] = subversion;
+    	}   	
+    }
     
-    /**
-     * Get the version number in an XML document.
-     * 
-     * @return the version wrapped in an XML document
-     */
-    public static String getVersionAsXml()
-    {
-        StringBuffer sb = new StringBuffer();
-        sb.append("<?xml version=\"1.0\"?>");
-        sb.append("<version>");
-        sb.append(Version.getVersion());
-        sb.append("</version>");
-        return sb.toString();
+    public String getVersionString() {
+    	return versionString;
     }
 }
Index: src/edu/ucsb/nceas/metacat/DBVersion.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBVersion.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/DBVersion.java	(revision 4080)
@@ -0,0 +1,62 @@
+/**
+ *  '$RCSfile$'
+ *  Copyright: 2008 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 DBVersion 2 of the License, or
+ * (at your option) any later DBVersion.
+ *
+ * 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 java.util.Vector;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.StringUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
+/**
+ * @author daigle@nceas.nceas.ucsb.edu
+ *
+ * DBVersion represents the current DBVersion information for this Metacat instance.
+ */
+public class DBVersion extends Version
+{
+	private Vector<String> updateScriptList = null;
+	
+	/**
+	 * Create a database version. Get the update script list from properties for
+	 * this version and save in a vector.
+	 * 
+	 * @param DBVersionId
+	 *            a string representing the version of the database.
+	 * @throws PropertyNotFoundException
+	 */
+    public DBVersion(String DBVersionId) throws PropertyNotFoundException {
+    	super(DBVersionId);
+		String updateScriptString = PropertyService.getProperty("database.upgradeVersion." + DBVersionId);
+    	updateScriptList = StringUtil.toVector(updateScriptString, ',');
+    }
+	
+    /**
+     * Get the update script list for this version
+     * @return a Vector of update script names.
+     */
+    public Vector<String> getUpdateScripts() {
+    	return updateScriptList;
+    }
+}

Property changes on: src/edu/ucsb/nceas/metacat/DBVersion.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
Index: src/edu/ucsb/nceas/metacat/DBSAXNode.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBSAXNode.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBSAXNode.java	(revision 4080)
@@ -35,6 +35,7 @@
 import org.xml.sax.SAXException;
 
 import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 
 /**
  * A Class that represents an XML node and its contents and
Index: src/edu/ucsb/nceas/metacat/service/SessionService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/SessionService.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/service/SessionService.java	(revision 4080)
@@ -0,0 +1,115 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements session utility methods 
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.service;
+
+import java.util.Hashtable;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.util.SessionData;
+
+public class SessionService implements ServiceInterface {
+	
+	private static SessionService sessionService = null;
+	
+	private static Logger logMetacat = Logger.getLogger(SessionService.class);
+	private static Hashtable<String, SessionData> sessionHash = null;
+	
+	public static final String PUBLIC_SESSION_ID = "0";
+
+	/**
+	 * private constructor since this is a singleton
+	 */
+	private SessionService() {
+		sessionHash = new Hashtable<String, SessionData>();
+		registerSession(PUBLIC_SESSION_ID, "public", null, null);
+	}
+	
+	/**
+	 * Get the single instance of AuthAdmin.
+	 * 
+	 * @return the single instance of AuthAdmin
+	 */
+	public static SessionService getInstance() {
+		if (sessionService == null) {
+			sessionService = new SessionService();
+		}
+		return sessionService;
+	}
+		
+	public static void registerSession(String sessionId, String userName,
+			String[] groupNames, String password) {
+		SessionData sessionData = new SessionData(sessionId, userName, groupNames,
+				password);
+		sessionHash.put(sessionId, sessionData);
+	}
+	
+	public static void registerSession(SessionData sessionData) {
+		sessionHash.put(sessionData.getId(), sessionData);
+	}
+	
+	public static void unRegisterSession(String sessionId) {
+		sessionHash.remove(sessionId);
+	}
+	
+	public static boolean isSessionRegistered(String sessionId) {
+		return sessionHash.containsKey(sessionId);
+	}
+	
+	public static SessionData getRegisteredSession(String sessionId) {
+		return sessionHash.get(sessionId);
+	}
+	
+	public static String getSessionIDFromRequest(HttpServletRequest request) {
+		String sessionId = null;
+		Cookie[] cookies = request.getCookies();
+
+		if (cookies == null) {
+			return null;
+		}
+
+		for (int i = 0; i < cookies.length; i++) {
+			if (cookies[i].getName().equals("JSESSIONID")) {
+				sessionId = cookies[i].getValue();
+			}
+		}
+
+		logMetacat.debug("Request session ID: " + sessionId);
+		return sessionId;
+	}
+	
+	public static synchronized void touchSession(String sessionId) {
+		if (isSessionRegistered(sessionId)) {
+			SessionData sessionData = getRegisteredSession(sessionId);
+			sessionData.setLastAccessedTime();
+		}
+	}
+
+}

Property changes on: src/edu/ucsb/nceas/metacat/service/SessionService.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
Index: src/edu/ucsb/nceas/metacat/DBUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBUtil.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBUtil.java	(revision 4080)
@@ -47,6 +47,11 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /**
  * A suite of utility classes for quering DB
  */
@@ -75,7 +80,6 @@
         try {
                     
           // Open a connection to the database
-          MetaCatUtil   util = new MetaCatUtil();
           //Connection dbconn = util.openDBConnection();
 
           DBUtil dbutil = new DBUtil();
@@ -166,7 +170,7 @@
    * read DTD or Schema file from Metacat's XML catalog system
    */
   public String readDTDSchema(String doctype)
-        throws SQLException, MalformedURLException, IOException
+        throws SQLException, MalformedURLException, IOException, PropertyNotFoundException
   {
     String systemID = null;
     PreparedStatement pstmt = null;
@@ -175,7 +179,7 @@
     int serialNumber = -1;
     // get doctype's System ID from db catalog
     try {
-      
+    
       dbConn=DBConnectionPool.
                   getDBConnection("DBUtil.readDTDSchema");
       serialNumber=dbConn.getCheckOutSerialNumber();
@@ -189,6 +193,10 @@
       boolean hasRow = rs.next();
       if (hasRow) {
         systemID = rs.getString(1);
+        // system id may not have server url on front.  Add it if not.
+        if (!systemID.startsWith("http://")) {
+        	systemID = SystemUtil.getServerURL() + systemID;
+        }
       } else {
         throw new SQLException("Non-registered doctype: " + doctype);
       }
@@ -337,7 +345,13 @@
         throws SQLException  {
 
     String accnum = null;
-    String sep = MetaCatUtil.getOption("accNumSeparator");
+    String sep = ".";
+    try {
+    	PropertyService.getProperty("accNumSeparator");
+    } catch (PropertyNotFoundException pnfe) {
+    	logMetacat.error("could not get property 'accNumSeparator'.  setting to '.': " 
+    			+ pnfe.getMessage());  	
+    }
     PreparedStatement pstmt = null;
     DBConnection dbConn = null;
     int serialNumber = -1;
@@ -430,7 +444,13 @@
         throws SQLException  {
     Vector resultVector = new Vector();
     String accnum = null;
-    String sep = MetaCatUtil.getOption("accNumSeparator");
+    String sep = ".";
+    try {
+    	PropertyService.getProperty("accNumSeparator");
+    } catch (PropertyNotFoundException pnfe) {
+    	logMetacat.error("could not get property 'accNumSeparator'.  setting to '.': " 
+    			+ pnfe.getMessage());  	
+    }
     PreparedStatement pstmt = null;
     DBConnection dbConn = null;
     int serialNumber = -1;
Index: src/edu/ucsb/nceas/metacat/util/SystemUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/SystemUtil.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/SystemUtil.java	(revision 4080)
@@ -0,0 +1,290 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements system utility methods 
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.util;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.MetaCatVersion;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.FileUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
+public class SystemUtil {
+
+	private static Logger logMetacat = Logger.getLogger(SystemUtil.class);
+	private static String METACAT_SERVLET = "metacat";
+
+	/**
+	 * private constructor - all methods are static so there is no no need to
+	 * instantiate.
+	 */
+	private SystemUtil() {}
+
+	/**
+	 * Attempt to discover the server name. The name is retrieved from the http
+	 * servlet request. This is used by configuration routines before the port
+	 * has been populated in metacat.properties. it is possible the port that
+	 * the user configures might be different than the name we get here. You
+	 * should use getServerPort() instead of this method whenever possible.
+	 * 
+	 * @param request
+	 *            the http servlet request we will use to find the server name
+	 * 
+	 * @return a string holding the server name
+	 */
+	public static String discoverServerName(HttpServletRequest request) {
+		String serverName = request.getServerName();
+
+		return serverName;
+	}
+
+	/**
+	 * Attempt to discover the server port. The port is retrieved from the http
+	 * servlet request. This is used by configuration routines before the port
+	 * has been populated in metacat.properties. it is possible the port that
+	 * the user configures might be different than the port we get here. You
+	 * should use getServerPort() instead of this method whenever possible.
+	 * 
+	 * @param request
+	 *            the http servlet request we will use to find the server port
+	 * 
+	 * @return a string holding the server port
+	 */
+	public static String discoverServerPort(HttpServletRequest request) {
+		return Integer.toString(request.getServerPort());
+	}
+	
+	/**
+	 * Attempt to discover the server ssl port. The ssl port is assumed using
+	 * the standard port. This is used by configuration routines before the port
+	 * has been populated in metacat.properties. it is possible the prot that
+	 * the user configures might be different than the port we get here. You
+	 * should use getServerSSLPort() instead of this method whenever possible.
+	 * 
+	 * @param request
+	 *            the http servlet request we will use to find the server port
+	 * 
+	 * @return a string holding the server ssl port
+	 */
+	public static String discoverServerSSLPort(HttpServletRequest request) {
+		String serverPort = discoverServerPort(request);
+
+		if (serverPort.length() == 4 && serverPort.charAt(0) == '8') {
+			return "8443";
+		}
+
+		return "443";
+	}
+
+	/**
+	 * Get the server URL which is made up of the server name + : + the http
+	 * port number. Note that if the port is 80, it is left off.
+	 * 
+	 * @return string holding the server URL
+	 */
+	public static String getServerURL() throws PropertyNotFoundException {
+		String ServerURL = "http://" + PropertyService.getProperty("server.name");
+		String httpPort = PropertyService.getProperty("server.httpPort");
+		if (!httpPort.equals("80")) {
+			ServerURL += ":" + httpPort;
+		}
+
+		return ServerURL;
+	}
+
+	/**
+	 * Get the secure server URL which is made up of the server name + : + the
+	 * https port number. Note that if the port is 443, it is left off.
+	 * 
+	 * @return string holding the server URL
+	 */
+	public static String getSecureServerURL() throws PropertyNotFoundException {
+		String ServerURL = "https://" + PropertyService.getProperty("server.name");
+		String httpPort = PropertyService.getProperty("server.httpSSLPort");
+		if (!httpPort.equals("443")) {
+			ServerURL = PropertyService.getProperty("server.name") + ":" + httpPort;
+		}
+
+		return ServerURL;
+	}
+
+	/**
+	 * Get the CGI URL which is made up of the server URL + file separator + the
+	 * CGI directory
+	 * 
+	 * @return string holding the server URL
+	 */
+	public static String getCGI_URL() throws PropertyNotFoundException{
+		return getServerURL() + FileUtil.getFS()
+				+ PropertyService.getProperty("application.cgiDir");
+	}
+
+	/**
+	 * Get the server URL with the context. This is made up of the server URL +
+	 * file separator + the context
+	 * 
+	 * @return string holding the server URL with context
+	 */
+	public static String getContextURL() throws PropertyNotFoundException {
+		return getServerURL() + FileUtil.getFS()
+				+ PropertyService.getProperty("application.context");
+	}
+
+	/**
+	 * Get the servlet URL. This is made up of the server URL with context +
+	 * file separator + the metacat servlet name
+	 * 
+	 * @return string holding the servlet URL
+	 */
+	public static String getServletURL() throws PropertyNotFoundException {
+		return getContextURL() + FileUtil.getFS() + METACAT_SERVLET;
+	}
+
+	/**
+	 * Get the style skins URL. This is made up of the server URL with context +
+	 * file separator + "style" + file separator + "skins"
+	 * 
+	 * @return string holding the style skins URL
+	 */
+	public static String getStyleSkinsURL() throws PropertyNotFoundException {
+		return getContextURL() + FileUtil.getFS() + "style" + FileUtil.getFS()
+				+ "skins";
+	}
+
+	/**
+	 * Get the style common URL. This is made up of the server URL with context +
+	 * file separator + "style" + file separator + "common"
+	 * 
+	 * @return string holding the style common URL
+	 */
+	public static String getStyleCommonURL() throws PropertyNotFoundException {
+		return getContextURL() + FileUtil.getFS() + "style" + FileUtil.getFS()
+				+ "common";
+	}
+	
+	/**
+	 * Get the metacat version by getting the string representation from
+	 * metacat.properties and instantiating a MetaCatVersion object
+	 * 
+	 * @return a MetaCatVersion object holding metacat version information
+	 */
+	public static MetaCatVersion getMetacatVersion() throws PropertyNotFoundException {
+		String metacatVersionString = 
+			PropertyService.getProperty("application.metacatVersion");
+		return new MetaCatVersion(metacatVersionString);
+	}
+
+	/**
+	 * Get the context directory. This is made up of the tomcat directory + file
+	 * separator + "webapps" + file separator + context
+	 * 
+	 * @return string holding the context directory
+	 */
+	public static String getContextDir() throws PropertyNotFoundException {
+		return PropertyService.getProperty("application.tomcatDir") + FileUtil.getFS()
+				+ "webapps" + FileUtil.getFS()
+				+ PropertyService.getProperty("application.context");
+	}
+
+	/**
+	 * Attempt to discover the context for this application. This is a best
+	 * guess scenario. It is used by configuration routines before the context
+	 * has been populated in metacat.properties. You should always use
+	 * getApplicationContext() instead of this method if possible.
+	 * 
+	 * @param request
+	 *            the http servlet request we will use to find the context
+	 * 
+	 * @return a string holding the context
+	 */
+	public static String discoverApplicationContext(HttpServletRequest request) {
+		String contextPath = request.getContextPath();
+
+		if (contextPath.charAt(0) == '/') {
+			contextPath = contextPath.substring(1);
+		}
+		logMetacat.debug("contextPath: " + contextPath);
+
+		return contextPath;
+	}
+
+	/**
+	 * Get the style skins directory. This is made up of the tomcat directory
+	 * with context + file separator + "style" + file separator + "skins"
+	 * 
+	 * @return string holding the style skins directory
+	 */
+	public static String getStyleSkinsDir() throws PropertyNotFoundException {
+		return getContextDir() + FileUtil.getFS() + "style" + FileUtil.getFS()
+				+ "skins";
+	}
+
+	/**
+	 * Get the SQL directory. This is made up of the context directory + file
+	 * separator + sql
+	 * 
+	 * @return string holding the sql directory
+	 */
+	public static String getSQLDir() throws PropertyNotFoundException {
+		return getContextDir() + FileUtil.getFS() + "sql";
+	}
+
+	/**
+	 * Get the default style URL from metacat.properties.
+	 * 
+	 * @return string holding the default style URL
+	 */
+	public static String getDefaultStyleURL() throws PropertyNotFoundException {
+		return getStyleCommonURL() + FileUtil.getFS()
+				+ PropertyService.getProperty("application.default-style");
+	}
+
+	/**
+	 * Attempt to discover the Tomcat directory for this application. This is a
+	 * best guess scenario. It is used by configuration routines before the
+	 * tomcat directory has been populated in metacat.properties. You should always
+	 * use getTomcatDir() instead of this method if possible.
+	 * 
+	 * @param request
+	 *            the http servlet request we will use to find the tomcat directory
+	 * 
+	 * @return a string holding the tomcat directory
+	 */
+	public static String discoverTomcatDir(HttpServletRequest request) {
+		ServletContext servletContext = request.getSession()
+				.getServletContext();
+		String realPath = servletContext.getRealPath(".");
+
+		int webappIndex = realPath.indexOf("webapp");
+
+		return realPath.substring(0, webappIndex - 1);
+	}
+
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/SystemUtil.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
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 4080)
@@ -1,4 +1,4 @@
-/**
+ /**
  *  '$RCSfile$'
  *    Purpose: A Class that implements a metadata catalog as a java Servlet
  *  Copyright: 2006 Regents of the University of California and the
@@ -32,7 +32,6 @@
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.io.Reader;
 import java.io.StringReader;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -69,10 +68,19 @@
 import com.oreilly.servlet.multipart.ParamPart;
 import com.oreilly.servlet.multipart.Part;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.service.ServiceException;
+import edu.ucsb.nceas.metacat.service.SessionService;
+import edu.ucsb.nceas.metacat.service.SkinPropertyService;
 import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
 import edu.ucsb.nceas.metacat.spatial.SpatialQuery;
-import edu.ucsb.nceas.utilities.Options;
-import edu.ucsb.nceas.utilities.OptionsMetadata;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.RequestUtil;
+import edu.ucsb.nceas.metacat.util.SessionData;
+import edu.ucsb.nceas.metacat.util.UtilException;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /**
  * A metadata catalog server implemented as a Java Servlet
@@ -124,8 +132,9 @@
  * reflect this information.
  */
 public class MetaCatServlet extends HttpServlet {
-    private static Hashtable sessionHash = new Hashtable();
-    private Timer timer = null;
+
+	private static final long serialVersionUID = 1L;
+	private Timer timer = null;
     private static boolean sitemapScheduled;
     
     // Constants -- these should be final in a servlet
@@ -140,7 +149,6 @@
     public static final String EML2KEYWORD = ":eml";
     public static final String XMLFORMAT = "xml";
     private static final String CONFIG_DIR = "WEB-INF";
-    private static final String CONFIG_NAME = "metacat.properties";
     private static final String FALSE = "false";
     private static final String TRUE  = "true";
     
@@ -148,46 +156,42 @@
      * Initialize the servlet by creating appropriate database connections
      */
     public void init(ServletConfig config) throws ServletException {
-        try {
+    	Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
+    	try {
             super.init(config);
-            Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
             
             ServletContext context = config.getServletContext();
-            
+             
             // Initialize the properties file for our options
             String dirPath = context.getRealPath(CONFIG_DIR);
-            File propertyFile = new File(dirPath, CONFIG_NAME);
             
             String LOG_CONFIG_NAME = dirPath + "/log4j.properties";
             PropertyConfigurator.configureAndWatch(LOG_CONFIG_NAME);
             
-            Options options = null;
-            try {
-                options = Options.initialize(propertyFile);
-            } catch (IOException ioe) {
-                logMetacat.error("Error in loading options: "
-                        + ioe.getMessage());
-            }
+            PropertyService propertyService = PropertyService.getInstance(context);
+            logMetacat.debug("PropertyService singleton created " + propertyService);
             
+            SkinPropertyService skinPropertyService = SkinPropertyService.getInstance(context);
+            logMetacat.debug("PropertyService singleton created " + skinPropertyService);
+            
+            SessionService sessionService = SessionService.getInstance();
+            logMetacat.debug("SessionService singleton created " + sessionService);
+            
             // Check if the servlet was configured, and if not stop the
             // initialization and skip to the configuration web form when
             // metacat is called
-            boolean configured = options.getOption("configured").equals("true");
-            if (!configured) {
-                logMetacat.info("Options configured: " + configured);
-                return;
-            }
+            if (!MetaCatUtil.isMetacatConfigured()) {
+            	return;
+            }       
             
-            MetaCatUtil util = new MetaCatUtil();
-            
             //initialize DBConnection pool
             DBConnectionPool connPool = DBConnectionPool.getInstance();
+            logMetacat.debug("DBConnection pool initialized: "+ connPool.toString());
             
-            //check if eml201 document were corrected or not.
-            // if not, correct eml201 documents.
+            //check if eml201 document were corrected or not. if not, correct eml201 documents.
             //Before Metacat 1.8.1, metacat uses tag RELEASE_EML_2_0_1_UPDATE_6 as eml 
             //schema, which accidentily points to wrong version of eml-resource.xsd.
-            String correctedEML201Doc = MetaCatUtil.getOption("eml201_document_corrected");
+            String correctedEML201Doc = PropertyService.getProperty("eml201_document_corrected");
             if (correctedEML201Doc != null && correctedEML201Doc.equals(FALSE))
             {
             	logMetacat.info("===Start to correct eml201 documents");
@@ -195,7 +199,7 @@
             	boolean success = correct.run();
             	if (success)
             	{
-            	     MetaCatUtil.setOption("eml201_document_corrected", TRUE);
+            		PropertyService.setProperty("eml201_document_corrected", TRUE);
             	}
             	logMetacat.info("====Finish to correct eml201 documents");
             }
@@ -209,8 +213,8 @@
             
             // start the IndexingThread if indexingTimerTaskTime more than 0.
             // It will index all the documents not yet indexed in the database
-            int indexingTimerTaskTime = Integer.parseInt(MetaCatUtil.getOption("indexingTimerTaskTime"));
-            int delayTime = Integer.parseInt(MetaCatUtil.getOption("indexingInitialDelay"));
+            int indexingTimerTaskTime = Integer.parseInt(PropertyService.getProperty("database.indexingTimerTaskTime"));
+            int delayTime = Integer.parseInt(PropertyService.getProperty("database.indexingInitialDelay"));
             
             if(indexingTimerTaskTime > 0){
                 timer = new Timer();
@@ -218,7 +222,7 @@
             }
             
             // read the config files:
-            Vector skins = MetaCatUtil.getOptionList(MetaCatUtil.getOption("skinconfigfiles"));
+            Vector<String> skins = MetaCatUtil.getOptionList(PropertyService.getProperty("skin.names"));
             String skinName, skinDirPath = null;
             File skinPropertyFile = null;
             
@@ -244,8 +248,8 @@
              *  If spatial option is turned on and set to regenerate the
              *  spatial cache on restart, trigger the harvester regeneratation method
              */
-            if ( MetaCatUtil.getOption("runSpatialOption").equals("true") &&
-                    MetaCatUtil.getOption("regenerateCacheOnRestart").equals("true") ) {
+            if ( PropertyService.getProperty("runSpatialOption").equals("true") &&
+                    PropertyService.getProperty("regenerateCacheOnRestart").equals("true") ) {
                 
                 // Begin timer
                 long before = System.currentTimeMillis();
@@ -258,7 +262,7 @@
                 
                 // After running the first time, we want to to set regenerateCacheOnRestart to false
                 // so that it does not regenerate the cache every time tomcat is restarted
-                MetaCatUtil.setOption("regenerateCacheOnRestart","false");
+                PropertyService.setProperty("regenerateCacheOnRestart","false");
                 
                 // End timer
                 long after = System.currentTimeMillis();
@@ -270,19 +274,30 @@
             
             sitemapScheduled = false;
             
-            logMetacat.warn("Metacat (" + Version.getVersion()
+            logMetacat.warn("Metacat (" + MetaCatVersion.getVersionID()
             + ") initialized.");
             
-        } catch (ServletException ex) {
-            throw ex;
         } catch (SQLException e) {
-            Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
-            logMetacat.error("Error in MetacatServlet.init: "
-                    + e.getMessage());
+        	String errorMessage = 
+        		"SQL problem while intializing MetaCat Servlet: " + e.getMessage();
+            logMetacat.error(errorMessage);
+            throw new ServletException(errorMessage);
+        } catch (ServiceException se) {
+        	String errorMessage = 
+        		"Service problem while intializing MetaCat Servlet: " + se.getMessage();
+            logMetacat.error(errorMessage);
+            throw new ServletException(errorMessage);
         } catch (IOException ie) {
-            Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
-            logMetacat.error("Error in MetacatServlet.init: "
-                    + ie.getMessage());
+           	String errorMessage = 
+           		"IO problem while intializing MetaCat Servlet: "+ ie.getMessage();
+           	logMetacat.error(errorMessage);
+           	throw new ServletException(errorMessage);
+        } catch (GeneralPropertyException gpe) {
+        	String errorMessage = 
+        		"Could not retrieve property while intializing MetaCat Servlet: " 
+        		+ gpe.getMessage();
+        	logMetacat.error(errorMessage);
+            throw new ServletException(errorMessage);
         }
     }
     
@@ -318,9 +333,20 @@
      */
     private void checkIndexPaths() {
         Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
-        MetaCatUtil.pathsForIndexing
-                = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
         
+        try {
+        	MetaCatUtil.pathsForIndexing
+                = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
+        
+        	MetaCatUtil.pathsForIndexing = 
+        		MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
+        }
+        catch (PropertyNotFoundException pnfe) {
+        	MetaCatUtil.pathsForIndexing = null;
+            logMetacat.error("Could not find index paths.  Setting " 
+            		+ "MetaCatUtil.pathsForIndexing to null: " + pnfe.getMessage());
+        }
+        
         if (MetaCatUtil.pathsForIndexing != null) {
             
             logMetacat.debug("Indexing paths specified in metacat.properties....");
@@ -451,429 +477,432 @@
     }
     
     /**
-     * Control servlet response depending on the action parameter specified
-     */
-    private void handleGetOrPost(HttpServletRequest request,
-            HttpServletResponse response) throws ServletException, IOException {
-        MetaCatUtil util = new MetaCatUtil();
-        Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
-        
-        // Each time metacat is called, see if it has been configured,
-        // and if not, then go ahead and configure it's options
-        boolean configured = MetaCatUtil.getOption("configured").equals("true");
-        if (!configured) {
-            configureMetacat(request, response);
-            return;
-        }
-        
-        /*
-         * logMetacat.debug("Connection pool size: "
-         * +connPool.getSizeOfDBConnectionPool(),10);
-         * logMetacat.debug("Free DBConnection number: "
-         */
-        //If all DBConnection in the pool are free and DBConnection pool
-        //size is greater than initial value, shrink the connection pool
-        //size to initial value
-        DBConnectionPool.shrinkDBConnectionPoolSize();
-        
-        //Debug message to print out the method which have a busy DBConnection
-        try {
-            DBConnectionPool pool = DBConnectionPool.getInstance();
-            pool.printMethodNameHavingBusyDBConnection();
-        } catch (SQLException e) {
-            logMetacat.error("Error in MetacatServlet.handleGetOrPost: "
-                    + e.getMessage());
-            e.printStackTrace();
-        }
-        
-        String ctype = request.getContentType();
-        if (ctype != null && ctype.startsWith("multipart/form-data")) {
-            handleMultipartForm(request, response);
-        } else {
-            
-            String name = null;
-            String[] value = null;
-            String[] docid = new String[3];
-            Hashtable params = new Hashtable();
-            
-            // Check if this is a simple read request that doesn't use the "action" syntax
-            // These URLs are of the form:
-            //            http://localhost:8180/knb/metacat/docid/skinname
-            //     e.g.,  http://localhost:8180/knb/metacat/test.1.1/knb
-            String pathInfo = request.getPathInfo();
-            if (pathInfo != null) {
-                String[] path = pathInfo.split("/");
-                if (path.length > 1) {
-                    String docidToRead = path[1];
-                    String docs[] = new String[1];
-                    docs[0] = docidToRead;
-                    logMetacat.debug("READING DOCID FROM PATHINFO: " + docs[0]);
-                    params.put("docid", docs);
-                    String skin = null;
-                    if (path.length > 2) {
-                        skin = path[2];
-                        String skins[] = new String[1];
-                        skins[0] = skin;
-                        params.put("qformat", skins);
-                    }
-                    handleReadAction(params, request, response, "public", null, null);
-                    return;
-                }
-            }
-            
-            Enumeration paramlist = request.getParameterNames();
-            while (paramlist.hasMoreElements()) {
-                
-                name = (String) paramlist.nextElement();
-                value = request.getParameterValues(name);
-                
-                // Decode the docid and mouse click information
-                // THIS IS OBSOLETE -- I THINK -- REMOVE THIS BLOCK 4/12/2007 MBJ
-                if (name.endsWith(".y")) {
-                    docid[0] = name.substring(0, name.length() - 2);
-                    params.put("docid", docid);
-                    name = "ypos";
-                }
-                if (name.endsWith(".x")) {
-                    name = "xpos";
-                }
-                
-                params.put(name, value);
-            }
-            
-            //handle param is emptpy
-            if (params.isEmpty() || params == null) { return; }
-            
-            //if the user clicked on the input images, decode which image
-            //was clicked then set the action.
-            if(params.get("action") == null){
-                PrintWriter out = response.getWriter();
-                response.setContentType("text/xml");
-                out.println("<?xml version=\"1.0\"?>");
-                out.println("<error>");
-                out.println("Action not specified");
-                out.println("</error>");
-                out.close();
-                return;
-            }
-            
-            String action = ((String[]) params.get("action"))[0];
-            logMetacat.info("Action is: " + action);
-            
-            // This block handles session management for the servlet
-            // by looking up the current session information for all actions
-            // other than "login" and "logout"
-            String username = null;
-            String password = null;
-            String[] groupnames = null;
-            String sess_id = null;
-            name = null;
-            
-            // handle login action
-            if (action.equals("login")) {
-                PrintWriter out = response.getWriter();
-                handleLoginAction(out, params, request, response);
-                out.close();
-                
-                // handle logout action
-            }   else if (action.equals("logout")) {
-                PrintWriter out = response.getWriter();
-                handleLogoutAction(out, params, request, response);
-                out.close();
-                
-                // handle shrink DBConnection request
-            } else if (action.equals("shrink")) {
-                PrintWriter out = response.getWriter();
-                boolean success = false;
-                //If all DBConnection in the pool are free and DBConnection
-                // pool
-                //size is greater than initial value, shrink the connection
-                // pool
-                //size to initial value
-                success = DBConnectionPool.shrinkConnectionPoolSize();
-                if (success) {
-                    //if successfully shrink the pool size to initial value
-                    out.println("DBConnection Pool shrunk successfully.");
-                }//if
-                else {
-                    out.println("DBConnection pool not shrunk successfully.");
-                }
-                //close out put
-                out.close();
-                
-                // aware of session expiration on every request
-            } else {
-                HttpSession sess = request.getSession(true);
-                logMetacat.info("session.isnew: " + sess.isNew() + "    params.hassessid: " + params.containsKey("sessionid"));
-                if (sess.isNew() && !params.containsKey("sessionid")) {
-                    // session expired or has not been stored b/w user requests
-                    logMetacat.info(
-                            "The session is new or no sessionid is assigned. The user is public");
-                    username = "public";
-                    sess.setAttribute("username", username);
-                    sess_id = (String)sess.getId();
-                    sess.setAttribute("sessionid", sess_id);
-                    sessionHash.put(sess_id, sess);
-                } else {
-                    logMetacat.info("The session is either old or "
-                            + "has sessionid parameter");
-                    try {
-                        if (params.containsKey("sessionid")) {
-                            sess_id = ((String[]) params.get("sessionid"))[0];
-                            logMetacat.info("in has sessionid "
-                                    + sess_id);
-                            if (sessionHash.containsKey(sess_id)) {
-                                logMetacat.info("find the id "
-                                        + sess_id + " in hash table");
-                                sess = (HttpSession) sessionHash.get(sess_id);
-                            }
-                        } else {
-                            //this makes sure there is a session object for public sessions
-                            sess_id = sess.getId();
-                            sessionHash.put(sess_id, sess);
-                        }
-                    } catch (IllegalStateException ise) {
-                        logMetacat.error(
-                                "Error in handleGetOrPost: this shouldn't "
-                                + "happen: the session should be valid: "
-                                + ise.getMessage());
-                    }
-                    
-                    username = (String) sess.getAttribute("username");
-                    logMetacat.info("The user name from session is: "
-                            + username);
-                    password = (String) sess.getAttribute("password");
-                    groupnames = (String[]) sess.getAttribute("groupnames");
-                    name = (String) sess.getAttribute("name");
-                }
-                
-                //make user user username should be public
-                if (username == null || (username.trim().equals(""))) {
-                    username = "public";
-                }
-                logMetacat.info("The user is : " + username);
-            }
-            // Now that we know the session is valid, we can delegate the
-            // request
-            // to a particular action handler
-            if (action.equals("query")) {
-            	ServletOutputStream streamOut = response.getOutputStream();
-                PrintWriter out = new PrintWriter(streamOut);
-                handleQuery(out, params, response, username, groupnames,
-                        sess_id);
-                out.close();
-            } else if (action.equals("squery")) {
-            	ServletOutputStream streamOut = response.getOutputStream();
-                PrintWriter out = new PrintWriter(streamOut);
-                if (params.containsKey("query")) {
-                    handleSQuery(out, params, response, username, groupnames,
-                            sess_id);
-                    out.close();
-                } else {
-                    out.println(
-                            "Illegal action squery without \"query\" parameter");
-                    out.close();
-                }
-            } else if ( action.trim().equals("spatial_query")) {
-                
-                logMetacat.debug("******************* SPATIAL QUERY ********************");
-                ServletOutputStream streamOut = response.getOutputStream();
-                PrintWriter out = new PrintWriter(streamOut);
-                handleSpatialQuery(out, params, response, username, groupnames, sess_id);
-                out.close();
-                
-            } else if (action.equals("export")) {
-                
-                handleExportAction(params, response, username,
-                        groupnames, password);
-            } else if (action.equals("read")) {
-                handleReadAction(params, request, response, username, password,
-                        groupnames);
-            } else if (action.equals("readinlinedata")) {
-                handleReadInlineDataAction(params, request, response, username,
-                        password, groupnames);
-            } else if (action.equals("insert") || action.equals("update")) {
-                PrintWriter out = response.getWriter();
-                if ((username != null) && !username.equals("public")) {
-                    handleInsertOrUpdateAction(request, response,
-                            out, params, username, groupnames);
-                } else {
-                    response.setContentType("text/xml");
-                    out.println("<?xml version=\"1.0\"?>");
-                    out.println("<error>");
-                    out.println("Permission denied for user " + username + " "
-                            + action);
-                    out.println("</error>");
-                }
-                out.close();
-            } else if (action.equals("delete")) {
-                PrintWriter out = response.getWriter();
-                if ((username != null) && !username.equals("public")) {
-                    handleDeleteAction(out, params, request, response, username,
-                            groupnames);
-                } else {
-                    response.setContentType("text/xml");
-                    out.println("<?xml version=\"1.0\"?>");
-                    out.println("<error>");
-                    out.println("Permission denied for " + action);
-                    out.println("</error>");
-                }
-                out.close();
-            } else if (action.equals("validate")) {
-                PrintWriter out = response.getWriter();
-                handleValidateAction(out, params);
-                out.close();
-            } else if (action.equals("setaccess")) {
-                PrintWriter out = response.getWriter();
-                handleSetAccessAction(out, params, username);
-                out.close();
-            } else if (action.equals("getaccesscontrol")) {
-                PrintWriter out = response.getWriter();
-                handleGetAccessControlAction(out, params, response, username,
-                        groupnames);
-                out.close();
-            } else if (action.equals("getprincipals")) {
-                PrintWriter out = response.getWriter();
-                handleGetPrincipalsAction(out, username, password);
-                out.close();
-            } else if (action.equals("getdoctypes")) {
-                PrintWriter out = response.getWriter();
-                handleGetDoctypesAction(out, params, response);
-                out.close();
-            } else if (action.equals("getdtdschema")) {
-                PrintWriter out = response.getWriter();
-                handleGetDTDSchemaAction(out, params, response);
-                out.close();
-            } else if (action.equals("getlastdocid")) {
-                PrintWriter out = response.getWriter();
-                handleGetMaxDocidAction(out, params, response);
-                out.close();
-            } else if (action.equals("getalldocids")) {
-                PrintWriter out = response.getWriter();
-                handleGetAllDocidsAction(out, params, response);
-                out.close();
-            } else if (action.equals("isregistered")) {
-                PrintWriter out = response.getWriter();
-                handleIdIsRegisteredAction(out, params, response);
-                out.close();
-            } else if (action.equals("getrevisionanddoctype")) {
-                PrintWriter out = response.getWriter();
-                handleGetRevisionAndDocTypeAction(out, params);
-                out.close();
-            } else if (action.equals("getversion")) {
-                response.setContentType("text/xml");
-                PrintWriter out = response.getWriter();
-                out.println(Version.getVersionAsXml());
-                out.close();
-            } else if (action.equals("getlog")) {
-                handleGetLogAction(params, request, response, username, groupnames);
-            } else if (action.equals("getloggedinuserinfo")) {
-                PrintWriter out = response.getWriter();
-                response.setContentType("text/xml");
-                out.println("<?xml version=\"1.0\"?>");
-                out.println("\n<user>\n");
-                out.println("\n<username>\n");
-                out.println(username);
-                out.println("\n</username>\n");
-                if(name!=null){
-                    out.println("\n<name>\n");
-                    out.println(name);
-                    out.println("\n</name>\n");
-                }
-                if(MetaCatUtil.isAdministrator(username, groupnames)){
-                    out.println("<isAdministrator></isAdministrator>\n");
-                }
-                if(MetaCatUtil.isModerator(username, groupnames)){
-                    out.println("<isModerator></isModerator>\n");
-                }
-                out.println("\n</user>\n");
-                out.close();
-            } else if (action.equals("buildindex")) {
-                handleBuildIndexAction(params, request, response, username, groupnames);
-            } else if (action.equals("login") || action.equals("logout")) {
-                /*
-            } else if (action.equals("protocoltest")) {
-                String testURL = "metacat://dev.nceas.ucsb.edu/NCEAS.897766.9";
-                try {
-                    testURL = ((String[]) params.get("url"))[0];
-                } catch (Throwable t) {
-                }
-                String phandler = System
-                        .getProperty("java.protocol.handler.pkgs");
-                response.setContentType("text/html");
-                PrintWriter out = response.getWriter();
-                out.println("<body bgcolor=\"white\">");
-                out.println("<p>Handler property: <code>" + phandler
-                        + "</code></p>");
-                out.println("<p>Starting test for:<br>");
-                out.println("    " + testURL + "</p>");
-                try {
-                    URL u = new URL(testURL);
-                    out.println("<pre>");
-                    out.println("Protocol: " + u.getProtocol());
-                    out.println("    Host: " + u.getHost());
-                    out.println("    Port: " + u.getPort());
-                    out.println("    Path: " + u.getPath());
-                    out.println("     Ref: " + u.getRef());
-                    String pquery = u.getQuery();
-                    out.println("   Query: " + pquery);
-                    out.println("  Params: ");
-                    if (pquery != null) {
-                        Hashtable qparams = MetaCatUtil.parseQuery(u.getQuery());
-                        for (Enumeration en = qparams.keys(); en
-                                .hasMoreElements();) {
-                            String pname = (String) en.nextElement();
-                            String pvalue = (String) qparams.get(pname);
-                            out.println("    " + pname + ": " + pvalue);
-                        }
-                    }
-                    out.println("</pre>");
-                    out.println("</body>");
-                    out.close();
-                } catch (MalformedURLException mue) {
-                    System.out.println(
-                            "bad url from MetacatServlet.handleGetOrPost");
-                    out.println(mue.getMessage());
-                    mue.printStackTrace(out);
-                    out.close();
-                }
-                 */
-            } else {
-                PrintWriter out = response.getWriter();
-                out.println("<?xml version=\"1.0\"?>");
-                out.println("<error>");
-                out.println(
-                        "Error: action not registered.  Please report this error.");
-                out.println("</error>");
-                out.close();
-            }
-            
-            //util.closeConnections();
-            // Close the stream to the client
-            //out.close();
-            
-            // Schedule the sitemap generator to run periodically
-            scheduleSitemapGeneration(request);
-        }
-    }
+	 * Control servlet response depending on the action parameter specified
+	 */
+	private void handleGetOrPost(HttpServletRequest request,
+			HttpServletResponse response) throws ServletException, IOException {
+		Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
+
+		// Update the last update time for this user if they are not new
+		HttpSession httpSession = request.getSession(false);
+		if (httpSession != null) {
+			SessionService.touchSession(httpSession.getId());
+		}
+		
+		// Each time metacat is called, see if it has been configured,
+		// and if not, then forward to the administration servlet
+		if (!MetaCatUtil.isMetacatConfigured()) {
+			RequestUtil.forwardRequest(request, response, "/admin?action=configure");
+			return;
+		}
+
+		/*
+		 * logMetacat.debug("Connection pool size: "
+		 * +connPool.getSizeOfDBConnectionPool(),10); logMetacat.debug("Free
+		 * DBConnection number: "
+		 */
+		// If all DBConnection in the pool are free and DBConnection pool
+		// size is greater than initial value, shrink the connection pool
+		// size to initial value
+		DBConnectionPool.shrinkDBConnectionPoolSize();
+
+		// Debug message to print out the method which have a busy DBConnection
+		try {
+			DBConnectionPool pool = DBConnectionPool.getInstance();
+			pool.printMethodNameHavingBusyDBConnection();
+		} catch (SQLException e) {
+			logMetacat.error("Error in MetacatServlet.handleGetOrPost: "
+					+ e.getMessage());
+			e.printStackTrace();
+		}
+
+		try {
+			String ctype = request.getContentType();
+			if (ctype != null && ctype.startsWith("multipart/form-data")) {
+				handleMultipartForm(request, response);
+			} else {
+
+				String name = null;
+				String[] value = null;
+				String[] docid = new String[3];
+				Hashtable<String, String[]> params = new Hashtable<String, String[]>();
+
+				// Check if this is a simple read request that doesn't use the
+				// "action" syntax
+				// These URLs are of the form:
+				// http://localhost:8180/knb/metacat/docid/skinname
+				// e.g., http://localhost:8180/knb/metacat/test.1.1/knb
+				String pathInfo = request.getPathInfo();
+				if (pathInfo != null) {
+					String[] path = pathInfo.split("/");
+					if (path.length > 1) {
+						String docidToRead = path[1];
+						String docs[] = new String[1];
+						docs[0] = docidToRead;
+						logMetacat.debug("READING DOCID FROM PATHINFO: " + docs[0]);
+						params.put("docid", docs);
+						String skin = null;
+						if (path.length > 2) {
+							skin = path[2];
+							String skins[] = new String[1];
+							skins[0] = skin;
+							params.put("qformat", skins);
+						}
+						handleReadAction(params, request, response, "public", null, null);
+						return;
+					}
+				}
+
+				Enumeration<String> paramlist =(Enumeration<String>)request.getParameterNames();
+				while (paramlist.hasMoreElements()) {
+
+					name = (String) paramlist.nextElement();
+					value = request.getParameterValues(name);
+
+					// Decode the docid and mouse click information
+					// THIS IS OBSOLETE -- I THINK -- REMOVE THIS BLOCK
+					// 4/12/2007
+					// MBJ
+					if (name.endsWith(".y")) {
+						docid[0] = name.substring(0, name.length() - 2);
+						params.put("docid", docid);
+						name = "ypos";
+					}
+					if (name.endsWith(".x")) {
+						name = "xpos";
+					}
+
+					params.put(name, value);
+				}
+
+				// handle param is emptpy
+				if (params.isEmpty() || params == null) {
+					return;
+				}
+
+				// if the user clicked on the input images, decode which image
+				// was clicked then set the action.
+				if (params.get("action") == null) {
+					PrintWriter out = response.getWriter();
+					response.setContentType("text/xml");
+					out.println("<?xml version=\"1.0\"?>");
+					out.println("<error>");
+					out.println("Action not specified");
+					out.println("</error>");
+					out.close();
+					return;
+				}
+
+				String action = ((String[]) params.get("action"))[0];
+				logMetacat.info("Action is: " + action);
+
+				// This block handles session management for the servlet
+				// by looking up the current session information for all actions
+				// other than "login" and "logout"
+				String username = null;
+				String password = null;
+				String[] groupnames = null;
+				String sess_id = null;
+				name = null;
+
+				// handle login action
+				if (action.equals("login")) {
+					PrintWriter out = response.getWriter();
+					handleLoginAction(out, params, request, response);
+					out.close();
+
+					// handle logout action
+				} else if (action.equals("logout")) {
+					PrintWriter out = response.getWriter();
+					handleLogoutAction(out, params, request, response);
+					out.close();
+
+					// handle shrink DBConnection request
+				} else if (action.equals("shrink")) {
+					PrintWriter out = response.getWriter();
+					boolean success = false;
+					// If all DBConnection in the pool are free and DBConnection
+					// pool
+					// size is greater than initial value, shrink the connection
+					// pool
+					// size to initial value
+					success = DBConnectionPool.shrinkConnectionPoolSize();
+					if (success) {
+						// if successfully shrink the pool size to initial value
+						out.println("DBConnection Pool shrunk successfully.");
+					}// if
+					else {
+						out.println("DBConnection pool not shrunk successfully.");
+					}
+					// close out put
+					out.close();
+
+					// aware of session expiration on every request
+				} else {
+					// TODO MCD take a closer look at this
+					HttpSession sess = request.getSession(true);
+					SessionData sessionData = null;
+					logMetacat.info("session.isnew: " + sess.isNew()
+							+ "    params.hassessid: " + params.containsKey("sessionid"));
+					if (sess.isNew() && !params.containsKey("sessionid")) {
+						// session expired or has not been stored b/w user
+						// requests
+						logMetacat.info("The session is new or no sessionid is assigned. " 
+								+ "The user is public");
+						sessionData = new SessionData(sess.getId(), "public", null, null);
+						SessionService.registerSession(sessionData);											
+					} else {
+						logMetacat.info("The session is either old or "
+								+ "has sessionid parameter");
+						try {
+							
+							if (params.containsKey("sessionid")) {
+								sess_id = ((String[]) params.get("sessionid"))[0];
+								logMetacat.info("in has sessionid " + sess_id);
+								if (SessionService.isSessionRegistered(sess_id)) {
+									logMetacat.info("find the id " + sess_id
+											+ " in hash table");
+									sessionData = SessionService.getRegisteredSession(sess_id);
+								}
+							} else {
+								// this makes sure there is a session object for
+								// public sessions
+								sess_id = sess.getId();
+								sessionData = new SessionData(sess.getId(), 
+										(String) sess.getAttribute("username"), 
+										(String[]) sess.getAttribute("groups"),
+										(String) sess.getAttribute("password"));
+								SessionService.registerSession(sessionData);
+							}
+						} catch (IllegalStateException ise) {
+							logMetacat.error("Error in handleGetOrPost: this shouldn't "
+									+ "happen: the session should be valid: "
+									+ ise.getMessage());
+						}
+
+						username = (String) sess.getAttribute("username");
+						logMetacat.info("The user name from session is: " + username);
+						password = (String) sess.getAttribute("password");
+						groupnames = (String[]) sess.getAttribute("groupnames");
+//						name = (String) sess.getAttribute("name");
+					}
+
+					// make user user username should be public
+					if (username == null || (username.trim().equals(""))) {
+						username = "public";
+					}
+					logMetacat.info("The user is : " + username);
+				}
+				// Now that we know the session is valid, we can delegate the
+				// request
+				// to a particular action handler
+				if (action.equals("query")) {
+					ServletOutputStream streamOut = response.getOutputStream();
+					PrintWriter out = new PrintWriter(streamOut);
+					handleQuery(out, params, response, username, groupnames, sess_id);
+					out.close();
+				} else if (action.equals("squery")) {
+					ServletOutputStream streamOut = response.getOutputStream();
+					PrintWriter out = new PrintWriter(streamOut);
+					if (params.containsKey("query")) {
+						handleSQuery(out, params, response, username, groupnames, sess_id);
+						out.close();
+					} else {
+						out.println("Illegal action squery without \"query\" parameter");
+						out.close();
+					}
+				} else if (action.trim().equals("spatial_query")) {
+
+					logMetacat
+							.debug("******************* SPATIAL QUERY ********************");
+					ServletOutputStream streamOut = response.getOutputStream();
+					PrintWriter out = new PrintWriter(streamOut);
+					handleSpatialQuery(out, params, response, username, groupnames,
+							sess_id);
+					out.close();
+
+				} else if (action.equals("export")) {
+
+					handleExportAction(params, response, username, groupnames, password);
+				} else if (action.equals("read")) {
+					handleReadAction(params, request, response, username, password,
+							groupnames);
+				} else if (action.equals("readinlinedata")) {
+					handleReadInlineDataAction(params, request, response, username,
+							password, groupnames);
+				} else if (action.equals("insert") || action.equals("update")) {
+					PrintWriter out = response.getWriter();
+					if ((username != null) && !username.equals("public")) {
+						handleInsertOrUpdateAction(request, response, out, params,
+								username, groupnames);
+					} else {
+						response.setContentType("text/xml");
+						out.println("<?xml version=\"1.0\"?>");
+						out.println("<error>");
+						out.println("Permission denied for user " + username + " "
+								+ action);
+						out.println("</error>");
+					}
+					out.close();
+				} else if (action.equals("delete")) {
+					PrintWriter out = response.getWriter();
+					if ((username != null) && !username.equals("public")) {
+						handleDeleteAction(out, params, request, response, username,
+								groupnames);
+					} else {
+						response.setContentType("text/xml");
+						out.println("<?xml version=\"1.0\"?>");
+						out.println("<error>");
+						out.println("Permission denied for " + action);
+						out.println("</error>");
+					}
+					out.close();
+				} else if (action.equals("validate")) {
+					PrintWriter out = response.getWriter();
+					handleValidateAction(out, params);
+					out.close();
+				} else if (action.equals("setaccess")) {
+					PrintWriter out = response.getWriter();
+					handleSetAccessAction(out, params, username);
+					out.close();
+				} else if (action.equals("getaccesscontrol")) {
+					PrintWriter out = response.getWriter();
+					handleGetAccessControlAction(out, params, response, username,
+							groupnames);
+					out.close();
+				} else if (action.equals("getprincipals")) {
+					PrintWriter out = response.getWriter();
+					handleGetPrincipalsAction(out, username, password);
+					out.close();
+				} else if (action.equals("getdoctypes")) {
+					PrintWriter out = response.getWriter();
+					handleGetDoctypesAction(out, params, response);
+					out.close();
+				} else if (action.equals("getdtdschema")) {
+					PrintWriter out = response.getWriter();
+					handleGetDTDSchemaAction(out, params, response);
+					out.close();
+				} else if (action.equals("getlastdocid")) {
+					PrintWriter out = response.getWriter();
+					handleGetMaxDocidAction(out, params, response);
+					out.close();
+				} else if (action.equals("getalldocids")) {
+					PrintWriter out = response.getWriter();
+					handleGetAllDocidsAction(out, params, response);
+					out.close();
+				} else if (action.equals("isregistered")) {
+					PrintWriter out = response.getWriter();
+					handleIdIsRegisteredAction(out, params, response);
+					out.close();
+				} else if (action.equals("getrevisionanddoctype")) {
+					PrintWriter out = response.getWriter();
+					handleGetRevisionAndDocTypeAction(out, params);
+					out.close();
+				} else if (action.equals("getversion")) {
+					response.setContentType("text/xml");
+					PrintWriter out = response.getWriter();
+					out.println(MetaCatVersion.getVersionAsXml());
+					out.close();
+				} else if (action.equals("getlog")) {
+					handleGetLogAction(params, request, response, username, groupnames);
+				} else if (action.equals("getloggedinuserinfo")) {
+					PrintWriter out = response.getWriter();
+					response.setContentType("text/xml");
+					out.println("<?xml version=\"1.0\"?>");
+					out.println("\n<user>\n");
+					out.println("\n<username>\n");
+					out.println(username);
+					out.println("\n</username>\n");
+					if (name != null) {
+						out.println("\n<name>\n");
+						out.println(name);
+						out.println("\n</name>\n");
+					}
+					if (LDAPUtil.isAdministrator(username, groupnames)) {
+						out.println("<isAdministrator></isAdministrator>\n");
+					}
+					if (LDAPUtil.isModerator(username, groupnames)) {
+						out.println("<isModerator></isModerator>\n");
+					}
+					out.println("\n</user>\n");
+					out.close();
+				} else if (action.equals("buildindex")) {
+					handleBuildIndexAction(params, request, response, username,
+							groupnames);
+				} else if (action.equals("login") || action.equals("logout")) {
+					/*
+					 * } else if (action.equals("protocoltest")) { String
+					 * testURL = "metacat://dev.nceas.ucsb.edu/NCEAS.897766.9";
+					 * try { testURL = ((String[]) params.get("url"))[0]; }
+					 * catch (Throwable t) { } String phandler = System
+					 * .getProperty("java.protocol.handler.pkgs");
+					 * response.setContentType("text/html"); PrintWriter out =
+					 * response.getWriter(); out.println("<body
+					 * bgcolor=\"white\">"); out.println("<p>Handler property:
+					 * <code>" + phandler + "</code></p>"); out.println("<p>Starting
+					 * test for:<br>"); out.println(" " + testURL + "</p>");
+					 * try { URL u = new URL(testURL); out.println("<pre>");
+					 * out.println("Protocol: " + u.getProtocol());
+					 * out.println(" Host: " + u.getHost()); out.println(" Port: " +
+					 * u.getPort()); out.println(" Path: " + u.getPath());
+					 * out.println(" Ref: " + u.getRef()); String pquery =
+					 * u.getQuery(); out.println(" Query: " + pquery);
+					 * out.println(" Params: "); if (pquery != null) { Hashtable
+					 * qparams = MetaCatUtil.parseQuery(u.getQuery()); for
+					 * (Enumeration en = qparams.keys(); en .hasMoreElements();) {
+					 * String pname = (String) en.nextElement(); String pvalue =
+					 * (String) qparams.get(pname); out.println(" " + pname + ": " +
+					 * pvalue); } } out.println("</pre>"); out.println("</body>");
+					 * out.close(); } catch (MalformedURLException mue) {
+					 * System.out.println( "bad url from
+					 * MetacatServlet.handleGetOrPost");
+					 * out.println(mue.getMessage()); mue.printStackTrace(out);
+					 * out.close(); }
+					 */
+				} else {
+					PrintWriter out = response.getWriter();
+					out.println("<?xml version=\"1.0\"?>");
+					out.println("<error>");
+					out
+							.println("Error: action not registered.  Please report this error.");
+					out.println("</error>");
+					out.close();
+				}
+
+				// util.closeConnections();
+				// Close the stream to the client
+				// out.close();
+
+				// Schedule the sitemap generator to run periodically
+				scheduleSitemapGeneration(request);
+			}
+		} catch (PropertyNotFoundException pnfe) {
+			String errorString = "Critical property not found: " + pnfe.getMessage();
+			logMetacat.error(errorString);
+			throw new ServletException(errorString);
+		} catch (UtilException ue) {
+			String errorString = "Utility error: " + ue.getMessage();
+			logMetacat.error(errorString);
+			throw new ServletException(errorString);
+		}
+	}
     
-    /////////////////////////////// METACAT SPATIAL ///////////////////////////
+    // ///////////////////////////// METACAT SPATIAL ///////////////////////////
     
     /**
-     * handles all spatial queries -- these queries may include any of the
-     * queries supported by the WFS / WMS standards
-     *
-     * handleSQuery(out, params, response, username, groupnames,
-     *                        sess_id);
-     */
-    private void handleSpatialQuery(PrintWriter out, Hashtable params,
+	 * handles all spatial queries -- these queries may include any of the
+	 * queries supported by the WFS / WMS standards
+	 * 
+	 * handleSQuery(out, params, response, username, groupnames, sess_id);
+	 */
+    private void handleSpatialQuery(PrintWriter out, Hashtable<String, String[]> params,
             HttpServletResponse response,
             String username, String[] groupnames,
-            String sess_id) {
+            String sess_id) throws PropertyNotFoundException {
         
         Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
         
-        if ( !MetaCatUtil.getOption("runSpatialOption").equals("true") ) {
+        if ( !PropertyService.getProperty("runSpatialOption").equals("true") ) {
             response.setContentType("text/html");
             out.println("<html> Metacat Spatial Option is turned off </html>");
             out.close();
@@ -881,26 +910,28 @@
         }
         
         /*
-         * Perform spatial query against spatial cache
-         */
+		 * Perform spatial query against spatial cache
+		 */
         float _xmax = Float.valueOf( ((String[]) params.get("xmax"))[0] ).floatValue();
         float _ymax = Float.valueOf( ((String[]) params.get("ymax"))[0] ).floatValue();
         float _xmin = Float.valueOf( ((String[]) params.get("xmin"))[0] ).floatValue();
         float _ymin = Float.valueOf( ((String[]) params.get("ymin"))[0] ).floatValue();
         SpatialQuery sq = new SpatialQuery();
-        Vector docids = sq.filterByBbox( _xmin, _ymin, _xmax, _ymax );
-        // logMetacat.info(" --- Spatial Query completed. Passing on the SQuery handler");
-        // logMetacat.warn("\n\n ******* after spatial query, we've got " + docids.size() + " docids \n\n");
+        Vector<String> docids = sq.filterByBbox( _xmin, _ymin, _xmax, _ymax );
+        // logMetacat.info(" --- Spatial Query completed. Passing on the SQuery
+		// handler");
+        // logMetacat.warn("\n\n ******* after spatial query, we've got " +
+		// docids.size() + " docids \n\n");
         
         /*
-         * Create an array matching docids
-         */
+		 * Create an array matching docids
+		 */
         String [] docidArray = new String[docids.size()];
         docids.toArray(docidArray);
         
         /*
-         * Create squery string
-         */
+		 * Create squery string
+		 */
         String squery = DocumentIdQuery.createDocidQuery( docidArray );
         // logMetacat.info("-----------\n" + squery + "\n------------------");
         String[] queryArray = new String[1];
@@ -908,14 +939,15 @@
         params.put("query", queryArray);
         
         /*
-         * Determine qformat
-         */
+		 * Determine qformat
+		 */
         String[] qformatArray = new String[1];
         try {
             String _skin = ((String[]) params.get("skin"))[0];
             qformatArray[0] = _skin;
         } catch (java.lang.NullPointerException e) {
-            // should be "default" but keep this for backwards compatibility with knp site
+            // should be "default" but keep this for backwards compatibility
+			// with knp site
             logMetacat.warn("No SKIN specified for metacat actions=spatial_query... defaulting to 'knp' skin !\n");
             qformatArray[0] = "knp";
         }
@@ -927,10 +959,11 @@
         params.put("action", actionArray);
         
         /*
-         * Pass the docids to the DBQuery contructor
-         */
+		 * Pass the docids to the DBQuery contructor
+		 */
         // This is a hack to get the empty result set to show...
-        // Otherwise dbquery sees no docidOverrides and does a full % percent query
+        // Otherwise dbquery sees no docidOverrides and does a full % percent
+		// query
         if (docids.size() == 0)
             docids.add("");
         
@@ -941,10 +974,10 @@
     
     // LOGIN & LOGOUT SECTION
     /**
-     * Handle the login request. Create a new session object. Do user
-     * authentication through the session.
-     */
-    private void handleLoginAction(PrintWriter out, Hashtable params,
+	 * Handle the login request. Create a new session object. Do user
+	 * authentication through the session.
+	 */
+    private void handleLoginAction(PrintWriter out, Hashtable<String, String[]> params,
             HttpServletRequest request, HttpServletResponse response) {
         Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
         AuthSession sess = null;
@@ -958,7 +991,7 @@
             return;
         }
         
-        //}
+        // }
         
         if(params.get("password") == null){
             response.setContentType("text/xml");
@@ -993,9 +1026,12 @@
             HttpSession session = sess.getSessions();
             String id = session.getId();
             logMetacat.info("Store session id " + id
-                    + "which has username" + session.getAttribute("username")
+                    + " which has username" + session.getAttribute("username")
                     + " into hash in login method");
-            sessionHash.put(id, session);
+            SessionService.registerSession(id, 
+					(String) session.getAttribute("username"), 
+					(String[]) session.getAttribute("groups"),
+					(String) session.getAttribute("password"));
         }
         
         // format and transform the output
@@ -1021,7 +1057,7 @@
     /**
      * Handle the logout request. Close the connection.
      */
-    private void handleLogoutAction(PrintWriter out, Hashtable params,
+    private void handleLogoutAction(PrintWriter out, Hashtable<String, String[]> params,
             HttpServletRequest request, HttpServletResponse response) {
         Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
         String qformat = "xml";
@@ -1081,7 +1117,7 @@
      */
     private void handleSQuery(PrintWriter out, Hashtable params,
             HttpServletResponse response, String user, String[] groups,
-            String sessionid) {
+            String sessionid) throws PropertyNotFoundException {
         double startTime = System.currentTimeMillis() / 1000;
         DBQuery queryobj = new DBQuery();
         queryobj.findDocuments(response, out, params, user, groups, sessionid);
@@ -1103,9 +1139,9 @@
      *            squery.
      * @param response the response object linked to the client
      */
-    private void handleQuery(PrintWriter out, Hashtable params,
+    private void handleQuery(PrintWriter out, Hashtable<String, String[]> params,
             HttpServletResponse response, String user, String[] groups,
-            String sessionid) {
+            String sessionid) throws PropertyNotFoundException {
         //create the query and run it
         String xmlquery = DBQuery.createSQuery(params);
         String[] queryArray = new String[1];
@@ -1137,7 +1173,7 @@
      * @param user the username sent the request
      * @param groups the user's groupnames
      */
-    private void handleExportAction(Hashtable params,
+    private void handleExportAction(Hashtable<String, String[]> params,
             HttpServletResponse response,
             String user, String[] groups, String passWord) {
         Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
@@ -1282,7 +1318,7 @@
             // Get output stream
             out = response.getOutputStream();
             // read the inline data from the file
-            String inlinePath = MetaCatUtil.getOption("inlinedatafilepath");
+            String inlinePath = PropertyService.getProperty("application.inlinedatafilepath");
             File lineData = new File(inlinePath, inlineDataId);
             FileInputStream input = new FileInputStream(lineData);
             byte[] buffer = new byte[4 * 1024];
@@ -1612,7 +1648,7 @@
             
             if (doc.getRootNodeID() == 0) {
                 // this is data file
-                String filepath = MetaCatUtil.getOption("datafilepath");
+                String filepath = PropertyService.getProperty("application.datafilepath");
                 if (!filepath.endsWith("/")) {
                     filepath += "/";
                 }
@@ -1812,7 +1848,7 @@
                 
                 if (doc.getRootNodeID() == 0) {
                     // this is data file; add file to zip
-                    String filepath = MetaCatUtil.getOption("datafilepath");
+                    String filepath = PropertyService.getProperty("application.datafilepath");
                     if (!filepath.endsWith("/")) {
                         filepath += "/";
                     }
@@ -1918,14 +1954,19 @@
             return;
         }
         
-        if(!MetaCatUtil.canInsertOrUpdate(user, groups)){
-            out.println("<?xml version=\"1.0\"?>");
-            out.println("<error>");
-            out.println("User '" + user + "' not allowed to insert and update");
-            out.println("</error>");
-            logMetacat.error("User '" + user + "' not allowed to insert and update");
-            return;
-        }
+        try {
+			if (!LDAPUtil.canInsertOrUpdate(user, groups)) {
+				out.println("<?xml version=\"1.0\"?>");
+				out.println("<error>");
+				out.println("User '" + user + "' not allowed to insert and update");
+				out.println("</error>");
+				logMetacat.error("User '" + user + "' not allowed to insert and update");
+				return;
+			}
+		} catch (UtilException ue) {
+			logMetacat.error("Could not determine if user could insert or update: "
+					+ ue.getMessage());
+		}
         
         try {
             // Get the document indicated
@@ -2368,7 +2409,7 @@
                     logMetacat.info("Document deleted.");
                     
                     // Delete from spatial cache if runningSpatialOption
-                    if ( MetaCatUtil.getOption("runSpatialOption").equals("true") ) {
+                    if ( PropertyService.getProperty("runSpatialOption").equals("true") ) {
                         SpatialHarvester sh = new SpatialHarvester();
                         sh.addToDeleteQue( MetaCatUtil.getSmartDocId( docid[0] ) );
                         sh.destroy();
@@ -2697,7 +2738,7 @@
             PrintWriter out = response.getWriter();
             
             // Check that the user is authenticated as an administrator account
-            if (!MetaCatUtil.isAdministrator(username, groups)) {
+            if (!LDAPUtil.isAdministrator(username, groups)) {
                 out.print("<error>");
                 out.print("The user \"" + username +
                         "\" is not authorized for this action.");
@@ -2739,22 +2780,28 @@
                     docid, event, startDate, endDate));
             out.close();
         } catch (IOException e) {
-            logMetacat.error(
-                    "Could not open http response for writing: " + e.getMessage());
-        }
+			logMetacat.error("Could not open http response for writing: "
+					+ e.getMessage());
+		} catch (UtilException ue) {
+			logMetacat.error("Could not determine if user is administrator: "
+					+ ue.getMessage());
+		}
     }
     
     /**
-     * Rebuild the index for one or more documents. If the docid parameter is
-     * provided, rebuild for just that one document or list of documents. If
-     * not, then rebuild the index for all documents in the xml_documents
-     * table.
-     *
-     * @param params the parameters from the web request
-     * @param request the http request object for getting request details
-     * @param response the http response object for writing output
-     * @param username the username of the authenticated user
-     */
+	 * Rebuild the index for one or more documents. If the docid parameter is
+	 * provided, rebuild for just that one document or list of documents. If
+	 * not, then rebuild the index for all documents in the xml_documents table.
+	 * 
+	 * @param params
+	 *            the parameters from the web request
+	 * @param request
+	 *            the http request object for getting request details
+	 * @param response
+	 *            the http response object for writing output
+	 * @param username
+	 *            the username of the authenticated user
+	 */
     private void handleBuildIndexAction(Hashtable params,
             HttpServletRequest request, HttpServletResponse response,
             String username, String[] groups) {
@@ -2769,7 +2816,7 @@
             PrintWriter out = response.getWriter();
             
             // Check that the user is authenticated as an administrator account
-            if (!MetaCatUtil.isAdministrator(username, groups)) {
+            if (!LDAPUtil.isAdministrator(username, groups)) {
                 out.print("<error>");
                 out.print("The user \"" + username +
                         "\" is not authorized for this action.");
@@ -2805,7 +2852,10 @@
             logMetacat.error(
                     "Could not open http response for writing: "
                     + e.getMessage());
-        }
+        } catch (UtilException ue) {
+			logMetacat.error("Could not determine if user is administrator: "
+					+ ue.getMessage());
+		}
     }
     
     /**
@@ -2844,8 +2894,14 @@
         
         Hashtable params = new Hashtable();
         Hashtable fileList = new Hashtable();
-        int sizeLimit = (new Integer(MetaCatUtil.getOption("datafilesizelimit")))
-        .intValue();
+        int sizeLimit = 1000;
+        try {
+        	sizeLimit = 
+        		(new Integer(PropertyService.getProperty("datafilesizelimit"))).intValue();
+        } catch (PropertyNotFoundException pnfe) {
+        	logMetacat.error("Could not determine data file size limit.  Using 1000. " 
+        			+ pnfe.getMessage());
+        }
         logMetacat.info(
                 "The size limit of uploaded data files is: " + sizeLimit);
         
@@ -2964,7 +3020,8 @@
     }
     
     /**
-     * this action allows users to upload an xml document with multipart encoding.
+     * Handle the upload action by saving the attached file to disk and
+     * registering it in the Metacat db
      */
     private void handleInsertMultipartAction(HttpServletRequest request, 
             HttpServletResponse response,
@@ -3015,7 +3072,7 @@
             if (DocumentImpl.getDataFileLockGrant(docid)) 
             {
               // Save the data file to disk using "docid" as the name
-              String datafilepath = MetaCatUtil.getOption("datafilepath");
+              String datafilepath = PropertyService.getProperty("datafilepath");
               File dataDirectory = new File(datafilepath);
               dataDirectory.mkdirs();
               File newFile = null;
@@ -3148,7 +3205,7 @@
                     //If document get lock data file grant
                     if (DocumentImpl.getDataFileLockGrant(docid)) {
                         // Save the data file to disk using "docid" as the name
-                        String datafilepath = MetaCatUtil.getOption("datafilepath");
+                        String datafilepath = PropertyService.getProperty("datafilepath");
                         File dataDirectory = new File(datafilepath);
                         dataDirectory.mkdirs();
                         File newFile = null;
@@ -3318,8 +3375,14 @@
         }
         
         // Get package doctype set
-        Vector packageSet = MetaCatUtil.getOptionList(MetaCatUtil
-                .getOption("packagedoctypeset"));
+        Vector packageSet = null;
+        try {
+        	packageSet = 
+        		MetaCatUtil.getOptionList(PropertyService.getProperty("packagedoctypeset"));
+        } catch (PropertyNotFoundException pnfe) {
+        	logMetacat.error("Could not find package doctype set.  Setting to null: " 
+        			+ pnfe.getMessage());
+        }
         //debug
         if (packageSet != null) {
             for (int i = 0; i < packageSet.size(); i++) {
@@ -3542,13 +3605,13 @@
         }
     }
     
-    /**
-     * Method to get session table which store the session info
-     * @return
-     */
-    public static Hashtable getSessionHash() {
-        return sessionHash;
-    }
+//    /**
+//     * Method to get session table which store the session info
+//     * @return
+//     */
+//    public static Hashtable getSessionHash() {
+//        return sessionHash;
+//    }
     
     /*
      * If the given docid only have one seperter, we need
@@ -3557,7 +3620,7 @@
     private static String appendRev(String docid) throws Exception {
         Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
         String newAccNum = null;
-        String separator = MetaCatUtil.getOption("accNumSeparator");
+        String separator = PropertyService.getProperty("accNumSeparator");
         int firstIndex = docid.indexOf(separator);
         int lastIndex = docid.lastIndexOf(separator);
         if (firstIndex == lastIndex) {
@@ -3578,97 +3641,97 @@
         return newAccNum;
     }
     
-    /**
-     * Handle configuration of the servlet the first time that Metacat starts
-     * by collecting necessary configuration information from the administrator.
-     *
-     * @param request the http request information
-     * @param response the http response to be sent back to the client
-     */
-    private void configureMetacat(HttpServletRequest request,
-            HttpServletResponse response) {
-        Options options = (Options)Options.getInstance();
-        String action = request.getParameter("action");
-        if (action == null || !action.equals("configure")) {
-            // The servlet configuration parameters have not been set, so
-            // redirect to a web form for configuring metacat
-            
-            // Load the properties metadata file to determine which properties
-            // need to be configured, and include this metadata object in
-            // the request so that the JSP page can use the metadata in
-            // constructing the editing form
-            String dirPath = this.getServletContext().getRealPath(CONFIG_DIR);
-            File metadataFile = new File(dirPath, CONFIG_NAME+".metadata");
-            OptionsMetadata metadata = null;
-            
-            try {
-                Reader reader = new FileReader(metadataFile);
-                metadata = new OptionsMetadata(reader);
-                reader.close();
-                request.setAttribute("metadata", metadata);
-            } catch (IOException e) {
-                Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
-                logMetacat.error("Error reading properties metadata: " +
-                        e.getMessage());
-            }
-            
-            // Also add the list of options and their values to the request
-            Enumeration properties = options.propertyNames();
-            while (properties.hasMoreElements()) {
-                String name = (String)properties.nextElement();
-                request.setAttribute( name, MetaCatUtil.getOption(name));
-            }
-            properties = options.propertyNames();
-            request.setAttribute("optionslist", properties);
-            
-            // Forward the request to the JSP page
-            forwardRequest(request, response,
-                    MetaCatUtil.getOption("configurationPage"));
-        } else {
-            // The configuration form is being submitted and needs to be
-            // processed, setting the properties in the configuration file
-            // then restart metacat
-            
-            // TODO: Should first validate that the options provided are
-            // legitimate, and possibly even test them (for example, use
-            // the database connection info to connect to the database)
-            
-            // For each property, check if it is changed and save it
-            Enumeration properties = options.propertyNames();
-            while (properties.hasMoreElements()) {
-                String name = (String)properties.nextElement();
-                checkAndSetOption(request, name);
-            }
-            
-            // Now that the options have been set, change the 'configured'
-            // option to 'true' so that normal metacat requests will go through
-            MetaCatUtil.setOption("configured", "true");
-            
-            // Reload the servlet so that the database connections are loaded
-            // In the absence of being able to do this programatically, then
-            // redirect to a response page with instructions to restart
-            forwardRequest(request, response,
-                    MetaCatUtil.getOption("configurationSuccessPage"));
-        }
-    }
+//    /**
+//     * Handle configuration of the servlet the first time that Metacat starts
+//     * by collecting necessary configuration information from the administrator.
+//     *
+//     * @param request the http request information
+//     * @param response the http response to be sent back to the client
+//     */
+//    private void configureMetacat(HttpServletRequest request,
+//            HttpServletResponse response) {
+//        Options options = (Options)Options.getInstance();
+//        String action = request.getParameter("action");
+//        if (action == null || !action.equals("configure")) {
+//            // The servlet configuration parameters have not been set, so
+//            // redirect to a web form for configuring metacat
+//            
+//            // Load the properties metadata file to determine which properties
+//            // need to be configured, and include this metadata object in
+//            // the request so that the JSP page can use the metadata in
+//            // constructing the editing form
+//            String dirPath = this.getServletContext().getRealPath(CONFIG_DIR);
+//            File metadataFile = new File(dirPath, CONFIG_NAME+".metadata");
+//            OptionsMetadata metadata = null;
+//            
+//            try {
+//                Reader reader = new FileReader(metadataFile);
+//                metadata = new OptionsMetadata(reader);
+//                reader.close();
+//                request.setAttribute("metadata", metadata);
+//            } catch (IOException e) {
+//                Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
+//                logMetacat.error("Error reading properties metadata: " +
+//                        e.getMessage());
+//            }
+//            
+//            // Also add the list of options and their values to the request
+//            Enumeration properties = options.propertyNames();
+//            while (properties.hasMoreElements()) {
+//                String name = (String)properties.nextElement();
+//                request.setAttribute( name, MetaCatUtil.getOption(name));
+//            }
+//            properties = options.propertyNames();
+//            request.setAttribute("optionslist", properties);
+//            
+//            // Forward the request to the JSP page
+//            forwardRequest(request, response,
+//                    MetaCatUtil.getOption("configurationPage"));
+//        } else {
+//            // The configuration form is being submitted and needs to be
+//            // processed, setting the properties in the configuration file
+//            // then restart metacat
+//            
+//            // TODO: Should first validate that the options provided are
+//            // legitimate, and possibly even test them (for example, use
+//            // the database connection info to connect to the database)
+//            
+//            // For each property, check if it is changed and save it
+//            Enumeration properties = options.propertyNames();
+//            while (properties.hasMoreElements()) {
+//                String name = (String)properties.nextElement();
+//                checkAndSetOption(request, name);
+//            }
+//            
+//            // Now that the options have been set, change the 'configured'
+//            // option to 'true' so that normal metacat requests will go through
+//            MetaCatUtil.setOption("configured", "true");
+//            
+//            // Reload the servlet so that the database connections are loaded
+//            // In the absence of being able to do this programatically, then
+//            // redirect to a response page with instructions to restart
+//            forwardRequest(request, response,
+//                    MetaCatUtil.getOption("configurationSuccessPage"));
+//        }
+//    }
     
-    /**
-     * Take input from the user in an HTTP request about an option to be
-     * changed and update the options property file with that new value
-     * if it has changed from the value that was originally set.
-     *
-     * @param request that was generated by the user
-     * @param response to send output back to the user
-     * @param optionName the name of the option to be checked and set
-     */
-    private void checkAndSetOption(HttpServletRequest request,
-            String optionName) {
-        String value = MetaCatUtil.getOption(optionName);
-        String newValue = request.getParameter(optionName);
-        if (newValue != null && !newValue.equals(value)) {
-            MetaCatUtil.setOption(optionName, newValue);
-        }
-    }
+//    /**
+//     * Take input from the user in an HTTP request about an option to be
+//     * changed and update the options property file with that new value
+//     * if it has changed from the value that was originally set.
+//     *
+//     * @param request that was generated by the user
+//     * @param response to send output back to the user
+//     * @param optionName the name of the option to be checked and set
+//     */
+//    private void checkAndSetOption(HttpServletRequest request,
+//            String optionName) {
+//        String value = MetaCatUtil.getOption(optionName);
+//        String newValue = request.getParameter(optionName);
+//        if (newValue != null && !newValue.equals(value)) {
+//            MetaCatUtil.setOption(optionName, newValue);
+//        }
+//    }
     
     /**
      * Forward a request that was received by this servlet on to another
@@ -3704,15 +3767,28 @@
      * @param request a servlet request, from which we determine the context
      */
     private void scheduleSitemapGeneration(HttpServletRequest request) {
-        if (!sitemapScheduled) {
-            String directoryName = MetaCatUtil.getOption("sitemapDirectory");
+    	Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
+    	if (!sitemapScheduled) {
+        	String directoryName = null;
+        	String skin = null;
+        	long sitemapInterval = 0;
+        	
+        	try {
+				directoryName = 
+					PropertyService.getProperty("application.tomcatDir") + "/webapps/"
+					+ PropertyService.getProperty("application.context") + "/sitemaps";
+				skin = PropertyService.getProperty("default-style");
+				sitemapInterval = 
+					Integer.parseInt(PropertyService.getProperty("sitemapInterval"));
+			} catch (PropertyNotFoundException pnfe) {
+				logMetacat.error("Could not run site map generation because property " 
+						+ "could not be found: " + pnfe.getMessage());
+			}
+			
             File directory = new File(directoryName);
             directory.mkdirs();
             String urlRoot = request.getRequestURL().toString();
-            String skin = MetaCatUtil.getOption("default-style");
             Sitemap smap = new Sitemap(directory, urlRoot, skin);
-            long sitemapInterval = Integer.parseInt(
-                    MetaCatUtil.getOption("sitemapInterval"));
             long firstDelay = 60*1000;   // 60 seconds delay
             timer.schedule(smap, firstDelay, sitemapInterval);
             sitemapScheduled = true;
Index: src/edu/ucsb/nceas/metacat/clientview/ClientViewHelper.java
===================================================================
--- src/edu/ucsb/nceas/metacat/clientview/ClientViewHelper.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/clientview/ClientViewHelper.java	(revision 4080)
@@ -13,13 +13,14 @@
 import com.oreilly.servlet.multipart.MultipartParser;
 import com.oreilly.servlet.multipart.ParamPart;
 import com.oreilly.servlet.multipart.Part;
-import edu.ucsb.nceas.metacat.MetaCatUtil;
 import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
 import edu.ucsb.nceas.metacat.client.MetacatClient;
 import edu.ucsb.nceas.metacat.client.MetacatException;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
+import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.utilities.XMLUtilities;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -104,7 +105,12 @@
         tmp = metacatPath.replaceFirst("%1s", host);
         metacatPath = tmp.replaceFirst("%2s", context);
         metacatClient = (MetacatClient) MetacatFactory.createMetacatConnection(metacatPath);
-        sizeLimit = (new Integer(MetaCatUtil.getOption("datafilesizelimit"))).intValue();
+        try {
+        	sizeLimit = 
+        		(new Integer(PropertyService.getProperty("datafilesizelimit"))).intValue();
+        } catch (PropertyNotFoundException pnfe) {
+        	throw new MetacatInaccessibleException(pnfe.getMessage());
+        }
     }
     
     /**
Index: src/edu/ucsb/nceas/metacat/ReplicationHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ReplicationHandler.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/ReplicationHandler.java	(revision 4080)
@@ -27,6 +27,10 @@
 package edu.ucsb.nceas.metacat;
 
 import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 import java.sql.*;
 import java.util.*;
 import java.util.Date;
@@ -58,7 +62,6 @@
 public class ReplicationHandler extends TimerTask
 {
   int serverCheckCode = 1;
-  MetaCatUtil util = new MetaCatUtil();
   ReplicationServerList serverList = null;
   //PrintWriter out;
   private static final AbstractDatabase dbAdapter = MetaCatUtil.dbAdapter;
@@ -141,7 +144,6 @@
     // them in to response
     for (int i=0; i<serverList.size(); i++)
     {
-    	
         // Get ReplicationServer object from server list
         replServer = serverList.serverAt(i);
         // Get server name from ReplicationServer object
@@ -152,7 +154,7 @@
         try
         {
           u = new URL("https://" + server + "?server="
-          +util.getLocalReplicationServerName()+"&action=update");
+          +MetaCatUtil.getLocalReplicationServerName()+"&action=update");
           logMetacat.info("Sending infomation " +u.toString());
           result = MetacatReplication.getURLContent(u);
         }
@@ -296,7 +298,7 @@
       serialNumber=dbConn.getCheckOutSerialNumber();
       //if the document needs to be updated or inserted, this is executed
       String readDocURLString = "https://" + remoteserver + "?server="+
-              util.getLocalReplicationServerName()+"&action=read&docid="+accNumber;
+              MetaCatUtil.getLocalReplicationServerName()+"&action=read&docid="+accNumber;
       readDocURLString = MetaCatUtil.replaceWhiteSpaceForURL(readDocURLString);
       URL u = new URL(readDocURLString);
 
@@ -314,7 +316,7 @@
       DocInfoHandler dih = new DocInfoHandler();
       XMLReader docinfoParser = initParser(dih);
       String docInfoURLStr = "https://" + remoteserver +
-                       "?server="+util.getLocalReplicationServerName()+
+                       "?server="+MetaCatUtil.getLocalReplicationServerName()+
                        "&action=getdocumentinfo&docid="+accNumber;
       docInfoURLStr = MetaCatUtil.replaceWhiteSpaceForURL(docInfoURLStr);
       URL docinfoUrl = new URL(docInfoURLStr);
@@ -329,7 +331,7 @@
       String createdDate = (String)docinfoHash.get("date_created");
       String updatedDate = (String)docinfoHash.get("date_updated");
       //docid should include rev number too
-      /*String accnum=docId+util.getOption("accNumSeparator")+
+      /*String accnum=docId+util.getProperty("accNumSeparator")+
                                               (String)docinfoHash.get("rev");*/
       logMetacat.info("docid in repl: "+accNumber);
       String docType = (String)docinfoHash.get("doctype");
@@ -432,7 +434,7 @@
       DocInfoHandler dih = new DocInfoHandler();
       XMLReader docinfoParser = initParser(dih);
       String docInfoURLString = "https://" + remoteserver +
-                  "?server="+util.getLocalReplicationServerName()+
+                  "?server="+MetaCatUtil.getLocalReplicationServerName()+
                   "&action=getdocumentinfo&docid="+accNumber;
       docInfoURLString = MetaCatUtil.replaceWhiteSpaceForURL(docInfoURLString);
       URL docinfoUrl = new URL(docInfoURLString);
@@ -452,14 +454,14 @@
       String createdDate = (String)docinfoHash.get("date_created");
       String updatedDate = (String)docinfoHash.get("date_updated");
       //docid should include rev number too
-      /*String accnum=docId+util.getOption("accNumSeparator")+
+      /*String accnum=docId+util.getProperty("accNumSeparator")+
                                               (String)docinfoHash.get("rev");*/
 
 
-      String datafilePath = util.getOption("datafilepath");
+      String datafilePath = PropertyService.getProperty("application.datafilepath");
       // Get data file content
       String readDataURLString = "https://" + remoteserver + "?server="+
-                                        util.getLocalReplicationServerName()+
+                                        MetaCatUtil.getLocalReplicationServerName()+
                                             "&action=readdata&docid="+accNumber;
       readDataURLString = MetaCatUtil.replaceWhiteSpaceForURL(readDataURLString);
       URL u = new URL(readDataURLString);
@@ -556,7 +558,7 @@
 
          //because delete method docid should have rev number
          //so we just add one for it. This rev number is no sence.
-         String accnum=docId+util.getOption("accNumSeparator")+"1";
+         String accnum=docId+PropertyService.getProperty("accNumSeparator")+"1";
          //System.out.println("accnum: "+accnum);
          DocumentImpl.delete(accnum, null, null, notifyServer);
          logMetacat.info("Successfully deleted doc " + docId);
@@ -600,7 +602,7 @@
       logMetacat.info("Try to update last_check for server: "+server);
       // Get time from remote server
       URL dateurl = new URL("https://" + server + "?server="+
-      util.getLocalReplicationServerName()+"&action=gettime");
+      MetaCatUtil.getLocalReplicationServerName()+"&action=gettime");
       String datexml = MetacatReplication.getURLContent(dateurl);
       logMetacat.info("datexml: "+datexml);
       if (datexml!=null && !datexml.equals(""))
@@ -673,7 +675,7 @@
         server = replServer.getServerName();
         // Try to get catalog
         URL u = new URL("https://" + server + "?server="+
-        util.getLocalReplicationServerName()+"&action=getcatalog");
+        MetaCatUtil.getLocalReplicationServerName()+"&action=getcatalog");
         logMetacat.info("sending message " + u.toString());
         String catxml = MetacatReplication.getURLContent(u);
 
@@ -894,8 +896,7 @@
       ContentHandler chandler = dh;
 
       // Get an instance of the parser
-      MetaCatUtil util = new MetaCatUtil();
-      String parserName = util.getOption("saxparser");
+      String parserName = PropertyService.getProperty("saxparser");
       parser = XMLReaderFactory.createXMLReader(parserName);
 
       // Turn off validation
@@ -999,68 +1000,61 @@
   
   
   /*
-   * This method will go through the docid list both in xml_Documents table
-   * and in xml_revisions table
-   * @author tao
-   */
-   private void handleDocList(Vector docList, String tableName)
-   {
-       boolean dataFile=false;
-       for(int j=0; j<docList.size(); j++)
-       {
-         //initial dataFile is false
-         dataFile=false;
-         //w is information for one document, information contain
-         //docid, rev, server or datafile.
-         Vector w = new Vector((Vector)(docList.elementAt(j)));
-         //Check if the vector w contain "datafile"
-         //If it has, this document is data file
-         if (w.contains((String)util.getOption("datafileflag")))
-         {
-           dataFile=true;
-         }
-         //System.out.println("w: " + w.toString());
-         // Get docid
-         String docid = (String)w.elementAt(0);
-         logMetacat.info("docid: " + docid);
-         // Get revision number
-         int rev = Integer.parseInt((String)w.elementAt(1));
-         logMetacat.info("rev: " + rev);
-         // Get remote server name (it is may not be doc homeserver because
-         // the new hub feature
-         String remoteServer = (String)w.elementAt(2);
-         remoteServer = remoteServer.trim();
+	 * This method will go through the docid list both in xml_Documents table
+	 * and in xml_revisions table @author tao
+	 */
+	private void handleDocList(Vector docList, String tableName) {
+		boolean dataFile = false;
+		for (int j = 0; j < docList.size(); j++) {
+			// initial dataFile is false
+			dataFile = false;
+			// w is information for one document, information contain
+			// docid, rev, server or datafile.
+			Vector w = new Vector((Vector) (docList.elementAt(j)));
+			// Check if the vector w contain "datafile"
+			// If it has, this document is data file
+			try {
+				if (w.contains((String) PropertyService.getProperty("datafileflag"))) {
+					dataFile = true;
+				}
+			} catch (PropertyNotFoundException pnfe) {
+				logMetacat.error("Could not retrieve data file flag property.  "
+						+ "Leaving as false: " + pnfe.getMessage());
+			}
+			// System.out.println("w: " + w.toString());
+			// Get docid
+			String docid = (String) w.elementAt(0);
+			logMetacat.info("docid: " + docid);
+			// Get revision number
+			int rev = Integer.parseInt((String) w.elementAt(1));
+			logMetacat.info("rev: " + rev);
+			// Get remote server name (it is may not be doc homeserver because
+			// the new hub feature
+			String remoteServer = (String) w.elementAt(2);
+			remoteServer = remoteServer.trim();
 
-         try
-         {
-             if (tableName.equals(DocumentImpl.DOCUMENTTABLE))
-             {
-                 handleDocInXMLDocuments(docid, rev, remoteServer, dataFile);
-             }
-             else if (tableName.equals(DocumentImpl.REVISIONTABLE))
-             {
-                 handleDocInXMLRevisions(docid, rev, remoteServer, dataFile);
-             }
-             else
-             {
-                 continue;
-             }
-                 
-         }
-         catch (Exception e)
-         {
-             logMetacat.error("error to handle update doc in "+ 
-                     tableName +" in time replication"+e.getMessage());
-             continue;
-         }
-        
-       }//for update docs
+			try {
+				if (tableName.equals(DocumentImpl.DOCUMENTTABLE)) {
+					handleDocInXMLDocuments(docid, rev, remoteServer, dataFile);
+				} else if (tableName.equals(DocumentImpl.REVISIONTABLE)) {
+					handleDocInXMLRevisions(docid, rev, remoteServer, dataFile);
+				} else {
+					continue;
+				}
 
-   }
+			} catch (Exception e) {
+				logMetacat.error("error to handle update doc in " + tableName
+						+ " in time replication" + e.getMessage());
+				continue;
+			}
+
+		}// for update docs
+
+	}
    
    /*
-    * This method will handle doc in xml_documents table.
-    */
+	 * This method will handle doc in xml_documents table.
+	 */
    private void handleDocInXMLDocuments(String docid, int rev, String remoteServer, boolean dataFile) 
                                         throws Exception
    {
@@ -1118,7 +1112,7 @@
          }
        }
        
-       String accNumber = docid + MetaCatUtil.getOption("accNumSeparator") + rev;
+       String accNumber = docid + PropertyService.getProperty("accNumSeparator") + rev;
        // this is non-data file
        if(flag && !dataFile)
        {
@@ -1184,7 +1178,7 @@
            flag = true;    
        }
      
-       String accNumber = docid + MetaCatUtil.getOption("accNumSeparator") + rev;
+       String accNumber = docid + PropertyService.getProperty("accNumSeparator") + rev;
        // this is non-data file
        if(flag && !dataFile)
        {
Index: src/edu/ucsb/nceas/metacat/service/ServiceInterface.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/ServiceInterface.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/service/ServiceInterface.java	(revision 4080)
@@ -0,0 +1,44 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements utility methods like:
+ *             1/ Reding all doctypes from db connection
+ *             2/ Reading DTD or Schema file from Metacat catalog system
+ *             3/ Reading Lore type Data Guide from db connection
+ *  Copyright: 2000 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Jivka Bojilova
+ * 
+ *   '$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.service;
+
+/**
+ * A suite of utility classes for querying DB
+ * 
+ */
+public interface ServiceInterface {
+
+	public boolean isRestartable = false;
+	
+	/**
+	 * TODO MCD define register(), restartable() and restart() abstract methods
+	 */
+
+}

Property changes on: src/edu/ucsb/nceas/metacat/service/ServiceInterface.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
Index: src/edu/ucsb/nceas/metacat/AccessionNumber.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AccessionNumber.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/AccessionNumber.java	(revision 4080)
@@ -32,6 +32,9 @@
 import java.sql.SQLException;
 
 import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /**
  * (on insert of XML document)
@@ -50,21 +53,28 @@
   private String docid = null;
   private String rev = null;
 
+    /**
+	 * Construct an AccessionNumber
+	 */
+	private AccessionNumber() throws AccessionNumberException {
+		try {
+			this.sitecode = PropertyService.getProperty("sitecode");
+			this.sep = PropertyService.getProperty("accNumSeparator");
+		} catch (PropertyNotFoundException pnfe) {
+			throw new AccessionNumberException("Could not retrieve property "
+					+ "in constructor: " + pnfe.getMessage());
+		}
+	}
+
   /**
-   * Construct an AccessionNumber
-   */
-  private AccessionNumber ()
-  {
-    this.sitecode = MetaCatUtil.getOption("sitecode");
-    this.sep = MetaCatUtil.getOption("accNumSeparator");
-  }
-
-  /** NEW - WHEN CLIENT ALWAYS PROVIDE ACCESSION NUMBER INCLUDING REV IN IT
-   * Construct an AccessionNumber
-   *
-   * @param conn the db connection to read Accession number from
-   * @param accnum the accession number to be checked for validness
-   */
+	 * NEW - WHEN CLIENT ALWAYS PROVIDE ACCESSION NUMBER INCLUDING REV IN IT
+	 * Construct an AccessionNumber
+	 * 
+	 * @param conn
+	 *            the db connection to read Accession number from
+	 * @param accnum
+	 *            the accession number to be checked for validness
+	 */
   public AccessionNumber (String accnum, String action)
            throws AccessionNumberException, SQLException, NumberFormatException
  {
Index: src/edu/ucsb/nceas/metacat/util/SkinUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/SkinUtil.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/SkinUtil.java	(revision 4080)
@@ -0,0 +1,75 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements administrative methods 
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.util;
+
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.utilities.StringUtil;
+
+public class SkinUtil {
+	
+	private static Logger logMetacat = Logger.getLogger(SkinUtil.class);
+
+	/**
+	 * private constructor - all methods are static so there is no no need to
+	 * instantiate.
+	 */
+	private SkinUtil() {
+	}
+		
+	/**
+	 * Reports whether skins are fully configured.
+	 * 
+	 * @return a boolean that is true if skins are not unconfigured and false
+	 *         otherwise
+	 */
+	public static boolean areSkinsConfigured() throws UtilException {
+		try {
+			return !PropertyService.getProperty("configutil.skinsConfigured").equals(
+					PropertyService.UNCONFIGURED);
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not determine if database is configured: "
+					+ pnfe.getMessage());
+		}
+	}
+
+	/**
+	 * Gets a list of available skin names by parsing a csv property from
+	 * metacat.properties.
+	 * 
+	 * @return a Vector of Strings holding skin names
+	 */
+	public static Vector<String> getSkinNames() throws PropertyNotFoundException {
+		String skinStringList = PropertyService.getProperty("skin.names");
+		return StringUtil.toVector(skinStringList, ',');
+	}
+
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/SkinUtil.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
Index: src/edu/ucsb/nceas/metacat/util/ResponseUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/ResponseUtil.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/ResponseUtil.java	(revision 4080)
@@ -0,0 +1,60 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements administrative methods 
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.util;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+public class ResponseUtil {
+	
+	private static Logger logMetacat = Logger.getLogger(ResponseUtil.class);
+	
+	/**
+	 * private constructor - all methods are static so there is no
+     * no need to instantiate.
+	 */
+	private ResponseUtil() {}
+	
+	/**
+	 * Redirect a response.
+	 * 
+	 * @param response
+	 *            that is to be redirected
+	 * @param destination
+	 *            the context-relative URL to which the request is forwarded
+	 */
+	public static void redirectResponse(HttpServletRequest request,
+			HttpServletResponse response, String destination)
+			throws IOException {
+		logMetacat.debug("Redirecting response to " + request.getContextPath() + destination);
+		response.sendRedirect(request.getContextPath() + destination);
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/ResponseUtil.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
Index: src/edu/ucsb/nceas/metacat/DocumentIdQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentIdQuery.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DocumentIdQuery.java	(revision 4080)
@@ -28,6 +28,7 @@
 import java.util.Hashtable;
 
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /**
  * Generate a pathquery document representing a metacat query for a list of 
@@ -60,7 +61,7 @@
      * 
      * @param docidList an array of document identifiers to search for
      */
-    public static String createDocidQuery(String[] docidList)
+    public static String createDocidQuery(String[] docidList) throws PropertyNotFoundException
     {
         String pathQuery = "";
         Hashtable params = getDefaultQueryParams();
@@ -134,7 +135,12 @@
         ids[1] = "knb-lter-vcr.97.1";
         ids[2] = "obfs.400.1";
         
-        String pathquery = createDocidQuery(ids);
+        String pathquery = null;
+        try {
+        	pathquery = createDocidQuery(ids);
+        } catch (PropertyNotFoundException pnfe) {
+        	System.out.println("Could not create doc id query: " + pnfe.getMessage());
+        }
         System.out.println(pathquery);
     }
 
Index: src/edu/ucsb/nceas/metacat/IndexingTimerTask.java
===================================================================
--- src/edu/ucsb/nceas/metacat/IndexingTimerTask.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/IndexingTimerTask.java	(revision 4080)
@@ -33,7 +33,9 @@
 import java.util.Vector;
 import java.util.Iterator;
 
-import edu.ucsb.nceas.metacat.MetaCatUtil;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+
 import org.apache.log4j.Logger;
 
 public class IndexingTimerTask extends TimerTask{
@@ -57,7 +59,7 @@
 	    		
 	    		dbConn = DBConnectionPool.getDBConnection("IndexingThread");
 	    		serialNumber = dbConn.getCheckOutSerialNumber();
-	            Vector indexNamespaces = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexNamespaces"));
+	            Vector indexNamespaces = MetaCatUtil.getOptionList(PropertyService.getProperty("indexNamespaces"));
 	            String nonJoinCriteria = "b.docid is NULL";
 	    		boolean first = true;
 
Index: src/edu/ucsb/nceas/metacat/DocumentImpl.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 4080)
@@ -50,7 +50,12 @@
 import java.util.Vector;
 
 import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 import org.apache.log4j.Logger;
 import org.xml.sax.ContentHandler;
@@ -90,15 +95,32 @@
     public static final String SCHEMAVALIDATIONFEATURE = "http://apache.org/xml/features/validation/schema";
     public static final String NAMESPACEFEATURE = "http://xml.org/sax/features/namespaces";
     public static final String NAMESPACEPREFIXESFEATURE = "http://xml.org/sax/features/namespace-prefixes";
-    public static final String EML2_1_0NAMESPACE = MetaCatUtil
-            .getOption("eml2_1_0namespace");
-    // "eml://ecoinformatics.org/eml-2.1.0";
-    public static final String EML2_0_1NAMESPACE = MetaCatUtil
-            .getOption("eml2_0_1namespace");
-    // "eml://ecoinformatics.org/eml-2.0.1";
-    public static final String EML2_0_0NAMESPACE = MetaCatUtil
-            .getOption("eml2_0_0namespace");
-    // "eml://ecoinformatics.org/eml-2.0.0";
+    
+    public static final String EML2_1_0NAMESPACE;
+    public static final String EML2_0_1NAMESPACE;
+    public static final String EML2_0_0NAMESPACE;
+    
+    static {
+    	String eml210NameSpace = null;
+    	String eml201NameSpace = null;
+    	String eml200NameSpace = null;
+    	try {
+    		eml210NameSpace = PropertyService.getProperty("eml2_1_0namespace");
+    		eml200NameSpace = PropertyService.getProperty("eml2_0_1namespace");
+    		eml201NameSpace = PropertyService.getProperty("eml2_0_0namespace");
+    	} catch (PropertyNotFoundException pnfe) {
+    		System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+    	}
+        
+    	EML2_1_0NAMESPACE = eml210NameSpace;
+        // "eml://ecoinformatics.org/eml-2.1.0";
+        EML2_0_1NAMESPACE = eml201NameSpace;
+        // "eml://ecoinformatics.org/eml-2.0.1";
+        EML2_0_0NAMESPACE = eml200NameSpace;
+        // "eml://ecoinformatics.org/eml-2.0.0";
+    }
+     
     public static final String DOCNAME = "docname";
     public static final String PUBLICID = "publicid";
     public static final String SYSTEMID = "systemid";
@@ -635,7 +657,7 @@
         // local server has newer version, then notify the remote server
         else if (userSpecifyRev < revInDataBase && revInDataBase > 0) {
             throw new Exception("Local server: "
-                    + MetaCatUtil.getOption("server")
+                    + SystemUtil.getSecureServerURL()
                     + " has newer revision of doc: " + docid + "."
                     + revInDataBase + ". Please notify it.");
         }
@@ -714,7 +736,6 @@
             throws Exception
     {
         boolean flag = true;
-        //MetaCatUtil util = new MetaCatUtil();
         String docid = MetaCatUtil.getDocIdFromString(accnum);
         int rev = MetaCatUtil.getVersionFromString(accnum);
 
@@ -981,8 +1002,6 @@
             out = new PrintWriter(pw);
         }
 
-        MetaCatUtil util = new MetaCatUtil();
-
         // Here add code to handle subtree access control
         /*
          * PermissionController control = new PermissionController(docid);
@@ -1367,36 +1386,50 @@
                                          + sqle.getMessage());
             }
         } finally {
-            DBConnectionPool.returnDBConnection(dbConn, serialNumber);
-        }
-        double finish = System.currentTimeMillis()/1000;
-        logMetacat.info("The time for inserting is "+(finish - afterDelete));
-    	logMetacat.warn("BuildIndex complete for docid " + docid);
+			DBConnectionPool.returnDBConnection(dbConn, serialNumber);
+		}
+		double finish = System.currentTimeMillis() / 1000;
+		logMetacat.info("The time for inserting is " + (finish - afterDelete));
+		logMetacat.warn("BuildIndex complete for docid " + docid);
 
-        // Adds the docid to the spatial data cache 
-        if ( MetaCatUtil.getOption("runSpatialOption").equals("true") ) {
-            SpatialHarvester spatialHarvester = new SpatialHarvester();
-            logMetacat.info(" --------- Attempting to update the spatial cache for docid " + docid );
-            spatialHarvester.addToUpdateQue(docid);
-            spatialHarvester.destroy();
-            logMetacat.info(" --------- Finish to update the spatial cache for docid " + docid );
+		// Adds the docid to the spatial data cache
+		try {
+			if (PropertyService.getProperty("runSpatialOption").equals("true")) {
+				SpatialHarvester spatialHarvester = new SpatialHarvester();
+				logMetacat.info(" --------- Attempting to update the spatial cache for docid "
+								+ docid);
+				spatialHarvester.addToUpdateQue(docid);
+				spatialHarvester.destroy();
+				logMetacat.info(" --------- Finish to update the spatial cache for docid "
+								+ docid);
+			}
+		} catch (PropertyNotFoundException pnfe) {
+			logMetacat.error("Could not get 'runSpatialOption' property.  Spatial " 
+					+ "cache not run for docid: " + docid + " : " + pnfe.getMessage());
+		}
+
+
 	}
-        
-    }
 
     /**
-     * Recurse up the parent node hierarchy and add each node to the
-     * hashmap of paths to be indexed.  Note: pathsForIndexing is a hash map of 
-     * paths
-     *
-     * @param records the set of records hashed by nodeId
-     * @param rootNodeId the id of the root element of the document
-     * @param leafNodeId the id of the leafNode being processed
-     * @param id the id of the current node to be processed
-     * @param children the string representation of all child nodes of this id
-     * @param pathList the hash to which paths are added
-     * @param nodedata the nodedata for the current node
-     */
+	 * Recurse up the parent node hierarchy and add each node to the hashmap of
+	 * paths to be indexed. Note: pathsForIndexing is a hash map of paths
+	 * 
+	 * @param records
+	 *            the set of records hashed by nodeId
+	 * @param rootNodeId
+	 *            the id of the root element of the document
+	 * @param leafNodeId
+	 *            the id of the leafNode being processed
+	 * @param id
+	 *            the id of the current node to be processed
+	 * @param children
+	 *            the string representation of all child nodes of this id
+	 * @param pathList
+	 *            the hash to which paths are added
+	 * @param nodedata
+	 *            the nodedata for the current node
+	 */
     private void traverseParents(HashMap records, long rootNodeId,
             long leafNodeId, long id,
             String children, HashMap pathList, HashMap pathsFoundForIndexing) {
@@ -1776,6 +1809,10 @@
                 tableHasRows = rs.next();
                 if (tableHasRows) {
                     this.system_id = rs.getString(1);
+                    // system id may not have server url on front.  Add it if not.
+                    if (!system_id.startsWith("http://")) {
+                    	system_id = SystemUtil.getServerURL() + system_id;
+                    }
                     this.validateType = rs.getString(2);
 
                 }
@@ -2001,7 +2038,7 @@
                 int thisrev = DBUtil.getLatestRevisionInDocumentTable(docid);
                 logMetacat.info("this revsion is: " + thisrev);
                 // Save the old document publicaccessentry in a backup table
-                String accNumber = docid+MetaCatUtil.getOption("accNumSeparator")+thisrev;
+                String accNumber = docid+PropertyService.getProperty("accNumSeparator")+thisrev;
                 thisdoc = new DocumentImpl(accNumber, false);
                 DocumentImpl.archiveDocAndNodesRevision(connection, docid, user, thisdoc);
                 logMetacat.info("after archiveDoc");
@@ -2015,8 +2052,8 @@
                     thisrev = rev;
                 }
                 logMetacat.info("final revsion is: " + thisrev);
-                boolean useXMLIndex = (new Boolean(MetaCatUtil
-                        .getOption("usexmlindex"))).booleanValue();
+                boolean useXMLIndex = (new Boolean(PropertyService
+                        .getProperty("usexmlindex"))).booleanValue();
                 if (useXMLIndex) {
                     logMetacat.info("before delete");
                     double start = System.currentTimeMillis()/1000;
@@ -2206,7 +2243,7 @@
             boolean needValidation) throws Exception
     {
         // NEW - WHEN CLIENT ALWAYS PROVIDE ACCESSION NUMBER INCLUDING REV IN IT
-        //MetaCatUtil util = new MetaCatUtil();
+
         logMetacat.info("conn usage count before writting: "
                 + conn.getUsageCount());
         AccessionNumber ac = new AccessionNumber(accnum, action);
@@ -2320,7 +2357,7 @@
         if (action.equals("UPDATE")) {
             // check for 'write' permission for 'user' to update this document
             if (!hasWritePermission(user, groups, accnum) 
-            		&& !MetaCatUtil.isAdministrator(user, groups)) {
+            		&& !LDAPUtil.isAdministrator(user, groups)) {
                 throw new Exception(
                     "User " + user
                     + " does not have permission to update XML Document #"
@@ -2389,7 +2426,7 @@
         ForceReplicationHandler frh = new ForceReplicationHandler(accnum,
                 action, true, null);
         // clear cache after inserting or updating a document
-        if (MetaCatUtil.getOption("query_cache_on").equals("true"))
+        if (PropertyService.getProperty("query_cache_on").equals("true"))
         {
           //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
      	   DBQuery.clearQueryResultCache();
@@ -2401,9 +2438,9 @@
     }
 
     
-    private static void addDocidToIndexingQueue(String docid, String rev){
+    private static void addDocidToIndexingQueue(String docid, String rev) throws PropertyNotFoundException {
         boolean useXMLIndex =
-            (new Boolean(MetaCatUtil.getOption("usexmlindex"))).booleanValue();
+            (new Boolean(PropertyService.getProperty("usexmlindex"))).booleanValue();
         if (useXMLIndex) {
             	IndexingQueue.getInstance().add(docid, rev);
         }
@@ -2576,7 +2613,7 @@
         }
         
         // clear cache after inserting or updating a document
-        if (MetaCatUtil.getOption("query_cache_on").equals("true"))
+        if (PropertyService.getProperty("query_cache_on").equals("true"))
         {
           //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
      	   DBQuery.clearQueryResultCache();
@@ -2594,7 +2631,7 @@
         PreparedStatement pstmt = null;
         String documenttype = getDocTypeFromDBForCurrentDocument(accnumber);
         try {
-            String packagedoctype = MetaCatUtil.getOption("packagedoctype");
+            String packagedoctype = PropertyService.getProperty("packagedoctype");
             Vector packagedoctypes = new Vector();
             packagedoctypes = MetaCatUtil.getOptionList(packagedoctype);
             String docIdWithoutRev = MetaCatUtil.getDocIdFromAccessionNumber(accnumber);
@@ -2624,7 +2661,7 @@
             // if it is an access file
             else if (documenttype != null
                     && MetaCatUtil.getOptionList(
-                            MetaCatUtil.getOption("accessdoctype")).contains(
+                            PropertyService.getProperty("accessdoctype")).contains(
                             documenttype)) {
                 dbconn = DBConnectionPool.getDBConnection(
                         "DocumentImpl.runRelationAndAccessHandeler");
@@ -2764,7 +2801,7 @@
             double start = System.currentTimeMillis()/1000;
             // check for 'write' permission for 'user' to delete this document
             if (!hasAllPermission(user, groups, accnum)) {
-                if(!MetaCatUtil.isAdministrator(user, groups)){
+                if(!LDAPUtil.isAdministrator(user, groups)){
                     throw new Exception(
                         "User " + user
                         + " does not have permission to delete XML Document #"
@@ -2778,8 +2815,8 @@
             double afterArchiveDocAndNode = System.currentTimeMillis()/1000;
             logMetacat.info("The time for archiveDocAndNodesRevision is "+(afterArchiveDocAndNode - start));
             // Now delete it from the xml_index table
-            boolean useXMLIndex = (new Boolean(MetaCatUtil
-                    .getOption("usexmlindex"))).booleanValue();
+            boolean useXMLIndex = (new Boolean(PropertyService
+                    .getProperty("usexmlindex"))).booleanValue();
 
 
 
@@ -2881,7 +2918,7 @@
             ForceReplicationHandler frh = new ForceReplicationHandler(
                              accnum, ForceReplicationHandler.DELETE, isXML, notifyServer);
             // clear cache after inserting or updating a document
-            if (MetaCatUtil.getOption("query_cache_on").equals("true"))
+            if (PropertyService.getProperty("query_cache_on").equals("true"))
             {
               //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
          	   DBQuery.clearQueryResultCache();
@@ -2987,7 +3024,7 @@
             EntityResolver eresolver;
             DTDHandler dtdhandler;
             // Get an instance of the parser
-            String parserName = MetaCatUtil.getOption("saxparser");
+            String parserName = PropertyService.getProperty("saxparser");
             parser = XMLReaderFactory.createXMLReader(parserName);
             if (ruleBase != null && ruleBase.equals(EML200)) {
                 logMetacat.warn("Using eml 2.0.0 parser");
@@ -3113,7 +3150,7 @@
 
         try {
             if (doc == null) {
-                String accNumber = docid + MetaCatUtil.getOption("accNumSeparator") +
+                String accNumber = docid + PropertyService.getProperty("accNumSeparator") +
                 DBUtil.getLatestRevisionInDocumentTable(docid);
                     doc = new DocumentImpl(accNumber);
             }
@@ -3375,7 +3412,6 @@
         int serverLocation = -2;
         DBConnection dbConn = null;
         int serialNumber = -1;
-        //MetaCatUtil util = new MetaCatUtil();
 
         //we should consider about local host too
         if (serverName.equals(MetaCatUtil.getLocalReplicationServerName())) {
@@ -3601,7 +3637,6 @@
             double startTime = System.currentTimeMillis();
 
             // Open a connection to the database
-            MetaCatUtil util = new MetaCatUtil();
 
             dbconn = DBConnectionPool.getDBConnection("DocumentImpl.main");
             serialNumber = dbconn.getCheckOutSerialNumber();
@@ -3791,7 +3826,6 @@
     {
         DBConnection dbconn = null;
         int serialNumber = -1;
-        //MetaCatUtil util = new MetaCatUtil();
         AccessionNumber ac;
         PreparedStatement pstmt = null;
         String action = null;
@@ -3826,7 +3860,6 @@
      */
     static private void deleteXMLNodes(DBConnection dbconn, long rootId) throws Exception
     {
-        //MetaCatUtil util = new MetaCatUtil();
         AccessionNumber ac;
         PreparedStatement pstmt = null;
         double start = System.currentTimeMillis()/1000;
Index: src/edu/ucsb/nceas/metacat/service/ServiceException.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/ServiceException.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/service/ServiceException.java	(revision 4080)
@@ -0,0 +1,46 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: An Exception thrown when an error occurs because an 
+ *             AccessionNumber was invalid or used incorrectly
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.service;
+
+/**
+ * Exception thrown when an error occurs in a configuration administrative
+ * class
+ */
+public class ServiceException extends Exception {
+	
+	private static final long serialVersionUID = -2982801310798091071L;
+
+	/**
+	 * Create a new AdminException.
+	 *
+	 * @param message The error or warning message.
+	 */
+	public ServiceException(String message) {
+		super(message);
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/service/ServiceException.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
Index: src/edu/ucsb/nceas/metacat/service/SkinPropertyService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/SkinPropertyService.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/service/SkinPropertyService.java	(revision 4080)
@@ -0,0 +1,411 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements properties methods for metacat
+ *             skins
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.service;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.transform.TransformerException;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.util.SkinUtil;
+import edu.ucsb.nceas.metacat.util.UtilException;
+import edu.ucsb.nceas.utilities.FileUtil;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
+import edu.ucsb.nceas.utilities.PropertiesMetaData;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.utilities.SortedProperties;
+
+/**
+ * A suite of utility classes for the skin configuration utility
+ */
+public class SkinPropertyService implements ServiceInterface {
+	
+	private static SkinPropertyService skinService = null;
+	
+	private static String SKIN_DIR = null;
+	private static String BACKUP_DIR = null;
+	
+	private static Vector<String> skinNames = null;
+	
+	private static HashMap<String, SortedProperties> skinPropertiesMap = null;	
+	private static HashMap<String, SortedProperties> skinBackupPropertiesMap = null;
+	private static HashMap<String, PropertiesMetaData> skinMetaDataMap = null;
+	
+	private static Logger logMetacat = Logger.getLogger(SkinPropertyService.class);
+
+	/**
+	 * private constructor since this is a singleton
+	 * 
+	 * @param servletContext the context we will use to get relative paths
+	 */
+	private SkinPropertyService(ServletContext servletContext) throws ServiceException {
+		try {
+			initialize(servletContext);
+		} catch (GeneralPropertyException gpe) {
+			throw new ServiceException(
+					"Properties problem while initializing PropertyService: "
+							+ gpe.getMessage());
+		} catch (IOException ioe) {
+			throw new ServiceException("I/O Problem while initializing PropertyService: "
+					+ ioe.getMessage());
+		}
+	}
+	
+	/**
+	 * Get the single instance of AuthAdmin.
+	 * 
+	 * @param servletContext the context we will use to get relative paths
+	 * @return the single instance of AuthAdmin
+	 */
+	public static SkinPropertyService getInstance(ServletContext servletContext) throws ServiceException {
+		if (skinService == null) {
+			skinService = new SkinPropertyService(servletContext);
+		}
+		return skinService;
+	}
+	
+	/**
+	 * Initialize the singleton.
+	 * 
+	 * @param servletContext
+	 *            the context we will use to get relative paths
+	 */
+	private void initialize(ServletContext servletContext) throws IOException,
+			GeneralPropertyException {
+
+		logMetacat.debug("Initializing SkinService");
+
+		SKIN_DIR = "/style/skins";
+		BACKUP_DIR = PropertyService.getBackupDir();
+
+		skinNames = SkinUtil.getSkinNames();
+
+		skinPropertiesMap = new HashMap<String, SortedProperties>();
+		skinBackupPropertiesMap = new HashMap<String, SortedProperties>();
+		skinMetaDataMap = new HashMap<String, PropertiesMetaData>();
+
+		try {
+			for (String skinName : skinNames) {
+				String propertyFilePath = servletContext.getRealPath(SKIN_DIR)
+						+ FileUtil.getFS() + skinName + FileUtil.getFS() + skinName
+						+ ".properties";
+				SortedProperties skinProperties = new SortedProperties(propertyFilePath);
+				skinProperties.load();
+				skinPropertiesMap.put(skinName, skinProperties);
+
+				String metaDataFilePath = servletContext.getRealPath(SKIN_DIR)
+						+ FileUtil.getFS() + skinName + FileUtil.getFS() + skinName
+						+ ".properties.metadata.xml";
+				PropertiesMetaData skinMetaData = new PropertiesMetaData(metaDataFilePath);
+				skinMetaDataMap.put(skinName, skinMetaData);
+
+				String backupPropertyFilePath = servletContext.getRealPath(BACKUP_DIR)
+						+ FileUtil.getFS() + skinName + ".properties.metadata.xml";
+				SortedProperties skinBackupProperties = new SortedProperties(
+						backupPropertyFilePath);
+				skinBackupProperties.load();
+				skinBackupPropertiesMap.put(skinName, skinBackupProperties);
+			}
+		} catch (TransformerException te) {
+			throw new GeneralPropertyException(te.getMessage());
+		}
+	}
+
+	/**
+	 * Utility method to get a property value from the properties file for
+	 * a specific skin.
+	 * 
+	 * @param skinName the skin for which we want to retrieve the property
+	 * @param propertyName
+	 *            the name of the property requested
+	 * @return the String value for the property
+	 */
+	public static String getProperty(String skinName, String propertyName)
+			throws PropertyNotFoundException {
+		SortedProperties skinProperties = skinPropertiesMap.get(skinName);
+		if (skinProperties == null) {
+			throw new PropertyNotFoundException("There is not property map for " + skinName);
+		}
+		return skinProperties.getProperty(propertyName);
+	}
+	
+	/**
+     * Get a set of all property names for a given skin.
+     * 
+     * @param skinName the skin for which we want to retrieve the property
+     * names
+     * @return Set of property names  
+     */
+    public static Vector<String> getPropertyNames(String skinName) throws PropertyNotFoundException {   
+		SortedProperties skinProperties = skinPropertiesMap.get(skinName);
+		if (skinProperties == null) {
+			throw new PropertyNotFoundException("There is not property map for " + skinName);
+		}
+    	return skinProperties.getPropertyNames();
+    }
+    
+
+	/**
+	 * Get a Set of all property names that start with the groupName prefix.
+	 * 
+	 * @param groupName
+	 *            the prefix of the keys to search for.
+	 * @return enumeration of property names
+	 */
+    public static Vector<String> getPropertyNamesByGroup(String skinName, String groupName) throws PropertyNotFoundException {  
+		SortedProperties skinProperties = skinPropertiesMap.get(skinName);
+		if (skinProperties == null) {
+			throw new PropertyNotFoundException("There is not property map for " + skinName);
+		}
+    	return skinProperties.getPropertyNamesByGroup(groupName);
+    }
+    
+	/**
+	 * Get the main backup properties file. These are configurable properties that
+	 * are stored outside the metacat install directories so the user does not
+	 * need to re-enter all the configuration information every time they do an
+	 * upgrade.
+	 * 
+	 * @return a SortedProperties object with the backup properties
+	 */
+	public static HashMap<String, SortedProperties> getProperties() {
+		return skinPropertiesMap;
+	}
+    
+	/**
+	 * Get the main backup properties file. These are configurable properties that
+	 * are stored outside the metacat install directories so the user does not
+	 * need to re-enter all the configuration information every time they do an
+	 * upgrade.
+	 * 
+	 * @return a SortedProperties object with the backup properties
+	 */
+	public static SortedProperties getProperties(String skinName) {
+		return skinPropertiesMap.get(skinName);
+	}
+
+	/**
+	 * Get the main backup properties file. These are configurable properties that
+	 * are stored outside the metacat install directories so the user does not
+	 * need to re-enter all the configuration information every time they do an
+	 * upgrade.
+	 * 
+	 * @return a SortedProperties object with the backup properties
+	 */
+	public static HashMap<String, SortedProperties> getBackupProperties() {
+		return skinBackupPropertiesMap;
+	}
+	
+	/**
+	 * Get the main backup properties file. These are configurable properties that
+	 * are stored outside the metacat install directories so the user does not
+	 * need to re-enter all the configuration information every time they do an
+	 * upgrade.
+	 * 
+	 * @return a SortedProperties object with the backup properties
+	 */
+	public static SortedProperties getBackupProperties(String skinName) {
+		return skinBackupPropertiesMap.get(skinName);
+	}
+	
+	/**
+	 * Get the main properties metadata. This is retrieved from an xml file that
+	 * describes the attributes of configurable properties.
+	 * 
+	 * @return a PropertiesMetaData object with the main properties metadata
+	 */
+	public static HashMap<String, PropertiesMetaData> getMetaData() {
+		return skinMetaDataMap;
+	}
+	
+	/**
+	 * Get the main properties metadata. This is retrieved from an xml file that
+	 * describes the attributes of configurable properties.
+	 * 
+	 * @return a PropertiesMetaData object with the main properties metadata
+	 */
+	public static PropertiesMetaData getMetaData(String skinName) {
+		return skinMetaDataMap.get(skinName);
+	}
+
+	/**
+	 * Utility method to set a property value both in memory and to the
+	 * properties file
+	 * 
+	 * @param propertyName
+	 *            the name of the property requested
+	 * @param newValue
+	 *            the new value for the property
+	 */
+	public static void setProperty(String skinName, String propertyName, String newValue) throws IOException, GeneralPropertyException {
+		SortedProperties skinProperties = skinPropertiesMap.get(skinName);
+		if (skinProperties == null) {
+			throw new GeneralPropertyException("There is not property map for " + skinName);
+		}
+		skinProperties.setProperty(propertyName, newValue);
+		skinProperties.store();
+
+	}
+
+	/**
+	 * Utility method to set a property value in memory. This will NOT cause the
+	 * property to be written to disk. Use this method to set multiple
+	 * properties in a row without causing excessive I/O. You must call
+	 * persistProperties() once you're done setting properties to have them
+	 * written to disk.
+	 * 
+	 * @param propertyName
+	 *            the name of the property requested
+	 * @param newValue
+	 *            the new value for the property
+	 */
+	public static void setPropertyNoPersist(String skinName, String propertyName, String newValue) throws GeneralPropertyException {
+		SortedProperties skinProperties = skinPropertiesMap.get(skinName);
+		if (skinProperties == null) {
+			throw new GeneralPropertyException("There is not property map for " + skinName);
+		}
+		skinProperties.setPropertyNoPersist(propertyName, newValue);
+	}
+
+	/**
+	 * Save the properties to a properties file. Note, the 
+	 * order and comments will be preserved.
+	 */
+	public static void persistProperties(String skinName) throws IOException, GeneralPropertyException {
+		SortedProperties skinProperties = skinPropertiesMap.get(skinName);
+		if (skinProperties == null) {
+			throw new GeneralPropertyException("There is not property map for " + skinName);
+		}
+		skinProperties.store();
+	}
+
+	/**
+	 * Save the properties to a properties file. Note, the order and comments
+	 * will be preserved.
+	 */
+	public static void persistAllProperties() throws IOException,
+			GeneralPropertyException {
+		for (String skinName : skinNames) {
+			persistProperties(skinName);
+		}
+	}
+	
+	/**
+	 * Writes out backup configurable properties to a file.
+	 */
+	public static void persistBackupProperties(String skinName, ServletContext servletContext)
+			throws GeneralPropertyException {
+		
+		String metaDataFilePath = servletContext.getRealPath(SKIN_DIR) + FileUtil.getFS()
+				+ skinName + FileUtil.getFS() + skinName + ".properties.metadata.xml";
+		
+		String backupPropertyFilePath = servletContext.getRealPath(BACKUP_DIR)
+				+ FileUtil.getFS() + skinName + ".properties.metadata.xml";
+
+		// Use the metadata to extract configurable properties from the 
+		// overall properties list, and store those properties.
+		try {
+			SortedProperties backupProperties = 
+				new SortedProperties(backupPropertyFilePath);
+			
+			// Populate the backup properties for main metacat properties using
+			// the associated metadata file
+			PropertiesMetaData mainMetadata = new PropertiesMetaData(metaDataFilePath);
+			Set<String> mainKeySet = mainMetadata.getKeys();
+			for (String propertyKey : mainKeySet) {
+				backupProperties.setProperty(propertyKey, getProperty(skinName, propertyKey));
+			}
+			
+			// store the properties to file
+			backupProperties.store();
+
+		} catch (TransformerException te) {
+			throw new GeneralPropertyException("Could not transform backup properties xml: "
+					+ te.getMessage());
+		} catch (IOException ioe) {
+			throw new GeneralPropertyException("Could not backup configurable properties: "
+					+ ioe.getMessage());
+		}
+	}
+
+	/**
+	 * Gets the backup properties directory
+	 * 
+	 * TODO MCD figure out how to expand this.  At least for Windows
+	 * 
+	 * @return a string which holds the name of the backup directory. returns
+	 *         null if directory could not be created.
+	 */
+	public static String getBackupDir() {
+		return "/var/metacat/.metacat";
+	}
+	
+	/**
+	 * Reports whether properties are fully configured.
+	 * 
+	 * @return a boolean that is true if properties are not unconfigured and
+	 *         false otherwise
+	 */
+	public static boolean areSkinsConfigured() throws UtilException {
+		try {
+			return !PropertyService.getProperty("configutil.skinsConfigured").equals(
+					PropertyService.UNCONFIGURED);
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not determine if skins are configured: "
+					+ pnfe.getMessage());
+		}
+	}
+	
+	/**
+	 * Take input from the user in an HTTP request about an property to be changed
+	 * and update the metacat property file with that new value if it has
+	 * changed from the value that was originally set.
+	 * 
+	 * @param request
+	 *            that was generated by the user
+	 * @param response
+	 *            to send output back to the user
+	 * @param propertyName
+	 *            the name of the property to be checked and set
+	 */
+	public static void checkAndSetProperty(String skinName, HttpServletRequest request,String propertyName) 
+			throws GeneralPropertyException {
+		String value = SkinPropertyService.getProperty(skinName, propertyName);
+		String newValue = request.getParameter(propertyName);
+		if (newValue != null && !newValue.equals(value)) {
+			SkinPropertyService.setPropertyNoPersist(skinName, propertyName, newValue);
+		}
+	}
+
+}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/service/SkinPropertyService.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
Index: src/edu/ucsb/nceas/metacat/util/DatabaseUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/DatabaseUtil.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/DatabaseUtil.java	(revision 4080)
@@ -0,0 +1,89 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements database administrative methods 
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.util;
+
+import java.util.TreeSet;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.DBVersion;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.utilities.StringUtil;
+
+public class DatabaseUtil {
+	
+	private static Logger logMetacat = Logger.getLogger(DatabaseUtil.class);
+
+	/**
+	 * private constructor - all methods are static so there is no no need to
+	 * instantiate.
+	 */
+	private DatabaseUtil() {}
+	
+	/**
+	 * Reports whether database is fully configured.
+	 * 
+	 * @return a boolean that is true if database is not unconfigured and false
+	 *         otherwise
+	 */
+	public static boolean isDatabaseConfigured() throws UtilException {
+		String databaseConfiguredString = PropertyService.UNCONFIGURED;
+		try {
+			databaseConfiguredString = 
+				PropertyService.getProperty("configutil.databaseConfigured");
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not determine if database is configured: "
+					+ pnfe.getMessage());
+		}
+		return !databaseConfiguredString.equals(PropertyService.UNCONFIGURED);
+	}	
+	
+	/**
+	 * Gets the available upgrade versions for metacat by getting a list of 
+	 * upgrade script from properties in metacat.properties that start with 
+	 * "database.upgradeVersion". It then creats a DBVersion object for each 
+	 * upgrade version.
+	 * 
+	 * @return a TreeSet of DBVersion objects holding individual version information
+	 */
+	public static TreeSet<DBVersion> getUpgradeVersions() throws PropertyNotFoundException {
+		
+		TreeSet<DBVersion> versionSet = new TreeSet<DBVersion>();
+		
+		Vector<String> upgradeVersionKeys = PropertyService.getPropertyNamesByGroup("database.upgradeVersion");
+		for (String upgradeVersionKey : upgradeVersionKeys) {
+			String upgradeVersionId = upgradeVersionKey.substring(24);
+			logMetacat.debug("Creating DBVersion object for version: " + upgradeVersionId);
+			DBVersion dbVersion = new DBVersion(upgradeVersionId);
+			versionSet.add(dbVersion);
+		}
+
+		return versionSet;
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/DatabaseUtil.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
Index: src/edu/ucsb/nceas/metacat/util/MetaCatUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/MetaCatUtil.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/MetaCatUtil.java	(revision 4080)
@@ -0,0 +1,1003 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements utility methods for a metadata catalog
+ *  Copyright: 2000 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Matt Jones, Jivka Bojilova
+ *
+ *   '$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.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Stack;
+import java.util.Vector;
+import java.util.regex.PatternSyntaxException;
+
+import org.apache.log4j.Logger;
+
+import com.oreilly.servlet.multipart.FilePart;
+
+import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.DBSAXHandler;
+import edu.ucsb.nceas.metacat.MetaCatServlet;
+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 MetaCatUtil
+{
+
+    public static AbstractDatabase dbAdapter;
+
+    public static Vector pathsForIndexing;
+    
+    private static HashMap skinconfigs = new HashMap();
+
+    private static boolean debug = true;
+    
+    private static boolean debugErrorDisplayed = false;
+    
+    private static Logger logMetacat = Logger.getLogger(MetaCatUtil.class);
+    private static char separator = '.';
+
+    static {
+    	// Determine our db adapter class and create an instance of that class
+        try {
+            dbAdapter = (AbstractDatabase) createObject(PropertyService.getProperty("database.adapter"));
+        } catch (Exception e) {
+            System.err.println("Error in MetaCatUtil static block:"
+                    + e.getMessage());
+            e.printStackTrace();
+        }
+
+        try {
+        	separator = PropertyService.getProperty("accNumSeparator").charAt(0);
+        } catch (PropertyNotFoundException pnfe) {
+        	logMetacat.error("Could not retrieve account number separator. " 
+        			+ "Separator set to '.' : " + pnfe.getMessage());
+        }
+    }
+    
+    /**
+     * Instantiate a class using the name of the class at runtime
+     *
+     * @param className the fully qualified name of the class to instantiate
+     */
+    public static Object createObject(String className) throws Exception
+    {
+
+        Object object = null;
+        try {
+            Class classDefinition = Class.forName(className);
+            object = classDefinition.newInstance();
+        } catch (InstantiationException e) {
+            throw e;
+        } catch (IllegalAccessException e) {
+            throw e;
+        } catch (ClassNotFoundException e) {
+            throw e;
+        }
+        return object;
+    }
+
+    /**
+     * 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
+     * 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.
+     */
+    public static Hashtable parseQuery(String query)
+            throws MalformedURLException
+    {
+        String[][] params = new String[200][2];
+        Hashtable parameters = new Hashtable();
+
+        String temp = "";
+        boolean ampflag = true;
+        boolean poundflag = false;
+        int arrcount = 0;
+
+        if (query != null) {
+            for (int i = 0; i < query.length(); i++) {
+
+                // go throught the remainder of the query one character at a
+                // time.
+                if (query.charAt(i) == '=') {
+                    // if the current char is a # then the preceding should be
+                    // a name
+                    if (!poundflag && ampflag) {
+                        params[arrcount][0] = temp.trim();
+                        temp = "";
+                    } else {
+                        //if there are two #s or &s in a row throw an
+                        // exception.
+                        throw new MalformedURLException(
+                                "metacatURL: Two parameter names "
+                                        + "not allowed in sequence");
+                    }
+                    poundflag = true;
+                    ampflag = false;
+                } else if (query.charAt(i) == '&' || i == query.length() - 1) {
+                    //the text preceding the & should be the param value.
+                    if (i == query.length() - 1) {
+                        //if at the end of the string grab the last value and
+                        // append it.
+                        if (query.charAt(i) != '=') {
+                            //ignore an extra & on the end of the string
+                            temp += query.charAt(i);
+                        }
+                    }
+
+                    if (!ampflag && poundflag) {
+                        params[arrcount][1] = temp.trim();
+                        parameters
+                                .put(params[arrcount][0], params[arrcount][1]);
+                        temp = "";
+                        arrcount++; //increment the array to the next row.
+                    } else {
+                        //if there are two =s or &s in a row through an
+                        // exception
+                        throw new MalformedURLException(
+                                "metacatURL: Two parameter values "
+                                        + "not allowed in sequence");
+                    }
+                    poundflag = false;
+                    ampflag = true;
+                } else {
+                    //get the next character in the string
+                    temp += query.charAt(i);
+                }
+            }
+        }
+        return parameters;
+    }
+  
+    public static Vector<String> getOptionList(String optiontext)
+    {
+        Vector<String> optionsVector = new Vector<String>();
+        if (optiontext.indexOf(",") == -1) {
+            optionsVector.addElement(optiontext);
+            return optionsVector;
+        }
+
+        while (optiontext.indexOf(",") != -1) {
+            String s = optiontext.substring(0, optiontext.indexOf(","));
+            optionsVector.addElement(s.trim());
+            optiontext = optiontext.substring(optiontext.indexOf(",") + 1,
+                    optiontext.length());
+            if (optiontext.indexOf(",") == -1) { //catch the last list entry
+                optionsVector.addElement(optiontext.trim());
+            }
+        }
+        return optionsVector;
+    }
+
+    /** Normalizes a string read from DB. So it will be compatible to HTML */
+    public static String normalize(String s)
+    {
+        StringBuffer str = new StringBuffer();
+
+             int len = (s != null) ? s.length() : 0;
+             for (int i = 0; i < len; i++) {
+                 char ch = s.charAt(i);
+                 switch (ch) {
+                     case '<': {
+                         str.append("&lt;");
+                         break;
+                     }
+                     case '>': {
+                         str.append("&gt;");
+                         break;
+                     }
+                     case '&': {
+                         /*
+                          * patch provided by Johnoel Ancheta from U of Hawaii
+                          */
+                         // check if & is for a character reference &#xnnnn;
+                         if (i + 1 < len - 1 && s.charAt(i + 1) == '#') {
+                             str.append("&#");
+                             i += 2;
+
+                             ch = s.charAt(i);
+                             while (i < len && ch != ';') {
+                                 str.append(ch);
+                                 i++;
+                                 ch = s.charAt(i);
+                             }
+                             str.append(';');
+                         } else 
+                         // check if & is in front of amp; 
+                         // (we dont yet check for other HTML 4.0 Character entities) 
+                         if (i + 4 < len  && s.charAt(i + 1) == 'a' 
+                        	 && s.charAt(i + 2) == 'm' 
+                        		 && s.charAt(i + 3) == 'p' 
+                        			 && s.charAt(i + 4) == ';'){
+                             str.append("&amp;");
+                             i += 4;                        	 
+                         }
+                         else  if (i + 3 < len && s.charAt(i + 1) == 'l' 
+                        	 && s.charAt(i + 2) == 't' 
+                        		 && s.charAt(i + 3) == ';' ){
+                    	  // check if & is in front of it; 
+                             str.append("&lt;");
+                             i += 3;                        	 
+                         } 
+                         else  if (i + 3 < len && s.charAt(i + 1) == 'g' 
+                        	 && s.charAt(i + 2) == 't' 
+                        		 && s.charAt(i + 3) == ';' ){
+                    	  // check if & is in front of gt; 
+                           // (we dont yet check for other HTML 4.0 Character entities) 
+                             str.append("&gt;");
+                             i += 3;                        	 
+                         } 
+                         else  if (i + 5 < len && s.charAt(i + 1) == 'q' 
+                        	 && s.charAt(i + 2) == 'u' 
+                        		 && s.charAt(i + 3) == 'o' 
+                        	 && s.charAt(i + 4) == 't'
+                        	 && s.charAt(i + 5) == ';')
+                             {
+                    	   // check if & is in front of quot; 
+                           // (we dont yet check for other HTML 4.0 Character entities) 
+                             str.append("&quot;");
+                             i += 5;                        	 
+                         } 
+                         else  if (i + 5 < len && s.charAt(i + 1) == 'a' 
+                        	 && s.charAt(i + 2) == 'p' 
+                        		 && s.charAt(i + 3) == 'o' 
+                        	 && s.charAt(i + 4) == 's'
+                        	 && s.charAt(i + 5) == ';')
+                             {
+                    	   // check if & is in front of apostrophe; 
+                           // (we dont yet check for other HTML 4.0 Character entities) 
+                             str.append("&apos;");
+                             i += 5;                        	 
+                         } 
+                         else{
+                             str.append("&amp;");
+                         }
+                         /////////
+                         break;
+                     }
+                     case '"':
+                    	 str.append("&quot;");
+                         break;
+                     case '\'':
+                    	 str.append("&apos;");
+                         break;
+                    default: {
+                         if ( (ch<128) && (ch>31) ) {
+                             str.append(ch);
+                         }
+                         else if (ch<32) {
+                             if (ch == 10) { // new line
+                                 str.append(ch);
+                             }
+                             if (ch == 13) { // carriage return
+                                 str.append(ch);
+                             }
+                             if (ch == 9) {  // tab
+                                 str.append(ch);
+                             }
+                             // otherwise skip
+                         }
+                         else {
+                        	 //Don't transfer special character to numeric entity
+                             /*str.append("&#");
+                             str.append(Integer.toString(ch));
+                             str.append(';');*/
+                             str.append(ch);
+                         }
+                     }
+                 }
+             }
+             return str.toString();
+    }
+
+    /**
+     * 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()
+    {
+        String replicationServerName = null;
+        // String serverHost = null;
+        // serverHost = getProperty("server");
+        // append "context/servlet/replication" to the host name
+        try {
+        replicationServerName = 
+        	SystemUtil.getContextURL() + "/servlet/replication";
+        } catch (PropertyNotFoundException pnfe) {
+        	logMetacat.error("Could not get local replication server name " 
+        			+ "because property could not be found: " + pnfe.getMessage());
+        }
+        return replicationServerName;
+
+    }
+
+    /**
+     * 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 reviseStack(Stack 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)
+    {
+        StringBuffer newUrl = new StringBuffer();
+        String whiteSpaceReplace = "%20";
+        if (urlHasWhiteSpace == null || urlHasWhiteSpace.trim().equals("")) { return null; }
+
+        for (int i = 0; i < urlHasWhiteSpace.length(); i++) {
+            char ch = urlHasWhiteSpace.charAt(i);
+            if (!Character.isWhitespace(ch)) {
+                newUrl.append(ch);
+            } else {
+                //it is white sapce, replace it by %20
+                newUrl = newUrl.append(whiteSpaceReplace);
+            }
+
+        }//for
+        logMetacat.info("The new string without space is:"
+                + newUrl.toString());
+        return newUrl.toString();
+
+    }// replaceWhiteSpaceForUR
+
+    /**
+	 * Writes debug information into a file. In metacat.properties, if property
+	 * writeDebugToFile is set to true, the debug information will be written to
+	 * debug file, which value is the property debugOutputFile in
+	 * metacat.properties.
+	 * 
+	 */
+	public static void writeDebugToFile(String debugInfo) {
+		String debug = "false";
+		try {
+			debug = PropertyService.getProperty("writeDebugToFile");
+			if (debug != null && debug.equalsIgnoreCase("true")) {
+				File outputFile = 
+					new File(PropertyService.getProperty("debugOutputFile"));
+				FileOutputStream fos = new FileOutputStream(outputFile, true);
+				PrintWriter pw = new PrintWriter(fos);
+				pw.println(debugInfo);
+				pw.flush();
+				pw.close();
+				fos.close();
+			}
+		} catch (PropertyNotFoundException pnfe) {
+			// only log debug to file warning once
+			if (!debugErrorDisplayed) {
+				logMetacat.warn("Could not get debug property.  Write debug to " 
+						+ "file is set to false: " + pnfe.getMessage());
+				debugErrorDisplayed = true;
+			}
+		} catch (Exception io) {
+			logMetacat.warn("Error in MetacatUtil.writeDebugToFile "
+					+ io.getMessage());
+		}
+	}
+    
+   /**
+	 * Writes debug information into a file in delimitered format
+	 * 
+	 * @param debugInfo
+	 *            the debug information
+	 * @param newLine
+	 *            append the debug info to a line or not
+	 */
+	public static void writeDebugToDelimiteredFile(String debugInfo, boolean newLine) {
+		String debug = "false";
+		try {
+			debug = PropertyService.getProperty("writeDebugToFile");
+			if (debug != null && debug.equalsIgnoreCase("true")) {
+				File outputFile = new File(PropertyService
+						.getProperty("delimiteredOutputFile"));
+				FileOutputStream fos = new FileOutputStream(outputFile, true);
+				PrintWriter pw = new PrintWriter(fos);
+				if (newLine) {
+					pw.println(debugInfo);
+				} else {
+					pw.print(debugInfo);
+				}
+				pw.flush();
+				pw.close();
+				fos.close();
+			}
+		} catch (PropertyNotFoundException pnfe) {
+			// only log debug to file warning once
+			if (!debugErrorDisplayed) {
+				logMetacat.warn("Could not get delimited debug property. Write debug to " 
+						+ "file is set to false: " + pnfe.getMessage());
+				debugErrorDisplayed = true;
+			}
+		} catch (Exception io) {
+			logMetacat.warn("Eorr in writeDebugToDelimiteredFile "
+					+ io.getMessage());
+		}
+	}
+
+		/**
+		 * Write the uploaded file to disk for temporary storage before moving
+		 * it to its final Metacat location.
+		 * 
+		 * @param filePart
+		 *            the FilePart object containing the file form element
+		 * @param fileName
+		 *            the name of the file to be written to disk
+		 * @return tempFilePath a String containing location of temporary file
+		 */
+    public static String writeTempFile (FilePart filePart, String fileName) {
+        Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
+        String tempFilePath = null;
+        String tempDirPath = null;
+        try {
+        	tempDirPath = PropertyService.getProperty("temp-dir");
+        } catch (PropertyNotFoundException pnfe) {
+        	logMetacat.warn("Temp property not found.  An attempt will be made " 
+        			+ "to use system temp directory: " + pnfe.getMessage());
+        }
+        long fileSize;
+        File tempFile;
+        File tempDir;
+
+        if ((fileName == null) || fileName.equals("")) {
+            return tempFilePath;
+        }
+				
+        // the tempfilepath token isn't set, use Java default
+		if (tempDirPath == null) {
+			String javaTempDir = System.getProperty("java.io.tempdir");
+			if (javaTempDir == null) {
+				// no paths set, use unix default
+				tempDirPath = "/tmp";
+			} else {
+				tempDirPath = javaTempDir;
+			}
+		}
+
+        tempDir = new File(tempDirPath);
+
+        // Create the temporary directory if it doesn't exist
+        try {
+            if (!tempDir.exists()) {
+                tempDir.mkdirs();
+            }
+        } catch (SecurityException e) {
+            logMetacat.error("Can't create directory: " + tempDir.getPath() +
+                             ". Error: " + e.getMessage());
+        }
+        try {
+            tempFile = new File(tempDirPath, fileName);
+            fileSize = filePart.writeTo(tempFile);
+            tempFilePath = tempDirPath + File.separator + fileName;
+
+            if (fileSize == 0) {
+                logMetacat.error("Uploaded file '" + fileName + "'is empty!");
+            }
+        } catch (IOException e) {
+            logMetacat.error("IO exception which writing temporary file: " +
+                             tempFilePath + " " + e.getMessage());
+        }
+
+        logMetacat.info("Temporary file is: " + tempFilePath);
+
+        return tempFilePath;
+    }
+
+    /**
+	 * 
+	 * Copy a file between two locations specified as strings. Fails if either
+	 * path cannot be created. Based on the public domain FileCopy class in
+	 * _Java in a Nutshell_.
+	 * 
+	 * @param sourceName
+	 *            the source file to read from disk
+	 * @param destName
+	 *            the destination file on disk
+	 */
+    public static void copyFile(String sourceName, String destName) throws IOException {
+        Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
+
+        File sourceFile = new File(sourceName);
+        File destFile = new File(destName);
+        FileInputStream source = null;
+        FileOutputStream dest = null;
+        byte[] buffer;
+        int bytesRead;
+
+        try {
+            if (!sourceFile.exists() || !sourceFile.isFile()) {
+                logMetacat.error("File copy: no such source" +
+                                 " file: " + sourceName);
+            }
+            if (!sourceFile.canRead()) {
+                logMetacat.error("File copy: source file " +
+                                 "is unreadable: " + sourceName);
+            }
+
+            if (destFile.exists()) {
+                if (destFile.isFile()) {
+                    if (!destFile.canWrite()) {
+                        logMetacat.error("File copy: destination " +
+                                         "file is unwriteable: " + destFile);
+                    }
+                } else {
+                    logMetacat.error("File copy: destination file " +
+                                     "is not a file: " + destFile);
+                }
+            } else {
+                File parentDir = parent(destFile);
+
+                if (!parentDir.exists())
+                {
+                    logMetacat.error("File copy: destination diretory " +
+                                     " doesn't exist: " + destName);
+                }
+                if (!parentDir.canWrite()) {
+                    logMetacat.error("File copy: destination directory " +
+                                     " is unwritable: " + destName);
+                }
+            }
+
+            // Verbose error checking done, copy the file object
+            source = new FileInputStream(sourceFile);
+            dest = new FileOutputStream(destFile);
+            buffer = new byte[1024];
+
+            while (true) {
+                bytesRead = source.read(buffer);
+                if (bytesRead == -1) {
+                    break;
+                }
+                dest.write(buffer, 0, bytesRead);
+            }
+        }
+        finally {
+            if (source != null) {
+                try { source.close(); } catch (IOException e) { ; }
+            }
+            if (dest != null) {
+                try { dest.close(); } catch (IOException e) { ; }
+            }
+        }
+    }
+
+    private static File parent(File f) {
+        String dirname = f.getParent();
+        if (dirname == null) {
+            if (f.isAbsolute()) return new File(File.separator);
+            else return new File(System.getProperty("user.dir"));
+        }
+        return new File(dirname);
+    }
+
+    // TODO MCD remove skins config stuff from here and move into PropertyService
+    
+    /**
+     * Adds the Properties and skin to the list of skin configurations.
+     * @param skinName String qformat
+     * @param skinProperties Properties instance
+     */
+    public static void addSkinConfig(String skinName, Properties skinProperties) {
+        skinconfigs.put(skinName, skinProperties);
+    }
+
+    /**
+     * Return the Properties for a given skin name.
+     * @param skinName String qformat
+     * @return Properties, or null if none exist for the skin.
+     */
+    public static Properties getSkinConfig(String skinName) {
+        Properties                      result;
+        
+        result = (Properties) skinconfigs.get(skinName);
+        return(result);
+    }
+    
+    /**
+     * Returns true if Properties exist for a given skin name, false otherwise.
+     * @param skinName String qformat
+     * @return boolean
+     */
+    public static boolean hasSkinConfig(String skinName) {
+        boolean                     result;
+        
+        result = skinconfigs.containsKey(skinName);
+        return(result);
+    }
+
+	/**
+	 * 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()
+					&& LDAPUtil.isLDAPConfigured() && SkinUtil.areSkinsConfigured()
+					&& DatabaseUtil.isDatabaseConfigured();
+		} catch (UtilException ue) {
+			logMetacat.error("Could not determine if metacat is configured: "
+					+ ue.getMessage());
+		}
+
+		return metacatConfigured;
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/MetaCatUtil.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
Index: src/edu/ucsb/nceas/metacat/ContentTypeProvider.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ContentTypeProvider.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/ContentTypeProvider.java	(revision 4080)
@@ -55,6 +55,10 @@
 import javax.xml.transform.dom.*;
 
 import org.ecoinformatics.eml.EMLParser;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 /**
  * This class will figure out which content type it is for a given data file.
  * First, from xml_relation to get all relative files to this data file.
@@ -71,8 +75,15 @@
   //Constant
   private String BETA = "beta";
   private String EML2 = "eml2";
-  private String DEFAULTCONTENTTYPE = MetaCatUtil.
-                                           getOption("defaultcontenttype");
+  private static String DEFAULTCONTENTTYPE;
+  static {
+		try {
+			DEFAULTCONTENTTYPE = PropertyService.getProperty("defaultcontenttype");
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property DEFAULTCONTENTTYPE:" 
+					+ pnfe.getMessage());
+		}
+	}
   private String FORMATPATH = "//format";
   private String TEXT       = "text";
   private String TEXTYPE    ="text/plain";
@@ -174,7 +185,7 @@
     // create xml document
     try
     {
-      String accNumber = eml2DocId + MetaCatUtil.getOption("accNumSeparator") +
+      String accNumber = eml2DocId + PropertyService.getProperty("accNumSeparator") +
                     DBUtil.getLatestRevisionInDocumentTable(eml2DocId);
       //System.out.println("the acc number is !!!!!!!!!!!!!!!!!"+accNumber);
       xmlDoc = new DocumentImpl(accNumber);
@@ -392,7 +403,7 @@
       }//while
 
       // set up data package type
-      if ((MetaCatUtil.getOptionList(MetaCatUtil.getOption("packagedoctype"))).
+      if ((MetaCatUtil.getOptionList(PropertyService.getProperty("packagedoctype"))).
                                      contains(packType))
       {
         //this is beta4 or beta6 version
@@ -400,7 +411,7 @@
         packageType = BETA;
       }
       else if ((MetaCatUtil.getOptionList
-               (MetaCatUtil.getOption("eml2_0_0namespace"))).contains(packType))
+               (PropertyService.getProperty("eml2_0_0namespace"))).contains(packType))
       {
         // this eml 2 document
         logMetacat.warn("This is EML2.0.0 package");
@@ -407,7 +418,7 @@
         packageType = EML2;
       }
       else if ((MetaCatUtil.getOptionList
-               (MetaCatUtil.getOption("eml2_0_1namespace"))).contains(packType))
+               (PropertyService.getProperty("eml2_0_1namespace"))).contains(packType))
       {
         // this eml 2 document
         logMetacat.warn("This is EML2.0.1 package");
@@ -423,6 +434,11 @@
       logMetacat.error("ContenTypProvider.getRelativeDoclist1 " +
                              e.getMessage());
     }//catch
+    catch(PropertyNotFoundException pnfe)
+    {
+      logMetacat.error("ContenTypProvider.getRelativeDoclist1 " +
+                             pnfe.getMessage());
+    }//catch
     finally
     {
       try
@@ -487,7 +503,7 @@
         String packType = rs.getString(1);
         String targetId  = rs.getString(2);
         // find physical document
-        if ((MetaCatUtil.getOptionList(MetaCatUtil.getOption(targetType))).
+        if ((MetaCatUtil.getOptionList(PropertyService.getProperty(targetType))).
                                      contains(packType))
        {
          // assign physical document and jump out the while loop
@@ -503,6 +519,12 @@
       logMetacat.error("ContenTypProvider.setPhysicalDocIdForBeta1 " +
                              e.getMessage());
     }//catch
+    catch(PropertyNotFoundException pnfe)
+    {
+
+      logMetacat.error("ContenTypProvider.setPhysicalDocIdForBeta1 " +
+                             pnfe.getMessage());
+    }//catch
     finally
     {
       try
@@ -533,7 +555,7 @@
     String xmlDoc = null;
     try
     {
-      String accNumber = physicalDocid + MetaCatUtil.getOption("accNumSeparator") +
+      String accNumber = physicalDocid + PropertyService.getProperty("accNumSeparator") +
         DBUtil.getLatestRevisionInDocumentTable(physicalDocid);
       //System.out.println("the accenumber is !!!!!!!!!!!!!!!!!!" + accNumber);
       DocumentImpl doc = new DocumentImpl(accNumber);
Index: src/edu/ucsb/nceas/metacat/PermissionController.java
===================================================================
--- src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 4080)
@@ -36,6 +36,10 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 public class PermissionController
 {
    private String docId = null;
@@ -419,74 +423,69 @@
   }
 
   /**
-    * Check if a document id is a access document. Access document need user
-    * has "all" permission to access it.
-    * @param docId, the document id need to be checked
-    */
-    private boolean isAccessDocument(String docId) throws SQLException
-    {
-      //detele the rev number if docid contains it
-      docId=MetaCatUtil.getDocIdFromString(docId);
-      PreparedStatement pStmt=null;
-      DBConnection conn = null;
-      int serialNumber = -1;
-      try
-      {
-        //check out DBConnection
-        conn=DBConnectionPool.getDBConnection("PermissionControl.isAccessDoc");
-        serialNumber=conn.getCheckOutSerialNumber();
-        pStmt = conn.prepareStatement("select doctype from xml_documents where " +
-                                      "docid like '" + docId +  "'");
-        pStmt.execute();
-        ResultSet rs = pStmt.getResultSet();
-        boolean hasRow = rs.next();
-        String doctype = null;
-        if (hasRow)
-        {
-          doctype = rs.getString(1);
+	 * Check if a document id is a access document. Access document need user
+	 * has "all" permission to access it.
+	 * 
+	 * @param docId,
+	 *            the document id need to be checked
+	 */
+	private boolean isAccessDocument(String docId) throws SQLException {
+		// detele the rev number if docid contains it
+		docId = MetaCatUtil.getDocIdFromString(docId);
+		PreparedStatement pStmt = null;
+		DBConnection conn = null;
+		int serialNumber = -1;
+		try {
+			// check out DBConnection
+			conn = DBConnectionPool.getDBConnection("PermissionControl.isAccessDoc");
+			serialNumber = conn.getCheckOutSerialNumber();
+			pStmt = conn.prepareStatement("select doctype from xml_documents where "
+					+ "docid like '" + docId + "'");
+			pStmt.execute();
+			ResultSet rs = pStmt.getResultSet();
+			boolean hasRow = rs.next();
+			String doctype = null;
+			if (hasRow) {
+				doctype = rs.getString(1);
 
-        }
-        pStmt.close();
+			}
+			pStmt.close();
 
-        // if it is an access document
-        if (doctype != null && ((MetaCatUtil.getOptionList(MetaCatUtil.
-           getOption("accessdoctype")).contains(doctype))))
-        {
+			// if it is an access document
+			if (doctype != null
+					&& ((MetaCatUtil.getOptionList(PropertyService
+							.getProperty("accessdoctype")).contains(doctype)))) {
 
-          return true;
-        }
+				return true;
+			}
 
-      }
-      catch(SQLException e)
-      {
+		} catch (SQLException e) {
+			throw new SQLException("PermissionControl.isAccessDocument "
+					+ "Error checking" + " on document " + docId + ". " + e.getMessage());
+		} catch (PropertyNotFoundException pnfe) {
+			throw new SQLException("PermissionControl.isAccessDocument "
+					+ "Error checking" + " on document " + docId + ". " + pnfe.getMessage());
+		} finally {
+			try {
+				pStmt.close();
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}
 
-        throw new SQLException("PermissionControl.isAccessDocument " +
-                     "Error checking" +
-                     " on document " + docId + ". " + e.getMessage());
-      }
-      finally
-      {
-        try
-        {
-           pStmt.close();
-        }
-        finally
-        {
-          DBConnectionPool.returnDBConnection(conn, serialNumber);
-        }
-      }
+		return false;
+	}// isAccessDocument
 
-      return false;
-    }//isAccessDocument
 
 
-
   /**
-    * Check if a stirng array contains a given documents' owner
-    * @param principals, a string array storing the username, groups name and
-    * public.
-    * @param docid, the id of given documents
-    */
+	 * Check if a stirng array contains a given documents' owner
+	 * 
+	 * @param principals,
+	 *            a string array storing the username, groups name and public.
+	 * @param docid,
+	 *            the id of given documents
+	 */
   private boolean containDocumentOwner( String[] principals, String docId)
                     throws SQLException
   {
@@ -642,8 +641,8 @@
     //if reach here, means there is no permssion record for given names and
     //docid. So throw a exception.
 
-    throw new Exception("There is no permission record for user " + principals[0] +
-                        " at document " + docId);
+    throw new Exception("There is no permission record for user"+principals[0]+
+                        "at document "+docId);
 
   }//isAllowFirst
 
Index: src/edu/ucsb/nceas/metacat/RelationHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/RelationHandler.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/RelationHandler.java	(revision 4080)
@@ -20,8 +20,11 @@
  
 package edu.ucsb.nceas.metacat;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.morpho.datapackage.Triple;
 import edu.ucsb.nceas.morpho.datapackage.TripleCollection;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 import java.io.StringReader;
 import java.sql.*;
@@ -171,67 +174,70 @@
   }
 
   /**
-   * Get the access file id for a package
-   * @param docid the document identifier of the package
-   * @return the document identifier of the access file for that package
-   */
-  public static String getAccessFileIDWithRevision(String docid) throws SQLException
-  {
-    String aclid = null;
-    int rev;
-    PreparedStatement pstmt = null;
-    DBConnection dbConn = null;
-    int serialNumber = -1;
-    
-    StringBuffer sql = new StringBuffer();
-    sql.append("SELECT docid, rev FROM xml_documents WHERE docid in (SELECT subject ");
-    sql.append("FROM xml_relation WHERE docid='").append(docid);
-    sql.append("' AND (");
-    Vector accessdoctypes = MetaCatUtil.getOptionList(
-                              MetaCatUtil.getOption("accessdoctype"));
-    for(int i=0; i<accessdoctypes.size(); i++)
-    {
-      String atype = (String)accessdoctypes.elementAt(i);
-      sql.append("doctype='").append(atype).append("'");
-      if(i < accessdoctypes.size()-1)
-      {
-        sql.append(" OR ");
-      }
-    }
-    sql.append("))");
-    //System.out.println("new sql script: " + sql.toString());
-    
-    try
-    {
-      dbConn=DBConnectionPool.
-                  getDBConnection("RelationHandler.getAccessFileID");
-      serialNumber=dbConn.getCheckOutSerialNumber();
-      pstmt = dbConn.prepareStatement(sql.toString());
-      pstmt.execute();
-      ResultSet rs = pstmt.getResultSet();
-      boolean hasRow = rs.next();
-      if (hasRow) {
-        aclid = rs.getString(1);
-        rev = rs.getInt(2);
-        aclid = aclid +MetaCatUtil.getOption("accNumSeparator")+rev;
-      }
-      pstmt.close();
-    }//try
-    finally
-    {
-      try
-      {
-        pstmt.close();
-      }//try
-      finally
-      {
-        DBConnectionPool.returnDBConnection(dbConn, serialNumber);
-      }//finally
-    }//finally
-     
-    logMetacat.info("The access docid get from xml_relation is: "+
-                              aclid);
-    return aclid;
-  }
+	 * Get the access file id for a package
+	 * @param docid the document identifier of the package
+	 * @return the document identifier of the access file for that package
+	 */
+	public static String getAccessFileIDWithRevision(String docid) throws SQLException {
+		String aclid = null;
+		int rev;
+		PreparedStatement pstmt = null;
+		DBConnection dbConn = null;
+		int serialNumber = -1;
 
+		StringBuffer sql = new StringBuffer();
+		sql
+				.append("SELECT docid, rev FROM xml_documents WHERE docid in (SELECT subject ");
+		sql.append("FROM xml_relation WHERE docid='").append(docid);
+		sql.append("' AND (");
+		Vector accessdoctypes;
+		try {
+			accessdoctypes = MetaCatUtil.getOptionList(PropertyService
+				.getProperty("accessdoctype"));
+		} catch (PropertyNotFoundException pnfe) {
+			throw new SQLException("Could not find access doctype: " + pnfe.getMessage());
+		}
+		for (int i = 0; i < accessdoctypes.size(); i++) {
+			String atype = (String) accessdoctypes.elementAt(i);
+			sql.append("doctype='").append(atype).append("'");
+			if (i < accessdoctypes.size() - 1) {
+				sql.append(" OR ");
+			}
+		}
+		sql.append("))");
+		//System.out.println("new sql script: " + sql.toString());
+
+		try {
+			dbConn = DBConnectionPool.getDBConnection("RelationHandler.getAccessFileID");
+			serialNumber = dbConn.getCheckOutSerialNumber();
+			pstmt = dbConn.prepareStatement(sql.toString());
+			pstmt.execute();
+			ResultSet rs = pstmt.getResultSet();
+			boolean hasRow = rs.next();
+			if (hasRow) {
+				aclid = rs.getString(1);
+				rev = rs.getInt(2);
+				String sep = ".";
+				try {
+					sep = PropertyService.getProperty("accNumSeparator");
+				} catch (PropertyNotFoundException pnfe) {
+					logMetacat.error("Could not find account separator.  Setting to '.': " + pnfe.getMessage());
+				}
+				aclid = sep + rev;
+			}
+			pstmt.close();
+		}//try
+		finally {
+			try {
+				pstmt.close();
+			}//try
+			finally {
+				DBConnectionPool.returnDBConnection(dbConn, serialNumber);
+			}//finally
+		}//finally
+
+		logMetacat.info("The access docid get from xml_relation is: " + aclid);
+		return aclid;
+	}
+
 }
Index: src/edu/ucsb/nceas/metacat/service/PropertyService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/PropertyService.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/service/PropertyService.java	(revision 4080)
@@ -0,0 +1,432 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements properties methods for metacat
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.service;
+
+import java.io.IOException;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.transform.TransformerException;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.UtilException;
+import edu.ucsb.nceas.utilities.FileUtil;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
+import edu.ucsb.nceas.utilities.MetaDataGroup;
+import edu.ucsb.nceas.utilities.MetaDataProperty;
+import edu.ucsb.nceas.utilities.PropertiesMetaData;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.utilities.SortedProperties;
+
+/**
+ * A suite of utility classes for the metadata configuration utility
+ */
+public class PropertyService implements ServiceInterface {
+	
+	private static PropertyService propertyService = null;
+	
+	// system is configured
+	public static final String CONFIGURED = "true"; 
+	// system has never been configured
+	public static final String UNCONFIGURED = "false"; 
+	
+	private static final String MAIN_CONFIG_NAME = "metacat.properties";
+	private static final String ORG_CONFIG_NAME = "org.properties";
+	private static final String CONFIG_DIR = "WEB-INF";
+	
+	private static String mainPropertiesFilePath = null;
+	private static SortedProperties mainProperties = null;
+	
+	private static String mainBackupPropertiesFilePath = null;
+	private static SortedProperties mainBackupProperties = null;
+	
+	private static String propertiesMetaDataFilePath = null;
+	private static PropertiesMetaData mainMetaData = null;
+	
+	private static String orgBackupPropertiesFilePath = null;
+	private static SortedProperties orgBackupProperties = null;
+	
+	private static String orgMetaDataFilePath = null;
+	private static PropertiesMetaData orgMetaData = null;
+	
+	private static Logger logMetacat = Logger.getLogger(PropertyService.class);
+
+	/**
+	 * private constructor since this is a singleton
+	 * 
+	 * @param servletContext the context we will use to get relative paths
+	 */
+	private PropertyService(ServletContext servletContext) throws ServiceException {
+		try {
+		initialize(servletContext);
+		} catch (GeneralPropertyException gpe) {
+			throw new ServiceException("Properties problem while initializing PropertyService: " + gpe.getMessage());
+		} catch (IOException ioe) {
+			throw new ServiceException("I/O Problem while initializing PropertyService: " + ioe.getMessage());
+		}
+	}
+	
+	/**
+	 * Get the single instance of AuthAdmin.
+	 * 
+	 * @param servletContext the context we will use to get relative paths
+	 * @return the single instance of AuthAdmin
+	 */
+	public static PropertyService getInstance(ServletContext servletContext) throws ServiceException {
+		if (propertyService == null) {
+			propertyService = new PropertyService(servletContext);
+		}
+		return propertyService;
+	}
+	
+	/**
+	 * Initialize the singleton.
+	 * 
+	 * @param servletContext the context we will use to get relative paths
+	 */
+	public void initialize(ServletContext servletContext)
+			throws IOException, GeneralPropertyException {
+		
+		logMetacat.debug("Initializing PropertyService");
+
+		// mainProperties will hold the primary configuration values for metacat.
+		mainPropertiesFilePath = servletContext.getRealPath(CONFIG_DIR) + FileUtil.getFS() + MAIN_CONFIG_NAME;
+		if (mainProperties == null) {
+			mainProperties = new SortedProperties(mainPropertiesFilePath);
+			mainProperties.load();
+		}
+
+		try {
+			// mainMetaData holds configuration information about main properties.
+			// This is primarily used to display input fields on the configuration
+			// page. The information is retrieved from an xml metadata file
+			propertiesMetaDataFilePath = servletContext.getRealPath(CONFIG_DIR) + FileUtil.getFS() + MAIN_CONFIG_NAME + ".metadata.xml";
+			if (mainMetaData == null) {
+				mainMetaData = new PropertiesMetaData(propertiesMetaDataFilePath);
+			}
+
+			// orgMetaData holds configuration information about organization level 
+			// properties.  these are mostly ldap information relative to an 
+			// organization. This is primarily used to display input fields on 
+			// the organization configuration page. The information is retrieved 
+			// from an xml metadata file dedication just to organization properties.
+			orgMetaDataFilePath = servletContext.getRealPath(CONFIG_DIR) + FileUtil.getFS() + ORG_CONFIG_NAME + ".metadata.xml";
+			if (orgMetaData == null) {
+				orgMetaData = new PropertiesMetaData(orgMetaDataFilePath);
+			}
+		} catch (TransformerException te) {
+			throw new GeneralPropertyException(te.getMessage());
+		}
+
+		String backupDirPath = getBackupDir();
+		
+		// The mainBackupProperties hold properties that were backed up the 
+		// last time the application was configured.  On disk, the file will
+		// look like a smaller version of metacat.properties.  It is stored 
+		// in the data storage directory outside the application directories.
+		mainBackupPropertiesFilePath = backupDirPath + FileUtil.getFS() + MAIN_CONFIG_NAME + ".backup";
+		if (mainBackupProperties == null) {
+			mainBackupProperties = 
+				new SortedProperties(mainBackupPropertiesFilePath);
+			mainBackupProperties.load();
+		}
+		
+		// The orgBackupProperties hold properties that were backed up the 
+		// last time the organizations were configured.  On disk, the file will
+		// look like a smaller version of metacat.properties.  It is stored 
+		// in the data storage directory outside the application directories.
+		orgBackupPropertiesFilePath = backupDirPath + FileUtil.getFS() +  ORG_CONFIG_NAME + ".backup";
+		if (orgBackupProperties == null) {
+			orgBackupProperties = 
+				new SortedProperties(orgBackupPropertiesFilePath);
+			orgBackupProperties.load();
+		}
+	
+	}
+
+	/**
+	 * Utility method to get a property value from the properties file
+	 * 
+	 * @param propertyName
+	 *            the name of the property requested
+	 * @return the String value for the property
+	 */
+	public static String getProperty(String propertyName)
+			throws PropertyNotFoundException {
+		return mainProperties.getProperty(propertyName);
+	}
+	
+	/**
+     * Get a set of all property names.
+     * 
+     * @return Set of property names  
+     */
+    public static Vector<String> getPropertyNames() {   	
+    	return mainProperties.getPropertyNames();
+    }
+    
+
+	/**
+	 * Get a Set of all property names that start with the groupName prefix.
+	 * 
+	 * @param groupName
+	 *            the prefix of the keys to search for.
+	 * @return enumeration of property names
+	 */
+    public static Vector<String> getPropertyNamesByGroup(String groupName) {   	
+    	return mainProperties.getPropertyNamesByGroup(groupName);
+    }
+
+	/**
+	 * Utility method to set a property value both in memory and to the
+	 * properties file
+	 * 
+	 * @param propertyName
+	 *            the name of the property requested
+	 * @param newValue
+	 *            the new value for the property
+	 */
+	public static void setProperty(String propertyName, String newValue) throws IOException {
+		mainProperties.setProperty(propertyName, newValue);
+		mainProperties.store();
+
+	}
+
+	/**
+	 * Utility method to set a property value in memory. This will NOT cause the
+	 * property to be written to disk. Use this method to set multiple
+	 * properties in a row without causing excessive I/O. You must call
+	 * persistProperties() once you're done setting properties to have them
+	 * written to disk.
+	 * 
+	 * @param propertyName
+	 *            the name of the property requested
+	 * @param newValue
+	 *            the new value for the property
+	 */
+	public static void setPropertyNoPersist(String propertyName, String newValue) {
+		mainProperties.setPropertyNoPersist(propertyName, newValue);
+	}
+
+	/**
+	 * Save the properties to a properties file. Note, the 
+	 * order and comments will be preserved.
+	 */
+	public static void persistProperties() throws IOException {
+		mainProperties.store();
+	}
+
+	/**
+	 * Get the main backup properties file. These are configurable properties that
+	 * are stored outside the metacat install directories so the user does not
+	 * need to re-enter all the configuration information every time they do an
+	 * upgrade.
+	 * 
+	 * @return a SortedProperties object with the backup properties
+	 */
+	public static SortedProperties getMainBackupProperties() {
+		return mainBackupProperties;
+	}
+	
+	/**
+	 * Get the organizational backup properties file. These are configurable 
+	 * properties that are stored outside the metacat install directories so 
+	 * the user does not need to re-enter all the configuration information 
+	 * every time they do an upgrade.
+	 * 
+	 * @return a SortedProperties object with the backup properties
+	 */
+	public static SortedProperties getOrgBackupProperties() {
+		return orgBackupProperties;
+	}
+	
+	/**
+	 * Get the main properties metadata. This is retrieved from an xml file that
+	 * describes the attributes of configurable properties.
+	 * 
+	 * @return a PropertiesMetaData object with the main properties metadata
+	 */
+	public static PropertiesMetaData getMainMetaData() {
+		return mainMetaData;
+	}
+	
+	/**
+	 * Get the organization properties metadata. This is retrieved from an xml
+	 * file that describes the attributes of configurable properties.
+	 * 
+	 * @return a PropertiesMetaData object with the organization properties
+	 *         metadata
+	 */
+	public static PropertiesMetaData getOrgMetaData() {
+		return orgMetaData;
+	}
+	
+	/**
+	 * Writes out backup configurable properties to a file.
+	 */
+	public static void persistMainBackupProperties(ServletContext servletContext)
+			throws GeneralPropertyException {
+
+		// Use the metadata to extract configurable properties from the 
+		// overall properties list, and store those properties.
+		try {
+			SortedProperties backupProperties = new SortedProperties(mainBackupPropertiesFilePath);
+			
+			// Populate the backup properties for main metacat properties using
+			// the associated metadata file
+			PropertiesMetaData mainMetadata = new PropertiesMetaData(propertiesMetaDataFilePath);
+			Set<String> mainKeySet = mainMetadata.getKeys();
+			for (String propertyKey : mainKeySet) {
+				backupProperties.setProperty(propertyKey, getProperty(propertyKey));
+			}
+			
+			// store the properties to file
+			backupProperties.store();
+
+		} catch (TransformerException te) {
+			throw new GeneralPropertyException("Could not transform backup properties xml: "
+					+ te.getMessage());
+		} catch (IOException ioe) {
+			throw new GeneralPropertyException("Could not backup configurable properties: "
+					+ ioe.getMessage());
+		}
+	}
+	
+	/**
+	 * Writes out backup configurable properties to a file.
+	 */
+	public static void persistOrgBackupProperties(ServletContext servletContext)
+			throws GeneralPropertyException {
+
+		// Use the metadata to extract configurable properties from the 
+		// overall properties list, and store those properties.
+		try {
+			SortedProperties backupProperties = 
+				new SortedProperties(orgBackupPropertiesFilePath);
+			
+			// Populate the backup properties for organization properties using
+			// the associated metadata file
+			PropertiesMetaData orgMetadata = new PropertiesMetaData(orgMetaDataFilePath);
+			
+			// Here we get the group definition for group 1 from the org
+			// metadata.  Group 1 should be global values across all 
+			// organizations.  We then get all properties metadata associated 
+			// with group 1, iterate through it and set it in the backup
+			// properties.
+			MetaDataGroup globalGroup = orgMetadata.getGroup(1);
+			SortedMap<Integer, MetaDataProperty> globalPropertyMap = 
+				orgMetadata.getPropertiesInGroup(globalGroup.getIndex());
+			for (MetaDataProperty property : globalPropertyMap.values()) {
+				String orgPropertyName = property.getKey();
+				backupProperties.setProperty(orgPropertyName, getProperty(orgPropertyName));
+			}
+			
+			// We do the same thing here for organization specific properies
+			// with the addition that we need to iterate through all available 
+			// organizations.  For instance, a metadata section that defines a 
+			// property as "ldap.base" will be entered into the metacat.properties
+			// file with a key of "ldap.base.NCEAS" for the NCEAS organization. 
+			// This will be repeated for all available organizations.
+			MetaDataGroup orgGroup = orgMetadata.getGroup(2);
+			SortedMap<Integer, MetaDataProperty> orgPropertyMap = orgMetadata
+					.getPropertiesInGroup(orgGroup.getIndex());
+			for (String orgName : LDAPUtil.getOrganizations()) {
+				for (MetaDataProperty property : orgPropertyMap.values()) {
+					String orgPropertyName = property.getKey() + "." + orgName;
+					backupProperties.setProperty(orgPropertyName, getProperty(orgPropertyName));
+				}
+			}
+			
+			// store the properties to file
+			backupProperties.store();
+
+		} catch (TransformerException te) {
+			throw new GeneralPropertyException("Could not transform backup properties xml: "
+					+ te.getMessage());
+		} catch (IOException ioe) {
+			throw new GeneralPropertyException("Could not backup configurable properties: "
+					+ ioe.getMessage());
+		} catch (UtilException ue) {
+			throw new GeneralPropertyException("Could not get organizations: " + ue.getMessage());
+		}
+	}
+
+	/**
+	 * Gets the backup properties directory
+	 * 
+	 * TODO MCD figure out how to expand this.  At least for Windows
+	 * 
+	 * @return a string which holds the name of the backup directory. returns
+	 *         null if directory could not be created.
+	 */
+	public static String getBackupDir() {
+		return "/var/metacat/.metacat";
+	}
+	
+	/**
+	 * Reports whether properties are fully configured.
+	 * 
+	 * @return a boolean that is true if properties are not unconfigured and
+	 *         false otherwise
+	 */
+	public static boolean arePropertiesConfigured() throws UtilException {
+		try {
+			return !PropertyService.getProperty("configutil.propertiesConfigured").equals(
+					PropertyService.UNCONFIGURED);
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not determine if properties are configured: "
+					+ pnfe.getMessage());
+		}
+	}
+	
+	/**
+	 * Take input from the user in an HTTP request about an property to be changed
+	 * and update the metacat property file with that new value if it has
+	 * changed from the value that was originally set.
+	 * 
+	 * @param request
+	 *            that was generated by the user
+	 * @param response
+	 *            to send output back to the user
+	 * @param propertyName
+	 *            the name of the property to be checked and set
+	 */
+	public static void checkAndSetProperty(HttpServletRequest request,String propertyName) 
+			throws GeneralPropertyException {
+		String value = PropertyService.getProperty(propertyName);
+		String newValue = request.getParameter(propertyName);
+		if (newValue != null && !newValue.equals(value)) {
+			PropertyService.setPropertyNoPersist(propertyName, newValue);
+		}
+	}
+
+}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/service/PropertyService.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
Index: src/edu/ucsb/nceas/metacat/ForceReplicationHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ForceReplicationHandler.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/ForceReplicationHandler.java	(revision 4080)
@@ -39,6 +39,9 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+
 /**
  * A class to asyncronously force the replication of each server
  * that has an entry in the xml_replication table.  When run,
@@ -49,7 +52,6 @@
 public class ForceReplicationHandler implements Runnable
 {
   private Thread btThread;
-  private MetaCatUtil util = new MetaCatUtil();
   private String docid;
   private String action;
   private boolean xmlDocument;
@@ -146,223 +148,198 @@
   {
 
     
-      // URL for notifcation
-      URL comeAndGetIt = null;
-      // If no server in xml_replication table, metacat don't need do anything
-      if (serverLists.isEmpty())
-      {
-        return;
-      }
+	    // URL for notifcation
+	    URL comeAndGetIt = null;
+		// If no server in xml_replication table, metacat don't need do anything
+		if (serverLists.isEmpty()) {
+			return;
+		}
 
-      // Thread seelping for some seconds to make sure the document was insert
-      // into the database before we send force replication request
-      int sleepTime = Integer.parseInt
-                         (MetaCatUtil.getOption("forcereplicationwaitingtime"));
-      try
-      {
-        Thread.sleep(sleepTime);
-      }
-      catch(Exception ee)
-      {
-        logMetacat.error("Couldn't sleep in force replication");
-      }
-      logMetacat.info("notification server:"+notificationServer);
-      // Check every server in the serverlists
-      for (int i=0; i<serverLists.size(); i++)
-      {
-        //Set comeAndGetIt null
-        comeAndGetIt = null;
-         // Get ReplicationServer object in index i
-        ReplicationServer replicationServer = serverLists.serverAt(i);
-        // Get this ReplicationServer 's name
-        String server = replicationServer.getServerName();
-        try
-        {
-        
+		// Thread seelping for some seconds to make sure the document was insert
+		// into the database before we send force replication request
+		int sleepTime;
+		try {
+			sleepTime = Integer.parseInt(PropertyService
+					.getProperty("forcereplicationwaitingtime"));
+			Thread.sleep(sleepTime);
+		} catch (Exception ee) {
+			logMetacat.error("Couldn't sleep in force replication");
+		}
+		logMetacat.info("notification server:" + notificationServer);
+		// Check every server in the serverlists
+		for (int i = 0; i < serverLists.size(); i++) {
+			//Set comeAndGetIt null
+			comeAndGetIt = null;
+			// Get ReplicationServer object in index i
+			ReplicationServer replicationServer = serverLists.serverAt(i);
+			// Get this ReplicationServer 's name
+			String server = replicationServer.getServerName();
+			try {
 
-        // If the server is the notification server, we don't notify it back
-        // again, if server is null we don't replication it
-        if (server!=null && !server.equals(notificationServer))
-        {
+				// If the server is the notification server, we don't notify it back
+				// again, if server is null we don't replication it
+				if (server != null && !server.equals(notificationServer)) {
 
-          if(dbactionFlag)
-          {
-            // xml documents and server can replicate xml doucment
-            if (xmlDocument && replicationServer.getReplication())
-            {
-              // If this docid's homeserver is localhost, replicate it
-              if (homeServerCode==1)
-              {
-                MetacatReplication.replLog("force xml replicating to "
-                                                                    + server);
-                comeAndGetIt = new URL("https://" + server +
-                                 "?action=forcereplicate&server=" +
-                                  util.getLocalReplicationServerName()+
-                                 "&docid=" + docid + "&dbaction=" +
-                                  action);
-                //over write the url for delete
-                if (action != null && action.equals(DELETE))
-                {
-                  comeAndGetIt = new URL("https://" + server + "?action=" +
-                                   MetacatReplication.FORCEREPLICATEDELETE +
-                                  "&docid=" + docid +"&server="+ util.getLocalReplicationServerName());
+					if (dbactionFlag) {
+						// xml documents and server can replicate xml doucment
+						if (xmlDocument && replicationServer.getReplication()) {
+							// If this docid's homeserver is localhost, replicate it
+							if (homeServerCode == 1) {
+								MetacatReplication.replLog("force xml replicating to "
+										+ server);
+								comeAndGetIt = new URL("https://" + server
+										+ "?action=forcereplicate&server="
+										+ MetaCatUtil.getLocalReplicationServerName()
+										+ "&docid=" + docid + "&dbaction=" + action);
+								//over write the url for delete
+								if (action != null && action.equals(DELETE)) {
+									comeAndGetIt = new URL("https://" + server
+											+ "?action="
+											+ MetacatReplication.FORCEREPLICATEDELETE
+											+ "&docid=" + docid + "&server="
+											+ MetaCatUtil.getLocalReplicationServerName());
 
-                }
-              }//if servercode==1
-              else if (replicationServer.getHub()||
-                   server.equals(MetacatReplication.
-                                  getServerNameForServerCode(homeServerCode)))
-              {
-                // If the docid's home server is not local host, but local host
-                // is a hub of this server, replicate the docid too.
-                // If the server is homeserver of the docid, replication it too
-                MetacatReplication.replLog("force xml replicating to "
-                                                                    + server);
-                comeAndGetIt = new URL("https://" + server +
-                                 "?action=forcereplicate&server=" +
-                                 util.getLocalReplicationServerName() +
-                                 "&docid=" + docid + "&dbaction=" +
-                                  action);
-                //over write the url for delete
-               if (action != null && action.equals(DELETE))
-               {
-                  comeAndGetIt = new URL("https://" + server + "?action=" +
-                            MetacatReplication.FORCEREPLICATEDELETE +
-                           "&docid=" + docid+"&server="+ util.getLocalReplicationServerName());
+								}
+							}//if servercode==1
+							else if (replicationServer.getHub()
+									|| server.equals(MetacatReplication
+											.getServerNameForServerCode(homeServerCode))) {
+								// If the docid's home server is not local host, but local host
+								// is a hub of this server, replicate the docid too.
+								// If the server is homeserver of the docid, replication it too
+								MetacatReplication.replLog("force xml replicating to "
+										+ server);
+								comeAndGetIt = new URL("https://" + server
+										+ "?action=forcereplicate&server="
+										+ MetaCatUtil.getLocalReplicationServerName()
+										+ "&docid=" + docid + "&dbaction=" + action);
+								//over write the url for delete
+								if (action != null && action.equals(DELETE)) {
+									comeAndGetIt = new URL("https://" + server
+											+ "?action="
+											+ MetacatReplication.FORCEREPLICATEDELETE
+											+ "&docid=" + docid + "&server="
+											+ MetaCatUtil.getLocalReplicationServerName());
 
-                }
-              }//else
+								}
+							}//else
 
-            }//if xmlDocument
-            //It is data file and configured to handle data replication
-            else if (replicationServer.getDataReplication())
-            {
-              // If the docid's home server is local host, replicate the docid
-              if (homeServerCode==1)
-              {
-                MetacatReplication.replLog("force data replicating to "
-                                                                      + server);
-                comeAndGetIt = new URL("https://" + server +
-                                 "?action=forcereplicatedatafile&server=" +
-                                 util.getLocalReplicationServerName() +
-                                 "&docid=" + docid + "&dbaction=" +
-                                  action);
-                //over write the url for delete
-               if (action != null && action.equals(DELETE))
-               {
-                 comeAndGetIt = new URL("https://" + server + "?action=" +
-                                 MetacatReplication.FORCEREPLICATEDELETE +
-                                 "&docid=" + docid +"&server="+ util.getLocalReplicationServerName());
+						}//if xmlDocument
+						//It is data file and configured to handle data replication
+						else if (replicationServer.getDataReplication()) {
+							// If the docid's home server is local host, replicate the docid
+							if (homeServerCode == 1) {
+								MetacatReplication.replLog("force data replicating to "
+										+ server);
+								comeAndGetIt = new URL("https://" + server
+										+ "?action=forcereplicatedatafile&server="
+										+ MetaCatUtil.getLocalReplicationServerName()
+										+ "&docid=" + docid + "&dbaction=" + action);
+								//over write the url for delete
+								if (action != null && action.equals(DELETE)) {
+									comeAndGetIt = new URL("https://" + server
+											+ "?action="
+											+ MetacatReplication.FORCEREPLICATEDELETE
+											+ "&docid=" + docid + "&server="
+											+ MetaCatUtil.getLocalReplicationServerName());
 
-               }
+								}
 
-              }//if serverCode==1
-              else if (replicationServer.getHub()||
-                server.equals(MetacatReplication.
-                                    getServerNameForServerCode(homeServerCode)))
-              {
-                // If the docid's home server is not local host, but local host
-                // is a hub of this server, replicate the docid too.
-                // If the server is homeserver of the docid replication it too
-                 MetacatReplication.replLog("force data replicating to "
-                                                                      + server);
-                comeAndGetIt = new URL("https://" + server +
-                                 "?action=forcereplicatedatafile&server=" +
-                                 util.getLocalReplicationServerName() +
-                                 "&docid=" + docid + "&dbaction=" +
-                                  action);
-                //over write the url for delete
-               if (action != null && action.equals(DELETE))
-               {
-                  comeAndGetIt = new URL("https://" + server + "?action=" +
-                         MetacatReplication.FORCEREPLICATEDELETE +
-                        "&docid=" + docid+"&server="+ util.getLocalReplicationServerName());
+							}//if serverCode==1
+							else if (replicationServer.getHub()
+									|| server.equals(MetacatReplication
+											.getServerNameForServerCode(homeServerCode))) {
+								// If the docid's home server is not local host, but local host
+								// is a hub of this server, replicate the docid too.
+								// If the server is homeserver of the docid replication it too
+								MetacatReplication.replLog("force data replicating to "
+										+ server);
+								comeAndGetIt = new URL("https://" + server
+										+ "?action=forcereplicatedatafile&server="
+										+ MetaCatUtil.getLocalReplicationServerName()
+										+ "&docid=" + docid + "&dbaction=" + action);
+								//over write the url for delete
+								if (action != null && action.equals(DELETE)) {
+									comeAndGetIt = new URL("https://" + server
+											+ "?action="
+											+ MetacatReplication.FORCEREPLICATEDELETE
+											+ "&docid=" + docid + "&server="
+											+ MetaCatUtil.getLocalReplicationServerName());
 
-               }
+								}
 
-              }//else if servercode==1
-            }//else if data file
+							}//else if servercode==1
+						}//else if data file
 
-          }//if has explicite action
-          else
-          { // has implicite action
-            MetacatReplication.replLog("force replicating (default action) to )"
-                                                + server);
-            // this docid is xml documents and can replicate xml doucment
-            if (xmlDocument && replicationServer.getReplication())
-            {
-              // If homeserver of this doicd is local, replicate it
-              if (homeServerCode ==1)
-              {
-                comeAndGetIt = new URL("https://" + server +
-                                 "?action=forcereplicate&server=" +
-                                 util.getLocalReplicationServerName()+
-                                 "&docid=" + docid);
+					}//if has explicite action
+					else { // has implicite action
+						MetacatReplication
+								.replLog("force replicating (default action) to )"
+										+ server);
+						// this docid is xml documents and can replicate xml doucment
+						if (xmlDocument && replicationServer.getReplication()) {
+							// If homeserver of this doicd is local, replicate it
+							if (homeServerCode == 1) {
+								comeAndGetIt = new URL("https://" + server
+										+ "?action=forcereplicate&server="
+										+ MetaCatUtil.getLocalReplicationServerName()
+										+ "&docid=" + docid);
 
-              }//if homeserver ==1
-              else if (replicationServer.getHub()||
-                   server.equals(MetacatReplication.
-                   getServerNameForServerCode(homeServerCode)))
-              {
-                // If home server of this docid is not local host, but local
-                // host is a hub for this server, replicate this doicd
-                // If the server is homeserver of the docid, replication it too
-                comeAndGetIt = new URL("https://" + server +
-                                 "?action=forcereplicate&server=" +
-                                 util.getLocalReplicationServerName() +
-                                 "&docid=" + docid);
+							}//if homeserver ==1
+							else if (replicationServer.getHub()
+									|| server.equals(MetacatReplication
+											.getServerNameForServerCode(homeServerCode))) {
+								// If home server of this docid is not local host, but local
+								// host is a hub for this server, replicate this doicd
+								// If the server is homeserver of the docid, replication it too
+								comeAndGetIt = new URL("https://" + server
+										+ "?action=forcereplicate&server="
+										+ MetaCatUtil.getLocalReplicationServerName()
+										+ "&docid=" + docid);
 
-              }//else if
+							}//else if
 
-            }//if xmlDoucment
-            else if (replicationServer.getDataReplication())
-            { //It is datafile and server is configured to replicate data file
+						}//if xmlDoucment
+						else if (replicationServer.getDataReplication()) { //It is datafile and server is configured to replicate data file
 
-              //if home server is local host, replicate the data file
-              if (homeServerCode ==1)
-              {
-                comeAndGetIt = new URL("https://" + server +
-                                 "?action=forcereplicatedatafile&server=" +
-                                 util.getLocalReplicationServerName() +
-                                 "&docid=" + docid);
-              }//if
-              else if (replicationServer.getHub()||
-                          server.equals(MetacatReplication.
-                          getServerNameForServerCode(homeServerCode)))
-              {
-                // If home server is not local host, but the local host is a hub
-                // For this server, replicate the data file
-                // If the server is homeserver of the docid, replication it too
-                comeAndGetIt = new URL("https://" + server +
-                                 "?action=forcereplicatedatafile&server=" +
-                                 util.getLocalReplicationServerName() +
-                                 "&docid=" + docid);
+							//if home server is local host, replicate the data file
+							if (homeServerCode == 1) {
+								comeAndGetIt = new URL("https://" + server
+										+ "?action=forcereplicatedatafile&server="
+										+ MetaCatUtil.getLocalReplicationServerName()
+										+ "&docid=" + docid);
+							}//if
+							else if (replicationServer.getHub()
+									|| server.equals(MetacatReplication
+											.getServerNameForServerCode(homeServerCode))) {
+								// If home server is not local host, but the local host is a hub
+								// For this server, replicate the data file
+								// If the server is homeserver of the docid, replication it too
+								comeAndGetIt = new URL("https://" + server
+										+ "?action=forcereplicatedatafile&server="
+										+ MetaCatUtil.getLocalReplicationServerName()
+										+ "&docid=" + docid);
 
-              }//else
-            }//else if
-          }//else has implicit action
+							}//else
+						}//else if
+					}//else has implicit action
 
-          //Make sure comeAndGetIt is not empty
-          if ( comeAndGetIt != null && !comeAndGetIt.equals(""))
-          {
-            logMetacat.warn("sending message: "
-                                                + comeAndGetIt.toString());
-            String message = MetacatReplication.getURLContent(comeAndGetIt);
-          }
-          //send out the url.  message is a dummy variable as the target of
-          //the URL never directly replies to the request.  this simply
-          //invoces a read request from the server to this local machine.
-         }//if notification server
-        }
-        catch (Exception ee)
-        {
-        	logMetacat.error("error in ForceReplicationHandler.run for server " 
-                    + server +" "+ee.getMessage());
-             ee.printStackTrace();
-        }
-      }//for
+					//Make sure comeAndGetIt is not empty
+					if (comeAndGetIt != null && !comeAndGetIt.equals("")) {
+						logMetacat.warn("sending message: " + comeAndGetIt.toString());
+						String message = MetacatReplication.getURLContent(comeAndGetIt);
+					}
+					//send out the url.  message is a dummy variable as the target of
+					//the URL never directly replies to the request.  this simply
+					//invoces a read request from the server to this local machine.
+				}//if notification server
+			} catch (Exception ee) {
+				logMetacat.error("error in ForceReplicationHandler.run for server "
+						+ server + " " + ee.getMessage());
+				ee.printStackTrace();
+			}
+		}//for
 
-   
-      logMetacat.warn("exiting ForceReplicationHandler Thread");
-  }//run
+		logMetacat.warn("exiting ForceReplicationHandler Thread");
+	}//run
 }//ForceReplication class
Index: src/edu/ucsb/nceas/metacat/util/RequestUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/RequestUtil.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/RequestUtil.java	(revision 4080)
@@ -0,0 +1,162 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements administrative methods 
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.util;
+
+import java.io.IOException;
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+public class RequestUtil {
+	
+	private static Logger logMetacat = Logger.getLogger(RequestUtil.class);
+	
+	/**
+	 * private constructor - all methods are static so there is no
+     * no need to instantiate.
+	 */
+	private RequestUtil() {}
+	
+	/**
+	 * Forward a request that was received by this servlet on to another JSP
+	 * page or servlet to continue handling the request.
+	 * 
+	 * @param request
+	 *            to be forwarded
+	 * @param response
+	 *            that can be used for writing output to the client
+	 * @param destination
+	 *            the context-relative URL to which the request is forwarded
+	 */
+	public static void forwardRequest(HttpServletRequest request,
+			HttpServletResponse response, String destination)
+			throws IOException, ServletException {
+
+		logMetacat.debug("Forwarding request to " + destination);
+		ServletContext servletContext = request.getSession()
+				.getServletContext();
+
+		servletContext.getRequestDispatcher(destination).forward(request,
+				response);
+	}
+	
+	/**
+	 * Add a list of errors to the request. The pages will pick up the errors
+	 * and display them where appropriate.
+	 * 
+	 * @param request
+	 *            the request that will get forwarded
+	 * @param errorVector
+	 *            a list of error strings
+	 */
+	public static void setRequestErrors(HttpServletRequest request,
+			Vector<String> errorVector) {
+		request.setAttribute("formErrors", "true");
+		request.setAttribute("processingErrors", errorVector);
+	}
+	
+	/**
+	 * Add a list of form errors to the request. The pages will pick up the
+	 * errors and display them where appropriate.
+	 * 
+	 * @param request
+	 *            the request that will get forwarded
+	 * @param errorVector
+	 *            a list of form error strings
+	 */
+	public static void setRequestFormErrors(HttpServletRequest request,
+			Vector<String> errorVector) {
+		request.setAttribute("formErrors", "true");
+		request.setAttribute("formFieldErrors", errorVector);
+	}
+	
+	/**
+	 * Add a list of success messages to the request. The pages will pick up the
+	 * messages and display them where appropriate.
+	 * 
+	 * @param request
+	 *            the request that will get forwarded
+	 * @param errorVector
+	 *            a list of success message strings
+	 */
+	public static void setRequestSuccess(HttpServletRequest request,
+			Vector<String> successVector) {
+		request.setAttribute("formSuccess", "true");
+		request.setAttribute("processingSuccess", successVector);
+	}
+	
+	/**
+	 * Add a list of general messages to the request. The pages will pick up the
+	 * messages and display them where appropriate.
+	 * 
+	 * @param request
+	 *            the request that will get forwarded
+	 * @param errorVector
+	 *            a list of general message strings
+	 */
+	public static void setRequestMessage(HttpServletRequest request,
+			Vector<String> messageVector) {
+		request.setAttribute("formMessage", "true");
+		request.setAttribute("processingMessage", messageVector);
+	}
+	
+	/**
+	 * Add a list of general messages to the request. The pages will pick up the
+	 * messages and display them where appropriate.
+	 * 
+	 * @param request
+	 *            the request that will get forwarded
+	 * @param errorVector
+	 *            a list of general message strings
+	 */
+	public static void clearRequestMessages(HttpServletRequest request) {
+		request.setAttribute("formMessage", null);
+		request.setAttribute("formSuccess", null);
+		request.setAttribute("formErrors", null);
+		request.setAttribute("processingMessage", null);
+		request.setAttribute("processingSuccess", null);
+		request.setAttribute("formFieldErrors", null);
+		request.setAttribute("processingErrors", null);
+	}
+	
+	/**
+	 * Add the user's login id to the session on this request
+	 * 
+	 * @param request
+	 *            the request that will get forwarded
+	 * @param userId
+	 *            the user's login id
+	 */
+	public static void setUserId(HttpServletRequest request, String userId) {
+		request.getSession().setAttribute("userId", userId);
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/RequestUtil.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
Index: src/edu/ucsb/nceas/metacat/util/UtilException.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/UtilException.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/UtilException.java	(revision 4080)
@@ -0,0 +1,44 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: An Exception thrown when an error occurs because an 
+ *             AccessionNumber was invalid or used incorrectly
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.util;
+/**
+ * Exception thrown when an error occurs in a utility method
+ */
+public class UtilException extends Exception {
+
+	private static final long serialVersionUID = -253071242028406390L;
+
+    /**
+	 * Create a new AdminException.
+	 *
+	 * @param message The error or warning message.
+	 */
+	public UtilException(String message) {
+		super(message);
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/UtilException.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
Index: src/edu/ucsb/nceas/metacat/AuthLdap.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AuthLdap.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/AuthLdap.java	(revision 4080)
@@ -50,6 +50,10 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
+import java.lang.InstantiationException;
 import java.net.URLDecoder;
 import java.util.Iterator;
 import java.util.HashMap;
@@ -65,7 +69,6 @@
  * is authenticated, and whether they are a member of a particular group.
  */
 public class AuthLdap implements AuthInterface {
-  private MetaCatUtil util = new MetaCatUtil();
   private String ldapUrl;
   private String ldapsUrl;
   private String ldapBase;
@@ -83,34 +86,48 @@
 
   private static Logger logMetacat = Logger.getLogger(AuthLdap.class);
   
-  /**
-   * Construct an AuthLdap
-   */
-  public AuthLdap() {
-    // Read LDAP URI for directory service information
-    this.ldapUrl = MetaCatUtil.getOption("ldapurl");
-    this.ldapsUrl = MetaCatUtil.getOption("ldapsurl");
-    this.ldapBase = MetaCatUtil.getOption("ldapbase");
-    this.referral = MetaCatUtil.getOption("referral");
-    this.ldapConnectTimeLimit = 
-      MetaCatUtil.getOption("ldapconnecttimelimit");
-    this.ldapSearchTimeLimit = Integer.parseInt(
-      MetaCatUtil.getOption("ldapsearchtimelimit"));
-    this.ldapSearchCountLimit = Integer.parseInt(
-      MetaCatUtil.getOption("ldapsearchcountlimit"));
-    
-    // Store referral info for use in building group DNs in getGroups() 
-    this.currentReferralInfo = "";
-  }
+    /**
+	 * Construct an AuthLdap
+	 */
+	public AuthLdap() throws InstantiationException {
+		// Read LDAP URI for directory service information
+		try {
+			this.ldapUrl = PropertyService.getProperty("ldap.url");
+			this.ldapsUrl = PropertyService.getProperty("ldap.surl");
+			// use the NCEAS base as a fallback.  Normally, the base will be
+			// parsed from the user during authentication
+			this.ldapBase = PropertyService.getProperty("ldap.base.NCEAS");
+			this.referral = PropertyService.getProperty("ldap.referral");
+			this.ldapConnectTimeLimit = PropertyService
+					.getProperty("ldap.connectTimeLimit");
+			this.ldapSearchTimeLimit = Integer.parseInt(PropertyService
+					.getProperty("ldap.searchTimeLimit"));
+			this.ldapSearchCountLimit = Integer.parseInt(PropertyService
+					.getProperty("ldap.searchCountLimit"));
+		} catch (PropertyNotFoundException pnfe) {
+			throw new InstantiationException(
+					"Could not instantiate AuthLdap.  Property not found: "
+							+ pnfe.getMessage());
+		} catch (NumberFormatException nfe) {
+			throw new InstantiationException(
+					"Could not instantiate AuthLdap.  Bad number format when converting properties: "
+							+ nfe.getMessage());
+		}
 
+		// Store referral info for use in building group DNs in getGroups()
+		this.currentReferralInfo = "";
+	}
+
   /**
-   * Determine if a user/password are valid according to the authentication
-   * service.
-   *
-   * @param user the name of the principal to authenticate
-   * @param password the password to use for authentication
-   * @returns boolean true if authentication successful, false otherwise
-   */
+	 * Determine if a user/password are valid according to the authentication
+	 * service.
+	 * 
+	 * @param user
+	 *            the name of the principal to authenticate
+	 * @param password
+	 *            the password to use for authentication
+	 * @returns boolean true if authentication successful, false otherwise
+	 */
   
   public boolean authenticate(String user, String password) throws 
     ConnectException {
@@ -134,7 +151,7 @@
         logMetacat.info("with user as identifier: " + identifier);
 
         authenticated = ldapAuthenticate(identifier, password, 
-        		(new Boolean(MetaCatUtil.getOption("onlySecureLDAPConnection"))).booleanValue());
+        		(new Boolean(PropertyService.getProperty("ldap.onlySecureConnection"))).booleanValue());
         // if not found, try looking up a valid DN then auth again
         if (!authenticated) {
         	logMetacat.info("Not Authenticated");
@@ -167,7 +184,7 @@
         		logMetacat.info("and refBase as: " + refBase);
 
         		authenticated = ldapAuthenticate(identifier, password, refUrl, refBase,
-                		(new Boolean(MetaCatUtil.getOption("onlySecureLDAPReferalsConnection")))
+                		(new Boolean(PropertyService.getProperty("ldap.onlySecureReferalsConnection")))
                 			.booleanValue());
         	} else {
         		logMetacat.info("identifier doesnt start with ldap");
@@ -177,7 +194,7 @@
         		logMetacat.info("with user as identifier: " + identifier);
         		
         		authenticated = ldapAuthenticate(identifier, password,
-            		(new Boolean(MetaCatUtil.getOption("onlySecureLDAPConnection"))).booleanValue());
+            		(new Boolean(PropertyService.getProperty("ldap.onlySecureConnection"))).booleanValue());
         	}
         }
     } catch (NullPointerException e) {
@@ -358,40 +375,23 @@
           for (boolean moreReferrals = true; moreReferrals;) {
               try {
                   // Perform the search
-            	  logMetacat.debug("before searching for DNs with following filter: " + filter);
-            	  //logMetacat.debug("the context name space is ====== "+sctx.getNameInNamespace());
                   NamingEnumeration answer = 
                       sctx.search("", filter, ctls);
-                  logMetacat.debug("after searching for DNs with following filter: " + filter);
+
                   // Return the answer
                   while (answer.hasMore()) {
-                	  logMetacat.debug("In anwer.hasMore() while loop");
                       SearchResult sr = (SearchResult)answer.next();
                       identifier = sr.getName();
-                      logMetacat.debug("after anwer.hasMore() while loop "+identifier);
                       return identifier;
                   }
                   // The search completes with no more referrals
                   moreReferrals = false;
               } catch (ReferralException e) {
-            	  logMetacat.warn("Got referral: " + e.getReferralInfo());
+            	  logMetacat.info("Got referral: " + e.getReferralInfo());
             	  // Point to the new context from the referral
-            	  //DirContext storedConext = sctx;
-            	  try
-            	  {
-	                  if (moreReferrals) {
-	                      sctx = (DirContext) e.getReferralContext();
-	                  }
-            	  }
-            	  catch(Exception ee)
-            	  {
-            		   e.skipReferral();
-            		   if (moreReferrals) {
- 	                      sctx = (DirContext) e.getReferralContext();
- 	                   }
-            		   logMetacat.warn("Naming exception while setting context to referral: " + ee);
-            	  }
-                  logMetacat.debug("after reset new context " + e.getReferralInfo());
+                  if (moreReferrals) {
+                      sctx = (DirContext) e.getReferralContext();
+                  }
               }
           }
       } catch (NamingException e) {
@@ -847,8 +847,8 @@
                 }
                 
               } catch (NamingException nameEx){
-                logMetacat.debug("Caught naming exception1: "+nameEx.getMessage());
-                //nameEx.printStackTrace(System.err);
+                logMetacat.debug("Caught naming exception: ");
+                nameEx.printStackTrace(System.err);
               }
             }
           }// end while
@@ -865,19 +865,7 @@
           
           // set moreReferrals to true and set the referral context
           moreReferrals = true;
-          try
-          {
-              ctx = (DirContext) re.getReferralContext();
-          }
-          catch(Exception ee)
-    	  {
-    		   re.skipReferral();
-    		   if (moreReferrals) {
-                   ctx = (DirContext) re.getReferralContext();
-                }
-    		   logMetacat.error("Naming exception while setting context to referral: " + ee);
-    	  }
-          logMetacat.debug("after reset new context in referral in getGroups " );
+          ctx = (DirContext) re.getReferralContext();
            
         }// end inner try
       }// end for
@@ -889,8 +877,8 @@
     } catch (NamingException e) {
       
       // naming exceptions get logged, groups are returned
-      logMetacat.info("In AuthLdap.getGroups()2, caught naming exception: "+e.getMessage());
-      //e.printStackTrace(System.err);
+      logMetacat.info("In AuthLdap.getGroups(), caught naming exception: ");
+      e.printStackTrace(System.err);
       
     } finally {
       // once all referrals are followed, report and return the groups found
@@ -1220,112 +1208,168 @@
     return -1;
   }
 
-  /**
-   * Test method for the class
-   */
-  public static void main(String[] args) {
+  public void testCredentials(String dn, String password, 
+		    String rootServer, String rootBase ) throws NamingException {
+	  
+	  String server = "";
+	  String userDN = "";
+	  logMetacat.debug("dn is: " + dn);
 
-    // Provide a user, such as: "Matt Jones", or "jones"
-    String user = args[0];
-    String password = args[1];
+	  int position = dn.lastIndexOf("/");
+      logMetacat.debug("position is: " + position);
+	  if (position == -1) {
+		  server = rootServer;
+		  if(dn.indexOf(userDN) < 0){
+			  userDN = dn + "," + rootBase;
+		  } else {
+			  userDN = dn;
+		  }
+		  logMetacat.debug("userDN is: " + userDN);
 
-    logMetacat.warn("Creating session...");
-    AuthLdap authservice = new AuthLdap();
-    logMetacat.warn("Session exists...");
+       } else {
+		  server = dn.substring(0, position+1);
+		  userDN = dn.substring(position+1);
+		  logMetacat.debug("server is: " + server);
+		  logMetacat.debug("userDN is: " + userDN);
+	   }
+		          
+	   logMetacat.debug("Trying to authenticate: " + userDN);
+	   logMetacat.debug("          Using server: " + server);
 
-    boolean isValid = false;
-    try {
-      logMetacat.warn("Authenticating...");
-      isValid = authservice.authenticate(user, password);
-      if (isValid) {
-    	  logMetacat.warn("Authentication successful for: " + user);
-      }
-      else {
-        logMetacat.warn("Authentication failed for: " + user);
-      }
+///*	   try { 
+			LdapContext ctx = null;
+			   
+			env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+	        env.put(Context.REFERRAL, "follow");
+			env.put(Context.SECURITY_AUTHENTICATION, "simple");
+			env.put(Context.SECURITY_PRINCIPAL, userDN);
+			env.put(Context.SECURITY_CREDENTIALS, password);
+			env.put(Context.PROVIDER_URL, rootServer);
 
-      // Get attributes for the user
-      if (isValid) {
-        logMetacat.info("\nGetting attributes for user....");
-        HashMap userInfo = authservice.getAttributes(user, password, user);
-        // Print all of the attributes
-        Iterator attList = (Iterator) ( ( (Set) userInfo.keySet()).iterator());
-        while (attList.hasNext()) {
-          String att = (String) attList.next();
-          Vector values = (Vector) userInfo.get(att);
-          Iterator attvalues = values.iterator();
-          while (attvalues.hasNext()) {
-            String value = (String) attvalues.next();
-            logMetacat.warn(att + ": " + value);
-          }
-        }
-      }
+			ctx = new InitialLdapContext(env, null);
 
-      // get the groups
-      if (isValid) {
-        logMetacat.warn("\nGetting all groups....");
-        String[][] groups = authservice.getGroups(user, password);
-        logMetacat.info("Groups found: " + groups.length);
-        for (int i = 0; i < groups.length; i++) {
-          logMetacat.info("Group " + i + ": " + groups[i][0]);
-        }
-      }
 
-      // get the groups for the user
-      String savedGroup = null;
-      if (isValid) {
-        logMetacat.warn("\nGetting groups for user....");
-        String[][] groups = authservice.getGroups(user, password, user);
-        logMetacat.info("Groups found: " + groups.length);
-        for (int i = 0; i < groups.length; i++) {
-          logMetacat.info("Group " + i + ": " + groups[i][0]);
-          savedGroup = groups[i][0];
-        }
-      }
+		
+  }
+   
+    /**
+	 * Test method for the class
+	 */
+	public static void main(String[] args) {
 
-      // get the users for a group
-      if (isValid) {
-        logMetacat.warn("\nGetting users for group....");
-        logMetacat.info("Group: " + savedGroup);
-        String[] users = authservice.getUsers(user, password, savedGroup);
-        logMetacat.info("Users found: " + users.length);
-        for (int i = 0; i < users.length; i++) {
-          logMetacat.warn("User " + i + ": " + users[i]);
-        }
-      }
+		// Provide a user, such as: "Matt Jones", or "jones"
+		String user = args[0];
+		String password = args[1];
+		String org = args[2];
 
-      // get all users
-      if (isValid) {
-        logMetacat.warn("\nGetting all users ....");
-        String[][] users = authservice.getUsers(user, password);
-        logMetacat.info("Users found: " + users.length);
+		logMetacat.warn("Creating session...");
+		AuthLdap authservice = null;
+		try {
+			authservice = new AuthLdap();
+		} catch (Exception e) {
+			logMetacat.error("Could not instantiate AuthLdap: "
+					+ e.getMessage());
+			return;
+		}
+		logMetacat.warn("Session exists...");
 
-      }
+		boolean isValid = false;
+		try {
+			logMetacat.warn("Authenticating...");
+			isValid = authservice.authenticate(user, password);
+			if (isValid) {
+				logMetacat.warn("Authentication successful for: " + user);
+			} else {
+				logMetacat.warn("Authentication failed for: " + user);
+			}
 
-      // get the whole list groups and users in XML format
-      if (isValid) {
-        logMetacat.warn("\nTrying principals....");
-        authservice = new AuthLdap();
-        String out = authservice.getPrincipals(user, password);
-        java.io.File f = new java.io.File("principals.xml");
-        java.io.FileWriter fw = new java.io.FileWriter(f);
-        java.io.BufferedWriter buff = new java.io.BufferedWriter(fw);
-        buff.write(out);
-        buff.flush();
-        buff.close();
-        fw.close();
-        logMetacat.warn("\nFinished getting principals.");
-      }
+			// Get attributes for the user
+			if (isValid) {
+				logMetacat.info("\nGetting attributes for user....");
+				HashMap userInfo = authservice.getAttributes(user, password,
+						user);
+				// Print all of the attributes
+				Iterator attList = (Iterator) (((Set) userInfo.keySet())
+						.iterator());
+				while (attList.hasNext()) {
+					String att = (String) attList.next();
+					Vector values = (Vector) userInfo.get(att);
+					Iterator attvalues = values.iterator();
+					while (attvalues.hasNext()) {
+						String value = (String) attvalues.next();
+						logMetacat.warn(att + ": " + value);
+					}
+				}
+			}
 
-    }
-    catch (ConnectException ce) {
-      logMetacat.error(ce.getMessage());
-    }
-    catch (java.io.IOException ioe) {
-      logMetacat.error("I/O Error writing to file principals.txt");
-    }
-  }
+			// get the groups
+			if (isValid) {
+				logMetacat.warn("\nGetting all groups....");
+				String[][] groups = authservice.getGroups(user, password);
+				logMetacat.info("Groups found: " + groups.length);
+				for (int i = 0; i < groups.length; i++) {
+					logMetacat.info("Group " + i + ": " + groups[i][0]);
+				}
+			}
 
+			// get the groups for the user
+			String savedGroup = null;
+			if (isValid) {
+				logMetacat.warn("\nGetting groups for user....");
+				String[][] groups = authservice.getGroups(user, password, user);
+				logMetacat.info("Groups found: " + groups.length);
+				for (int i = 0; i < groups.length; i++) {
+					logMetacat.info("Group " + i + ": " + groups[i][0]);
+					savedGroup = groups[i][0];
+				}
+			}
+
+			// get the users for a group
+			if (isValid) {
+				logMetacat.warn("\nGetting users for group....");
+				logMetacat.info("Group: " + savedGroup);
+				String[] users = authservice.getUsers(user, password,
+						savedGroup);
+				logMetacat.info("Users found: " + users.length);
+				for (int i = 0; i < users.length; i++) {
+					logMetacat.warn("User " + i + ": " + users[i]);
+				}
+			}
+
+			// get all users
+			if (isValid) {
+				logMetacat.warn("\nGetting all users ....");
+				String[][] users = authservice.getUsers(user, password);
+				logMetacat.info("Users found: " + users.length);
+
+			}
+
+			// get the whole list groups and users in XML format
+			if (isValid) {
+				logMetacat.warn("\nTrying principals....");
+				authservice = new AuthLdap();
+				String out = authservice.getPrincipals(user, password);
+				java.io.File f = new java.io.File("principals.xml");
+				java.io.FileWriter fw = new java.io.FileWriter(f);
+				java.io.BufferedWriter buff = new java.io.BufferedWriter(fw);
+				buff.write(out);
+				buff.flush();
+				buff.close();
+				fw.close();
+				logMetacat.warn("\nFinished getting principals.");
+			}
+
+		} catch (ConnectException ce) {
+			logMetacat.error(ce.getMessage());
+		} catch (java.io.IOException ioe) {
+			logMetacat.error("I/O Error writing to file principals.txt: "
+					+ ioe.getMessage());
+		} catch (InstantiationException ie) {
+			logMetacat.error("Instantiation error writing to file principals.txt: "
+							+ ie.getMessage());
+		}
+	}
+
   /**
    * This method will be called by start a thread.
    * It can handle if a referral exception happend.
Index: src/edu/ucsb/nceas/metacat/AccessControlForSingleFile.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AccessControlForSingleFile.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/AccessControlForSingleFile.java	(revision 4080)
@@ -36,7 +36,9 @@
 import java.net.MalformedURLException;
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 
+
 /** 
  * A Class that loads eml-access.xml file containing ACL for a metadata
  * document into relational DB. It extends DefaultHandler class to handle
Index: src/edu/ucsb/nceas/metacat/harvesterClient/HarvesterRegistration.java
===================================================================
--- src/edu/ucsb/nceas/metacat/harvesterClient/HarvesterRegistration.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/harvesterClient/HarvesterRegistration.java	(revision 4080)
@@ -750,10 +750,10 @@
       System.out.println("Error in loading options: " + e.getMessage());
     }
     
-    dbDriver = options.getOption("dbDriver");
-    defaultDB = options.getOption("defaultDB");
-    password = options.getOption("password");
-    user = options.getOption("user");
+    dbDriver = options.getOption("database.driver");
+    defaultDB = options.getOption("database.connectionURI");
+    password = options.getOption("database.password");
+    user = options.getOption("database.user");
 
     // Load the jdbc driver
     try {
Index: src/edu/ucsb/nceas/metacat/DBConnectionPool.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBConnectionPool.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBConnectionPool.java	(revision 4080)
@@ -37,6 +37,9 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /** 
  * A class represent a DBConnection pool. Another user can use the
  * object to initial a connection pool, get db connection or return it.
@@ -53,36 +56,69 @@
   private static int countOfReachMaximum = 0;
   private static Logger logMetacat = Logger.getLogger(DBConnectionPool.class);
 
-  //maximum connection number in the connection pool
-  final static int MAXIMUMCONNECTIONNUMBER=
-                  Integer.parseInt(MetaCatUtil.getOption("maximumConnections"));
+  private static int maxConnNum;
+  private static int initConnNum;
+  private static int incrConnNum;
+  private static long maxAge;
+  private static long maxConnTime;
+  private static int maxUsageNum;
+  private static String dbConnRecyclThrd;
+  private static long cyclTimeDbConn;
   
-  //inintila connection number int the connection pool
-  final static int INITIALCONNECTIONNUMBER=
-                  Integer.parseInt(MetaCatUtil.getOption("initialConnections"));
- 
-  //the number to increase connection pool size
-  final static int INCREASECONNECTIONNUMBER=
-                Integer.parseInt(MetaCatUtil.getOption("incrementConnections"));
-                
-  //maximum age for a connection (in milli seconds)
-  final static long MAXIMUMAGE =
-                  Long.parseLong(MetaCatUtil.getOption("maximumConnectionAge"));
-  //maximum connection time for a connection ( in milli second)
-  final static long MAXIMUMCONNECTIONTIME =
-                 Long.parseLong(MetaCatUtil.getOption("maximumConnectionTime"));
-  //maximum number for using a connection.
-  final static int MAXIMUMUSAGENUMBER =
-                  Integer.parseInt(MetaCatUtil.getOption("maximumUsageNumber"));
-  //the parameter if run dbconncestionrecyclethread or not
-  final static String DBCONNECTIONRECYCLETHREAD =
-                          MetaCatUtil.getOption("runDBConnectionRecycleThread");
-  //the cycle time of connection recycle action
-  final static long CYCLETIMEOFDBCONNECTION = 
-               Long.parseLong(MetaCatUtil.getOption("cycleTimeOfDBConnection"));
-               
-  //the number for trying to check out a connection in the pool in 
-  //getDBConnection method
+  final static int MAXIMUMCONNECTIONNUMBER;
+  final static int INITIALCONNECTIONNUMBER;
+  final static int INCREASECONNECTIONNUMBER;
+  final static long MAXIMUMAGE;
+  final static long MAXIMUMCONNECTIONTIME;
+  final static int MAXIMUMUSAGENUMBER;
+  final static String DBCONNECTIONRECYCLETHREAD ;
+  final static long CYCLETIMEOFDBCONNECTION;
+  
+  static {
+		int maxConnNum = 0;
+		int initConnNum = 0;
+		int incrConnNum = 0;
+		long maxAge = 0;
+		long maxConnTime = 0;
+		int maxUsageNum = 0;
+		String dbConnRecyclThrd = null;
+		long cyclTimeDbConn = 0;
+		
+		try {
+			// maximum connection number in the connection pool
+			maxConnNum = Integer.parseInt(PropertyService
+					.getProperty("database.maximumConnections"));
+			initConnNum = Integer.parseInt(PropertyService
+					.getProperty("database.initialConnections"));
+			incrConnNum = Integer.parseInt(PropertyService
+					.getProperty("database.incrementConnections"));
+			maxAge = Integer.parseInt(PropertyService
+					.getProperty("database.maximumConnections"));
+			maxConnTime = Long.parseLong(PropertyService
+					.getProperty("database.maximumConnectionTime"));
+			maxUsageNum = Integer.parseInt(PropertyService
+					.getProperty("database.maximumUsageNumber"));
+			dbConnRecyclThrd = PropertyService
+					.getProperty("database.runDBConnectionRecycleThread");
+			cyclTimeDbConn = Long.parseLong(PropertyService
+					.getProperty("database.cycleTimeOfDBConnection"));
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: "
+					+ pnfe.getMessage());
+		}
+		
+		MAXIMUMCONNECTIONNUMBER = maxConnNum;
+		INITIALCONNECTIONNUMBER = initConnNum;
+		INCREASECONNECTIONNUMBER = incrConnNum;
+		MAXIMUMAGE = maxAge;
+		MAXIMUMCONNECTIONTIME = maxConnTime;
+		MAXIMUMUSAGENUMBER = maxUsageNum;
+		DBCONNECTIONRECYCLETHREAD  = dbConnRecyclThrd;
+		CYCLETIMEOFDBCONNECTION = cyclTimeDbConn;
+	}
+  
+  // the number for trying to check out a connection in the pool in
+  // getDBConnection method
   final static int LIMIT = 2;
   
   final static int FREE = 0; //status of a connection
Index: src/edu/ucsb/nceas/metacat/DBQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 4080)
@@ -48,8 +48,12 @@
 import org.xml.sax.InputSource;
 import org.w3c.dom.ls.*;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.morpho.datapackage.Triple;
 import edu.ucsb.nceas.morpho.datapackage.TripleCollection;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 
 /**
@@ -70,8 +74,6 @@
     //private Connection conn = null;
     private String parserName = null;
 
-    private MetaCatUtil util = new MetaCatUtil();
-
     private Logger logMetacat = Logger.getLogger(DBQuery.class);
 
     /** true if the metacat spatial option is installed **/
@@ -86,7 +88,18 @@
     private static Hashtable queryResultCache = new Hashtable();
     
     // Capacity of the query result cache
-    private static final int QUERYRESULTCACHESIZE = Integer.parseInt(MetaCatUtil.getOption("queryresult_cache_size"));
+    private static final int QUERYRESULTCACHESIZE;
+    static {
+    	int qryRsltCacheSize = 0;
+    	try {
+    		qryRsltCacheSize = Integer.parseInt(PropertyService.getProperty("queryresult_cache_size"));
+    	} catch (PropertyNotFoundException pnfe) {
+    		System.err.println("Could not get QUERYRESULTCACHESIZE property in static block: "
+					+ pnfe.getMessage());
+    	}
+    	QUERYRESULTCACHESIZE = qryRsltCacheSize;
+    }
+    
 
     // Size of page for non paged query
     private static final int NONPAGESIZE = 99999999;
@@ -124,7 +137,6 @@
                 double startTime = System.currentTimeMillis();
 
                 // Open a connection to the database
-                MetaCatUtil util = new MetaCatUtil();
                 //Connection dbconn = util.openDBConnection();
 
                 double connTime = System.currentTimeMillis();
@@ -197,9 +209,9 @@
      * @param parserName the fully qualified name of a Java class implementing
      *            the org.xml.sax.XMLReader interface
      */
-    public DBQuery()
+    public DBQuery() throws PropertyNotFoundException
     {
-        String parserName = MetaCatUtil.getOption("saxparser");
+        String parserName = PropertyService.getProperty("saxparser");
         this.parserName = parserName;
     }
 
@@ -218,11 +230,11 @@
      *
      * @param docids List of docids to display in the resultset
      */
-    public DBQuery(Vector docids)
+    public DBQuery(Vector docids) throws PropertyNotFoundException
     {
     	// since the query will be too long to be handled, so we divided the 
     	// docids vector into couple vectors.
-    	int size = (new Integer(MetaCatUtil.getOption("app_resultsetsize"))).intValue();
+    	int size = (new Integer(PropertyService.getProperty("app_resultsetsize"))).intValue();
     	logMetacat.info("The size of select doicds is "+docids.size());
     	logMetacat.info("The application result size in metacat.properties is "+size);
     	Vector subset = new Vector();
@@ -256,7 +268,7 @@
     		this.docidOverride.add(docids);
     	}
         
-        String parserName = MetaCatUtil.getOption("saxparser");
+        String parserName = PropertyService.getProperty("saxparser");
         this.parserName = parserName;
     }
 
@@ -272,9 +284,9 @@
   public void findDocuments(HttpServletResponse response,
                                        PrintWriter out, Hashtable params,
                                        String user, String[] groups,
-                                       String sessionid)
+                                       String sessionid) throws PropertyNotFoundException
   {
-    boolean useXMLIndex = (new Boolean(MetaCatUtil.getOption("usexmlindex")))
+    boolean useXMLIndex = (new Boolean(PropertyService.getProperty("usexmlindex")))
                .booleanValue();
     findDocuments(response, out, params, user, groups, sessionid, useXMLIndex);
 
@@ -335,7 +347,7 @@
          {
            qspec = new QuerySpecification(xmlquery,
                                           parserName,
-                                          MetaCatUtil.getOption("accNumSeparator"));
+                                          PropertyService.getProperty("accNumSeparator"));
          }
          catch (Exception ee)
          {
@@ -372,7 +384,7 @@
 
          // if the user is a moderator, then pass a param to the 
          // xsl specifying the fact
-         if(MetaCatUtil.isModerator(user, groups)){
+         if(LDAPUtil.isModerator(user, groups)){
         	 params.put("isModerator", new String[] {"true"});
          }
 
@@ -437,8 +449,8 @@
     StringBuffer resultset = new StringBuffer();
 
     //try to get the cached version first    
-    Hashtable sessionHash = MetaCatServlet.getSessionHash();
-    HttpSession sess = (HttpSession)sessionHash.get(sessionid);
+    // Hashtable sessionHash = MetaCatServlet.getSessionHash();
+    // HttpSession sess = (HttpSession)sessionHash.get(sessionid);
 
     
     resultset.append("<?xml version=\"1.0\"?>\n");
@@ -561,12 +573,12 @@
       {
         // for html page, we put everything into one page
         offset =
-            (new Integer(MetaCatUtil.getOption("web_resultsetsize"))).intValue();
+            (new Integer(PropertyService.getProperty("web_resultsetsize"))).intValue();
       }
       else
       {
           offset =
-              (new Integer(MetaCatUtil.getOption("app_resultsetsize"))).intValue();
+              (new Integer(PropertyService.getProperty("app_resultsetsize"))).intValue();
       }
 
       /*
@@ -613,7 +625,7 @@
       String selectionAndExtendedQuery = null;
       // we only get cache for public
       if (user != null && user.equalsIgnoreCase("public") 
-     		 && pagesize == 0 && MetaCatUtil.getOption("query_cache_on").equals("true"))
+     		 && pagesize == 0 && PropertyService.getProperty("query_cache_on").equals("true"))
       {
     	  selectionAndExtendedQuery = query +qspec.getReturnDocList()+qspec.getReturnFieldList();
    	      String cachedResult = getResultXMLFromCache(selectionAndExtendedQuery);
@@ -670,7 +682,7 @@
            document = new StringBuffer();
 
            String completeDocid = docid
-                            + MetaCatUtil.getOption("accNumSeparator");
+                            + PropertyService.getProperty("accNumSeparator");
            completeDocid += rev;
            document.append("<docid>").append(completeDocid).append("</docid>");
            if (docname != null)
@@ -768,7 +780,7 @@
      
      // now we only cached none-paged query and user is public
      if (user != null && user.equalsIgnoreCase("public") 
-    		 && pagesize == NONPAGESIZE && MetaCatUtil.getOption("query_cache_on").equals("true"))
+    		 && pagesize == NONPAGESIZE && PropertyService.getProperty("query_cache_on").equals("true"))
      {
        //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
   	   storeQueryResultIntoCache(selectionAndExtendedQuery, resultsetBuffer.toString());
@@ -796,8 +808,8 @@
      boolean enterRecords = false;
 
      // get value of xml_returnfield_count
-     int count = (new Integer(MetaCatUtil
-                            .getOption("xml_returnfield_count")))
+     int count = (new Integer(PropertyService
+                            .getProperty("xml_returnfield_count")))
                             .intValue();
 
      // set enterRecords to true if usage_count is more than the offset
@@ -864,8 +876,8 @@
      String key = null;
      String element = null;
      String query = null;
-     int offset = (new Integer(MetaCatUtil
-                               .getOption("queryresult_string_length")))
+     int offset = (new Integer(PropertyService
+                               .getProperty("queryresult_string_length")))
                                .intValue();
      while (keys.hasNext())
      {
@@ -1448,7 +1460,7 @@
      * @param params The list of parameters that should be included in the
      *            query
      */
-    public static String createSQuery(Hashtable params)
+    public static String createSQuery(Hashtable params) throws PropertyNotFoundException
     {
         StringBuffer query = new StringBuffer();
         Enumeration elements;
@@ -1580,8 +1592,8 @@
 
             // Also ignore parameters listed in the properties file
             // so that they can be passed through to stylesheets
-            String paramsToIgnore = MetaCatUtil
-                    .getOption("query.ignored.params");
+            String paramsToIgnore = PropertyService
+                    .getProperty("query.ignored.params");
             StringTokenizer st = new StringTokenizer(paramsToIgnore, ",");
             while (st.hasMoreTokens()) {
                 ignoredParams.add(st.nextToken());
@@ -1983,7 +1995,7 @@
                 }
 
                 String docidPlusVersion = ((String) docIdList.elementAt(i))
-                        + MetaCatUtil.getOption("accNumSeparator") + rev;
+                        + PropertyService.getProperty("accNumSeparator") + rev;
 
                 //create new documentImpl object
                 DocumentImpl documentImplObject = new DocumentImpl(
@@ -2071,7 +2083,7 @@
         byte[] byteString = null;
         ZipEntry zEntry = null;
         // this is data file; add file to zip
-        String filePath = MetaCatUtil.getOption("datafilepath");
+        String filePath = PropertyService.getProperty("application.datafilepath");
         if (!filePath.endsWith("/")) {
             filePath += "/";
         }
@@ -2260,8 +2272,8 @@
                 version = currentVersion;
                 //get package zip entry name
                 //it should be docId.revsion.package
-                rootName = packageId + MetaCatUtil.getOption("accNumSeparator")
-                        + version + MetaCatUtil.getOption("accNumSeparator")
+                rootName = packageId + PropertyService.getProperty("accNumSeparator")
+                        + version + PropertyService.getProperty("accNumSeparator")
                         + "package";
                 //get the whole id list for data packadge
                 docIdList = getCurrentDocidListForDataPackage(packageId);
@@ -2277,7 +2289,7 @@
             {
 
                 rootName = docIdString
-                        + MetaCatUtil.getOption("accNumSeparator") + "package";
+                        + PropertyService.getProperty("accNumSeparator") + "package";
                 //get the whole id list for data packadge
                 docIdList = getOldVersionDocidListForDataPackage(docIdString);
 
@@ -2325,7 +2337,7 @@
                             // Add String object to htmlDocumentImplList
                             String elementInHtmlList = remoteDoc
                                     .getDocIdWithoutRevsion()
-                                    + MetaCatUtil.getOption("accNumSeparator")
+                                    + PropertyService.getProperty("accNumSeparator")
                                     + remoteDoc.getRevision();
                             htmlDocumentImplList.add(elementInHtmlList);
                         }//if
Index: src/edu/ucsb/nceas/metacat/harvesterClient/MetUpload.java
===================================================================
--- src/edu/ucsb/nceas/metacat/harvesterClient/MetUpload.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/harvesterClient/MetUpload.java	(revision 4080)
@@ -41,7 +41,12 @@
 import com.oreilly.servlet.multipart.MultipartParser;
 import com.oreilly.servlet.multipart.ParamPart;
 import com.oreilly.servlet.multipart.Part;
+
 import edu.ucsb.nceas.metacat.client.*;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.service.ServiceException;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
 import edu.ucsb.nceas.utilities.IOUtil;
 
 /**
@@ -175,51 +180,51 @@
 
   }
 
-
   /**
-   * Initializes the servlet. Reads properties and initializes object fields.
-   * 
-   * @throws ServletException
-   */
-  public void init(ServletConfig config) throws ServletException {
-    String contextString;
-    String dirPath;
-    String httpserver;
-    Options options = null;
+	 * Initializes the servlet. Reads properties and initializes object fields.
+	 * 
+	 * @throws ServletException
+	 */
+	public void init(ServletConfig config) throws ServletException {
+		String dirPath;
 
-    super.init(config);
-    this.config = config;
-    this.context = config.getServletContext();
-    dirPath = context.getRealPath(CONFIG_DIR);
-    File propertyFile = new File(dirPath, CONFIG_NAME);
-    
-    try {
-      options = Options.initialize(propertyFile);
-    }
-    catch (IOException e) {
-      System.out.println("Error in loading options: " + e.getMessage());
-    }
-    
-    httpserver = options.getOption("httpserver");
-    contextString = options.getOption("context");
-    metacatURL = httpserver + "/" + contextString + "/servlet/metacat";
-    System.out.println("metacatURL: " + metacatURL);
-  }
+		super.init(config);
+		this.config = config;
+		this.context = config.getServletContext();
+		dirPath = context.getRealPath(CONFIG_DIR);
+		File propertyFile = new File(dirPath, CONFIG_NAME);
 
+		try {
+			PropertyService.getInstance(this.context);
+			metacatURL = SystemUtil.getServletURL();
+		} catch (ServiceException se) {
+			System.out.println("Service problem while initializing MetUpload: " + se.getMessage());
+		} catch (GeneralPropertyException gpe) {
+			System.out.println("Error initializing properties utility: " + gpe.getMessage());
+		}
 
+		System.out.println("metacatURL: " + metacatURL);
+	}
+
+
   /**
-   * Uploads a file to Metacat for insertion or updating. This implementation
-   * is limited by the fact that all ".1" documents are inserted while all
-   * other revisions are updated. This logic can be improved after the Metacat
-   * interface is extended with additional methods to query information about
-   * revisions, for example, hasDocument() and highestRevision().
-   * 
-   * @param out        the PrintWriter output stream
-   * @param docid      the docid, e.g. "document.1.1"
-   * @param sr         the StringReader containing the contents of the document
-   * @param username   the Metacat username
-   * @param password   the Metacat password
-   */
+	 * Uploads a file to Metacat for insertion or updating. This implementation
+	 * is limited by the fact that all ".1" documents are inserted while all
+	 * other revisions are updated. This logic can be improved after the Metacat
+	 * interface is extended with additional methods to query information about
+	 * revisions, for example, hasDocument() and highestRevision().
+	 * 
+	 * @param out
+	 *            the PrintWriter output stream
+	 * @param docid
+	 *            the docid, e.g. "document.1.1"
+	 * @param sr
+	 *            the StringReader containing the contents of the document
+	 * @param username
+	 *            the Metacat username
+	 * @param password
+	 *            the Metacat password
+	 */
   private void upload(PrintWriter out, 
                       String docid,
                       StringReader sr,
Index: src/edu/ucsb/nceas/metacat/QueryTerm.java
===================================================================
--- src/edu/ucsb/nceas/metacat/QueryTerm.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/QueryTerm.java	(revision 4080)
@@ -32,6 +32,8 @@
 import java.util.Vector;
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+
 /** a utility class that represents a single term in a query */
 public class QueryTerm
 {
Index: src/edu/ucsb/nceas/metacat/util/LDAPUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/LDAPUtil.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/LDAPUtil.java	(revision 4080)
@@ -0,0 +1,510 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements administrative methods 
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.util;
+
+import java.util.Calendar;
+import java.util.Vector;
+
+import javax.naming.AuthenticationException;
+import javax.naming.NamingException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import edu.ucsb.nceas.metacat.AuthLdap;
+import edu.ucsb.nceas.metacat.AuthSession;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.service.SessionService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.utilities.StringUtil;
+
+public class LDAPUtil {
+
+//	private static Logger logMetacat = Logger.getLogger(LDAPUtil.class);
+	private static Vector<String> administrators = null;
+	private static Vector<String> moderators = null;
+	private static Vector<String> allowedSubmitters = null;
+	private static Vector<String> deniedSubmitters = null;
+
+	/**
+	 * private constructor - all methods are static so there is no no need to
+	 * instantiate.
+	 */
+	private LDAPUtil() {}
+
+	/**
+	 * Get the administrators from metacat.properties
+	 * 
+	 * @return a Vector of Strings holding the administrators
+	 */
+	public static Vector<String> getAdministrators() throws UtilException {
+		if (administrators == null) {
+			populateAdministrators();
+		}
+		return administrators;
+	}
+	
+	/**
+	 * Get the allowed submitters from metacat.properties
+	 * 
+	 * @return a Vector of Strings holding the submitters
+	 */
+	public static Vector<String> getAllowedSubmitters() throws UtilException {
+		if (allowedSubmitters == null) {			
+			populateAllowedSubmitters();	
+		}
+		return allowedSubmitters;
+	}
+	
+	/**
+	 * Get the denied submitters from metacat.properties
+	 * 
+	 * @return a Vector of Strings holding the denied submitters
+	 */
+	public static Vector<String> getDeniedSubmitters() throws UtilException {
+		if (deniedSubmitters == null) {
+			populateDeniedSubmitters();
+		}
+		return deniedSubmitters;
+	}
+	
+	/**
+	 * Get the vector of administrator credentials from metacat.properties
+	 * and put into global administrators list
+	 */
+	private static void populateAdministrators() throws UtilException {
+		String administratorString = null;
+		try {
+			administratorString = 
+				PropertyService.getProperty("ldap.administrators");
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not get metacat property: ldap.administrators. "
+							+ "There will be no registered metacat adminstrators: "
+							+ pnfe.getMessage());
+		}
+		administrators = StringUtil.toVector(administratorString, ':');
+	}
+	
+	/**
+	 * Get the vector of allowed submitter credentials from metacat.properties
+	 * and put into global allowedSubmitters list
+	 */
+	private static void populateAllowedSubmitters() throws UtilException {
+		String allowedSubmitterString = null;
+		try {
+			allowedSubmitterString = PropertyService.getProperty("ldap.allowedSubmitters");
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not get metacat property: ldap.allowedSubmitters. "
+					+ "Anyone will be allowed to submit: "
+					+ pnfe.getMessage());
+		}		
+		allowedSubmitters = StringUtil.toVector(allowedSubmitterString, ':');		
+	}
+	
+	/**
+	 * Get the vector of denied submitter credentials from metacat.properties
+	 * and put into global deniedSubmitters list
+	 */
+	private static void populateDeniedSubmitters() throws UtilException {
+		String deniedSubmitterString = null;
+		try {
+			deniedSubmitterString = PropertyService.getProperty("ldap.deniedSubmitters");
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not get metacat property: ldap.deniedSubmitters: "
+					+ pnfe.getMessage());
+		}		
+		deniedSubmitters = StringUtil.toVector(deniedSubmitterString, ':');		
+	}
+
+	/**
+	 * Validate connectivity to the ldap server. This does not test user
+	 * authentication. Validation methods return a string error message if there
+	 * is an issue. This allows the calling code to run several validations and
+	 * compile the errors into a list that can be displayed on a web page if
+	 * desired.
+	 * 
+	 * @param ldapurl
+	 *            the url of the ldap server
+	 * @param ldapbase
+	 *            the ldap base value to test
+	 * @return a string holding error message if validation fails.
+	 */
+	public static String validateLDAPConnectivity(String ldapurl,
+			String ldapbase) {
+		try {
+			AuthLdap authLdap = new AuthLdap();
+			authLdap.testCredentials(
+					"uid=bogusname,o=NCEAS,dc=ecoinformatics,dc=org",
+					"boguspassword", ldapurl, ldapbase);
+		} catch (AuthenticationException ae) {
+			// Do nothing here. We are using dummy uid and password, so we
+			// expect authentication exceptions
+		} catch (javax.naming.InvalidNameException ine) {
+			return "An invalid domain name was provided: " + ine.getMessage();
+		} catch (NamingException ne) {
+			return "An invalid ldap name was provided: " + ne.getMessage();
+		} catch (InstantiationException ie) {
+			return "Could not instantiate AuthLdap: " + ie.getMessage();
+		}
+
+		return null;
+	}
+
+	/**
+	 * log the user in against ldap.  If the login is successful, add
+	 * the session information to the session list in SessionUtil.
+	 * 
+	 * @param request the http request.
+	 */
+	public static boolean logUserIn(HttpServletRequest request, String userName, String organization,
+			Vector<String> dnList, String password) throws UtilException {
+		AuthSession authSession = null;
+
+		// make sure we have username and password.
+		if (userName == null || password == null || dnList == null || dnList.size() == 0) {
+			throw new UtilException("null username, password, or dn list when logging user in");
+		}
+
+		// put the login credentials into an LDAP string
+		String ldapString = createLDAPString(userName, organization, dnList);
+
+		// Create auth session
+		try {
+			authSession = new AuthSession();
+		} catch (Exception e) {
+			throw new UtilException("Could not instantiate AuthSession: "
+					+ e.getMessage());
+		}
+		// authenticate user against ldap
+		boolean isValid = authSession.authenticate(request, ldapString,
+				password);
+		
+		// if login was successful, add the session information to the 
+		// global session list.
+		if (isValid) {
+			HttpSession session = authSession.getSessions();
+			String sessionId = session.getId();
+			SessionService.registerSession(sessionId, 
+					(String) session.getAttribute("username"), 
+					(String[]) session.getAttribute("groups"),
+					(String) session.getAttribute("password"));
+		}
+		
+		return isValid;
+	}
+
+	/**
+	 * Checks to see if the user is logged in by grabbing the session from the
+	 * request and seeing if it exists in the global session list.
+	 * 
+	 * @param request the http request that holds the login session
+	 * @return boolean that is true if the user is logged in, false otherwise
+	 */
+	public static boolean isUserLoggedIn(HttpServletRequest request) throws UtilException{
+		SessionData sessionData = null;
+		String sessionId = request.getSession().getId();
+
+		try {
+
+			if (sessionId != null && SessionService.isSessionRegistered(sessionId)) {
+				// get the registered session data
+				sessionData = SessionService.getRegisteredSession(sessionId);
+
+				// get the timeout limit
+				String sessionTimeout = PropertyService.getProperty("auth.timeoutMinutes");
+				int sessionTimeoutInt = Integer.parseInt(sessionTimeout);
+
+				// get the last time the session was accessed
+				Calendar lastAccessedTime = sessionData.getLastAccessedTime();
+				// get the current time and set back "sessionTimoutInt" minutes
+				Calendar now = Calendar.getInstance();
+				now.add(Calendar.MINUTE, 0 - sessionTimeoutInt);
+
+				// if the last accessed time is before now minus the timeout,
+				// the session has expired. Unregister it and return false.
+				if (lastAccessedTime.before(now)) {
+					SessionService.unRegisterSession(sessionId);
+					return false;
+				}
+
+				return true;
+			}
+			
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not determine if user is logged in because " 
+					+ "of property error: " + pnfe.getMessage());
+		} catch (NumberFormatException nfe) {
+			throw new UtilException("Could not determine if user is logged in because " 
+					+ "of number conversion error: " + nfe.getMessage());
+		}
+
+		return false;
+	}
+
+	/**
+	 * Checks to see if the user is logged in as admin by first checking if the
+	 * user is logged in and then seeing if the user's account is on the
+	 * administrators list in metacat.properties.
+	 * 
+	 * @param request
+	 *            the http request that holds the login session
+	 * @return boolean that is true if the user is logged in as admin, false
+	 *         otherwise
+	 */
+	public static boolean isUserLoggedInAsAdmin(HttpServletRequest request) throws UtilException {
+		if (!isUserLoggedIn(request)) {
+			return false;
+		}
+
+		String userName = getUserName(request);
+		boolean isAdmin = isAdministrator(userName, null);
+
+		return isAdmin;
+	}
+
+	/**
+	 * Gets the user name from the login session on the http request
+	 * 
+	 * @param request
+	 *            the http request that holds the login session
+	 * @return String that holds the user name
+	 */
+	public static String getUserName(HttpServletRequest request) {
+		String userName = (String)request.getSession().getAttribute("username");
+
+		return userName;
+	}
+
+	/**
+	 * Gets the user group names from the login session on the http request
+	 * 
+	 * @param request
+	 *            the http request that holds the login session
+	 * @return String array that holds the user groups
+	 */
+	public static String[] getGroupNames(HttpServletRequest request) {
+		String sessionId = request.getSession().getId();;
+		SessionData sessionData = SessionService.getRegisteredSession(sessionId);
+		String[] groupNames = { "" };
+
+		if (sessionData != null) {
+			groupNames = sessionData.getGroupNames();
+		}
+
+		return groupNames;
+	}
+
+	/**
+	 * Creates an ldap credentail string from the username, organization
+	 * and dn list.
+	 * 
+	 * @param username the user name
+	 * @param organization the organization
+	 * @param dnList a list of dns
+	 * @return String holding the ldap login string
+	 */	
+	public static String createLDAPString(String username, String organization,
+			Vector<String> dnList) throws UtilException {
+
+		if (username == null || organization == null || dnList == null || dnList.size() == 0) {
+			throw new UtilException("Could not generate LDAP user string.  One of the following is null: username, organization or dnlist");
+		}
+
+		String ldapString = "uid=" + username + ",o=" + organization;
+
+		for (String dn : dnList) {
+			ldapString += "," + dn;
+		}
+
+		return ldapString;
+	}
+
+	/**
+	 * gets a list of organization names from metacat.properties. Parses the csv
+	 * string into a vector
+	 * 
+	 * @return a Vector of Strings that hold all available organizations
+	 * 
+	 * TODO MCD this should be retrieved from ldap instead of metacat.properties
+	 */
+	public static Vector<String> getOrganizations() throws UtilException {
+
+		Vector<String> shortOrgNames = new Vector<String>();
+		Vector<String> longOrgNames = null;
+		
+		longOrgNames = PropertyService.getPropertyNamesByGroup("ldap.org");
+
+		for (String longName : longOrgNames) {
+			shortOrgNames.add(longName.substring(9));
+		}
+		return shortOrgNames;
+	}
+	
+	/**
+	 * gets a list of organization names from metacat.properties. Parses the csv
+	 * string into a vector
+	 * 
+	 * @return a Vector of Strings that hold all available organizations
+	 */
+	public static Vector<String> getOrgDNs(String orgName) throws UtilException {
+
+		String orgBaseList = null;
+		try {
+			orgBaseList = PropertyService.getProperty("ldap.base." + orgName);
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not get metacat property: ldap.base." 
+					+ orgName + " : " + pnfe.getMessage());
+		}
+		// this will always return a vector (maybe an empty one)
+		return StringUtil.toVector(orgBaseList, ',');
+	}
+
+	/**
+	 * Reports whether LDAP is fully configured.
+	 * 
+	 * @return a boolean that is true if all sections are configured and false
+	 *         otherwise
+	 */
+	public static boolean isLDAPConfigured() throws UtilException {
+		String ldapConfiguredString = PropertyService.UNCONFIGURED;
+		try {
+			ldapConfiguredString = PropertyService.getProperty("configutil.ldapConfigured");
+		} catch (PropertyNotFoundException pnfe) {
+			throw new UtilException("Could not determine if LDAP is configured: "
+					+ pnfe.getMessage());
+		}
+		return !ldapConfiguredString.equals(PropertyService.UNCONFIGURED);
+	}
+
+	/**
+	 * Check if the specified user is part of the administrators list
+	 * 
+	 * @param username
+	 *            the user login credentails
+	 * @param groups
+	 *            a list of the user's groups
+	 */
+	public static boolean isAdministrator(String username, String[] groups)
+			throws UtilException {
+		return onAccessList(getAdministrators(), username, groups);
+	}
+
+	/**
+	 * Check if the specified user is part of the moderators list
+	 * 
+	 * @param username
+	 *            the user login credentails
+	 * @param groups
+	 *            a list of the user's groups
+	 */
+	public static boolean isModerator(String username, String[] groups) {
+		return onAccessList(moderators, username, groups);
+	}
+
+	/**
+	 * Check if the specified user is part of the moderators list
+	 * 
+	 * @param username
+	 *            the user login credentails
+	 * @param groups
+	 *            a list of the user's groups
+	 */
+	public static boolean isAllowedSubmitter(String username, String[] groups)
+			throws UtilException {
+		if (getAllowedSubmitters().size() == 0) {
+			// no allowedSubmitters list specified -
+			// hence everyone should be allowed
+			return true;
+		}
+		return (onAccessList(getAllowedSubmitters(), username, groups));
+	}
+
+	/**
+	 * Check if the specified user is part of the moderators list
+	 * 
+	 * @param username
+	 *            the user login credentails
+	 * @param groups
+	 *            a list of the user's groups
+	 */
+	public static boolean isDeniedSubmitter(String username, String[] groups)
+			throws UtilException {
+		return (onAccessList(getDeniedSubmitters(), username, groups));
+	}
+
+	/**
+	 * Check if the specified user can insert the document
+	 * 
+	 * @param username
+	 *            the user login credentails
+	 * @param groups
+	 *            a list of the user's groups
+	 */
+	public static boolean canInsertOrUpdate(String username, String[] groups)
+			throws UtilException {
+		return (isAllowedSubmitter(username, groups) && !isDeniedSubmitter(username,
+				groups));
+	}
+
+	/**
+	 * Check if the user is on a given access list.  This is true if either the 
+	 * user or the user's group is on the list.
+	 * 
+	 * @param accessList the list we want to check against
+	 * @param username the name of the user we want to check
+	 * @param groups a list of the user's groups
+	 */
+	private static boolean onAccessList(Vector<String> accessList, String username,
+			String[] groups) {
+
+		// this should never happen.  All calls to this method should use the 
+		// appropriate getter to retrieve the accessList.  That should guarentee
+		// that the access is at least an empty Vector.
+		if (accessList == null) {
+			return false;
+		}
+
+		// Check that the user is authenticated as an administrator account
+		for (String accessString : accessList) {
+			// check the given admin dn is a group dn...
+			if (groups != null && accessString.startsWith("cn=")) {
+				// is a group dn
+				for (int j = 0; j < groups.length; j++) {
+					if (groups[j].equals(accessString)) {
+						return true;
+					}
+				}
+			} else {
+				// is a user dn
+				if (username != null && username.equals(accessString)) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/LDAPUtil.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
Index: src/edu/ucsb/nceas/metacat/DBConnection.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBConnection.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBConnection.java	(revision 4080)
@@ -32,6 +32,9 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /**
  * A class represent a connection object, it includes connection itself, 
  * index, status, age, createtime, connection time, usageCount, warning message
@@ -54,10 +57,22 @@
   private String checkOutMethodName;
   
   
-  private static String  DBDriver=MetaCatUtil.getOption("dbDriver");
-  private static String  DBConnectedJDBC=MetaCatUtil.getOption("defaultDB");
-  private static String  userName=MetaCatUtil.getOption("user");
-  private static String  passWord=MetaCatUtil.getOption("password");
+  private static String  DBDriver;
+  private static String  DBConnectedJDBC;
+  private static String  userName;
+  private static String  passWord;
+  static {
+		try {
+			DBDriver=PropertyService.getProperty("database.driver");
+			DBConnectedJDBC=PropertyService.getProperty("database.connectionURI");
+			userName=PropertyService.getProperty("database.user");
+			passWord=PropertyService.getProperty("database.password");
+		} catch (PropertyNotFoundException pnfe) {
+			System.err.println("Could not get property in static block: " 
+					+ pnfe.getMessage());
+		}
+	}
+  
   private static Logger logMetacat = Logger.getLogger(DBConnection.class);
 
   /**
@@ -355,6 +370,33 @@
      return connLocal;
   }//OpenDBConnection
   
+  /** 
+   * Method to test a JDBC database connection 
+   *
+   * @param dbDriver the string representing the database driver
+   * @param connection the string representing the database connectin parameters
+   * @param user name of the user to use for database connection
+   * @param password password for the user to use for database connection
+   */
+  public static void testConnection(String dbDriver, String connection,
+                String user, String password)
+                throws SQLException
+  {
+     // Load the Oracle JDBC driver
+     try
+     {
+       Class.forName (dbDriver);
+     }
+     catch (ClassNotFoundException e)
+     {
+       throw new SQLException(e.getMessage());
+     }
+     // Connect to the database
+     Connection connLocal = null;
+     connLocal = DriverManager.getConnection( connection, user, password);
+     connLocal.close();
+  }
+  
   /**
    * Method to create a PreparedStatement by sending a sql statement
    * @Param sql, the sql statement which will be sent to db
Index: src/edu/ucsb/nceas/metacat/harvesterClient/Harvester.java
===================================================================
--- src/edu/ucsb/nceas/metacat/harvesterClient/Harvester.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/harvesterClient/Harvester.java	(revision 4080)
@@ -39,9 +39,11 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+
 import edu.ucsb.nceas.metacat.client.Metacat;
 import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
 
 /**
  * Harvester is the main class for the Harvester application. The main
@@ -399,10 +401,10 @@
     SQLWarning warn;
     
     if (conn == null) {
-      dbDriver = options.getOption("dbDriver");
-      defaultDB = options.getOption("defaultDB");
-      password = options.getOption("password");
-      user = options.getOption("user");
+      dbDriver = options.getOption("database.driver");
+      defaultDB = options.getOption("database.connectionURI");
+      password = options.getOption("database.password");
+      user = options.getOption("database.user");
 
       // Load the jdbc driver
       try {
@@ -957,11 +959,9 @@
    */
   private void startup(int nHarvests, int maxHarvests) {
     Boolean ctm;
-    String httpserver;
     Integer lp;
     String metacatURL;
     Date now = new Date();
-    String servletPath;
     
     timestamp = now.toString();
     System.out.println(Harvester.marker);
@@ -994,9 +994,7 @@
       
     if (connectToMetacat()) {      
       try {
-        httpserver = options.getOption("httpserver");
-        servletPath = options.getOption("servletpath");
-        metacatURL = httpserver + servletPath;
+        metacatURL = SystemUtil.getServletURL();
         System.out.println("Connecting to Metacat: " + metacatURL);
         metacat = MetacatFactory.createMetacatConnection(metacatURL);
       } 
Index: src/edu/ucsb/nceas/metacat/MetaCatVersion.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatVersion.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/MetaCatVersion.java	(revision 4080)
@@ -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
Index: src/edu/ucsb/nceas/metacat/util/SessionData.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/SessionData.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/util/SessionData.java	(revision 4080)
@@ -0,0 +1,107 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that stores user session information 
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.util;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.naming.AuthenticationException;
+import javax.naming.NamingException;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.AuthLdap;
+import edu.ucsb.nceas.metacat.MetaCatServlet;
+
+public class SessionData {
+	
+	private String id = null;
+	private String userName = null;
+	private String[] groupNames = null;
+	private String password = null;
+	private final Calendar creationTime = Calendar.getInstance();
+	private Calendar lastAccessedTime = Calendar.getInstance();
+	
+	private Logger logMetacat = Logger.getLogger(SessionData.class);
+	
+	/**
+	 * 
+	 * @param userName
+	 * @param groupNames
+	 * @param password
+	 */
+	public SessionData(String id, String userName, String[] groupNames, String password) {
+		this.id = id;
+		this.userName = userName;
+		this.groupNames = groupNames;
+		this.password = password;
+	}
+	
+	public String getId() {
+		return id;
+	}
+	
+	public String getUserName() {
+		return userName;
+	}
+	
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+	
+	public String[] getGroupNames() {
+		return groupNames;
+	}
+	
+	public void setGroupNames(String[] groupNames) {
+		this.groupNames = groupNames;
+	}
+	
+	public String getPassword() {
+		return password;
+	}
+	
+	public void setPassword(String password) {
+		this.password = password;
+	}
+	
+	public Calendar getLastAccessedTime() {
+		return lastAccessedTime;
+	}
+	
+	public void setLastAccessedTime() {
+		lastAccessedTime.setTime(new Date());
+	}
+	
+	public Calendar getCreationTime() {
+		return creationTime;
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/util/SessionData.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
Index: src/edu/ucsb/nceas/metacat/AuthSession.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AuthSession.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/AuthSession.java	(revision 4080)
@@ -32,6 +32,10 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.UtilException;
+
 /**
  * A Class that implements session tracking for MetaCatServlet users.
  * User's login data are stored in the session object.
@@ -39,217 +43,230 @@
  */
 public class AuthSession {
 
-  private String authClass = null;
-  private HttpSession session = null;
-  private AuthInterface authService = null;
-  private String statusMessage = null;
-  private static Logger logMetacat = Logger.getLogger(AuthSession.class);
+	private String authClass = null;
+	private HttpSession session = null;
+	private AuthInterface authService = null;
+	private String statusMessage = null;
+	private static Logger logMetacat = Logger.getLogger(AuthSession.class);
 
-  /**
-   * Construct an AuthSession
-   */
-  public AuthSession() throws Exception {
-    // Determine our session authentication method and
-    // create an instance of the auth class
-    MetaCatUtil util = new MetaCatUtil();
-    this.authClass = util.getOption("authclass");
-    this.authService = (AuthInterface)createObject(authClass);
-  }
+	/**
+	 * Construct an AuthSession
+	 */
+	public AuthSession() throws Exception {
+		// Determine our session authentication method and
+		// create an instance of the auth class
+		this.authClass = PropertyService.getProperty("auth.class");
+		this.authService = (AuthInterface) createObject(authClass);
+	}
 
-  /**
-   * Get the new session
-   */
-  public HttpSession getSessions()
-  {
-    return this.session;
-  }
+	/**
+	 * Get the new session
+	 */
+	public HttpSession getSessions() {
+		return this.session;
+	}
 
-  /**
-   * determine if the credentials for this session are valid by
-   * authenticating them using the authService configured for this session.
-   *
-   * @param request the request made from the client
-   * @param username the username entered when login
-   * @param password the password entered when login
-   */
-  public boolean authenticate(HttpServletRequest request,
-                              String username, String password)  {
-    String message = null;
-    try {
-      if ( authService.authenticate(username, password) ) {
+	/**
+	 * determine if the credentials for this session are valid by
+	 * authenticating them using the authService configured for this session.
+	 *
+	 * @param request the request made from the client
+	 * @param username the username entered when login
+	 * @param password the password entered when login
+	 */
+	public boolean authenticate(HttpServletRequest request, String username,
+			String password) {
+		String message = null;
+		try {
+			if (authService.authenticate(username, password)) {
 
-        // getGroups returns groupname along with their description.
-        // hence groups[] is generated from groupsWithDescription[][]
-        String[][] groupsWithDescription =
-            authService.getGroups(username,password,username);
-        String groups[] = new String[groupsWithDescription.length];
-        
-        for(int i=0; i<groupsWithDescription.length; i++){
-          groups[i] = groupsWithDescription[i][0];
-        }
+				// getGroups returns groupname along with their description.
+				// hence groups[] is generated from groupsWithDescription[][]
+				String[][] groupsWithDescription = authService.getGroups(username,
+						password, username);
+				String groups[] = new String[groupsWithDescription.length];
 
-        if(groups == null)
-        {
-          groups = new String[0];
-        }
-        
-        String[] userInfo =
-            authService.getUserInfo(username,password);
-        
-        
-        this.session = createSession(request, username, password, groups, userInfo);
-        String sessionId = session.getId();
-        message = "Authentication successful for user: " + username;
-        this.statusMessage = formatOutput("login", message, sessionId, username, groups, userInfo);
-        return true;
-      } else {
-        message = "Authentication failed for user: " + username;
-        this.statusMessage = formatOutput("unauth_login", message);
-        return false;
-      }
-    } catch ( ConnectException ce ) {
-      message = "Connection to the authentication service failed in " +
-                "AuthSession.authenticate: " + ce.getMessage();
-    } catch ( IllegalStateException ise ) {
-      message = ise.getMessage();
-    }
+				for (int i = 0; i < groupsWithDescription.length; i++) {
+					groups[i] = groupsWithDescription[i][0];
+				}
 
-    this.statusMessage = formatOutput("error_login", message);
-    return false;
-  }
+				if (groups == null) {
+					groups = new String[0];
+				}
 
-  /** Get new HttpSession and store username & password in it */
-  private HttpSession createSession(HttpServletRequest request,
-                                 String username, String password,
-                                 String[] groups, String[] userInfo)
-                      throws IllegalStateException {
+				String[] userInfo = authService.getUserInfo(username, password);
 
-    // get the current session object, create one if necessary
-    HttpSession session = request.getSession(true);
+				this.session = createSession(request, username, password, groups,
+						userInfo);
+				String sessionId = session.getId();
+				message = "Authentication successful for user: " + username;
+				this.statusMessage = formatOutput("login", message, sessionId, username,
+						groups, userInfo);
+				return true;
+			} else {
+				message = "Authentication failed for user: " + username;
+				this.statusMessage = formatOutput("unauth_login", message);
+				return false;
+			}
+		} catch (ConnectException ce) {
+			message = "Connection to the authentication service failed in "
+					+ "AuthSession.authenticate: " + ce.getMessage();
+		} catch (IllegalStateException ise) {
+			message = ise.getMessage();
+		}
 
-    // if it is still in use invalidate and get a new one
-    if ( !session.isNew() ) {
-      logMetacat.info("in session is not new");
-      logMetacat.info("the old session id is : " +
-                                session.getId());
-      logMetacat.info("the old session username : " +
-                                session.getAttribute("username"));
-      session.invalidate();
-      logMetacat.info("in session is not new");
-      session = request.getSession(true);
-    }
-    // store the username, password, and groupname (the first only)
-    // in the session obj for use on subsequent calls to Metacat servlet
-    session.setMaxInactiveInterval(-1);
-    session.setAttribute("username", username);
-    session.setAttribute("password", password);
-    
-    if ( userInfo!=null & userInfo.length == 3 ) {
-        session.setAttribute("name", userInfo[0]);
-        session.setAttribute("organization", userInfo[1]);
-        session.setAttribute("email", userInfo[2]);
-    }
-    
-    if ( groups.length > 0 ) {
-      session.setAttribute("groupnames", groups);
-    }
-     logMetacat.info("the new session id is : " +
-                                session.getId());
-     logMetacat.info("the new session username : " +
-                                session.getAttribute("username"));
-    return session;
-  }
+		this.statusMessage = formatOutput("error_login", message);
+		return false;
+	}
 
-  /**
-   * Get the message associated with authenticating this session. The
-   * message is formatted in XML.
-   */
-  public String getMessage()
-  {
-    return this.statusMessage;
-  }
+	/** Get new HttpSession and store username & password in it */
+	private HttpSession createSession(HttpServletRequest request, String username,
+			String password, String[] groups, String[] userInfo)
+			throws IllegalStateException {
 
-  /**
-   * Get all groups and users from authentication scheme.
-   * The output is formatted in XML.
-   * @param user the user which requests the information
-   * @param password the user's password
-   */
-  public String getPrincipals(String user, String password)
-                throws ConnectException
-  {
-    return authService.getPrincipals(user, password);
-  }
+		// get the current session object, create one if necessary
+		HttpSession session = request.getSession(true);
 
-  /*
-   * format the output in xml for processing from client applications
-   *
-   * @param tag the root element tag for the message (error or success)
-   * @param message the message content of the root element
-   */
-  private String formatOutput(String tag, String message)
-  {
-      return formatOutput(tag, message, null, null, null, null);
-  }
+		// if it is still in use invalidate and get a new one
+		if (!session.isNew()) {
+			logMetacat.info("in session is not new");
+			logMetacat.info("the old session id is : " + session.getId());
+			logMetacat.info("the old session username : "
+					+ session.getAttribute("username"));
+			session.invalidate();
+			logMetacat.info("in session is not new");
+			session = request.getSession(true);
+		}
+		// store the username, password, and groupname (the first only)
+		// in the session obj for use on subsequent calls to Metacat servlet
+		session.setMaxInactiveInterval(-1);
+		session.setAttribute("username", username);
+		session.setAttribute("password", password);
 
-  /*
-   * format the output in xml for processing from client applications
-   *
-   * @param tag the root element tag for the message (error or success)
-   * @param message the message content of the root element
-   * @param sessionId the session identifier for a successful login
-   */
-  private String formatOutput(String tag, String message, 
-		  String sessionId, String username, String[] groups,
-		  String userInfo[])
-  {
-    StringBuffer out = new StringBuffer();
+		if (userInfo != null & userInfo.length == 3) {
+			session.setAttribute("name", userInfo[0]);
+			session.setAttribute("organization", userInfo[1]);
+			session.setAttribute("email", userInfo[2]);
+		}
 
-    out.append("<?xml version=\"1.0\"?>\n");
-    out.append("<" + tag + ">");
-    out.append("\n  <message>" + message + "</message>\n");
-    if (sessionId != null) {
-        out.append("\n  <sessionId>" + sessionId + "</sessionId>\n");
-        
-        if(userInfo != null && userInfo[0]!=null){
-        	out.append("\n<name>\n");
-        	out.append(userInfo[0]);
-        	out.append("\n</name>\n");
-        }
-        
-        // insert <isAdministrator> tag if the user is an administrator
-        if(MetaCatUtil.isAdministrator(username,groups)){
-            out.append("\n  <isAdministrator></isAdministrator>\n");
-        }
-        
-        // insert <isModerator> tag if the user is a Moderator
-        if(MetaCatUtil.isModerator(username,groups)){
-            out.append("\n  <isModerator></isModerator>\n");
-        }
-    }
-    out.append("</" + tag + ">");
+		if (groups.length > 0) {
+			session.setAttribute("groupnames", groups);
+		}
+		logMetacat.info("the new session id is : " + session.getId());
+		logMetacat.info("the new session username : " + session.getAttribute("username"));
+		return session;
+	}
 
-    return out.toString();
-  }
+	/**
+	 * Get the message associated with authenticating this session. The
+	 * message is formatted in XML.
+	 */
+	public String getMessage() {
+		return this.statusMessage;
+	}
 
-  /**
-   * Instantiate a class using the name of the class at runtime
-   *
-   * @param className the fully qualified name of the class to instantiate
-   */
-  private static Object createObject(String className) throws Exception {
+	/**
+	 * Get all groups and users from authentication scheme.
+	 * The output is formatted in XML.
+	 * @param user the user which requests the information
+	 * @param password the user's password
+	 */
+	public String getPrincipals(String user, String password) throws ConnectException {
+		return authService.getPrincipals(user, password);
+	}
 
-    Object object = null;
-    try {
-      Class classDefinition = Class.forName(className);
-      object = classDefinition.newInstance();
-    } catch (InstantiationException e) {
-      throw e;
-    } catch (IllegalAccessException e) {
-      throw e;
-    } catch (ClassNotFoundException e) {
-      throw e;
-    }
-    return object;
-  }
+	/*
+	 * format the output in xml for processing from client applications
+	 *
+	 * @param tag the root element tag for the message (error or success)
+	 * @param message the message content of the root element
+	 */
+	private String formatOutput(String tag, String message) {
+		return formatOutput(tag, message, null, null, null, null);
+	}
+
+	/*
+	 * format the output in xml for processing from client applications
+	 *
+	 * @param tag the root element tag for the message (error or success)
+	 * @param message the message content of the root element
+	 * @param sessionId the session identifier for a successful login
+	 */
+	private String formatOutput(String tag, String message, String sessionId,
+			String username, String[] groups, String userInfo[]) {
+		StringBuffer out = new StringBuffer();
+
+		out.append("<?xml version=\"1.0\"?>\n");
+		out.append("<" + tag + ">");
+		out.append("\n  <message>" + message + "</message>\n");
+		if (sessionId != null) {
+			out.append("\n  <sessionId>" + sessionId + "</sessionId>\n");
+
+			if (userInfo != null && userInfo[0] != null) {
+				out.append("\n<name>\n");
+				out.append(userInfo[0]);
+				out.append("\n</name>\n");
+			}
+
+			try {
+				// insert <isAdministrator> tag if the user is an administrator
+				if (LDAPUtil.isAdministrator(username, groups)) {
+					out.append("\n  <isAdministrator></isAdministrator>\n");
+				}
+			} catch (UtilException ue) {
+				logMetacat.error("Could not determine if user is administrator. "
+						+ "Omitting from xml output: " + ue.getMessage());
+			}
+
+			// insert <isModerator> tag if the user is a Moderator
+			if (LDAPUtil.isModerator(username, groups)) {
+				out.append("\n  <isModerator></isModerator>\n");
+			}
+		}
+		out.append("</" + tag + ">");
+
+		return out.toString();
+	}
+
+	/**
+	 * Instantiate a class using the name of the class at runtime
+	 *
+	 * @param className the fully qualified name of the class to instantiate
+	 */
+	private static Object createObject(String className) throws Exception {
+
+		Object object = null;
+		try {
+			Class classDefinition = Class.forName(className);
+			object = classDefinition.newInstance();
+		} catch (InstantiationException e) {
+			throw e;
+		} catch (IllegalAccessException e) {
+			throw e;
+		} catch (ClassNotFoundException e) {
+			throw e;
+		}
+		return object;
+	}
+	
+	/**
+	 * Instantiate a class using the name of the class at runtime
+	 *
+	 * @param className the fully qualified name of the class to instantiate
+	 */
+	private static Object createObject(String className, String orgName) throws Exception {
+
+		Object object = null;
+		try {
+			Class classDefinition = Class.forName(className);
+			object = classDefinition.newInstance();
+		} catch (InstantiationException e) {
+			throw e;
+		} catch (IllegalAccessException e) {
+			throw e;
+		} catch (ClassNotFoundException e) {
+			throw e;
+		}
+		return object;
+	}
 }
Index: src/edu/ucsb/nceas/metacat/DBTransform.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBTransform.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBTransform.java	(revision 4080)
@@ -52,13 +52,11 @@
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 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 org.w3c.dom.NamedNodeMap;
 
 /*
 import oracle.xml.parser.v2.XSLStylesheet;
@@ -73,6 +71,11 @@
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 import java.util.Properties;
 
 
@@ -100,15 +103,14 @@
   public DBTransform()
                   throws IOException,
                          SQLException,
-                         ClassNotFoundException
+                         ClassNotFoundException,
+                         PropertyNotFoundException
   {
-    //this.conn = conn;
-    util = new MetaCatUtil();
-    configDir = util.getOption("config-dir");
-    defaultStyle = util.getOption("default-style");
-    httpServer = util.getOption("httpserver");
-    contextURL = util.getOption("httpserver")+"/"+util.getOption("context");
-    servletURL = util.getOption("httpserver")+util.getOption("servletpath");
+    configDir = SystemUtil.getStyleSkinsDir();
+    defaultStyle = PropertyService.getProperty("application.default-style");
+    httpServer = SystemUtil.getServerURL();
+    contextURL = SystemUtil.getContextURL();
+    servletURL = SystemUtil.getServletURL();
   }
 
   /**
@@ -165,7 +167,7 @@
       }
       catch (Exception e)
       {
-    	  logMetacat.error(xslSystemId + ": Error transforming document in " +
+        pw.println(xslSystemId + ": Error transforming document in " +
                    "DBTransform.transformXMLDocument: " +
                    e.getMessage());
 
@@ -247,7 +249,7 @@
       }
       catch (Exception e)
       {
-    	  logMetacat.error(xslSystemId + ": Error transforming document in " +
+        pw.println(xslSystemId + ": Error transforming document in " +
                    "DBTransform.transformXMLDocument: " +
                    e.getMessage());
 
@@ -308,7 +310,7 @@
         }
         
         //set up the default params (can be overridden by the passed in params)
-        String cgiPrefix = MetaCatUtil.getOption("cgi-prefix");
+        String cgiPrefix = SystemUtil.getCGI_URL();
         logMetacat.debug("cgi-prefix=" + cgiPrefix);
         logMetacat.debug("httpServer=" + httpServer);
         logMetacat.debug("contextURL=" + contextURL);
@@ -528,10 +530,6 @@
      } else {
         try {
 
-          // Open a connection to the database
-          /*MetaCatUtil   util = new MetaCatUtil();
-          Connection dbconn = util.openDBConnection();*/
-
           // Create a test document
           StringBuffer testdoc = new StringBuffer();
           testdoc.append("<?xml version=\"1.0\"?>");
Index: src/edu/ucsb/nceas/metacat/QueryGroup.java
===================================================================
--- src/edu/ucsb/nceas/metacat/QueryGroup.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/QueryGroup.java	(revision 4080)
@@ -30,6 +30,7 @@
 package edu.ucsb.nceas.metacat;
 
 import edu.ucsb.nceas.dbadapter.*;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 
 import java.io.*;
 import java.util.Hashtable;
Index: src/edu/ucsb/nceas/metacat/DBSAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBSAXHandler.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBSAXHandler.java	(revision 4080)
@@ -37,8 +37,11 @@
 import java.util.Stack;
 import java.util.Vector;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.morpho.datapackage.Triple;
 import edu.ucsb.nceas.morpho.datapackage.TripleCollection;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 import org.apache.log4j.Logger;
 import org.xml.sax.Attributes;
@@ -226,35 +229,33 @@
     }
 
     /** SAX Handler that receives notification of end of the document */
-    public void endDocument() throws SAXException
-    {
-        logMetacat.info("end Document");
-        // Starting new thread for writing XML Index.
-        // It calls the run method of the thread.
+	public void endDocument() throws SAXException {
+		logMetacat.info("end Document");
+		// Starting new thread for writing XML Index.
+		// It calls the run method of the thread.
 
-        //if it is data package insert triple into relationtion table;
-        if (doctype != null
-                && MetaCatUtil.getOptionList(
-                        MetaCatUtil.getOption("packagedoctype")).contains(
-                        doctype) && hasTriple && !isRevisionDoc) {
-            try {
-                //initial handler and write into relationdb only for xml-documents
-                if (!isRevisionDoc)
-                {
-                  RelationHandler handler = new RelationHandler(docid, doctype,
-                        connection, tripleList);
-                }
-            } catch (Exception e) {
-                logMetacat.error(
-                        "Failed to write triples into relation table"
-                                + e.getMessage());
-                throw new SAXException(
-                        "Failed to write triples into relation table "
-                                + e.getMessage());
-            }
-        }
-    }
+		try {
+			// if it is data package insert triple into relationtion table;
+			if (doctype != null
+					&& MetaCatUtil.getOptionList(
+							PropertyService.getProperty("packagedoctype")).contains(
+							doctype) && hasTriple && !isRevisionDoc) {
 
+				// initial handler and write into relationdb only for
+				// xml-documents
+				if (!isRevisionDoc) {
+					RelationHandler handler = new RelationHandler(docid, doctype,
+							connection, tripleList);
+				}
+			}
+		} catch (Exception e) {
+			logMetacat.error("Failed to write triples into relation table"
+					+ e.getMessage());
+			throw new SAXException("Failed to write triples into relation table "
+					+ e.getMessage());
+		}
+	}
+
     /** SAX Handler that is called at the start of Namespace */
     public void startPrefixMapping(String prefix, String uri)
             throws SAXException
@@ -418,20 +419,26 @@
         }
 
         // Add the node to the stack, so that any text data can be
-        // added as it is encountered
-        nodeStack.push(currentNode);
-        // Add the node to the vector used by thread for writing XML Index
-        nodeIndex.addElement(currentNode);
-        // start parsing triple
-        if (doctype != null
-                && MetaCatUtil.getOptionList(
-                        MetaCatUtil.getOption("packagedoctype")).contains(
-                        doctype) && localName.equals("triple")) {
-            startParseTriple = true;
-            hasTriple = true;
-            currentTriple = new Triple();
-        }
-    }    
+		// added as it is encountered
+		nodeStack.push(currentNode);
+		// Add the node to the vector used by thread for writing XML Index
+		nodeIndex.addElement(currentNode);
+		// start parsing triple
+		try {
+			if (doctype != null
+					&& MetaCatUtil.getOptionList(
+							PropertyService.getProperty("packagedoctype")).contains(doctype)
+					&& localName.equals("triple")) {
+				startParseTriple = true;
+				hasTriple = true;
+				currentTriple = new Triple();
+			}
+		} catch (PropertyNotFoundException pnfe) {
+			pnfe.printStackTrace();
+			throw (new SAXException("Error in DBSaxHandler.startElement " + action, pnfe));
+		}
+	}               
+    
 
     /** SAX Handler that is called for each XML text node */
     public void characters(char[] cbuf, int start, int len) throws SAXException
Index: src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java	(revision 4080)
@@ -0,0 +1,276 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose:  A Class that implements main property configuration methods
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.admin;
+
+import java.io.IOException;
+import java.util.Vector;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.DBVersion;
+import edu.ucsb.nceas.metacat.MetaCatVersion;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.RequestUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+
+import edu.ucsb.nceas.utilities.FileUtil;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
+import edu.ucsb.nceas.utilities.PropertiesMetaData;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.utilities.SortedProperties;
+
+/**
+ * Control the display of the main properties configuration page and the 
+ * processing of the configuration values.
+ */
+public class PropertiesAdmin extends MetaCatAdmin {
+
+	private static PropertiesAdmin propertiesAdmin = null;
+	private static Logger logMetacat = Logger.getLogger(PropertiesAdmin.class);
+
+	/**
+	 * private constructor since this is a singleton
+	 */
+	private PropertiesAdmin() {}
+
+	/**
+	 * Get the single instance of the MetaCatConfig.
+	 * 
+	 * @return the single instance of MetaCatConfig
+	 */
+	public static PropertiesAdmin getInstance() {
+		if (propertiesAdmin == null) {
+			propertiesAdmin = new PropertiesAdmin();
+		}
+		return propertiesAdmin;
+	}
+	
+	/**
+	 * Handle configuration of the main application properties
+	 * 
+	 * @param request
+	 *            the http request object
+	 * @param response
+	 *            the http response to be sent back to the client
+	 */
+	public void configureProperties(HttpServletRequest request,
+			HttpServletResponse response) throws AdminException {
+
+		String processForm = request.getParameter("processForm");
+		String formErrors = (String)request.getAttribute("formErrors");
+
+		if (processForm == null || !processForm.equals("true") || formErrors != null) {
+			// The servlet configuration parameters have not been set, or there
+			// were form errors on the last attempt to configure, so redirect to
+			// the web form for configuring metacat
+
+			try {
+				// Load the properties metadata file so that the JSP page can
+				// use the metadata to construct the editing form
+				PropertiesMetaData metadata = PropertyService.getMainMetaData();
+				request.setAttribute("metadata", metadata);
+
+				// Attempt to discover the following properties.  These will show
+				// up in the configuration fields if nothing else is provided.
+				PropertyService.setPropertyNoPersist("application.context",
+						SystemUtil.discoverApplicationContext(request));
+				PropertyService.setPropertyNoPersist("server.name", SystemUtil
+						.discoverServerName(request));
+				PropertyService.setPropertyNoPersist("server.httpPort", SystemUtil
+						.discoverServerPort(request));
+				PropertyService.setPropertyNoPersist("server.httpSSLPort",
+						SystemUtil.discoverServerSSLPort(request));
+				PropertyService.setPropertyNoPersist("application.tomcatDir",
+						SystemUtil.discoverTomcatDir(request));
+
+				PropertyService.persistProperties();
+
+				// Add the list of properties from metacat.properties to the request
+				Vector<String> propertyNames = PropertyService.getPropertyNames();
+				for (String propertyName : propertyNames) {
+					request.setAttribute(propertyName, PropertyService.getProperty(propertyName));
+				}
+
+				// Check for any backup properties and apply them to the
+				// request. These are properties from previous configurations. 
+				// They keep the user from having to re-enter all values when 
+				// upgrading. If this is a first time install, getBackupProperties 
+				// will return null.
+				SortedProperties backupProperties = null;
+				if ((backupProperties = 
+						PropertyService.getMainBackupProperties()) != null) {
+					Vector<String> backupKeys = backupProperties.getPropertyNames();
+					for (String key : backupKeys) {
+						String value = backupProperties.getProperty(key);
+						if (value != null) {
+							request.setAttribute(key, value);
+						}
+					}
+				}
+
+				// Forward the request to the JSP page
+				RequestUtil.forwardRequest(request, response,
+						"/admin/properties-configuration.jsp");
+
+			} catch (PropertyNotFoundException pnfe) {
+				throw new AdminException("Problem getting property while initializing "
+								+ "system properties page: " + pnfe.getMessage());
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while initializing "
+						+ "system properties page:" + ioe.getMessage());
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while " 
+						+ "initializing system properties page: " + se.getMessage());
+			}
+		} else {
+			// The configuration form is being submitted and needs to be
+			// processed.
+			Vector<String> validationErrors = new Vector<String>();
+			Vector<String> processingErrors = new Vector<String>();
+			Vector<String> processingSuccess = new Vector<String>();
+
+			MetaCatVersion metacatVersion = null;
+			
+			try {
+				metacatVersion = SystemUtil.getMetacatVersion();
+				
+				// For each property, check if it is changed and save it
+				Vector<String> propertyNames = PropertyService.getPropertyNames();
+				for (String name : propertyNames) {
+					PropertyService.checkAndSetProperty(request, name);
+				}
+
+				// we need to write the options from memory to the properties
+				// file
+				PropertyService.persistProperties();
+
+				// Validate that the options provided are legitimate. Note that
+				// we've allowed them to persist their entries. As of this point
+				// there is no other easy way to go back to the configure form
+				// and preserve their entries.
+				validationErrors.addAll(validateOptions(request));
+
+				// Try to create backup directories if necessary.
+				String backupDir = PropertyService.getBackupDir();
+				if (!FileUtil.createDirectory(backupDir)) {
+					String errorString = "Could not create directory: " + backupDir;
+					logMetacat.error(errorString);
+					validationErrors.add(errorString);
+				}
+
+				// write the backup properties to a location outside the 
+				// application directories so they will be available after
+				// the next upgrade
+				PropertyService.persistMainBackupProperties(
+						request.getSession().getServletContext());
+
+			} catch (GeneralPropertyException gpe) {
+				String errorMessage = "Problem getting or setting property while "
+						+ "processing system properties page: " + gpe.getMessage();
+				logMetacat.error(errorMessage);
+				processingErrors.add(errorMessage);
+			} catch (IOException ioe) {
+				String errorMessage = "IO problem while processing system "
+						+ "properties page: " + ioe.getMessage();
+				logMetacat.error(errorMessage);
+				processingErrors.add(errorMessage);
+			}
+			
+			try {
+				if (validationErrors.size() > 0 || processingErrors.size() > 0) {
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestFormErrors(request, validationErrors);
+					RequestUtil.setRequestErrors(request, processingErrors);
+					RequestUtil.forwardRequest(request, response, "/admin");
+				} else {
+					// Now that the options have been set, change the
+					// 'propertiesConfigured' option to 'true'
+					PropertyService.setProperty("configutil.propertiesConfigured",
+							PropertyService.CONFIGURED);
+					
+					// if the db version is already the same as the metacat version,
+					// update metacat.properties. Have to do this after
+					// propertiesConfigured is set to CONFIGURED
+					DBVersion dbVersion = DBAdmin.getInstance().getDBVersion();
+					if (dbVersion != null && metacatVersion != null && 
+							dbVersion.compareTo(metacatVersion) == 0) {
+						PropertyService.setProperty("databaseConfigured", 
+								PropertyService.CONFIGURED);
+					}
+					
+					// Reload the main metacat configuration page
+					processingSuccess.add("Properties successfully configured");
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestSuccess(request, processingSuccess);
+					RequestUtil.forwardRequest(request, response, 
+							"/admin?configureType=configure&processForm=false");
+				}
+
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while "
+						+ "processing system properties page: " + se.getMessage());
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while processing system "
+						+ "properties page: " + ioe.getMessage());
+			}
+		}
+	}
+
+	/**
+	 * Validate the most important configuration options submitted by the user.
+	 * 
+	 * @param request
+	 *            the http request object
+	 * 
+	 * @return a vector holding error message for any fields that fail
+	 *         validation.
+	 */
+	protected Vector<String> validateOptions(HttpServletRequest request) {
+		Vector<String> errorVector = new Vector<String>();
+
+		// Test database connectivity
+		try {
+			String dbError = DBAdmin.getInstance().validateDBConnectivity(
+					request.getParameter("database.driver"),
+					request.getParameter("database.connectionURI"),
+					request.getParameter("database.user"),
+					request.getParameter("database.password"));
+			if (dbError != null) {
+				errorVector.add(dbError);
+			}
+		} catch (AdminException ae) {
+			errorVector.add("Could not instantiate database admin: "
+					+ ae.getMessage());
+		}
+
+		return errorVector;
+	}
+}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.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
Index: src/edu/ucsb/nceas/metacat/admin/AuthAdmin.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/AuthAdmin.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/AuthAdmin.java	(revision 4080)
@@ -0,0 +1,184 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements ldap configuration methods
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.admin;
+
+import java.io.IOException;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.Vector;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.RequestUtil;
+import edu.ucsb.nceas.metacat.util.UtilException;
+import edu.ucsb.nceas.utilities.FileUtil;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
+import edu.ucsb.nceas.utilities.MetaDataProperty;
+import edu.ucsb.nceas.utilities.PropertiesMetaData;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.utilities.SortedProperties;
+
+/**
+ * Control the display of the LDAP configuration page and the processing
+ * of the configuration values.
+ */
+public class AuthAdmin extends MetaCatAdmin {
+
+	private static AuthAdmin authAdmin = null;
+	private static Logger logMetacat = Logger.getLogger(AuthAdmin.class);
+
+	/**
+	 * private constructor since this is a singleton
+	 */
+	private AuthAdmin() {}
+
+	/**
+	 * Get the single instance of AuthAdmin.
+	 * 
+	 * @return the single instance of AuthAdmin
+	 */
+	public static AuthAdmin getInstance() {
+		if (authAdmin == null) {
+			authAdmin = new AuthAdmin();
+		}
+		return authAdmin;
+	}
+	
+	/**
+	 * Handle configuration of the LDAP properties
+	 * 
+	 * @param request
+	 *            the http request information
+	 * @param response
+	 *            the http response to be sent back to the client
+	 */
+	public void authenticateUser(HttpServletRequest request,
+			HttpServletResponse response) throws AdminException {
+
+		String processForm = request.getParameter("processForm");
+		String formErrors = (String) request.getAttribute("formErrors");
+
+		if (processForm == null || !processForm.equals("true") || formErrors != null) {
+			// The servlet configuration parameters have not been set, or there
+			// were form errors on the last attempt to configure, so redirect to
+			// the web form for configuring metacat
+			
+			try {
+				// Forward the request to the JSP page
+				RequestUtil.forwardRequest(request, response,
+						"/admin/admin-login.jsp");
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while initializing "
+						+ "user login page:" + ioe.getMessage());
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while "
+						+ "initializing user login page: " + se.getMessage());
+			}
+		} else {
+			// The configuration form is being submitted and needs to be
+			// processed.
+			Vector<String> processingSuccess = new Vector<String>();
+			Vector<String> processingErrors = new Vector<String>();
+			Vector<String> validationErrors = new Vector<String>();
+			
+			String loginString = null;
+			Boolean isLoggedIn = false;
+
+			try {
+				String userName = request.getParameter("username");
+				String organization = request.getParameter("organization");
+				String password = request.getParameter("password");
+				
+				// Validate that the options provided are legitimate. Note that
+				// we've allowed them to persist their entries. As of this point
+				// there is no other easy way to go back to the configure form
+				// and preserve their entries.
+				validationErrors.addAll(validateOptions(request));
+				
+				if (validationErrors.size() == 0) {
+					Vector<String> dnList = LDAPUtil.getOrgDNs(organization);
+					isLoggedIn = LDAPUtil.logUserIn(request, userName, organization, dnList, password);
+					loginString = LDAPUtil.createLDAPString(userName, organization, dnList);
+				}
+				
+				if (!isLoggedIn) {
+					String errorMessage = "Could not log in as: " + loginString
+							+ " .Please try again";
+					processingErrors.add(errorMessage);
+				}
+			} catch (UtilException ue) {
+				String errorMessage = "Problem in utility while "
+					+ "processing authentication page: " + ue.getMessage();
+				processingErrors.add(errorMessage);
+				logMetacat.error(errorMessage);
+			} 
+			
+			try {
+				if (validationErrors.size() > 0 || processingErrors.size() > 0) {
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestFormErrors(request, validationErrors);
+					RequestUtil.setRequestErrors(request, processingErrors);
+					RequestUtil.forwardRequest(request, response, "/admin");
+				} else {
+					// Reload the main metacat configuration page
+					processingSuccess.add("User logged in as: " + loginString);
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setUserId(request, loginString);
+					RequestUtil.setRequestSuccess(request, processingSuccess);
+					RequestUtil.forwardRequest(request, response,
+							"/admin?configureType=configure&processForm=false");
+				}
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while processing LDAP "
+						+ "properties page: " + ioe.getMessage());
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while "
+						+ "processoing LDAP properties page: " + se.getMessage());
+			}
+		}
+	}
+	
+	/**
+	 * Validate the most important configuration options submitted by the user.
+	 * 
+	 * @return a vector holding error message for any fields that fail
+	 *         validation.
+	 */
+	protected Vector<String> validateOptions(HttpServletRequest request) {
+		Vector<String> errorVector = new Vector<String>();
+
+		//TODO MCD validate options.
+
+		return errorVector;
+	}
+}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/admin/AuthAdmin.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
Index: src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java	(revision 4080)
@@ -47,6 +47,10 @@
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /**
  * A database aware Class implementing callback bethods for the SAX parser to
  * call when processing the XML stream and generating events
@@ -192,7 +196,7 @@
         // Get the unchangable subtrees (user doesn't have write permission)
         try {
             PermissionController control = new PermissionController(docid
-                    + MetaCatUtil.getOption("accNumSeparator") + revision);
+                    + PropertyService.getProperty("accNumSeparator") + revision);
             //unChangableSubTreeHash = getUnchangableSubTree(control, user,
             // groups);
 
@@ -341,7 +345,13 @@
                 inlineDataNameSpace = new Hashtable();
                 //initialize file writer
                 String docidWithoutRev = MetaCatUtil.getDocIdFromString(docid);
-                String seperator = MetaCatUtil.getOption("accNumSeparator");
+                String seperator = ".";
+                try {
+                seperator = PropertyService.getProperty("accNumSeparator");
+                } catch (PropertyNotFoundException pnfe) {
+                	logMetacat.error("Could not fing property 'accNumSeparator'. " 
+                			+ "Setting separator to '.': " + pnfe.getMessage());
+                }
                 // the new file name will look like docid.rev.2
                 inlineDataFileName = docidWithoutRev + seperator + revision
                         + seperator + inLineDataIndex;
@@ -1012,9 +1022,9 @@
                         handleOnlineUrlDataFile(data);
                         /*if (data != null
                                 && (data.indexOf(MetaCatUtil
-                                        .getOption("httpserver")) != -1 || data
+                                        .getProperty("httpserver")) != -1 || data
                                         .indexOf(MetaCatUtil
-                                                .getOption("server")) != -1)) {
+                                                .getProperty("server")) != -1)) {
                             // Get docid from url
                             String dataId = MetaCatUtil
                                     .getDocIdWithRevFromOnlineURL(data);
@@ -1953,7 +1963,12 @@
             throws SAXException
     {
         FileWriter writer = null;
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
+        String path;
+        try {
+        	path = PropertyService.getProperty("application.inlinedatafilepath");
+        } catch (PropertyNotFoundException pnfe) {
+        	throw new SAXException(pnfe.getMessage());
+        }
         /*
          * File inlineDataDirectory = new File(path);
          */
@@ -1991,12 +2006,13 @@
         // this method need to be testing
         boolean same = true;
         String data = null;
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
-        // the new file name will look like path/docid.rev.2
-        File inlineDataDirectory = new File(path);
-        File oldDataFile = new File(inlineDataDirectory, oldFileName);
-        File newDataFile = new File(inlineDataDirectory, newFileName);
         try {
+        	String path = PropertyService.getProperty("application.inlinedatafilepath");
+			// the new file name will look like path/docid.rev.2
+			File inlineDataDirectory = new File(path);
+			File oldDataFile = new File(inlineDataDirectory, oldFileName);
+			File newDataFile = new File(inlineDataDirectory, newFileName);
+
             FileReader oldFileReader = new FileReader(oldDataFile);
             BufferedReader oldStringReader = new BufferedReader(oldFileReader);
             FileReader newFileReader = new FileReader(newDataFile);
@@ -2031,7 +2047,7 @@
 
     // if xml file failed to upload, we need to call this method to delete
     // the inline data already in file system
-    public void deleteInlineFiles()
+    public void deleteInlineFiles() throws SAXException
     {
         if (!inlineFileIDList.isEmpty()) {
             for (int i = 0; i < inlineFileIDList.size(); i++) {
@@ -2042,10 +2058,15 @@
     }
 
     /* delete the inline data file */
-    private void deleteInlineDataFile(String fileName)
+    private void deleteInlineDataFile(String fileName) throws SAXException
     {
-
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
+    	String path;
+    	try {
+        	path = PropertyService.getProperty("application.inlinedatafilepath");
+    	} catch (PropertyNotFoundException pnfe) {
+    		throw new SAXException ("Could not find inline data file path: " 
+    				+ pnfe.getMessage());
+    	}
         File inlineDataDirectory = new File(path);
         File newFile = new File(inlineDataDirectory, fileName);
         newFile.delete();
@@ -2053,28 +2074,28 @@
     }
 
     /*
-     * In eml2, the inline data wouldn't store in db, it store in file system
-     * The db stores file name(without path).
-     */
-    public static Reader readInlineDataFromFileSystem(String fileName)
-            throws McdbException
-    {
-        //BufferedReader stringReader = null;
-        FileReader fileReader = null;
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
-        // the new file name will look like path/docid.rev.2
-        File inlineDataDirectory = new File(path);
-        File dataFile = new File(inlineDataDirectory, fileName);
-        try {
-            fileReader = new FileReader(dataFile);
-            //stringReader = new BufferedReader(fileReader);
-        } catch (Exception e) {
-            throw new McdbException(e.getMessage());
-        }
-        // return stringReader;
-        return fileReader;
-    }
+	 * In eml2, the inline data wouldn't store in db, it store in file system
+	 * The db stores file name(without path).
+	 */
+	public static Reader readInlineDataFromFileSystem(String fileName)
+			throws McdbException {
+		// BufferedReader stringReader = null;
+		FileReader fileReader = null;
+		try {
+			String path = PropertyService.getProperty("application.inlinedatafilepath");
+			// the new file name will look like path/docid.rev.2
+			File inlineDataDirectory = new File(path);
+			File dataFile = new File(inlineDataDirectory, fileName);
 
+			fileReader = new FileReader(dataFile);
+			// stringReader = new BufferedReader(fileReader);
+		} catch (Exception e) {
+			throw new McdbException(e.getMessage());
+		}
+		// return stringReader;
+		return fileReader;
+	}
+
     /* Delete relations */
     private void deleteRelations() throws SAXException
     {
Index: src/edu/ucsb/nceas/metacat/DBSimpleQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBSimpleQuery.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBSimpleQuery.java	(revision 4080)
@@ -67,7 +67,6 @@
           String doctype  = args[1];
 
           // Open a connection to the database
-          MetaCatUtil   util = new MetaCatUtil();
           //Connection dbconn = util.openDBConnection();
 
           // Execute the simple query
Index: src/xmltables-sqlserver.sql
===================================================================
--- src/xmltables-sqlserver.sql	(revision 4079)
+++ src/xmltables-sqlserver.sql	(revision 4080)
@@ -30,6 +30,7 @@
 drop table [dbo].[harvest_site_schedule];
 drop table [dbo].[harvest_log];
 drop table [dbo].[harvest_detail_log];
+drop table [dbo].[db_version];
 
 /* 
  * ACL -- table to store ACL for XML documents by principals
@@ -237,6 +238,17 @@
 GO
 
 /* 
+ * db_version -- table to store the version history of this database
+ */
+CREATE TABLE [dbo].[db_version] (
+  [db_version_id]	[bigint] IDENTITY (1, 1) NOT NULL ,
+  [version]		    [varchar] (250) NOT NULL ,
+  [status]		    [int] NOT NULL ,
+  [date_created]	[datetime] NULL
+) ON [PRIMARY]
+GO
+
+/* 
  * Constraints and indexes
  */
 ALTER TABLE [dbo].[xml_catalog] WITH NOCHECK ADD 
@@ -310,6 +322,13 @@
 	)  ON [PRIMARY] 
 GO
 
+ALTER TABLE [dbo].[db_version] WITH NOCHECK ADD 
+	CONSTRAINT [PK_db_version] PRIMARY KEY  CLUSTERED 
+	(
+		[db_version_id]
+	)  ON [PRIMARY] 
+GO
+
 ALTER TABLE [dbo].[xml_access] WITH NOCHECK ADD 
 	CONSTRAINT [CK_xml_access] CHECK ([begin_time] < [end_time])
 GO
Index: src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.java	(revision 4080)
@@ -0,0 +1,224 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose:  A Class that implements skins configuration methods
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.admin;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Vector;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.service.SkinPropertyService;
+import edu.ucsb.nceas.metacat.util.RequestUtil;
+import edu.ucsb.nceas.metacat.util.SkinUtil;
+import edu.ucsb.nceas.utilities.PropertiesMetaData;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
+import edu.ucsb.nceas.utilities.SortedProperties;
+
+/**
+ * Control the display of the skins configuration page and the processing
+ * of the configuration values.
+ */
+public class SkinsAdmin extends MetaCatAdmin {
+
+	private static SkinsAdmin skinsAdmin = null;
+	private static Logger logMetacat = Logger.getLogger(SkinsAdmin.class);
+
+	/**
+	 * private constructor since this is a singleton
+	 */
+	private SkinsAdmin() {}
+
+	/**
+	 * Get the single instance of the MetaCatConfig.
+	 * 
+	 * @return the single instance of MetaCatConfig
+	 */
+	public static SkinsAdmin getInstance() {
+		if (skinsAdmin == null) {
+			skinsAdmin = new SkinsAdmin();
+		}
+		return skinsAdmin;
+	}
+	
+	/**
+	 * Handle configuration of the application the first time that Metacat
+	 * starts or when it is explicitly called in the url. Collect necessary
+	 * configuration information from the administrator.
+	 * 
+	 * @param request
+	 *            the http request information
+	 * @param response
+	 *            the http response to be sent back to the client
+	 */
+	public void configureSkins(HttpServletRequest request, HttpServletResponse response)
+			throws AdminException {
+
+		String processForm = request.getParameter("processForm");
+		String formErrors = (String) request.getAttribute("formErrors");
+
+		if (processForm == null || !processForm.equals("true") || formErrors != null) {
+			// The servlet configuration parameters have not been set, or there
+			// were form errors on the last attempt to configure, so redirect to
+			// the web form for configuring metacat
+			try {
+				Vector<String> skinNames = SkinUtil.getSkinNames();
+				String defaultStyle = 
+					PropertyService.getProperty("application.default-style");
+
+				request.setAttribute("defaultStyle", defaultStyle);
+				request.setAttribute("skinNameList", skinNames);
+				
+				// add skin metadata to the request.  The configuration form
+				// will use this data to determine what the configuration 
+				// fields should look like.
+				HashMap<String, PropertiesMetaData> propertyMetaData = 
+					SkinPropertyService.getMetaData();
+				request.setAttribute("metadataMap", propertyMetaData);
+				
+				// get a deep copy of properties so we can override with 
+				// backup values without changing originals
+				HashMap<String, SortedProperties> originalPropertyMap =
+					SkinPropertyService.getProperties();
+				HashMap<String, HashMap<String, String>> localPropertyMap =
+					new HashMap<String, HashMap<String, String>>();
+				HashMap<String, SortedProperties> backupPropertiesMap = 
+					SkinPropertyService.getBackupProperties();
+					
+				for (String skinName : skinNames) {
+					// first, get a deep copy of this skin's properties
+
+					SortedProperties skinProperties = originalPropertyMap.get(skinName);
+					if (skinProperties == null) {
+						throw new GeneralPropertyException("Could not find properties " 
+								+ "for skin: " + skinName);
+					}
+
+					HashMap<String, String> originalSkinProperties = 
+						skinProperties.getProperties();
+					HashMap<String, String> localSkinProperties = 
+						new HashMap<String, String>(originalSkinProperties);
+
+					// now get the backup properties for this skin.  Overwrite the 
+					// properties with backup properties.  This allows previously 
+					// set properties to be preserved in an application upgrade.
+					SortedProperties backupProperties = backupPropertiesMap.get(skinName);
+					for (String propertyName : backupProperties.getPropertyNames())
+					{
+						localSkinProperties.put(propertyName, 
+								backupProperties.getProperty(propertyName));
+					}
+								
+					localPropertyMap.put(skinName, localSkinProperties);					
+				}				
+				request.setAttribute("skinProperties", localPropertyMap);
+				
+				// Forward the request to the JSP page
+				RequestUtil.forwardRequest(request, response,
+						"/admin/skins-configuration.jsp");
+
+			} catch (GeneralPropertyException pnfe) {
+				throw new AdminException("Problem getting property while initializing "
+						+ "skins properties page: " + pnfe.getMessage());
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while initializing "
+						+ "skins properties page:" + ioe.getMessage());
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while "
+						+ "initializing skins properties page: " + se.getMessage());
+			}
+
+		} else {
+			// The configuration form is being submitted and needs to be
+			// processed.
+			Vector<String> processingSuccess = new Vector<String>();
+			Vector<String> processingErrors = new Vector<String>();
+			Vector<String> validationErrors = new Vector<String>();
+
+			
+			
+			
+			// Now that the options have been set, change the 'skinsConfigured'
+			// option to 'true' so that normal metacat requests will go through
+			try {
+				PropertyService.setProperty("configutil.skinsConfigured",
+						PropertyService.CONFIGURED);
+
+			} catch (IOException ioe) {
+				String errorMessage = "IO problem while processing skins "
+						+ "properties page: " + ioe.getMessage();
+				logMetacat.error(errorMessage);
+				processingErrors.add(errorMessage);
+			}
+			try {
+				if (validationErrors.size() > 0 || processingErrors.size() > 0) {
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestFormErrors(request, validationErrors);
+					RequestUtil.setRequestErrors(request, processingErrors);
+					RequestUtil.forwardRequest(request, response, "/admin");
+				} else {
+					// Now that the options have been set, change the
+					// 'skinsConfigured' option to 'true'
+					PropertyService.setProperty("configutil.skinsConfigured",
+							PropertyService.CONFIGURED);
+
+					// Reload the main metacat configuration page
+					processingSuccess.add("Skins successfully configured");
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestSuccess(request, processingSuccess);
+					RequestUtil.forwardRequest(request, response,
+							"/admin?configureType=configure&processForm=false");
+				}
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while "
+						+ "processing skins properties page: " + se.getMessage());
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while processing skins "
+						+ "properties page: " + ioe.getMessage());
+			}
+		}
+	}
+	
+	/**
+	 * Validate the most important configuration options submitted by the user.
+	 * 
+	 * @return a vector holding error message for any fields that fail
+	 *         validation.
+	 */
+	protected Vector<String> validateOptions(HttpServletRequest request) {
+		Vector<String> errorVector = new Vector<String>();
+
+		//TODO MCD validate options.
+
+		return errorVector;
+	}
+}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.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
Index: src/edu/ucsb/nceas/metacat/admin/LDAPAdmin.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/LDAPAdmin.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/LDAPAdmin.java	(revision 4080)
@@ -0,0 +1,278 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements ldap configuration methods
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.admin;
+
+import java.io.IOException;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.Vector;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.RequestUtil;
+import edu.ucsb.nceas.metacat.util.UtilException;
+import edu.ucsb.nceas.utilities.FileUtil;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
+import edu.ucsb.nceas.utilities.MetaDataProperty;
+import edu.ucsb.nceas.utilities.PropertiesMetaData;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.utilities.SortedProperties;
+
+/**
+ * Control the display of the LDAP configuration page and the processing
+ * of the configuration values.
+ */
+public class LDAPAdmin extends MetaCatAdmin {
+
+	private static LDAPAdmin ldapAdmin = null;
+	private static Logger logMetacat = Logger.getLogger(LDAPAdmin.class);
+
+	/**
+	 * private constructor since this is a singleton
+	 */
+	private LDAPAdmin() {}
+
+	/**
+	 * Get the single instance of the MetaCatConfig.
+	 * 
+	 * @return the single instance of MetaCatConfig
+	 */
+	public static LDAPAdmin getInstance() {
+		if (ldapAdmin == null) {
+			ldapAdmin = new LDAPAdmin();
+		}
+		return ldapAdmin;
+	}
+	
+	/**
+	 * Handle configuration of the LDAP properties
+	 * 
+	 * @param request
+	 *            the http request information
+	 * @param response
+	 *            the http response to be sent back to the client
+	 */
+	public void configureLDAP(HttpServletRequest request,
+			HttpServletResponse response) throws AdminException {
+
+		String processForm = request.getParameter("processForm");
+		String formErrors = (String) request.getAttribute("formErrors");
+
+		if (processForm == null || !processForm.equals("true") || formErrors != null) {
+			// The servlet configuration parameters have not been set, or there
+			// were form errors on the last attempt to configure, so redirect to
+			// the web form for configuring metacat
+			
+			try {
+				// Load the properties metadata file so that the JSP page can
+				// use
+				// the metadata to construct the editing form
+				PropertiesMetaData metadata = PropertyService.getOrgMetaData();
+				request.setAttribute("metadata", metadata);
+				request.setAttribute("groupMap", metadata.getGroups());
+				
+				request.setAttribute("orgList", LDAPUtil.getOrganizations());
+
+				// add the list of ldap options and their values to the request
+				Vector<String> propertyNames = PropertyService.getPropertyNamesByGroup("ldap");
+				for (String name : propertyNames) {
+					request.setAttribute(name, PropertyService.getProperty(name));
+				} 
+
+				// Check for any backup properties and apply them to the request.
+				// These are properties from previous configurations. They keep
+				// the user from having to re-enter all values when upgrading.
+				// If this is a first time install, getBackupProperties will return
+				// null.
+				SortedProperties backupProperties = PropertyService.getOrgBackupProperties();
+				if (backupProperties != null) {
+					Vector<String> backupKeys = backupProperties.getPropertyNames();
+					for (String key : backupKeys) {
+						String value = backupProperties.getProperty(key);
+						if (value != null) {
+							request.setAttribute(key, value);
+						}
+					}
+				}
+				// Forward the request to the JSP page
+				RequestUtil.forwardRequest(request, response,
+						"/admin/ldap-configuration.jsp");
+			} catch (PropertyNotFoundException pnfe) {
+				throw new AdminException("Problem getting property while initializing "
+						+ "LDAP properties page: " + pnfe.getMessage());
+			} catch (UtilException ue) {
+				throw new AdminException("Utility problem while " 
+						+ "initializing LDAP properties page: " + ue.getMessage());
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while initializing "
+						+ "LDAP properties page:" + ioe.getMessage());
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while " 
+						+ "initializing LDAP properties page: " + se.getMessage());
+			}
+		} else {
+			// The configuration form is being submitted and needs to be
+			// processed.
+			Vector<String> processingSuccess = new Vector<String>();
+			Vector<String> processingErrors = new Vector<String>();
+			Vector<String> validationErrors = new Vector<String>();
+
+			try {
+				// For each property, check if it is changed and save it
+				PropertiesMetaData orgMetaData = PropertyService
+						.getOrgMetaData();
+
+				// process the fields for the global options (group 1)
+				SortedMap<Integer, MetaDataProperty> globalPropertyMap = orgMetaData
+						.getPropertiesInGroup(1);
+				Set<Integer> globalPropertyIndexes = globalPropertyMap.keySet();
+				for (Integer globalPropertyIndex : globalPropertyIndexes) {
+					String globalPropertyKey = globalPropertyMap.get(
+							globalPropertyIndex).getKey();
+					PropertyService.checkAndSetProperty(request,
+							globalPropertyKey);
+				}
+
+				// process the fields for the organization options (group 2)
+				SortedMap<Integer, MetaDataProperty> orgPropertyMap = 
+						orgMetaData.getPropertiesInGroup(2);
+				Set<Integer> orgPropertyIndexes = orgPropertyMap.keySet();
+				for (String orgName : LDAPUtil.getOrganizations()) {
+					if (request.getParameter(orgName + ".cb") != null) {
+						for (Integer orgPropertyIndex : orgPropertyIndexes) {
+							String orgPropertyKey = orgPropertyMap.get(
+									orgPropertyIndex).getKey() + "." + orgName;
+							PropertyService.checkAndSetProperty(request, orgPropertyKey);
+						}
+						PropertyService.setPropertyNoPersist("ldap.configured." + orgName,
+								"true");
+					} else {
+						PropertyService.setPropertyNoPersist("ldap.configured." + orgName,
+								"false");
+					}
+				}
+
+				// we need to write the options from memory to the properties
+				// file
+				PropertyService.persistProperties();
+
+				// Validate that the options provided are legitimate. Note that
+				// we've allowed them to persist their entries. As of this point
+				// there is no other easy way to go back to the configure form
+				// and preserve their entries.
+				validationErrors.addAll(validateOptions(request));
+
+				// Try to create data file and backup directories if
+				// necessary.
+				String backupDir = PropertyService.getBackupDir();
+				if (!FileUtil.createDirectory(backupDir)) {
+					String errorString = "Could not create directory: " + backupDir;
+					logMetacat.error(errorString);
+					validationErrors.add(errorString);
+				}
+
+				// Write out the configurable properties to a backup file
+				// outside the install directory.  Note that we allow them to
+				// do this even if they have validation errors.  They will
+				// need to go back and fix the errors before they can run metacat.
+				PropertyService.persistOrgBackupProperties(request.getSession()
+						.getServletContext());
+			
+			} catch (GeneralPropertyException gpe) {
+				String errorMessage = "Problem getting or setting property while "
+					+ "processing LDAP properties page: " + gpe.getMessage();
+				logMetacat.error(errorMessage);
+				processingErrors.add(errorMessage);
+			} catch (IOException ioe) {
+				String errorMessage = "IO problem while processing LDAP "
+						+ "properties page: " + ioe.getMessage();
+				logMetacat.error(errorMessage);
+				processingErrors.add(errorMessage);
+			} catch (UtilException ue) {
+				String errorMessage = "Error in utilities while: " 
+						+ "processing LDAP properties page: " + ue.getMessage();
+				logMetacat.error(errorMessage);
+				processingErrors.add(errorMessage);
+			}
+			
+			try {
+				if (validationErrors.size() > 0 || processingErrors.size() > 0) {
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestFormErrors(request, validationErrors);
+					RequestUtil.setRequestErrors(request, processingErrors);
+					RequestUtil.forwardRequest(request, response, "/admin");
+				} else {
+					// Now that the options have been set, change the
+					// 'ldapConfigured' option to 'true'
+					PropertyService.setProperty("configutil.ldapConfigured",
+							PropertyService.CONFIGURED);
+					
+					// Reload the main metacat configuration page
+					processingSuccess.add("LDAP successfully configured");
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestSuccess(request, processingSuccess);
+					RequestUtil.forwardRequest(request, response,
+							"/admin?configureType=configure&processForm=false");
+				}
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while "
+						+ "processing LDAP properties page: " + se.getMessage());
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while processing LDAP "
+						+ "properties page: " + ioe.getMessage());
+			}
+		}
+	}
+	
+	/**
+	 * Validate the most important configuration options submitted by the user.
+	 * 
+	 * @return a vector holding error message for any fields that fail
+	 *         validation.
+	 */
+	protected Vector<String> validateOptions(HttpServletRequest request) {
+		Vector<String> errorVector = new Vector<String>();
+
+		//TODO MCD validate options.
+		
+//		// Test ldap connectivity
+//		String ldapError = LDAPUtil.validateLDAPConnectivity(
+//				request.getParameter("ldap.url"), request.getParameter("ldap.base"));
+//		if (ldapError != null) {
+//			errorVector.add(ldapError);
+//		}
+
+		return errorVector;
+	}
+}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/admin/LDAPAdmin.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
Index: src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java	(revision 4080)
@@ -48,6 +48,11 @@
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /**
  * A database aware Class implementing callback bethods for the SAX parser to
  * call when processing the XML stream and generating events
@@ -308,7 +313,7 @@
         try
         {
             PermissionController control = new PermissionController(docid
-                    + MetaCatUtil.getOption("accNumSeparator") + revision);
+                    + PropertyService.getProperty("accNumSeparator") + revision);
             //unChangableSubTreeHash = getUnchangableSubTree(control, user,
             // groups);
 
@@ -317,7 +322,7 @@
             if (action != null && action.equals("UPDATE")
                     && !control.hasPermission(user, groups,
                             AccessControlInterface.ALLSTRING) 
-                            && !MetaCatUtil.isAdministrator(user, groups))
+                            && !LDAPUtil.isAdministrator(user, groups))
             {
                 needCheckingAccessModule = true;
                 unChangebleTopAccessSubTree = getTopAccessSubTreeFromDB();
@@ -594,7 +599,13 @@
                 inlineDataNameSpace = new Hashtable();
                 //initialize file writer
                 String docidWithoutRev = MetaCatUtil.getDocIdFromString(docid);
-                String seperator = MetaCatUtil.getOption("accNumSeparator");
+                String seperator = ".";
+                try {
+					seperator = PropertyService.getProperty("accNumSeparator");
+				} catch (PropertyNotFoundException pnfe) {
+					logMetacat.error("Could not get property 'accNumSeparator'.  " 
+							+ "Setting separator to '.': "+ pnfe.getMessage());
+				}
                 // the new file name will look like docid.rev.2
                 inlineDataFileName = docidWithoutRev + seperator + revision
                         + seperator + inLineDataIndex;
@@ -1424,8 +1435,7 @@
      * Method to check if the new line data is as same as the old one
      */
      private boolean modifiedInlineData(String inlineDistributionId,
-                                          String newInlineInternalFileName)
-     {
+			String newInlineInternalFileName) throws SAXException {
        boolean modified = true;
        if (inlineDistributionId == null || newInlineInternalFileName == null)
        {
@@ -1479,39 +1489,36 @@
         {
           throw new SAXException("The inline file name is null");
         }
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
-        // the new file name will look like path/docid.rev.2
-        File inlineDataDirectory = new File(path);
-        File inlineDataFile = new File(inlineDataDirectory, fileName);
-        try
-        {
-            FileReader inlineFileReader = new FileReader(inlineDataFile);
-            BufferedReader inlineStringReader = new BufferedReader(inlineFileReader);
-            String string = inlineStringReader.readLine();
-            // at the end oldstring will be null
-            while (string != null)
-            {
-                string = inlineStringReader.readLine();
-                if (string != null && !string.trim().equals(""))
-                {
-                  isEmpty = false;
-                  break;
-                }
-            }
+        
+        try {
+			String path = PropertyService.getProperty("application.inlinedatafilepath");
+			// the new file name will look like path/docid.rev.2
+			File inlineDataDirectory = new File(path);
+			File inlineDataFile = new File(inlineDataDirectory, fileName);
 
-        }
-        catch (Exception e)
-        {
-            throw new SAXException(e.getMessage());
-        }
-        return isEmpty;
+			FileReader inlineFileReader = new FileReader(inlineDataFile);
+			BufferedReader inlineStringReader = new BufferedReader(inlineFileReader);
+			String string = inlineStringReader.readLine();
+			// at the end oldstring will be null
+			while (string != null) {
+				string = inlineStringReader.readLine();
+				if (string != null && !string.trim().equals("")) {
+					isEmpty = false;
+					break;
+				}
+			}
 
+		} catch (Exception e) {
+			throw new SAXException(e.getMessage());
+		}
+		return isEmpty;
+
      }
 
 
     /**
-     * SAX Handler that receives notification of comments in the DTD
-     */
+	 * SAX Handler that receives notification of comments in the DTD
+	 */
     public void comment(char[] ch, int start, int length) throws SAXException
     {
         logMetacat.info("COMMENT");
@@ -2366,7 +2373,12 @@
             throws SAXException
     {
         FileWriter writer = null;
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
+        String path;
+        try {
+        	 path = PropertyService.getProperty("application.inlinedatafilepath");
+        } catch (PropertyNotFoundException pnfe) {
+            throw new SAXException(pnfe.getMessage());
+        }
         /*
          * File inlineDataDirectory = new File(path);
          */
@@ -2406,12 +2418,13 @@
         // this method need to be testing
         boolean same = true;
         String data = null;
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
-        // the new file name will look like path/docid.rev.2
-        File inlineDataDirectory = new File(path);
-        File oldDataFile = new File(inlineDataDirectory, oldFileName);
-        File newDataFile = new File(inlineDataDirectory, newFileName);
         try {
+        	String path = PropertyService.getProperty("application.inlinedatafilepath");
+			// the new file name will look like path/docid.rev.2
+			File inlineDataDirectory = new File(path);
+			File oldDataFile = new File(inlineDataDirectory, oldFileName);
+			File newDataFile = new File(inlineDataDirectory, newFileName);
+
             FileReader oldFileReader = new FileReader(oldDataFile);
             BufferedReader oldStringReader = new BufferedReader(oldFileReader);
             FileReader newFileReader = new FileReader(newDataFile);
@@ -2445,89 +2458,70 @@
     }
 
    /*
-    * Copy a old line file to a new inline file
-    */
-   public void copyInlineFile(String inlineDistributionId, String newFileName)
-           throws SAXException
-   {
-     if (inlineDistributionId == null || newFileName == null)
-     {
-       throw new SAXException("Could not copy inline file from old one to new "+
-                              "one!");
-     }
-     // get old file id from previousUnreadable data object
-    String oldInlineInternalFileName =
-         (String)previousUnreadableInlineDataObjectHash.get(inlineDistributionId);
+	 * Copy a old line file to a new inline file
+	 */
+	public void copyInlineFile(String inlineDistributionId, String newFileName)
+			throws SAXException {
+		if (inlineDistributionId == null || newFileName == null) {
+			throw new SAXException("Could not copy inline file from old one to new "
+					+ "one!");
+		}
+		// get old file id from previousUnreadable data object
+		String oldInlineInternalFileName = (String) previousUnreadableInlineDataObjectHash
+				.get(inlineDistributionId);
 
-    if (oldInlineInternalFileName == null ||
-        oldInlineInternalFileName.trim().equals(""))
-    {
-      throw new SAXException("Could not copy inline file from old one to new "+
-                              "one because can't find old file name");
-    }
-    logMetacat.info("in handle inline data");
-    logMetacat.info("the inline data file name from xml_access is: "
-                                 + oldInlineInternalFileName);
+		if (oldInlineInternalFileName == null
+				|| oldInlineInternalFileName.trim().equals("")) {
+			throw new SAXException("Could not copy inline file from old one to new "
+					+ "one because can't find old file name");
+		}
+		logMetacat.info("in handle inline data");
+		logMetacat.info("the inline data file name from xml_access is: "
+				+ oldInlineInternalFileName);
 
-    String path = MetaCatUtil.getOption("inlinedatafilepath");
-    // the new file name will look like path/docid.rev.2
-    File inlineDataDirectory = new File(path);
-    File oldDataFile = new File(inlineDataDirectory, oldInlineInternalFileName);
-    File newDataFile = new File(inlineDataDirectory, newFileName);
-    FileReader oldFileReader = null;
-    FileWriter newFileWriter = null;
-    try
-    {
-      oldFileReader = new FileReader(oldDataFile);
-      newFileWriter = new FileWriter(newDataFile);
-      char[] buf = new char[4 * 1024]; // 4K buffer
-      int b = oldFileReader.read(buf);
-      while (b != -1)
-      {
-        newFileWriter.write(buf, 0, b);
-        b = oldFileReader.read(buf);
+		FileReader oldFileReader = null;
+		FileWriter newFileWriter = null;
+		try {
+			String path = PropertyService.getProperty("application.inlinedatafilepath");
+			// the new file name will look like path/docid.rev.2
+			File inlineDataDirectory = new File(path);
+			File oldDataFile = new File(inlineDataDirectory, oldInlineInternalFileName);
+			File newDataFile = new File(inlineDataDirectory, newFileName);
 
-      }
-    }
-    catch (Exception e)
-    {
-      throw new SAXException(e.getMessage());
-    }
-    finally
-    {
-        if (oldFileReader != null)
-        {
-          try
-          {
-            oldFileReader.close();
-          }
-          catch (Exception ee)
-          {
-            throw new SAXException(ee.getMessage());
-          }
+			oldFileReader = new FileReader(oldDataFile);
+			newFileWriter = new FileWriter(newDataFile);
+			char[] buf = new char[4 * 1024]; // 4K buffer
+			int b = oldFileReader.read(buf);
+			while (b != -1) {
+				newFileWriter.write(buf, 0, b);
+				b = oldFileReader.read(buf);
+			}
+		} catch (Exception e) {
+			throw new SAXException(e.getMessage());
+		} finally {
+			if (oldFileReader != null) {
+				try {
+					oldFileReader.close();
+				} catch (Exception ee) {
+					throw new SAXException(ee.getMessage());
+				}
 
-        }
-        if (newFileWriter != null)
-        {
-          try
-          {
-            newFileWriter.close();
-          }
-          catch (Exception ee)
-          {
-            throw new SAXException(ee.getMessage());
-          }
+			}
+			if (newFileWriter != null) {
+				try {
+					newFileWriter.close();
+				} catch (Exception ee) {
+					throw new SAXException(ee.getMessage());
+				}
 
-        }
+			}
+		}
+	}
 
-    }
 
-  }
-
-
     // if xml file failed to upload, we need to call this method to delete
     // the inline data already in file system
-    public void deleteInlineFiles()
+    public void deleteInlineFiles() throws SAXException
     {
         if (!inlineFileIDList.isEmpty()) {
             for (int i = 0; i < inlineFileIDList.size(); i++) {
@@ -2538,10 +2532,15 @@
     }
 
     /* delete the inline data file */
-    private void deleteInlineDataFile(String fileName)
+    private void deleteInlineDataFile(String fileName) throws SAXException
     {
-
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
+    	String path;
+    	try {
+    		path = PropertyService.getProperty("application.inlinedatafilepath");
+    	} catch (PropertyNotFoundException pnfe) {
+    		throw new SAXException ("Could not find inline data file path: " 
+    				+ pnfe.getMessage());
+    	}
         File inlineDataDirectory = new File(path);
         File newFile = new File(inlineDataDirectory, fileName);
         newFile.delete();
@@ -2549,28 +2548,28 @@
     }
 
     /*
-     * In eml2, the inline data wouldn't store in db, it store in file system
-     * The db stores file name(without path).
-     */
-    public static Reader readInlineDataFromFileSystem(String fileName)
-            throws McdbException
-    {
-        //BufferedReader stringReader = null;
-        FileReader fileReader = null;
-        String path = MetaCatUtil.getOption("inlinedatafilepath");
-        // the new file name will look like path/docid.rev.2
-        File inlineDataDirectory = new File(path);
-        File dataFile = new File(inlineDataDirectory, fileName);
-        try {
-            fileReader = new FileReader(dataFile);
-            //stringReader = new BufferedReader(fileReader);
-        } catch (Exception e) {
-            throw new McdbException(e.getMessage());
-        }
-        // return stringReader;
-        return fileReader;
-    }
+	 * In eml2, the inline data wouldn't store in db, it store in file system
+	 * The db stores file name(without path).
+	 */
+	public static Reader readInlineDataFromFileSystem(String fileName)
+			throws McdbException {
+		// BufferedReader stringReader = null;
+		FileReader fileReader = null;
+		try {
+			String path = PropertyService.getProperty("application.inlinedatafilepath");
+			// the new file name will look like path/docid.rev.2
+			File inlineDataDirectory = new File(path);
+			File dataFile = new File(inlineDataDirectory, fileName);
 
+			fileReader = new FileReader(dataFile);
+			// stringReader = new BufferedReader(fileReader);
+		} catch (Exception e) {
+			throw new McdbException(e.getMessage());
+		}
+		// return stringReader;
+		return fileReader;
+	}
+
     /* Delete relations */
     private void deleteRelations() throws SAXException
     {
Index: src/edu/ucsb/nceas/metacat/DocumentIdentifier.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentIdentifier.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DocumentIdentifier.java	(revision 4080)
@@ -31,6 +31,9 @@
 import java.lang.*;
 import java.sql.*;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /**
  * A class to parse document ids
  * The docid is of the form siteCode.uniqueId.rev 
@@ -42,33 +45,34 @@
   private String uniqueId = null;
   private String siteCode = null;
   private String separator = null;
-  private MetaCatUtil util = new MetaCatUtil();
   
-  /** 
-   * Constructor to build a docid object and parse an incoming string.
-   */
-  public DocumentIdentifier(String docid) throws AccessionNumberException
-  {
-    this.docid = docid;
-    this.separator = util.getOption("accNumSeparator");
+  /**
+	 * Constructor to build a docid object and parse an incoming string.
+	 */
+	public DocumentIdentifier(String docid) throws AccessionNumberException {
+		this.docid = docid;
+		try {
+			this.separator = PropertyService.getProperty("accNumSeparator");
+		} catch (PropertyNotFoundException pnfe) {
+			throw new AccessionNumberException(
+					"Could not get property 'accNumSeparator' :" + pnfe.getMessage());
+		}
 
-    if(docid.endsWith(this.separator))
-    {
-      throw new AccessionNumberException("Accession number cannot end with " + 
-                "a seperator.");
-    }
-    if(docid.startsWith(this.separator))
-    {
-      throw new AccessionNumberException("Accession number cannot begin with " + 
-                "a seperator.");
-    }
-    
-    parseDocid();
-  }
+		if (docid.endsWith(this.separator)) {
+			throw new AccessionNumberException("Accession number cannot end with "
+					+ "a seperator.");
+		}
+		if (docid.startsWith(this.separator)) {
+			throw new AccessionNumberException("Accession number cannot begin with "
+					+ "a seperator.");
+		}
+
+		parseDocid();
+	}
   
   /**
-   * parses the docid into its parts
-   */
+	 * parses the docid into its parts
+	 */
   private void parseDocid() throws AccessionNumberException
   {
     try {
Index: src/edu/ucsb/nceas/metacat/AccessControlList.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AccessControlList.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/AccessControlList.java	(revision 4080)
@@ -46,6 +46,11 @@
 import org.xml.sax.helpers.XMLReaderFactory;
 import org.xml.sax.helpers.DefaultHandler;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /** 
  * A Class that loads eml-access.xml file containing ACL for a metadata
  * document into relational DB. It extends DefaultHandler class to handle
@@ -117,45 +122,44 @@
    * @param serverCode the serverid from xml_replication on which this document
    *        resides.
    */
-  public AccessControlList(DBConnection conn, String aclid, int rev,//Reader acl,
+  public AccessControlList(DBConnection conn, String aclid, int rev,
                            String user, String[] groups, int serverCode)
-                  throws SAXException, IOException, McdbException
+                  throws SAXException, IOException, McdbException, PropertyNotFoundException
   {
-    String parserName = MetaCatUtil.getOption("saxparser");
-    this.server = MetaCatUtil.getOption("server");
-    this.sep = MetaCatUtil.getOption("accNumSeparator");
+		String parserName = PropertyService.getProperty("saxparser");
+		this.server = SystemUtil.getSecureServerURL();
+		this.sep = PropertyService.getProperty("accNumSeparator");
 
-    this.connection = conn;
-    this.parserName = parserName;
-    this.processingDTD = false;
-    this.elementStack = new Stack();
-    
-    this.user = user;
-    this.groups = groups;
-    this.aclid = aclid;
-    this.resourceURL = new Vector();
-    this.resourceID = new Vector();
-    this.principal = new Vector();
-    this.permission = 0;
-    this.ticketCount = 0;
-  //  this.publicAcc = null;
-    this.serverCode = serverCode;
-    
-    // read the access file from db connection
-    DocumentImpl acldoc = new DocumentImpl(aclid+sep+rev);
-    String acl = acldoc.toString();
-    this.rev = acldoc.getRev();
+		this.connection = conn;
+		this.parserName = parserName;
+		this.processingDTD = false;
+		this.elementStack = new Stack();
 
-    // Initialize the parse
-    XMLReader parser = initializeParser();
-    // parse the access file and write the info to xml_access
-    parser.parse(new InputSource(new StringReader(acl)));
-    
-  }
+		this.user = user;
+		this.groups = groups;
+		this.aclid = aclid;
+		this.resourceURL = new Vector();
+		this.resourceID = new Vector();
+		this.principal = new Vector();
+		this.permission = 0;
+		this.ticketCount = 0;
+		// this.publicAcc = null;
+		this.serverCode = serverCode;
 
+		// read the access file from db connection
+		DocumentImpl acldoc = new DocumentImpl(aclid + sep + rev);
+		String acl = acldoc.toString();
+		this.rev = acldoc.getRev();
+
+		// Initialize the parse
+		XMLReader parser = initializeParser();
+		// parse the access file and write the info to xml_access
+		parser.parse(new InputSource(new StringReader(acl)));
+	}
+
 // NOT USED
-//  /**
-//   * Construct an instance of the AccessControlList class.
+// /**
+// * Construct an instance of the AccessControlList class.
 //   * It parses eml-access file and loads acl data into db connection.
 //   * It is used from command line execution.
 //   *
@@ -662,9 +666,8 @@
   {
     StringBuffer output = new StringBuffer();
     StringBuffer outTemp = new StringBuffer();
-    MetaCatUtil util = new MetaCatUtil();
-    String accDoctype = util.getOption("accessdoctype");
-    String server = util.getOption("server");
+    String accDoctype = PropertyService.getProperty("accessdoctype");
+    String server = PropertyService.getProperty("server");
     String docurl = "metacat://" + server + "/?docid=" + docid;
     String systemID;
     boolean isOwned = false;
@@ -923,44 +926,41 @@
   }
 
   /* Get SystemID for @publicID from Metacat DB Catalog. */
-  private String getSystemID(String publicID) throws SQLException {
-    
-    String systemID = "";
-    PreparedStatement pstmt = null;
-    DBConnection conn = null;
-    int serialNumber = -1;
-    
-    try
-    {
-      //check out DBConnection
-      conn=DBConnectionPool.getDBConnection("AccessControlList.getSystemID");
-      serialNumber=conn.getCheckOutSerialNumber();
-    
-      pstmt = conn.prepareStatement("SELECT system_id FROM xml_catalog " +
-                                  "WHERE entry_type = 'DTD' " + 
-                                  "AND public_id = ?");
-      pstmt.setString(1, publicID);
-      pstmt.execute();
-      ResultSet rs = pstmt.getResultSet();
-      boolean hasRow = rs.next();
-      if ( hasRow ) {
-        systemID = rs.getString(1);
-      }
-    
-      return systemID;
-    }//try
-    finally
-    {
-      
-      try
-      {
-        pstmt.close();
-      }
-      finally
-      {
-        DBConnectionPool.returnDBConnection(conn, serialNumber);
-      }
-    }//finally
-  }
+  private String getSystemID(String publicID) throws SQLException, PropertyNotFoundException {
 
+		String systemID = "";
+		PreparedStatement pstmt = null;
+		DBConnection conn = null;
+		int serialNumber = -1;
+
+		try {
+			//check out DBConnection
+			conn = DBConnectionPool.getDBConnection("AccessControlList.getSystemID");
+			serialNumber = conn.getCheckOutSerialNumber();
+
+			pstmt = conn.prepareStatement("SELECT system_id FROM xml_catalog "
+					+ "WHERE entry_type = 'DTD' " + "AND public_id = ?");
+			pstmt.setString(1, publicID);
+			pstmt.execute();
+			ResultSet rs = pstmt.getResultSet();
+			boolean hasRow = rs.next();
+			if (hasRow) {
+				systemID = rs.getString(1);
+				// system id may not have server url on front.  Add it if not.
+				if (!systemID.startsWith("http://")) {
+					systemID = SystemUtil.getServerURL() + systemID;
+				}
+			}
+
+			return systemID;
+		}//try
+		finally {
+			try {
+				pstmt.close();
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}//finally
+	}
+
 }
Index: src/edu/ucsb/nceas/metacat/DBEntityResolver.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBEntityResolver.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBEntityResolver.java	(revision 4080)
@@ -31,6 +31,9 @@
 import org.xml.sax.*;
 import org.xml.sax.helpers.DefaultHandler;
 
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 import java.sql.*;
 import java.io.File;
 import java.io.Reader;
@@ -208,12 +211,19 @@
       boolean tableHasRows = rs.next();
       if (tableHasRows) {
         systemid = rs.getString(1);
+        // system id may not have server url on front.  Add it if not.
+        if (!systemid.startsWith("http://")) {
+        	systemid = SystemUtil.getServerURL() + systemid;
+        }
       }
       stmt.close();
     } catch (SQLException e) {
       throw new SAXException
       ("DBEntityResolver.getDTDSystemID(): " + e.getMessage());
-    }
+    } catch (PropertyNotFoundException pnfe) {
+        throw new SAXException
+        ("DBEntityResolver.getDTDSystemID(): " + pnfe.getMessage());
+      }
     finally
     {
       try
@@ -285,170 +295,177 @@
   }
 
   /**
-   * Upload new DTD text identified by @systemId to Metacat file system
-   */
-  private String uploadDTD ( String systemId )
-                 throws SAXException
-  {
-    MetaCatUtil util = new MetaCatUtil();
-    String dtdPath = util.getOption("dtdPath");
-    String dtdURL = util.getOption("dtdURL");
+	 * Upload new DTD text identified by
+	 * 
+	 * @systemId to Metacat file system
+	 */
+	private String uploadDTD(String systemId) throws SAXException {
+		String dtdPath = null;
+		String dtdURL = null;
+		try {
+			dtdPath = SystemUtil.getContextDir() + "/dtd/";
+			dtdURL = SystemUtil.getContextURL() + "/dtd/";
+		} catch (PropertyNotFoundException pnfe) {
+			throw new SAXException("DBEntityResolver.uploadDTD: " + pnfe.getMessage());
+		}
 
-    // get filename from systemId
-    String filename = systemId;
-    int slash = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
-    if ( slash > -1 ) {
-      filename = filename.substring(slash + 1);
-    }
+		// get filename from systemId
+		String filename = systemId;
+		int slash = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
+		if (slash > -1) {
+			filename = filename.substring(slash + 1);
+		}
 
-    // writing dtd text on Metacat file system as filename
-    try {
-      // create a buffering character-input stream
-      // that uses a default-sized input buffer
-      BufferedReader in = new BufferedReader(dtdtext);
+		// writing dtd text on Metacat file system as filename
+		try {
+			// create a buffering character-input stream
+			// that uses a default-sized input buffer
+			BufferedReader in = new BufferedReader(dtdtext);
 
-      // open file writer to write the input into it
-      //String dtdPath = "/opt/tomcat/webapps/bojilova/dtd/";
-      File f = new File(dtdPath, filename);
-     synchronized (f) {
-      try {
-        if ( f.exists() ) {
-          throw new IOException("File already exist: " + f.getCanonicalFile());
-        //if ( f.exists() && !f.canWrite() ) {
-        //  throw new IOException("Not writable: " + f.getCanonicalFile());
-        }
-      } catch (SecurityException se) {
-        // if a security manager exists,
-        // its checkRead method is called for f.exist()
-        // or checkWrite method is called for f.canWrite()
-        throw se;
-      }
-      // create a buffered character-output stream
-      // that uses a default-sized output buffer
-      FileWriter fw = new FileWriter(f);
-      BufferedWriter out = new BufferedWriter(fw);
+			// open file writer to write the input into it
+			// String dtdPath = "/opt/tomcat/webapps/bojilova/dtd/";
+			File f = new File(dtdPath, filename);
+			synchronized (f) {
+				try {
+					if (f.exists()) {
+						throw new IOException("File already exist: "
+								+ f.getCanonicalFile());
+						// if ( f.exists() && !f.canWrite() ) {
+						// throw new IOException("Not writable: " +
+						// f.getCanonicalFile());
+					}
+				} catch (SecurityException se) {
+					// if a security manager exists,
+					// its checkRead method is called for f.exist()
+					// or checkWrite method is called for f.canWrite()
+					throw se;
+				}
+				// create a buffered character-output stream
+				// that uses a default-sized output buffer
+				FileWriter fw = new FileWriter(f);
+				BufferedWriter out = new BufferedWriter(fw);
 
-      // read the input and write into the file writer
-      String inputLine;
-      while ( (inputLine = in.readLine()) != null ) {
-        out.write(inputLine, 0, inputLine.length());
-        out.newLine(); //instead of out.write('\r\n');
-      }
+				// read the input and write into the file writer
+				String inputLine;
+				while ((inputLine = in.readLine()) != null) {
+					out.write(inputLine, 0, inputLine.length());
+					out.newLine(); // instead of out.write('\r\n');
+				}
 
-      // the input and the output streams must be closed
-      in.close();
-      out.flush();
-      out.close();
-      fw.close();
-     } // end of synchronized
-    } catch (MalformedURLException e) {
-      throw new SAXException
-      ("DBEntityResolver.uploadDTD(): " + e.getMessage());
-    } catch (IOException e) {
-      throw new SAXException
-      ("DBEntityResolver.uploadDTD(): " + e.getMessage());
-    } catch (SecurityException e) {
-      throw new SAXException
-      ("DBEntityResolver.uploadDTD(): " + e.getMessage());
-    }
+				// the input and the output streams must be closed
+				in.close();
+				out.flush();
+				out.close();
+				fw.close();
+			} // end of synchronized
+		} catch (MalformedURLException e) {
+			throw new SAXException("DBEntityResolver.uploadDTD(): " + e.getMessage());
+		} catch (IOException e) {
+			throw new SAXException("DBEntityResolver.uploadDTD(): " + e.getMessage());
+		} catch (SecurityException e) {
+			throw new SAXException("DBEntityResolver.uploadDTD(): " + e.getMessage());
+		}
 
-    //String dtdURL = "http://dev.nceas.ucsb.edu/bojilova/dtd/";
-    return  dtdURL + filename;
-  }
+		// String dtdURL = "http://dev.nceas.ucsb.edu/bojilova/dtd/";
+		return dtdURL + filename;
+	}
 
 
   /**
-   * Upload new DTD located at outside URL to Metacat file system
-   */
-  private String uploadDTDFromURL(InputStream istream, String systemId)
-                 throws SAXException
-  {
-    MetaCatUtil util = new MetaCatUtil();
-    String dtdPath = util.getOption("dtdPath");
-    String dtdURL = util.getOption("dtdURL");
+	 * Upload new DTD located at outside URL to Metacat file system
+	 */
+	private String uploadDTDFromURL(InputStream istream, String systemId)
+			throws SAXException {
+		String dtdPath = null;
+		String dtdURL = null;
+		try {
+			dtdPath = SystemUtil.getContextDir() + "/dtd/";
+			dtdURL = SystemUtil.getContextURL() + "/dtd/";
+		} catch (PropertyNotFoundException pnfe) {
+			throw new SAXException("DBEntityResolver.uploadDTDFromURL: "
+					+ pnfe.getMessage());
+		}
 
-    // get filename from systemId
-    String filename = systemId;
-    int slash = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
-    if ( slash > -1 ) {
-      filename = filename.substring(slash + 1);
-    }
+		// get filename from systemId
+		String filename = systemId;
+		int slash = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
+		if (slash > -1) {
+			filename = filename.substring(slash + 1);
+		}
 
-    // writing dtd text on Metacat file system as filename
-    try {
-      // create a buffering character-input stream
-      // that uses a default-sized input buffer
-      BufferedInputStream in = new BufferedInputStream(istream);
+		// writing dtd text on Metacat file system as filename
+		try {
+			// create a buffering character-input stream
+			// that uses a default-sized input buffer
+			BufferedInputStream in = new BufferedInputStream(istream);
 
-      // open file writer to write the input into it
-      //String dtdPath = "/opt/tomcat/webapps/bojilova/dtd/";
-      File f = new File(dtdPath, filename);
-     synchronized (f) {
-      try {
-        if ( f.exists() ) {
-          throw new IOException("File already exist: " + f.getCanonicalFile());
-        //if ( f.exists() && !f.canWrite() ) {
-        //  throw new IOException("Not writable: " + f.getCanonicalFile());
-        }
-      } catch (SecurityException se) {
-        // if a security manager exists,
-        // its checkRead method is called for f.exist()
-        // or checkWrite method is called for f.canWrite()
-        throw se;
-      }
-      // create a buffered character-output stream
-      // that uses a default-sized output buffer
-      FileWriter fw = new FileWriter(f);
-      BufferedWriter out = new BufferedWriter(fw);
+			// open file writer to write the input into it
+			//String dtdPath = "/opt/tomcat/webapps/bojilova/dtd/";
+			File f = new File(dtdPath, filename);
+			synchronized (f) {
+				try {
+					if (f.exists()) {
+						throw new IOException("File already exist: "
+								+ f.getCanonicalFile());
+						//if ( f.exists() && !f.canWrite() ) {
+						//  throw new IOException("Not writable: " + f.getCanonicalFile());
+					}
+				} catch (SecurityException se) {
+					// if a security manager exists,
+					// its checkRead method is called for f.exist()
+					// or checkWrite method is called for f.canWrite()
+					throw se;
+				}
+				// create a buffered character-output stream
+				// that uses a default-sized output buffer
+				FileWriter fw = new FileWriter(f);
+				BufferedWriter out = new BufferedWriter(fw);
 
-      // read the input and write into the file writer
-      int inputByte;
-      while ( (inputByte = in.read()) != -1 ) {
-        out.write(inputByte);
-        //out.newLine(); //instead of out.write('\r\n');
-      }
+				// read the input and write into the file writer
+				int inputByte;
+				while ((inputByte = in.read()) != -1) {
+					out.write(inputByte);
+					//out.newLine(); //instead of out.write('\r\n');
+				}
 
-      // the input and the output streams must be closed
-      in.close();
-      out.flush();
-      out.close();
-      fw.close();
-     } // end of synchronized
-    } catch (MalformedURLException e) {
-      throw new SAXException
-      ("DBEntityResolver.uploadDTDFromURL(): " + e.getMessage());
-    } catch (IOException e) {
-      throw new SAXException
-      ("DBEntityResolver.uploadDTDFromURL(): " + e.getMessage());
-    } catch (SecurityException e) {
-      throw new SAXException
-      ("DBEntityResolver.uploadDTDFromURL(): " + e.getMessage());
-    }
+				// the input and the output streams must be closed
+				in.close();
+				out.flush();
+				out.close();
+				fw.close();
+			} // end of synchronized
+		} catch (MalformedURLException e) {
+			throw new SAXException("DBEntityResolver.uploadDTDFromURL(): "
+					+ e.getMessage());
+		} catch (IOException e) {
+			throw new SAXException("DBEntityResolver.uploadDTDFromURL(): "
+					+ e.getMessage());
+		} catch (SecurityException e) {
+			throw new SAXException("DBEntityResolver.uploadDTDFromURL(): "
+					+ e.getMessage());
+		}
 
-    //String dtdURL = "http://dev.nceas.ucsb.edu/bojilova/dtd/";
-    return  dtdURL + filename;
-  }
+		//String dtdURL = "http://dev.nceas.ucsb.edu/bojilova/dtd/";
+		return dtdURL + filename;
+	}
 
-  /**
-   * Check URL Connection for @systemId, and return an InputStream
-   * that can be used to read from the systemId URL.  The parser ends
-   * up using this via the InputSource to read the DTD.
-   *
-   * @param systemId a URI (in practice URL) to be checked and opened
-   */
-  public static InputStream checkURLConnection (String systemId)
-                      throws SAXException
-  {
-    try {
+	/**
+	 * Check URL Connection for @systemId, and return an InputStream
+	 * that can be used to read from the systemId URL.  The parser ends
+	 * up using this via the InputSource to read the DTD.
+	 *
+	 * @param systemId a URI (in practice URL) to be checked and opened
+	 */
+	public static InputStream checkURLConnection(String systemId) throws SAXException {
+		try {
+			return (new URL(systemId).openStream());
 
-      return (new URL(systemId).openStream());
-
-    } catch (MalformedURLException e) {
-      throw new SAXException
-      ("DBEntityResolver.checkURLConnection(): " + e.getMessage());
-    } catch (IOException e) {
-      throw new SAXException
-      ("DBEntityResolver.checkURLConnection(): " + e.getMessage());
-    }
-  }
+		} catch (MalformedURLException e) {
+			throw new SAXException("DBEntityResolver.checkURLConnection(): "
+					+ e.getMessage());
+		} catch (IOException e) {
+			throw new SAXException("DBEntityResolver.checkURLConnection(): "
+					+ e.getMessage());
+		}
+	}
 }
Index: src/edu/ucsb/nceas/metacat/admin/MetaCatAdmin.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/MetaCatAdmin.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/MetaCatAdmin.java	(revision 4080)
@@ -0,0 +1,50 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements utility methods like:
+ *             1/ Reding all doctypes from db connection
+ *             2/ Reading DTD or Schema file from Metacat catalog system
+ *             3/ Reading Lore type Data Guide from db connection
+ *  Copyright: 2000 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Jivka Bojilova
+ * 
+ *   '$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.admin;
+
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * A suite of utility classes for querying DB
+ * 
+ */
+public abstract class MetaCatAdmin {
+	
+	/**
+	 * Require subclasses to implement a properties validator.
+	 * 
+	 * @return a vector holding error message for any fields that fail
+	 *         validation.
+	 */
+	protected abstract Vector<String> validateOptions(HttpServletRequest request);
+
+}

Property changes on: src/edu/ucsb/nceas/metacat/admin/MetaCatAdmin.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
Index: src/edu/ucsb/nceas/metacat/admin/DBAdmin.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/DBAdmin.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/DBAdmin.java	(revision 4080)
@@ -0,0 +1,893 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements database configuration methods
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$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.admin;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.sql.Timestamp;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.TreeSet;
+import java.util.Vector;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import edu.ucsb.nceas.metacat.DBConnection;
+import edu.ucsb.nceas.metacat.DBConnectionPool;
+import edu.ucsb.nceas.metacat.DBVersion;
+import edu.ucsb.nceas.metacat.MetaCatVersion;
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.DatabaseUtil;
+import edu.ucsb.nceas.metacat.util.RequestUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.metacat.util.UtilException;
+
+import edu.ucsb.nceas.utilities.DBUtil;
+import edu.ucsb.nceas.utilities.FileUtil;
+import edu.ucsb.nceas.utilities.GeneralPropertyException;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Control the display of the database configuration page and the processing
+ * of the configuration values.
+ */
+public class DBAdmin extends MetaCatAdmin {
+	// db statuses used by discovery code
+	public static final int DB_DOES_NOT_EXIST = 0;
+	public static final int TABLES_DO_NOT_EXIST = 1;
+	public static final int TABLES_EXIST = 2;
+
+	// db version statuses. This allows us to keep version history
+	// in the db. Only the latest version record should be active.
+	public static final int VERSION_INACTIVE = 0;
+	public static final int VERSION_ACTIVE = 1;
+
+	private TreeSet<DBVersion> versionSet = null;
+
+	private static DBAdmin dbAdmin = null;
+	private Logger logMetacat = Logger.getLogger(DBAdmin.class);
+	private HashSet<String> sqlCommandSet = new HashSet<String>();
+//	private MetaCatVersion metacatVersion = null;
+	private static DBVersion databaseVersion = null;
+
+	/**
+	 * private constructor since this is a singleton
+	 */
+	private DBAdmin() throws AdminException {
+		sqlCommandSet.add("INSERT");
+		sqlCommandSet.add("UPDATE");
+		sqlCommandSet.add("DELETE");
+		sqlCommandSet.add("ALTER");
+		sqlCommandSet.add("CREATE");
+		sqlCommandSet.add("DROP");
+		sqlCommandSet.add("BEGIN");
+		sqlCommandSet.add("COMMIT");
+
+		// gets all the upgrade version objects
+		try {
+			versionSet = DatabaseUtil.getUpgradeVersions();
+		} catch (PropertyNotFoundException pnfe) {
+			throw new AdminException("Could not retrieve database upgrade " 
+					+ "versions during instantiation" + pnfe.getMessage());
+		} catch (NumberFormatException nfe) {
+			throw new AdminException("Bad version format numbering: "
+					+ nfe.getMessage());
+		}
+	}
+
+	/**
+	 * Get the single instance of DBAdmin.
+	 * 
+	 * @return the single instance of DBAdmin
+	 */
+	public static DBAdmin getInstance() throws AdminException {
+		if (dbAdmin == null) {
+			dbAdmin = new DBAdmin();
+		}
+		return dbAdmin;
+	}
+
+	/**
+	 * Handle configuration of the database the first time that Metacat starts
+	 * or when it is explicitly called. Collect necessary update information
+	 * from the administrator.
+	 * 
+	 * @param request
+	 *            the http request information
+	 * @param response
+	 *            the http response to be sent back to the client
+	 */
+	public void configureDatabase(HttpServletRequest request,
+			HttpServletResponse response) throws AdminException {
+
+		String processForm = request.getParameter("processForm");
+		String formErrors = (String) request.getAttribute("formErrors");
+		HttpSession session = request.getSession();
+
+		if (processForm == null || !processForm.equals("true") || formErrors != null) {
+			// The servlet configuration parameters have not been set, or there
+			// were form errors on the last attempt to configure, so redirect to
+			// the web form for configuring metacat
+
+			try {
+				// get the current metacat version and the database version. If
+				// the database version is older that the metacat version, run
+				// the appropriate scripts to get them synchronized.
+
+				databaseVersion = discoverDBVersion();
+				MetaCatVersion metacatVersion = SystemUtil.getMetacatVersion();
+				
+				session.setAttribute("metacatVersion", MetaCatVersion.getVersionID());
+
+				// if the db version is already the same as the metacat
+				// version, update metacat.properties
+				if (databaseVersion.compareTo(metacatVersion) == 0) {
+					PropertyService.setProperty("configutil.databaseConfigured",
+							PropertyService.CONFIGURED);
+				}
+				
+				MetaCatVersion metaCatVersion = SystemUtil.getMetacatVersion();
+				request.setAttribute("metacatVersion", metaCatVersion);
+				DBVersion dbVersionString = getDBVersion();
+				request.setAttribute("databaseVersion", dbVersionString);
+				Vector<String> updateScriptList = getUpdateScripts();
+				request.setAttribute("updateScriptList", updateScriptList);
+
+				// Forward the request to the JSP page
+				RequestUtil.clearRequestMessages(request);
+				RequestUtil.forwardRequest(request, response,
+						"/admin/database-configuration.jsp");
+			} catch (PropertyNotFoundException pnfe) {
+				throw new AdminException("Problem getting property while initializing "
+						+ "system properties page: " + pnfe.getMessage());
+			} catch (IOException ioe) {
+				throw new AdminException("IO problem while initializing "
+						+ "system properties page:" + ioe.getMessage());
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while "
+						+ "initializing system properties page: " + se.getMessage());
+			}  
+		} else {
+			// The configuration form is being submitted and needs to be
+			// processed, setting the properties in the configuration file
+			// then restart metacat
+
+			// The configuration form is being submitted and needs to be
+			// processed.
+			Vector<String> validationErrors = new Vector<String>();
+			Vector<String> processingSuccess = new Vector<String>();
+
+			try {
+				// Validate that the options provided are legitimate. Note that
+				// we've allowed them to persist their entries. As of this point
+				// there is no other easy way to go back to the configure form
+				// and
+				// preserve their entries.
+				validationErrors.addAll(validateOptions(request));
+
+				upgradeDatabase();
+
+				// Now that the options have been set, change the
+				// 'databaseConfigured' option to 'true' so that normal metacat
+				// requests will go through
+				PropertyService.setProperty("configutil.databaseConfigured",
+						PropertyService.CONFIGURED);
+
+				// Reload the main metacat configuration page
+				processingSuccess.add("Database successfully upgraded");
+				RequestUtil.clearRequestMessages(request);
+				RequestUtil.setRequestSuccess(request, processingSuccess);
+				RequestUtil.forwardRequest(request, response,
+						"/admin?configureType=configure&processForm=false");
+				// Write out the configurable properties to a backup file
+				// outside the install directory.
+
+				PropertyService.persistMainBackupProperties(request.getSession()
+						.getServletContext());
+			} catch (GeneralPropertyException gpe) {
+				throw new AdminException("Problem getting or setting property while "
+						+ "upgrading database: " + gpe.getMessage());
+			}  catch (IOException ioe) {
+				throw new AdminException("IO problem while upgrading database: "
+						 + ioe.getMessage());
+			} catch (ServletException se) {
+				throw new AdminException("problem forwarding request while "
+						+ "upgrading database: " + se.getMessage());
+			}
+		}
+	}
+
+
+	/**
+	 * Performs a status check on the database.
+	 * 
+	 * @returns integer representing the status of the database. These can be: 
+	 * 		-- DB_DOES_NOT_EXIST = 0; 
+	 *      -- TABLES_DO_NOT_EXIST = 1; 
+	 *      -- TABLES_EXIST = 2;
+	 */
+	public int getDBStatus() throws SQLException, PropertyNotFoundException {
+		Connection connection = DBUtil.getConnection(PropertyService
+				.getProperty("database.connectionURI"), PropertyService
+				.getProperty("database.user"), PropertyService
+				.getProperty("database.password"));
+
+		if (DBUtil.tableExists(connection, "xml_documents")) {
+			return TABLES_EXIST;
+		}
+
+		return TABLES_DO_NOT_EXIST;
+	}
+
+	/**
+	 * Get the version of the database as a string
+	 * 
+	 * @returns string representing the version of the database.
+	 */
+	public DBVersion getDBVersion() throws AdminException {
+
+		// don't even try to search for a database version until system
+		// properties have been configured
+		try {
+		if (!PropertyService.arePropertiesConfigured()) {
+			throw new AdminException("An attempt was made to get the database version " 
+					+ "before system properties were configured");
+		}
+		} catch (UtilException ue) {
+			throw new AdminException("Could not determine the database version: " + ue.getMessage());
+		}
+		if (databaseVersion == null) {
+			databaseVersion = discoverDBVersion();
+		}
+
+		if (databaseVersion == null) {
+			throw new AdminException("Could not find database version");
+		}
+
+		return databaseVersion;
+	}
+
+	/**
+	 * Try to discover the database version, first by calling
+	 * getRegisteredDBVersion() to see if the database version is in a table in
+	 * the database. If not, getUnRegisteredDBVersion() is called to see if we
+	 * can devine the version by looking for unique changes made by scripts for
+	 * each version update.
+	 * 
+	 * @returns string representing the version of the database, null if none
+	 *          could be found.
+	 */
+	private DBVersion discoverDBVersion() throws AdminException {
+		try {
+			int dbStatus = getDBStatus();
+			if (dbStatus == DB_DOES_NOT_EXIST) {
+				throw new AdminException(
+						"Database does not exist for connection"
+						+ PropertyService.getProperty("database.connectionURI"));
+			} else if (dbStatus == TABLES_DO_NOT_EXIST) {
+				databaseVersion = new DBVersion("0.0.0");
+				return databaseVersion;
+			}
+
+			databaseVersion = getRegisteredDBVersion();
+			if (databaseVersion != null) {
+				return databaseVersion;
+			}
+
+			databaseVersion = getUnRegisteredDBVersion();
+			
+		} catch (SQLException sqle) {
+			String errorMessage = "SQL error during  database version discovery: "
+				+ sqle.getMessage();
+			logMetacat.error(errorMessage);
+			throw new AdminException(errorMessage);
+		} catch (PropertyNotFoundException pnfe) {
+			String errorMessage = "Property not found during  database version discovery: "
+					+ pnfe.getMessage();
+			logMetacat.error(errorMessage);
+			throw new AdminException(errorMessage);
+		} catch (NumberFormatException nfe) {
+			throw new AdminException("Bad version format numbering: "
+					+ nfe.getMessage());
+		}
+		
+		if (databaseVersion == null) {
+			throw new AdminException("Database version discovery returned null");
+		}
+		return databaseVersion;
+	}
+
+	/**
+	 * Gets the version of the database from the db_version table. Usually this
+	 * is the same as the version of the product, however the db version could
+	 * be more granular if we applied a maintenance patch for instance.
+	 * 
+	 * @returns string representing the version of the database.
+	 */
+	private DBVersion getRegisteredDBVersion() throws AdminException, SQLException {
+		String dbVersionString = null;
+		PreparedStatement pstmt = null;
+
+		try {
+			// check out DBConnection
+			Connection connection = 
+				DBUtil.getConnection(
+						PropertyService.getProperty("database.connectionURI"),
+						PropertyService.getProperty("database.user"),
+						PropertyService.getProperty("database.password"));
+
+			if (!DBUtil.tableExists(connection, "db_version")) {
+				return null;
+			}
+
+			pstmt = 
+				connection.prepareStatement("SELECT version FROM db_version WHERE status = ?");
+
+			// Bind the values to the query
+			pstmt.setInt(1, VERSION_ACTIVE);
+			pstmt.execute();
+			ResultSet rs = pstmt.getResultSet();
+			boolean hasRows = rs.next();
+			if (hasRows) {
+				dbVersionString = rs.getString(1);
+			}
+			
+			if (dbVersionString == null) {
+				return null;
+			} 
+				
+			return new DBVersion(dbVersionString);
+			
+		} catch (SQLException sqle) {
+			throw new AdminException("Could not run SQL to get registered db version: " 
+					+ sqle.getMessage());			
+		} catch (PropertyNotFoundException pnfe) {
+			throw new AdminException("Could not get property for registered db version: " 
+					+ pnfe.getMessage());		
+		} catch (NumberFormatException nfe) {
+			throw new AdminException("Bad version format numbering: "
+					+ nfe.getMessage());
+		} finally {
+			if (pstmt != null) {
+				pstmt.close();
+			}
+		}
+	}
+
+	/**
+	 * Finds the version of the database for a database that does not have a
+	 * dbVersion table yet. Work backwards with various clues found in update
+	 * scripts to find the version.
+	 * 
+	 * @returns string representing the version of the database.
+	 */
+	public DBVersion getUnRegisteredDBVersion() throws AdminException, SQLException {
+		Connection connection = null;
+		try {
+			connection = DBUtil.getConnection(PropertyService
+					.getProperty("database.connectionURI"), PropertyService
+					.getProperty("database.user"), PropertyService
+					.getProperty("database.password"));
+
+			String dbVersionString = null;
+
+			if (is1_9_0(connection)) {
+				dbVersionString = "1.9.0";
+			} else if (is1_8_0(connection)) {
+				dbVersionString = "1.8.0";
+			} else if (is1_7_0(connection)) {
+				dbVersionString = "1.7.0";
+			} else if (is1_6_0(connection)) {
+				dbVersionString = "1.6.0";
+			} else if (is1_5_0(connection)) {
+				dbVersionString = "1.5.0";
+			} else if (is1_4_0(connection)) {
+				dbVersionString = "1.4.0";
+			} else if (is1_3_0(connection)) {
+				dbVersionString = "1.3.0";
+			} else if (is1_2_0(connection)) {
+				dbVersionString = "1.2.0";
+			}
+
+			if (dbVersionString == null) {
+				return null;
+			} else {
+				return new DBVersion(dbVersionString);
+			}
+		} catch (PropertyNotFoundException pnfe) {
+			throw new AdminException(
+					"Could not get property for unregistered db version: "
+							+ pnfe.getMessage());
+		} catch (NumberFormatException nfe) {
+			throw new AdminException("Bad version format numbering: "
+					+ nfe.getMessage());
+		}
+	}
+
+	/**
+	 * Updates the version of the database. Typically this is done in the update
+	 * scripts that get run when we upgrade the application. This method can be
+	 * used if you are automating a patch on the database internally.
+	 * 
+	 * @returns string representing the version of the database.
+	 */
+	public void updateDBVersion() throws SQLException {
+		DBConnection conn = null;
+		PreparedStatement pstmt = null;
+		int serialNumber = -1;
+		try {
+
+			// check out DBConnection
+			conn = DBConnectionPool
+					.getDBConnection("DBAdmin.updateDBVersion()");
+			serialNumber = conn.getCheckOutSerialNumber();
+			conn.setAutoCommit(false);
+
+			pstmt = conn.prepareStatement("UPDATE db_version SET status = ?");
+			pstmt.setInt(1, VERSION_INACTIVE);
+			pstmt.execute();
+			pstmt.close();
+
+			pstmt = conn.prepareStatement("INSERT INTO db_version "
+					+ "(version, status, date_created) VALUES (?,?,?)");
+			pstmt.setString(1, MetaCatVersion.getVersionID());
+			pstmt.setInt(2, VERSION_ACTIVE);
+			pstmt.setTimestamp(3, new Timestamp(new Date().getTime()));
+			pstmt.execute();
+
+			conn.commit();
+		} catch (SQLException e) {
+			conn.rollback();
+			throw new SQLException("DBAdmin.getDBVersion(). " + e.getMessage());
+		} catch (PropertyNotFoundException pnfe) {
+			conn.rollback();
+			throw new SQLException("DBAdmin.getDBVersion(). " + pnfe.getMessage());
+		}
+		finally {
+			try {
+				pstmt.close();
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}
+	}
+
+	/**
+	 * Validate connectivity to the database. Validation methods return a string
+	 * error message if there is an issue. This allows the calling code to run
+	 * several validations and compile the errors into a list that can be
+	 * displayed on a web page if desired.
+	 * 
+	 * @param dbDriver
+	 *            the database driver
+	 * @param connection
+	 *            the jdbc connection string
+	 * @param user
+	 *            the user name
+	 * @param password
+	 *            the login password
+	 * @return a string holding error message if validation fails.
+	 */
+	public String validateDBConnectivity(String dbDriver, String connection,
+			String user, String password) {
+		try {
+			DBConnection.testConnection(dbDriver, connection, user, password);
+		} catch (SQLException se) {
+			return "Invalid database credential was provided: "
+					+ se.getMessage();
+		}
+
+		return null;
+	}
+
+	/**
+	 * Checks to see if this is a 1.9.0 database schema by looking for the
+	 * db_version table which was created for 1.9.0. Note, there is no guarantee
+	 * that this table will not be removed in subsequent versions. You should
+	 * search for db versions from newest to oldest, only getting to this
+	 * function when newer versions have not been matched.
+	 * 
+	 * @param dbMetaData
+	 *            the meta data for this database.
+	 * @returns boolean which is true if table is found, false otherwise
+	 */
+	private boolean is1_9_0(Connection connection) throws SQLException {
+		return DBUtil.tableExists(connection, "db_version");
+	}
+
+	/**
+	 * Checks to see if this is a 1.8.0 database schema by looking for the
+	 * xml_nodes_idx4 index which was created for 1.8.0. Note, there is no
+	 * guarantee that this index will not be removed in subsequent versions. You
+	 * should search for db versions from newest to oldest, only getting to this
+	 * function when newer versions have not been matched.
+	 * 
+	 * @param dbMetaData
+	 *            the meta data for this database.
+	 * @returns boolean which is true if index is found, false otherwise
+	 */
+	private boolean is1_8_0(Connection connection) throws SQLException {
+		return DBUtil.indexExists(connection, "xml_nodes", "xml_nodes_idx4");
+	}
+
+	/**
+	 * Checks to see if this is a 1.7.0 database schema by looking for the
+	 * xml_documents_idx2 index which was created for 1.7.0. Note, there is no
+	 * guarantee that this index will not be removed in subsequent versions. You
+	 * should search for db versions from newest to oldest, only getting to this
+	 * function when newer versions have not been matched.
+	 * 
+	 * @param dbMetaData
+	 *            the meta data for this database.
+	 * @returns boolean which is true if index is found, false otherwise
+	 */
+	private boolean is1_7_0(Connection connection) throws SQLException {
+		return DBUtil.indexExists(connection, "xml_documents",
+				"xml_documents_idx2");
+	}
+
+	/**
+	 * Checks to see if this is a 1.6.0 database schema by looking for the
+	 * identifier table which was created for 1.6.0. Note, there is no guarantee
+	 * that this table will not be removed in subsequent versions. You should
+	 * search for db versions from newest to oldest, only getting to this
+	 * function when newer versions have not been matched.
+	 * 
+	 * @param dbMetaData
+	 *            the meta data for this database.
+	 * @returns boolean which is true if table is found, false otherwise
+	 */
+	private boolean is1_6_0(Connection connection) throws SQLException {
+		return DBUtil.tableExists(connection, "identifier");
+	}
+
+	/**
+	 * Checks to see if this is a 1.5.0 database schema by looking for the
+	 * xml_returnfield table which was created for 1.5.0. Note, there is no
+	 * guarantee that this table will not be removed in subsequent versions. You
+	 * should search for db versions from newest to oldest, only getting to this
+	 * function when newer versions have not been matched.
+	 * 
+	 * @param dbMetaData
+	 *            the meta data for this database.
+	 * @returns boolean which is true if table is found, false otherwise
+	 */
+	private boolean is1_5_0(Connection connection) throws SQLException {
+		return DBUtil.tableExists(connection, "xml_returnfield");
+	}
+
+	/**
+	 * Checks to see if this is a 1.4.0 database schema by looking for the
+	 * access_log table which was created for 1.4.0. Note, there is no guarantee
+	 * that this table will not be removed in subsequent versions. You should
+	 * search for db versions from newest to oldest, only getting to this
+	 * function when newer versions have not been matched.
+	 * 
+	 * @param dbMetaData
+	 *            the meta data for this database.
+	 * @returns boolean which is true if table is found, false otherwise
+	 */
+	private boolean is1_4_0(Connection connection) throws SQLException {
+		return DBUtil.tableExists(connection, "access_log");
+	}
+
+	/**
+	 * Checks to see if this is a 1.3.0 database schema by looking for the
+	 * xml_accesssubtree table which was created for 1.3.0. Note, there is no
+	 * guarantee that this table will not be removed in subsequent versions. You
+	 * should search for db versions from newest to oldest, only getting to this
+	 * function when newer versions have not been matched.
+	 * 
+	 * @param dbMetaData
+	 *            the meta data for this database.
+	 * @returns boolean which is true if table is found, false otherwise
+	 */
+	private boolean is1_3_0(Connection connection) throws SQLException {
+		return DBUtil.tableExists(connection, "xml_accesssubtree");
+	}
+
+	/**
+	 * Checks to see if this is a 1.2.0 database schema by looking for the
+	 * datareplicate column which was created on the xml_replication table for
+	 * 1.2.0. Note, there is no guarantee that this column will not be removed
+	 * in subsequent versions. You should search for db versions from newest to
+	 * oldest, only getting to this function when newer versions have not been
+	 * matched.
+	 * 
+	 * @param dbMetaData
+	 *            the meta data for this database.
+	 * @returns boolean which is true if column is found, false otherwise
+	 */
+	private boolean is1_2_0(Connection connection) throws SQLException {
+		return DBUtil.columnExists(connection, "xml_replication",
+				"datareplicate");
+	}
+
+	/**
+	 * Creates a list of database update script names by looking at the database
+	 * version and the metacat version and then getting any script that is
+	 * inbetween the two (inclusive of metacat version).
+	 * 
+	 * @returns a Vector of Strings holding the names of scripts that need to be
+	 *          run to get the database updated to this version of metacat
+	 * 
+	 */
+	public Vector<String> getUpdateScripts() throws AdminException {
+		Vector<String> updateScriptList = new Vector<String>();
+		String sqlFileLocation = null;
+		String databaseType = null;
+		MetaCatVersion metaCatVersion = null; 
+		
+		// get the location of sql scripts
+		String sqlSuffix = ".sql";
+		try {
+			metaCatVersion = SystemUtil.getMetacatVersion();
+			sqlFileLocation = SystemUtil.getSQLDir();
+			databaseType = PropertyService.getProperty("database.type");
+		} catch (PropertyNotFoundException pnfe) {
+			throw new AdminException("Could not get property while trying " 
+					+ "to retrieve database update scripts: " + pnfe.getMessage());
+		}
+		// for postgres, we only want scripts that end in -postgres.sql
+		if (databaseType.equals("PostgreSQL")) {
+			sqlSuffix = "-postgres.sql";
+		}
+
+		// if either of these is null, we don't want to do anything.  Just 
+		// return an empty list.
+		if (metaCatVersion == null || databaseVersion == null) {
+			return updateScriptList;
+		}
+
+		// go through all the versions that the the software went through and 
+		// figure out which ones need to be applied to the database	
+		for (DBVersion nextVersion : versionSet) {
+			Vector<String> versionUpdateScripts = nextVersion
+					.getUpdateScripts();
+			
+			// if the database version is 0.0.0, it is new.
+			// apply all scripts.
+			if (databaseVersion.getVersionString().equals("0.0.0")
+					&& nextVersion.getVersionString().equals("0.0.0")) {
+				for (String versionUpdateScript : versionUpdateScripts) {
+					updateScriptList.add(sqlFileLocation + FileUtil.getFS()
+							+ versionUpdateScript + sqlSuffix);
+				}
+				return updateScriptList;
+			}
+
+			// add every update script that is > than the db version
+			// but <= to the metacat version to the update list.
+			if (nextVersion.compareTo(databaseVersion) > 0
+					&& nextVersion.compareTo(metaCatVersion) <= 0
+					&& nextVersion.getUpdateScripts() != null) {
+				for (String versionUpdateScript : versionUpdateScripts) {
+					updateScriptList.add(sqlFileLocation + FileUtil.getFS()
+							+ versionUpdateScript + sqlSuffix);
+				}
+			}
+		}
+
+		// this should now hold all the script names that need to be run
+		// to bring the database up to date with this version of metacat
+		return updateScriptList;
+	}
+
+	/**
+	 * Iterates through the list of scripts that need to be run to upgrade
+	 * the database and calls runSQLFile on each.
+	 */
+	public void upgradeDatabase() throws AdminException {
+		try {
+			// get a list of the script names that need to be run
+			Vector<String> updateScriptList = getUpdateScripts();
+
+			// call runSQLFile on each
+			for (String updateScript : updateScriptList) {
+				runSQLFile(updateScript);
+			}
+
+			// update the db version to be the metacat version
+			databaseVersion = new DBVersion(SystemUtil.getMetacatVersion().getVersionString());
+		} catch (SQLException sqle) {
+			throw new AdminException("SQL error when running upgrade scripts: "
+					+ sqle.getMessage());
+		} catch (PropertyNotFoundException pnfe) {
+			throw new AdminException("SQL error when running upgrade scripts: "
+					+ pnfe.getMessage());
+		}catch (NumberFormatException nfe) {
+			throw new AdminException("Bad version format numbering: "
+					+ nfe.getMessage());
+		}
+	}
+
+	/**
+	 * Runs the commands in a sql script. Individual commands are loaded into a
+	 * string vector and run one at a time.
+	 * 
+	 * @param sqlFileName
+	 *            the name of the file holding the sql statements that need to
+	 *            get run.
+	 */
+	public void runSQLFile(String sqlFileName) throws AdminException, SQLException {
+
+		// if update file does not exist, do not do the update.
+		if (FileUtil.getFileStatus(sqlFileName) < FileUtil.EXISTS_READABLE) {
+			throw new AdminException("Could not read sql update file: "
+					+ sqlFileName);
+		}
+
+		Connection connection = null;
+		try {
+			connection = DBUtil.getConnection(PropertyService
+					.getProperty("database.connectionURI"), PropertyService
+					.getProperty("database.user"), PropertyService
+					.getProperty("database.password"));
+			connection.setAutoCommit(false);
+
+			// load the sql from the file into a vector of individual statements
+			// and execute them.
+			logMetacat.debug("processing File: " + sqlFileName);
+			Vector<String> sqlCommands = loadSQLFromFile(sqlFileName);
+			for (String sqlStatement : sqlCommands) {
+				Statement statement = connection.createStatement();
+				logMetacat.debug("executing sql: " + sqlStatement);
+				statement.execute(sqlStatement);
+			}
+			connection.commit();
+			
+		} catch (IOException ioe) {
+			throw new AdminException("Could not read SQL file" 
+					+ ioe.getMessage());
+		} catch (PropertyNotFoundException pnfe) {
+			throw new AdminException("Could not find property to run SQL file" 
+					+ pnfe.getMessage());
+		} catch (SQLException sqle) {
+			if (connection != null) {
+				connection.rollback();
+			}
+			throw sqle;
+		} finally {
+			if (connection != null) {
+				connection.close();
+			}
+		}
+	}
+
+	/**
+	 * Very basic utility to read sql from a file and return a vector of the
+	 * individual sql statements. This ignores any line that starts with /* or *.
+	 * It strips anything following --. Sql is parsed by looking for lines that
+	 * start with one of the following identifiers: INSERT, UPDATE, ALTER,
+	 * CREATE, DROP, BEGIN and COMMIT. It then assumes that everything until the
+	 * line that ends with ; is part of the sql, excluding comments.
+	 * 
+	 * @param sqlFileName
+	 *            the name of the file to read.
+	 * @return a vector holding the individual sql statements.
+	 */
+	public Vector<String> loadSQLFromFile(String sqlFileName)
+			throws IOException {
+
+		// this will end up holding individual sql statements
+		Vector<String> sqlCommands = new Vector<String>();
+
+		FileInputStream fin = null;
+		try {
+			fin = new FileInputStream(sqlFileName);
+
+			BufferedReader reader = new BufferedReader(new InputStreamReader(
+					fin));
+
+			// Read in file
+			String fileLine;
+			while ((fileLine = reader.readLine()) != null) {
+				String trimmedLine = fileLine.trim();
+
+				// get the first word on the line
+				String firstWord = trimmedLine;
+				if (trimmedLine.indexOf(' ') > 0) {
+					firstWord = trimmedLine.substring(0, trimmedLine
+							.indexOf(' '));
+				}
+				if (firstWord.endsWith(";")) {
+					firstWord = firstWord.substring(0, firstWord.indexOf(';'));
+				}
+
+				// if the first word is a known sql command, start creating a
+				// sql statement.
+				if (sqlCommandSet.contains(firstWord.toUpperCase())) {
+					String sqlStatement = trimmedLine;
+
+					// if this ends with ; it is a single line statement. Add to
+					// command vector and process next line.
+					if (trimmedLine.endsWith(";")) {
+						sqlCommands.add(sqlStatement);
+						continue;
+					}
+
+					// keep reading lines until we find one that is not a
+					// comment and ends with ;
+					String innerLine;
+					while ((innerLine = reader.readLine()) != null) {
+						String trimmedInnerLine = innerLine.trim();
+						// ignore comments and empty lines
+						if (trimmedInnerLine.matches("^$")
+								|| trimmedInnerLine.matches("^\\*.*")
+								|| trimmedInnerLine.matches("/\\*.*")) {
+							continue;
+						}
+
+						// get rid of any "--" comments at the end of the line
+						if (trimmedInnerLine.indexOf("--") >= 0) {
+							trimmedInnerLine = trimmedInnerLine.substring(0,
+									trimmedInnerLine.indexOf("--")).trim();
+						}
+						sqlStatement += " " + trimmedInnerLine;
+						if (trimmedInnerLine.endsWith(";")) {
+							sqlCommands.add(sqlStatement);
+							break;
+						}
+					}
+				}
+			}
+		} finally {
+			// Close our input stream
+			fin.close();
+		}
+
+		return sqlCommands;
+	}
+
+	/**
+	 * Validate the most important configuration options submitted by the user.
+	 * 
+	 * @return a vector holding error message for any fields that fail
+	 *         validation.
+	 */
+	protected Vector<String> validateOptions(HttpServletRequest request) {
+		Vector<String> errorVector = new Vector<String>();
+
+		// TODO MCD validate options.
+
+		return errorVector;
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/admin/DBAdmin.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
Index: src/edu/ucsb/nceas/metacat/DBDTDHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBDTDHandler.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/DBDTDHandler.java	(revision 4080)
@@ -88,6 +88,9 @@
     * Return empty string if there are not 
     */
 /*
+ * If this ever gets uncommented, you will need to verify the 
+ * server url on the front of the system ID.
+ * 
    private String getEntitySystemID (Connection conn, String doctype, 
                                      String publicId)
    {
Index: src/edu/ucsb/nceas/metacat/ReplicationServerList.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ReplicationServerList.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/ReplicationServerList.java	(revision 4080)
@@ -28,6 +28,8 @@
 package edu.ucsb.nceas.metacat;
 
 import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+
 import java.util.Vector;
 import java.sql.*;
 
Index: docs/dev/images/KNBLogo.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: docs/dev/images/KNBLogo.gif
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/Sitemap.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Sitemap.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/Sitemap.java	(revision 4080)
@@ -35,6 +35,9 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /**
  * A Sitemap represents a document that lists all of the content of the Metacat
  * server for use by harvesting spiders that wish to index the contents of the
@@ -140,7 +143,7 @@
                         writeSitemapHeader(sitemap);
                     }
 
-                    String separator = MetaCatUtil.getOption("accNumSeparator");
+                    String separator = PropertyService.getProperty("accNumSeparator");
                     String docid = rs.getString(1) + separator
                             + rs.getString(2);
                     writeSitemapEntry(sitemap, docid);
@@ -154,6 +157,9 @@
             } catch (IOException ioe) {
                 logMetacat.warn("Could not open or write to the sitemap file."
                         + ioe.getMessage());
+            } catch (PropertyNotFoundException pnfe) {
+                logMetacat.warn("Could not retrieve the account number separator."
+                        + pnfe.getMessage());
             } finally {
                 // Return database connection to the pool
                 DBConnectionPool.returnDBConnection(dbConn, serialNumber);
Index: src/edu/ucsb/nceas/metacat/admin/AdminException.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/AdminException.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/AdminException.java	(revision 4080)
@@ -0,0 +1,46 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: An Exception thrown when an error occurs because an 
+ *             AccessionNumber was invalid or used incorrectly
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.admin;
+
+/**
+ * Exception thrown when an error occurs in a configuration administrative
+ * class
+ */
+public class AdminException extends Exception {
+	
+	private static final long serialVersionUID = -7190381642745794017L;
+
+	/**
+	 * Create a new AdminException.
+	 *
+	 * @param message The error or warning message.
+	 */
+	public AdminException(String message) {
+		super(message);
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/admin/AdminException.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
Index: src/edu/ucsb/nceas/metacat/admin/MetaCatAdminServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/MetaCatAdminServlet.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/MetaCatAdminServlet.java	(revision 4080)
@@ -0,0 +1,190 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that implements utility methods for a metadata catalog
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$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.admin;
+
+import java.io.IOException;
+import java.util.Vector;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.service.SessionService;
+import edu.ucsb.nceas.metacat.util.LDAPUtil;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
+import edu.ucsb.nceas.metacat.util.RequestUtil;
+import edu.ucsb.nceas.metacat.util.SkinUtil;
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.metacat.util.UtilException;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
+/**
+ * Entry servlet for the metadata configuration utility
+ */
+public class MetaCatAdminServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+	
+	private Logger logMetacat = Logger.getLogger(MetaCatAdminServlet.class);
+	
+    /**
+	 * Initialize the servlet
+	 */
+	public void init(ServletConfig config) throws ServletException {
+		super.init(config);
+	}
+        
+    /** Handle "GET" method requests from HTTP clients */
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+
+		// Process the data and send back the response
+		handleGetOrPost(request, response);
+	}
+
+	/** Handle "POST" method requests from HTTP clients */
+	public void doPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+
+		// Process the data and send back the response
+		handleGetOrPost(request, response);
+	}
+       
+    /**
+	 * Control servlet response depending on the action parameter specified
+	 * 
+	 * @param request
+	 *            the http request information
+	 * @param response
+	 *            the http response to be sent back to the client
+	 */
+	private void handleGetOrPost(HttpServletRequest request,
+			HttpServletResponse response) throws ServletException, IOException {
+		String action = request.getParameter("configureType");
+		logMetacat.debug("Processing admin action: " + action);
+		Vector<String> processingMessage = new Vector<String>();
+		Vector<String> processingErrors = new Vector<String>();
+
+		try {
+			// Update the last update time for this user if they are not new
+			HttpSession httpSession = request.getSession(false);
+			if (httpSession != null) {
+				SessionService.touchSession(httpSession.getId());
+			}
+			
+			// if ldap isn't configured, change the action to ldap.  ldap
+			// needs to be set up before we do anything else
+			if (!LDAPUtil.isLDAPConfigured()) {
+				processingMessage.add("You must configure LDAP before "
+						+ "you can continue with MetaCat configuration.");
+				RequestUtil.setRequestMessage(request, processingMessage);
+				action = "ldap";
+				logMetacat.debug("Admin action changed to 'ldap'");
+			}
+
+			// Once ldap is configured, see if the user is logged in
+			// as an administrator.  If not, they need to log in before
+			// they can continue with configuration.
+			if (LDAPUtil.isLDAPConfigured()
+					&& !LDAPUtil.isUserLoggedInAsAdmin(request)) {
+				processingMessage.add("You must log in as an administrative " + "" +
+						"user before you can continue with MetaCat configuration.");
+				RequestUtil.setRequestMessage(request, processingMessage);
+				action = "login";
+				logMetacat.debug("Admin action changed to 'login'");
+			}
+
+			if (action == null || action.equals("configure")) {
+				// Forward the request main configuration page
+				request.setAttribute("metaCatVersion", SystemUtil.getMetacatVersion()); 
+			    request.setAttribute("propsConfigured", new Boolean(PropertyService.arePropertiesConfigured()));
+			    if (PropertyService.arePropertiesConfigured()) {
+					request.setAttribute("databaseVersion", 
+							DBAdmin.getInstance().getDBVersion());
+				}
+			    request.setAttribute("ldapConfigured", new Boolean(LDAPUtil.isLDAPConfigured()));	
+			    request.setAttribute("skinsConfigured", new Boolean(SkinUtil.areSkinsConfigured()));
+			    request.setAttribute("metacatConfigured", new Boolean(MetaCatUtil.isMetacatConfigured()));	
+				RequestUtil.forwardRequest(request, response,
+						"/admin/metacat-configuration.jsp?configureType=configure");
+				return;
+			} else if (action.equals("properties")) {
+				// process properties
+				PropertiesAdmin.getInstance().configureProperties(request,
+						response);
+				return;
+			} else if (action.equals("skins")) {
+				// process skins
+				SkinsAdmin.getInstance().configureSkins(request, response);
+				return;
+			} else if (action.equals("database")) {
+				// process properties
+				DBAdmin.getInstance().configureDatabase(request, response);
+				return;
+			} else if (action.equals("ldap")) {
+				// process properties
+				LDAPAdmin.getInstance().configureLDAP(request, response);
+				return;
+			} else if (action.equals("login")) {
+				// process properties
+				AuthAdmin.getInstance().authenticateUser(request, response);
+				return;
+			} else {
+				String errorMessage = "Invalid action in configuration request: " + action;
+				logMetacat.error(errorMessage);
+				processingErrors.add(errorMessage);
+			}
+		} catch (PropertyNotFoundException pnfe) {
+			String errorMessage = 
+				"Property problem while handling request: " + pnfe.getMessage();
+			logMetacat.error(errorMessage);
+			processingErrors.add(errorMessage);
+		} catch (AdminException ae) {
+			String errorMessage = 
+				"Admin problem while handling request: " + ae.getMessage();
+			logMetacat.error(errorMessage);
+			processingErrors.add(errorMessage);
+		} catch (UtilException ue) {
+			String errorMessage = 
+				"Utility problem while handling request: " + ue.getMessage();
+			logMetacat.error(errorMessage);
+			processingErrors.add(errorMessage);
+		}
+		
+		if (processingErrors.size() > 0) {
+			RequestUtil.clearRequestMessages(request);
+			RequestUtil.setRequestErrors(request,processingErrors);
+			RequestUtil.forwardRequest(request, response, "/admin/metacat-configuration.jsp");
+		}
+	}       	
+}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/admin/MetaCatAdminServlet.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
Index: src/edu/ucsb/nceas/metacat/SchemaLocationResolver.java
===================================================================
--- src/edu/ucsb/nceas/metacat/SchemaLocationResolver.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/SchemaLocationResolver.java	(revision 4080)
@@ -44,6 +44,9 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.util.SystemUtil;
+import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+
 /**
  * A database aware Class to handle schema location. If namespace is in the
  * xml_catalog table (public_id), the schema location specified in xml document
@@ -126,80 +129,79 @@
  
   }
 
-  /* This method will take look xml_catalog table and create a string look like
-   * "namespace1 location namespacke2 location". This string will be set as 
-   * a extenalschemalocation in SAX parser. Then when parser check the 
-   * it will ignore the schema location specified by xml document
-   */
-  private void createNameSpaceAndLocationStringFromDB()
-  {
-    DBConnection conn = null;
-    int serialNumber = -1;
-    PreparedStatement pstmt = null;
-    ResultSet result = null;
-    String sql = "SELECT public_id, system_id FROM xml_catalog where " +
-                 "entry_type ='" + DocumentImpl.SCHEMA +"'";
-    try 
-    {
-      //check out DBConnection
-      conn=DBConnectionPool.getDBConnection("SchemaLocationResl.createName");
-      serialNumber=conn.getCheckOutSerialNumber();
-      pstmt = conn.prepareStatement(sql);
-      pstmt.execute();
-      result = pstmt.getResultSet();
-      
-      // Get string for namespace and location form DB
-      boolean hasRow = result.next();
-      StringBuffer buffer = new StringBuffer();
-      boolean firstTime = true;
-      while (hasRow)
-      {
-        String namespace = result.getString(1);
-        String location  = result.getString(2);
-        String pairOfNameSpaceAndLocation = namespace + WHITESPACESTRING 
-                                            +location;
-        if (!firstTime)
-        {
-          buffer.append(WHITESPACESTRING);
-        }
-        buffer.append(pairOfNameSpaceAndLocation);
-        firstTime = false;
-        hasRow = result.next();
-        
-      }
-      // give the buffer to the string if buffer has something in it
-      if (buffer.length() != 0)
-      {
-        nameSpaceAndLocationString = buffer.toString();
-      }
-      result.close();
-      pstmt.close();
-    } 
-    catch (SQLException e) 
-    {
-      logMetacat.error("schemaLocation.createNameSpaceAndLocationString: " + 
-                         e.getMessage());
-    }
-    finally
-    {
-      try
-      {
-        pstmt.close();
-      }//try
-      catch (SQLException sqlE)
-      {
-        logMetacat.error("Error in schema.createNameSpaceAndLocation "
-                                    + sqlE.getMessage());
-      }//catch
-      DBConnectionPool.returnDBConnection(conn, serialNumber);
-    }//finally
-    
+  /*
+	 * This method will take look xml_catalog table and create a string look
+	 * like "namespace1 location namespacke2 location". This string will be set
+	 * as a extenalschemalocation in SAX parser. Then when parser check the it
+	 * will ignore the schema location specified by xml document
+	 */
+	private void createNameSpaceAndLocationStringFromDB() {
+		DBConnection conn = null;
+		int serialNumber = -1;
+		PreparedStatement pstmt = null;
+		ResultSet result = null;
+		String sql = "SELECT public_id, system_id FROM xml_catalog where "
+				+ "entry_type ='" + DocumentImpl.SCHEMA + "'";
+		try {
+			// check out DBConnection
+			conn = DBConnectionPool.getDBConnection("SchemaLocationResl.createName");
+			serialNumber = conn.getCheckOutSerialNumber();
+			pstmt = conn.prepareStatement(sql);
+			pstmt.execute();
+			result = pstmt.getResultSet();
 
-  }
+			// Get string for namespace and location form DB
+			boolean hasRow = result.next();
+			StringBuffer buffer = new StringBuffer();
+			boolean firstTime = true;
+			while (hasRow) {
+				String namespace = result.getString(1);
+				String location = result.getString(2);
+				// system id may not have server url on front. Add it if not.
+				if (!location.startsWith("http://")) {
+					try {
+						location = SystemUtil.getServerURL() + location;
+					} catch (PropertyNotFoundException pnfe) {
+						throw new SQLException("Could not find property: "
+								+ pnfe.getMessage());
+					}
+				}
+				String pairOfNameSpaceAndLocation = namespace + WHITESPACESTRING
+						+ location;
+				if (!firstTime) {
+					buffer.append(WHITESPACESTRING);
+				}
+				buffer.append(pairOfNameSpaceAndLocation);
+				firstTime = false;
+				hasRow = result.next();
 
-  /* This method will take look xml_catalog table and create a name space
-   * vector already in the table
-   */
+			}
+			// give the buffer to the string if buffer has something in it
+			if (buffer.length() != 0) {
+				nameSpaceAndLocationString = buffer.toString();
+			}
+			result.close();
+			pstmt.close();
+		} catch (SQLException e) {
+			logMetacat.error("schemaLocation.createNameSpaceAndLocationString: "
+					+ e.getMessage());
+		} finally {
+			try {
+				pstmt.close();
+			}// try
+			catch (SQLException sqlE) {
+				logMetacat.error("Error in schema.createNameSpaceAndLocation "
+						+ sqlE.getMessage());
+			}// catch
+			DBConnectionPool.returnDBConnection(conn, serialNumber);
+		}// finally
+
+	}
+
+  /*
+	 * This method will take look xml_catalog table and create a name space
+	 * vector already in the table
+	 */
   private void createNameSpaceListFromDB()
   {
     DBConnection conn = null;
@@ -258,8 +260,8 @@
   private String uploadSchemaFromURL(InputStream istream) throws Exception
   {
    
-    String schemaPath = MetaCatUtil.getOption("schemaPath");
-    String schemaURL = MetaCatUtil.getOption("schemaURL");
+    String schemaPath = SystemUtil.getContextDir() + "/schema/";
+    String schemaURL = SystemUtil.getContextURL()  + "/schema/";
 
     // get filename from systemId
     String filename = schemaLocation;
Index: src/edu/ucsb/nceas/metacat/RemoteDocument.java
===================================================================
--- src/edu/ucsb/nceas/metacat/RemoteDocument.java	(revision 4079)
+++ src/edu/ucsb/nceas/metacat/RemoteDocument.java	(revision 4080)
@@ -26,6 +26,8 @@
 
 package edu.ucsb.nceas.metacat;
 
+import edu.ucsb.nceas.metacat.service.PropertyService;
+import edu.ucsb.nceas.metacat.util.MetaCatUtil;
 import edu.ucsb.nceas.utilities.HttpMessage;
 import javax.servlet.ServletOutputStream;
 
@@ -90,7 +92,7 @@
     userName = myUserName;
     passWord = myPassWord;
     zipEntry = myZipEntryPath+ docIdWithoutRevision + 
-                MetaCatUtil.getOption("accNumSeparator") + revision;
+                PropertyService.getProperty("accNumSeparator") + revision;
    
 
   }// Constructor
@@ -205,7 +207,7 @@
       throw new Exception ("Couldn't find a dataset docid for the required id");
     }
     // Create a documentImpl object
-    String accNumber = givenDocId + MetaCatUtil.getOption("accNumSeparator") +
+    String accNumber = givenDocId + PropertyService.getProperty("accNumSeparator") +
     DBUtil.getLatestRevisionInDocumentTable(givenDocId);
     document = new DocumentImpl(accNumber, false);
     // get the replication home server (it come from xml_replication table)
@@ -293,7 +295,7 @@
     }
     // User specified docid (including revision number
     String specifiedDocId = docIdWithoutRevision + 
-                MetaCatUtil.getOption("accNumSeparator") +revision;
+                PropertyService.getProperty("accNumSeparator") +revision;
     logMetacat.info("The requried docid is: "+ specifiedDocId);
     
     // At first login to remote metacat server. 
@@ -364,7 +366,7 @@
     }
     // User specified docid (including revision number
     String specifiedDocId = docIdWithoutRevision + 
-                MetaCatUtil.getOption("accNumSeparator") +revision;
+                PropertyService.getProperty("accNumSeparator") +revision;
     logMetacat.info("The requried docid is: "+ specifiedDocId);
     
     // At first login to remote metacat server.
Index: docs/dev/metacat-turnkey-installation-token-replacement-1.0.txt
===================================================================
--- docs/dev/metacat-turnkey-installation-token-replacement-1.0.txt	(revision 4079)
+++ docs/dev/metacat-turnkey-installation-token-replacement-1.0.txt	(revision 4080)
@@ -20,7 +20,7 @@
      additional post field might be appended to the fields defined in 
      common-settings.jsp.  An example is: skins/default/settings.jsp.  
      Also, all calls to insert*() java scripts now pass the
-     SERVER_URL_WITH_CONTEXT as a parameter (see .js section).
+     CONTEXT_URL as a parameter (see .js section).
    * <skin>.xml - these are used by DBTransform.java to do drive xslt tranforms.
      The tokens were removed in the publicid targets that give a full url to the
      skins directory.  DBTransform.java knows (thanks to Ben) to prepend the
Index: docs/dev/images/registry-nceas-projects.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: docs/dev/images/registry-nceas-projects.png
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: docs/dev/index.html
===================================================================
--- docs/dev/index.html	(nonexistent)
+++ docs/dev/index.html	(revision 4080)
@@ -0,0 +1,86 @@
+<!DOCTYPE html PUBliC "-//W3C//DTD html 4.0//EN">
+<html>
+
+<head>
+  <title>KNB Software Development Guide: Metacat</title>
+  <link rel="stylesheet" type="text/css" href="./default.css">
+</head>
+
+<body>
+
+<table class="tabledefault" width="100%">
+<tr>
+  <td rowspan="2"><img src="./images/KNBLogo.gif"></td>
+  <td colspan="7"><div class="title">KNB Software Development Guide: Metacat</div></td>
+</tr>
+<tr>
+  <td><a href="/" class="toollink"> KNB Home </a></td>
+  <td><a href="/data.html" class="toollink"> Data </a></td>
+  <td><a href="/people.html" class="toollink"> People </a></td>
+  <td><a href="/informatics" class="toollink"> Informatics </a></td>
+  <td><a href="/biodiversity" class="toollink"> Biocomplexity </a></td>
+  <td><a href="/education" class="toollink"> Education </a></td>
+  <td><a href="/software" class="toollink"> Software </a></td>
+</tr>
+</table>
+<hr>
+
+<p>&nbsp;</p>
+<table class="tabledefault" width="100%">
+<tr>
+  <td class="tablehead" colspan="2"><p class="label">Metacat Development Guide</p></td>
+</tr>
+<tr>
+  <td>
+  <p><a href="/software/download.html">Download Metacat</a></p>
+  <p><a href="./metacatinstall.html">Metacat Installation Instructions</a></p>
+  <p>Metacat is a flexible metadata database. It utilizes 
+     <a href="http://www.w3.org/TR/REC-xml" target="offline">XML</a> as a 
+     common syntax for representing the large number of metadata content
+     standards that are relevant to ecology.  Thus, Metacat is a generic XML
+     database that allows storage, query, and retrieval of arbitrary XML 
+     documents without prior knowledge of the XML schema.
+  </p>
+  <p>
+     The Metacat database models XML documents as a DOM tree, basically 
+     decomposing the nodes of the XML document and storing the node data
+     as a series of records in a relational database via a JDBC connection.
+     At this point, only Oracle and PostgreSQL have been tested as a backend databases, but
+     we have avoided RDBMS specific features in order to maintain portability
+     to other relational databases.
+  </p>
+  <p>
+     Metacat is implemented as a Java Servlet, and so communicates using basic
+     HTTP protocol semantics.  The figure below shows the basic structure of
+     the Metacat architecture. A well defined interface for inserting, 
+     updating, deleting, querying, and transforming (using XSL) XML documents
+     is presented.  We would like to add the DOM API as an alternative 
+     supported mechanism for interacting with Metacat, but have not yet
+     implemented this functionality.
+  </p>
+  <p><img src="./metacat.gif" /></p>
+  </td>
+</tr>
+<tr><td>&nbsp;</td></tr>
+
+<tr>
+  <td>The pages below provide more detailed descriptions of the 
+      various components of the Metacat Servlet. Take the Metacat Tour for 
+      a detailed look at the algorithms and implementation of Metacat.
+
+    <ul>
+      <li> <a href="./metacattour.html">A Tour of Metacat</a></li>
+      <li> <a href="./dev/api/index.html" target="offline">Javadoc API 
+           Documentation</a></li>
+    </ul>
+  </td>
+</tr>
+<tr><td>&nbsp;</td></tr>
+
+</table>
+
+<p class="contact">
+Web Contact: <a href="mailto:jones@nceas.ucsb.edu">jones@nceas.ucsb.edu</A>
+</p>
+</body>
+</html>

Property changes on: docs/dev/index.html
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: docs/user/metacatinstall.html
===================================================================
--- docs/user/metacatinstall.html	(revision 4079)
+++ docs/user/metacatinstall.html	(revision 4080)
@@ -65,16 +65,13 @@
          <a HREF="metacatinstall.html#Pre-Installation">Pre-Installation</a>
       </li>
       <li>
-         <a HREF="metacatinstall.html#Aditional Software Setup">Aditional Software Setup</a>
+         <a HREF="metacatinstall.html#Additional Software Setup">Additional Software Setup</a>
       </li>
       <li>
-         <a HREF="metacatinstall.html#Edit build.properties File">Edit <code>build.properties</code> File</a>
+         <a HREF="metacatinstall.html#Installing Metacat">Installing Metacat</a>
       </li>
-      <li>
-         <a HREF="metacatinstall.html#Compilation and Installation">Compilation and Installation</a>
-      </li>
         <li>
-         <a HREF="metacatinstall.html#Upgrade">Compilation and Upgrading Existing Metacat</a>
+         <a HREF="metacatinstall.html#Upgrade">Upgrading Existing Metacat</a>
       </li>
       <li>
         <a href="metacatinstall.html#Registry">Registry</a>
@@ -137,7 +134,7 @@
 </table>
 
 <table class="tabledefault" width="100%">
-<td class="tablehead" colspan="2"><p><a name="Aditional Software Setup"><h2>Aditional Software Setup</h2></p></td>
+<td class="tablehead" colspan="2"><p><a name="Additional Software Setup"><h2>Aditional Software Setup</h2></p></td>
 <tr>
 <td>
   <p class="header">Java</p>
@@ -222,623 +219,45 @@
 </table>
 
 <table class="tabledefault" width="100%">
-<td class="tablehead" colspan="2"><p><a name="Edit build.properties File"><h2>Edit <code>build.properties</code> File</h2></p></td>
+<td class="tablehead" colspan="2"><p><a name="Installing Metacat"><h2>Installing Metacat</h2></p></td>
 <tr>
 <td>
-  <p>
-   Once all of the prerequisite software is installed as described above, 
-   the installation of Metacat can begin.  First you must have a current
-   version of the source distribution of Metacat.  You can get it two ways.
-   Authorized users can check it out of the NCEAS 
-   <a href="http://www.nceas.ucsb.edu/cgi-bin/cvsweb.cgi/xmltodb/">CVS</a>
-   system. You'll need both the "metacat" module and the "utilities" module to
-   be checked out in sibling directories. The command is as follows: 
-   <pre>mkdir knb-software</pre>
-   <pre>cd knb-software</pre>
-   <pre>cvs checkout -P metacat</pre>
-   <pre>cvs checkout -P utilities</pre>  
-   Or you can 
-   <a href="/software/download.html">download</a> a gzipped tar file
-   from this site.
-  </p>
-   <p>
-   Once you have either checked out or unzipped and untarred the source
-   distribution, you can begin the installation process.  Change into the 
-   metacat directory and edit the file called "<code>build.properties</code>".  You will need 
-   to change a number of configuration properties to match the setup on
-   your system. The property values that you will likely need to change are described in 
-   detail in the following table:
-  </p>
-  <br/>
-  <table border="1">
-    <tr>
-      <td><b>Property</b></td>
-      <td><b>Description</b></td>
-      <td><b>Default value and examples of other values</b></td>
-    </tr>
-    <tr>
-      <td>tomcat</td>
-      <td>The tomcat property is the location in which tomcat is installed.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>/usr/local/devtools/jakarta-tomcat</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>C:/Tomcat-5.5</code></td>
-    </tr>
-    <tr>
-      <td>deploy.dir</td>
-      <td>The deploy.dir property is the location in which your tomcat servlet 
-          contexts are deployed. This is typically "${tomcat}/webapps",
-          where ${tomcat} is the same value that you entered for the 'tomcat'
-          property above.
-      </td>
-      <td>Default:&nbsp;&nbsp;
-          <code>/var/www/org.ecoinformatics.knb</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>C:/Tomcat-5.5/webapps</code>
-      </td>
-    </tr>
-    <tr>
-      <td>tomcatversion</td>
-      <td>The tomcatversion property is the version of Tomcat in which you 
-          want Metacat to run. This will determine the location of some
-          jar files coming with Tomcat. 
-          <p>
-            <em>Note: Tomcat 3 and 4 are no longer tested or supported by Metacat.
-                Users are highly encouraged to upgrade to Tomcat 5.5.
-            </em>
-          </p>
-          <p>
-            <em>Also note: a property value of 'tomcat5' can be set when using
-                either Tomcat 5.0 or Tomcat 5.5.
-            </em>
-          </p>
-      </td>
-      <td>Default:&nbsp;&nbsp;
-          <code>tomcat5</code>
-      <br><br>Other possible values (deprecated):&nbsp;&nbsp;
-          <code>tomcat3 tomcat4</code>
-      </td>
-      </td>
-    </tr>
-    <tr>
-      <td>metacat.context</td>
-      <td>The metacat.context property is the name of the servlet context in which you 
-          want Metacat to be installed. This will determine the installation 
-          directory for the servlet and many of the URLs that are used to access
-          the installed Metacat server.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>knb</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>mycontext</code>
-      </td>
-    </tr>
-    <tr>
-      <td>config.hostname</td>
-      <td>The config.hostname property is the hostname of the server on which Metacat is 
-          running (note that you should not include the 'http://' in the config.hostname
-          property).
-      </td>
-      <td>Default:&nbsp;&nbsp;
-         <code>knb.ecoinformatics.org</code>
-      <br><br>Example:&nbsp;&nbsp;
-         <code>somehost.university.edu</code>
-      </td>
-    </tr>
-    <tr>
-      <td>config.port</td>
-      <td>The config.port property is the HTTP plain port number that is used to connect to Metacat.
-          If Tomcat is running stand-alone, the value will typically be 8080.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>80</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>8080</code>
-      </td>
-    </tr>
-    <tr>
-      <td>config.port.https</td>
-      <td>The config.port.https property is the HTTP secure port number that is used to connect to Metacat,
-          generally when replicating documents to and from other Metacat servers.
-          If Tomcat is running stand-alone, the value will typically be 8443.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>443</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>8443</code>
-      </td>
-    </tr>
-    <tr>
-      <td>ldapUrl</td>
-      <td>URL to the LDAP server. The LDAP server is used in the default
-          authentication module to authenticate and identify users of the
-          system.  To participate in the KNB network, you should leave this at
-          the default.  But it can be changed if you want to use a 
-          different directory of users.
-      </td>
-      <td>Default:&nbsp;&nbsp;
-          <code>ldap://ldap.ecoinformatics.org/dc=ecoinformatics,dc=org</code>
-      </td>
-    </tr>
-    <tr>
-      <td>database</td>
-      <td>Select the database to use for metadata storage.
-          <p>
-          The build file is preconfigured to install Metacat either using 
-          Oracle, PostgreSQL, or Microsoft SQL Server as a backend database.  
-          To change the database system, simply change the value of the 'database' 
-          property to be the name of the database target that you wish to use.
-          </p>
-          <p>
-          Valid values are <code>oracle</code>, <code>postgresql</code>, or
-          <code>sqlserver</code>. <em>Note that sqlserver support is minimal and
-          probably will not work without substantial changes on your part,
-          possibly including code changes.  We have not recently tested on 
-          sqlserver.</em>
-          </p>
-      </td>
-      <td>Default:&nbsp;&nbsp;
-          <code>postgresql</code>
-      <br><br>Other possible values:&nbsp;&nbsp;
-          <code>oracle</code>&nbsp;&nbsp;
-          <code>sqlserver</code>
-      </td>
-    </tr>
-    <tr>
-      <td>jdbc-connect</td>
-      <td>The JDBC connection string used to connect to the database.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>jdbc:postgresql://localhost/metacat</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>jdbc:oracle:thin:@somehost.university.edu:1521:metacat</code>
-      </td>
-    <tr>
-      <td>jdbc-base</td>
-      <td>The base directory for locating JDBC jar files. When using the postgresql database, the default setting of './lib' can be used,
-          while oracle and sqlserver databases will require a different setting since these jar files are not included in the Metacat
-          distribution.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>./lib</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>/usr/oracle/jdbc/lib</code><br>
-      </td>
-    </tr>
-    <tr>
-      <td>user</td>
-      <td>The database user name that you set up to use Metacat.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>metacat</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>metacatuser</code>
-      </td>
-    </tr>
-    <tr>
-      <td>password</td>
-      <td>The database password that you set up to use Metacat.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>yourPasswordHere</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>metacat123</code>
-      </td>
-    </tr>
-    <tr>
-      <td>datafilepath</td>
-      <td>The datafilepath is the directory to store data files.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>/var/metacat/data</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>C:/Tomcat-5.5/data/metacat/data</code>
-      </td>
-    </tr>
-    <tr>
-      <td>inlinedatafilepath</td>
-      <td>The inlinedatafilepath is the directory to store inline data that
-          has been extracted from EML documents.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>/var/metacat/inline-data</code>
-      <br><br>Example:&nbsp;&nbsp;
-          <code>C:/Tomcat-5.5/data/metacat/inlinedata</code>
-      </td>
-    </tr>
-    <tr>
-      <td>default-style</td>
-      <td>The default-style parameter defines the "style-set" that is to be used
-          by default when the qformat parameter is missing or set to "html"
-          during a query. It is set to "default", which is one of the styles that 
-          ships with the default metacat distribution. Other possible settings
-          are shown in the examples to the right.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>default</code>
-      <br><br>Examples:<code>esa kepler knb knb2 knp lter ltss nceas nrs obfs pisco specnet</code>
-      </td>
-    </tr>
-    <tr>
-      <td>administrators</td>
-      <td>The administrators parameter lists the accounts that are allowed to
-          perform administrative actions such as rebuilding indices for 
-          documents. The list can contain more than one account separated
-          by colons.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>uid=jones,o=NCEAS,dc=ecoinformatics,dc=org</code>
-      <br><br>Examples:&nbsp;&nbsp;
-          <code>uid=localadmin,o=ucnrs.org</code>
-      </td>
-    </tr>
-	
-	<!-- start lsid stuff -->
-	<tr>
-      <td>authority.context</td>
-      <td>This is the context for the (Life Sciences Identifier) LSID authority.
-        LSID support is an optional feature which can be configured to provide
-        metacat access to LSID clients. For more information on LSID's see <a href="http://wiki.gbif.org/guidwiki/wikka.php?wakka=LSID">TDWG
-        site</a>.</td>
-      <td>Default: <code>authority</code></td>
-    </tr>
-	<tr>
-      <td>config.lsidauthority</td>
-      <td>This is the name of the LSID authority that this metacat should use.
-        This authority needs to be defined as SRV record in a DNS.</td>
-      <td><p>Default: <code>ecoinformatics.org</code></p>
-        <p>Examples: <code>esa.org</code> or <code>sulphur.ecoinformatics.org</code></p></td>
-    </tr>
-    <tr>
-      <td>install.ecogrid</td>
-      <td>Enables EarthGrid web services. EarthGrid web services are disabled by default. 
-          To enable EarthGrid web services (including query, put, authentication and 
-          identifier interface), set this value to <code>true</code>, and also set the value
-          of the <em>metacat.dir</em> property as detailed below.</td>
-      <td>
-          Default:&nbsp;&nbsp;<code>false</code>
-      </td>
-    </tr>
-    <tr>
-      <td>metacat.dir</td>
-      <td>If the <em>install.ecogrid</em> property (see above) is set to <code>true</code>, this
-          property should be set to the absolute path of the top-level metacat directory.
-          If <em>install.ecogrid</em> is set to <code>false</code> (the default setting), 
-          the value of <em>metacat.dir</em> is ignored.          
-      </td>
-      <td>Default:&nbsp;&nbsp;<code>/home/tao/project/metacat</code></td>
-    </tr>
-  </table>
-   Note: If property "install.ecogrid" is set to be true(EarthGrid is enabled), you need to change the value of "metacatURL" to your metacat url in
-   seek/projects/ecogrid/conf/MetacatImpl/classes/metacat.properties file.
-  <br>
+  <a name="protocol"></a>
+  <p>This section is only for a fresh installation. If you are upgrading an existing Metacat, please skip
+  this section and go to the next one -  <a HREF="metacatinstall.html#Upgrade">Upgrading Existing Metacat</a>
+  
+  <h3>Download Metacat application</h3>
 
-  <p>
-  Other properties in <code>build.properties</code> that you can (but generally need not) change:
-  </p>
+  <p>First <a href="/software/download.html">download metacat-1.9.0.tar.gz</a> from this site.</p><br>
 
-  <table border="1">
-    <tr>
-      <td><b>Property</b></td>
-      <td><b>Description</b></td>
-      <td><b>Default value and examples of other values</b></td>
-    </tr>
-    <tr>
-      <td>server</td>
-      <td>The server property is the hostname and port number of the server that Metacat uses
-          for replicating documents to and from other Metacat servers, which should be with the secure (HTTPS) port.
-          Since this property is usually composed of the <code>config.hostname</code> and <code>config.port.https</code> properties (described above),
-          the default setting can be used in most cases.
-      </td>
-      <td>Default:&nbsp;&nbsp;<code>${config.hostname}:${config.port.https}</code></td>
-    </tr>
-    <tr>
-      <td>httpserver</td>
-      <td>httpserver is the plain HTTP address and port number that Metacat uses for purposes
-          other than replication. Since this property is usually composed of the <code>config.hosthame</code> and <code>config.port</code>
-          properties (described above), the default setting can be used in most cases.</td>
-      <td>Default:&nbsp;&nbsp;<code>${config.hostname}:${config.port}</code>
-      </td>
-    </tr>
-    <tr>
-      <td>http.protocol</td>
-      <td>http.protocol is the string used in the leading part of a URL to indicate use of the HTTP protocol.</td>
-      <td>Default:&nbsp;&nbsp;<code>http</code>
-      </td>
-    </tr>
-    <tr>
-      <td>config.metacatserver</td>
-      <td>The URL to the metacat server, composed in part from three other properties (http.protocol, httpserver, and metacat.context).</td>
-      <td>Default:&nbsp;&nbsp;<code>${http.protocol}://${httpserver}/${metacat.context}/metacat</code>
-      </td>
-    </tr>
-    <tr>
-      <td>inst.cgi.dir</td>
-      <td>Installation directory for registry CGI scripts</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>/var/www/cgi-knb</code>
-      </td>
-    </tr>
-    <tr>
-      <td>cgi-prefix</td>
-      <td>The URL used for executing CGI scripts</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>http://${httpserver}/cgi-bin</code>
-      </td>
-    </tr>
-    <tr>
-      <td>cvsroot</td>
-      <td>CVS access to retrieve latest EML. Only used by
-          developers in building the release.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code><pre>:ext:${env.USER}@cvs.ecoinformatics.org:/cvs</pre></code>
-          Example:&nbsp;&nbsp;
-          <code><pre>:ext:myaccount@cvs.ecoinformatics.org:/cvs</pre></code>
-      </td>
-    </tr>
-    <tr>
-      <td>knb-site-url</td>
-      <td>This is the URL to the web context root for the knb site. 
-          It is used for the qformat=knb skin only.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>http://knb.ecoinformatics.org</code>
-      </td>
-    </tr>
-    <tr>
-      <td>timedreplication</td>
-      <td>Determines whether timed replication to other metacat servers is being used.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>false</code>
-      <br><br>Other possible values:&nbsp;&nbsp;
-          <code>true</code>
-      </td>
-    </tr>
-    <tr>
-      <td>firsttimedreplication</td>
-      <td>The time for starting first timed replication if timedreplication is true.
-          (See comments in build.properties file for additional details.)</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>10:00 PM</code>
-          <code>&nbsp;</code>
-      </td>
-    </tr>
-    <tr>
-      <td>timedreplicationinterval</td>
-      <td>The interval to next timed replication if timedreplication is true.
-          The value is in milliseconds and default value is 48 hours.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>172800000</code>
-          <code>&nbsp;</code>
-      </td>
-    </tr>
-    <tr>
-      <td>forcereplicationwaitingtime</td>
-      <td>The waiting time before replication is forced to begin after
-          uploading a package. The default value should usually suffice.</td>
-      <td>Default:&nbsp;&nbsp;
-          <code>30000</code>
-          <code>&nbsp;</code>
-      </td>
-    </tr>
-    <tr>
-      <td>log.dir</td>
-      <td>The directory where replication log files are to be written by Metacat.</td>
-      <td>Default:&nbsp;&nbsp;<code>${tomcat}/logs</code></td>
-    </tr>
-    <tr>
-      <td>moderators</td>
-      <td>Moderator accounts, in a colon-separated list. Specifies a list of special users who can review a general user's submission. 
-             Moderators can approve, revise and reject the submission after reviewing. This property is only used in the ESA skin.</td>
-      <td>Default:&nbsp;&nbsp;<code>cn=knb-prod,o=NCEAS,dc=ecoinformatics,dc=org</code></td>
-    </tr>
-    <tr>
-      <td>allowedSubmitters</td>
-      <td>Specifies the list of users who should be allowed to submit documents. 
-          If no value is specified (the default setting), all users will be allowed to submit documents.
-      </td>
-      <td>Default:&nbsp;&nbsp;(no value)</td>
-    </tr>
-    <tr>
-      <td>deniedSubmitters</td>
-      <td>Specify the list of users who should not be allowed to submit documents. 
-          If no value is specified (the default setting), all users will be allowed to submit documents.</td>
-      <td>Default:&nbsp;&nbsp;(no value)</td>
-    </tr>
-    <tr>
-      <td>config.metadataLabelLsid</td>
-      <td> </td>
-      <td>Default:&nbsp;&nbsp;<code>${config.lsidauthority}</code></td>
-    </tr>
-    <tr>
-      <td>build.dir</td>
-      <td>The name of the subdirectory that is created when metacat is built by the 'ant' tool.</td>
-      <td>Default:&nbsp;&nbsp;<code>build</code></td>
-    </tr>
-    <tr>
-      <td>lsid.build.dir</td>
-      <td>The name of the subdirectory for building the LSID component of metacat.</td>
-      <td>Default:&nbsp;&nbsp;<code>${build.dir}/lsid</code></td>
-    </tr>
-    <tr>
-      <td>lib.dir</td>
-      <td>The name of the subdirectory where library (.jar) files and a number of other important files are located.</td>
-      <td>Default:&nbsp;&nbsp;<code>lib</code></td>
-    </tr>
-    <tr>
-      <td>lsid.lib.dir</td>
-      <td>The name of the subdirectory where LSID library (.jar) files are located.</td>
-      <td>Default:&nbsp;&nbsp;<code>${lib.dir}/lsid_lib</code></td>
-    </tr>
-    <tr>
-      <td>lsid.classes.dir</td>
-      <td>The relative path to the location of Java classes that support LSID.</td>
-      <td>Default:&nbsp;&nbsp;<code>edu/ucsb/nceas/metacat/lsid</code></td>
-    </tr>
-    <tr>
-      <td>conf.dir</td>
-      <td>The name of the directory where LSID configuration files are located.</td>
-      <td>Default:&nbsp;&nbsp;<code>lib/lsid_conf</code></td>
-    </tr>
-    <tr>
-      <td>services.dir</td>
-      <td>The name of the directory where LSID services configuration files are located.</td>
-      <td>Default:&nbsp;&nbsp;<code>${conf.dir}/services</code></td>
-    </tr>
-    <tr>
-      <td>webinf.dir</td>
-      <td>The name of the directory where additional LSID web services files are located.</td>
-      <td>Default:&nbsp;&nbsp;<code>${conf.dir}/WEB-INF</code></td>
-    </tr>
-    <tr>
-      <td>compile.debug</td>
-      <td>Indicates whether Java source should be compiled with debug information.</td>
-      <td>Default:&nbsp;&nbsp;<code>true</code></td>
-    </tr>
-    <tr>
-      <td>compile.deprecation</td>
-      <td>Indicates whether Java source should be compiled with deprecation information.</td>
-      <td>Default:&nbsp;&nbsp;<code>false</code></td>
-    </tr>
-    <tr>
-      <td>compile.optimize</td>
-      <td>Indicates whether Java source should be compiled with optimization.</td>
-      <td>Default:&nbsp;&nbsp;<code>true</code></td>
-    </tr>
-    <tr>
-      <td>indexPaths</td>
-      <td>The <em>indexPaths</em> property specifies a comma-separated (potentially long) list 
-          of indexed paths that can be utilized to improve the
-          performance of metacat queries. Each component of the <em>indexPaths</em> property
-          should specify an absolute or relative path (using an XPath-like syntax) to an XML element or 
-          attribute present in the XML documents being queried. Metacat stores XML 
-          element and attribute values for indexed paths in a special database table 
-          that optimizes search performance.
-          <p>Metacat queries allow you to specify (using the &lt;pathexpr&gt; tag in search query) 
-          an exact path to which you want
-          to restrict the search. When the &lt;pathexpr&gt; path that is specified in the query
-          is a member of the <em>indexPaths</em> list, search results are returned faster 
-          because metacat can conduct its search using the optimized database table.
-          <p>
-          The default value for the <em>indexPaths</em> property contains numerous paths to EML
-          elements and attributes that are commonly queried by metacat search tools. 
-          For example, <em>keyword</em> is a
-          member of this list because it is common for search tools to query
-          the <em>keyword</em> field in EML documents. For most purposes, the default value will
-          optimize various types of searches on EML documents and need not be changed.
-          <p>
-          For more information about metacat queries, 
-          see <a href="./metacatquery.html">Queries and Results</a>.
-      </td>
-      <td>Default:&nbsp;&nbsp;<code>organizationName,originator/individualName/surName,...</code></td>
-    </tr>
-  </table>
-  <p>
-  Metacat has a number of additional settable properties in file
-  <code>lib/metacat.properties</code>. Under most circumstances,
-  you will not need to modify this file because the properties of interest
-  to you can be controlled by editing <code>build.properties</code> as
-  described above. To learn more about Metacat's additional properties,
-  see <a href="./properties.html">Metacat Properties File</a>.
-  </p>
-  <p class="emphasis">
-   Note: When setting properties, DO NOT add a trailing slash [/] to the end of any paths that are specified.
-   Metacat will not function correctly if you do so.
-  </p>
+  <p>Extract the contents of the tar file in Linux/Mac by typing: </p>
+  <pre>
+  <b>
+  tar-xvzf metacat-1.9.0.tar.gz
+  </b>
+  </pre> 
+ 
+  <h3>Copy war file to Tomcat application directory</h3>
 
-</td>
-</tr>
-</table>
+  <p>Copy knb.war to $CATALINA_HOME/webapps</p>
+  <p>If desired, you can rename the war file to &lt;yourcontext&gt;.war</p>
 
-<table class="tabledefault" width="100%">
-<td class="tablehead" colspan="2"><p><a name="Compilation and Installation"><h2>Compilation and Installation</h2></p></td>
-<tr>
-<td>
-  <a name="protocol"></a>
-  <p>This section is only for a fresh installation. If you are upgrading an existing Metacat, please skip
-  this section and go to the next one -  <a HREF="metacatinstall.html#Upgrade">Compilation and Upgrading Existing Metacat</a>
-  <p>    
-  <h3>Run Ant Build</h3></p>
-  <p>
-   Ant allows compilation and installation to be done in one step.
-   Change into the metacat directory and type: 
-   <pre><b>ant install</b></pre>
-   <p>
-   You should see a bunch of messages telling you the progress of compilation
-   and installation.  When it is done you should see the message 
-   BUILD SUCCESSFUL
-   and you should be returned to a UNIX command prompt.  If you do not see
-   the message BUILD SUCCESSFUL then there was an error that you need to 
-   resolve.
-   This may come up if you are logged in as a user that does not have write
-   access to one or more of the directories that are listed in the build.xml
-   file, or if any of the paths to files are not configured correctly in the
-   "config" target.
-  </p>
-  <p>
-  Note: The 'data' directories that are indicated in the 'datafilepath' and
-  'inlinedatafilepath' build properties must be writable
-  by user account under which Tomcat runs or you will not be able to upload 
-  data files to the system.
-  </p>
+  <h3>Create Metacat directory</h3>
+  
+  <p>Create the Metacat storage directory:</p>
+  <pre>
+  <b>
+  mkdir /var/metacat
+  </b>
+  </pre> 
+  
+  <p>Change the ownership of the Metacat storage directory to be the user that runs Tomcat:
+  <pre>
+  <b>
+  chown tomcat:tomcat /var/metacat
+  </b>
+  </pre></p> 
 
-  <p class="header">To install metacat LSID support, adjust the LSID-related
-    properties in the build.properties files and type:
-  <p class="header"><b>ant deploy-lsid</b>
-  <p>    
-  <h3>SQL Scripts</h3></p>
-  <p>
-   You now need to set up the table structure in your database.  You can 
-   do this either using the ant build system, or by manually running the
-   scripts using a sql utility.
-  </p>
-  <p><b>WARNING: Do NOT run this on an existing metacat installation as it
-  will delete all of your data.  If you have an existing metacat installation,
-  see the instructions for <a HREF="metacatinstall.html#Upgrade">"Compilation and Upgrading Existing Metacat"</a> below.</b></p>
-
-  <p>To run the scripts using ant, type
-   <pre><b>ant installdb</b></pre> 
-  </p>
-  <p>To run the scripts manually, change to the
-   metacat/build/src directory.  Then run you RDBMS's SQL utility.  In Oracle it is
-   SQLPlus.  This tutorial assumes an Oracle database so this example is for
-   SQLPlus.  Login as the oracle user that was set up for use with Metacat.
-   At the SQLPlus prompt type the following: <pre><b>@xmltables.sql;</b></pre>
-   For postgres, use a command like: 
-   <code>psql -U metacat -W -h localhost -f build/src/xmltables-postgres.sql metacat</code>
-  </p>
-  <p>Either way, 
-   you should see a bunch of output showing the creation of the Metacat table
-   space. The first time you run this script you will get several errors at the 
-   beginning saying that you cannot drop a table/index/trigger because it 
-   does not exist.  This is normal.  Any other errors besides this need to be
-   resolved before continuing. The script file name for PostgreSQL is 
-   xmltables-postgres.sql and for Microsoft SQL server is 
-   xmltables-sqlserver.sql.
-  </p>
-  <p>
-   If the script has run correctly you should be able to type 
-   <pre>describe xml_documents</pre> and it should show:
-   <pre>
-    Name            Null?         Type
-    --------------  ------------  ---------------- 
-     DOCID          NOT NULL      VARCHAR2(250)
-     ROOTNODEID                   NUMBER(20)
-     DOCNAME                      VARCHAR2(100)
-     DOCTYPE                      VARCHAR2(100)
-     DOCTITLE                     VARCHAR2(1000)
-     USER_OWNER                   VARCHAR2(100)
-     USER_UPDATED                 VARCHAR2(100)
-     SERVER_LOCATION              NUMBER(20)
-     REV                          NUMBER(10)
-     DATE_CREATED                 DATE
-     DATE_UPDATED                 DATE
-     PUBLIC_ACCESS                NUMBER(1)
-     UPDATED                      NUMBER(1)
-   </pre>
-  </p>
-  <p><h3>Register schemas and DTDs</h3></p>
-  <p>Once the tables have been created, you should also register the Ecological
-  Metadata Language (EML) DTDs and schemas. <b>However, note that you should 
-  NOT do this if you are upgrading an existing installation -- the upgrade
-  scripts take care of it for you (see the next section).</b>  If you are
-  installing new, you can register the schema documents by running:</p>
-  <pre><b>ant register-schemas</b></pre> 
-  <p>This command registers the EML DTDs' and schemas' location in the 
-  metacat server.  Your database username and password have to be set correctly
-  for this to work.  Also, if for some reason running this script from ant
-  does not work, you could instead try running "build/src/loaddtdschema.sql"
-  from your sql utility (but be sure to use the version in the 'build' directory
-  that has been customized for your installation).
-  </p>
   <h3>Restart Tomcat</h3>
   <p>
    Once you have successfully installed Metacat, there is one more step.  Tomcat
@@ -857,12 +276,15 @@
    </pre>
    If you see that message Tomcat is successfully loading the Metacat servlet.
    Next, try to run your new servlet.  Go to a web browser and type:
-   <pre>http://yourserver.yourdomain.com/yourcontext/</pre>
+     <pre>
+     http://yourserver.yourdomain.com/yourcontext/
+     </pre>
    You should substitute your context name for "yourcontext" in the url above.
-   If everything is working correctly, you should see a query page followed
-   by an empty result set.  Note that if you do not have Tomcat integrated with
+   If everything is working correctly, you should see a Metacat configuration screen.  Note that if you do not have Tomcat integrated with
    Apache you will probably have to type
-   <pre>http://yourserver.yourdomain.com:8080/yourcontext/</pre>
+     <pre>
+     http://yourserver.yourdomain.com:8080/yourcontext/
+     </pre>
   </p>
   <p><b>Troubleshooting</b>: If you see something like java.lang.InternalError: 
   Can't connect to X11 window server using 'yourservanme:0.0' as the value of the DISPLAY variable.
@@ -871,6 +293,13 @@
   catalina.sh file in tomcat bin directory. The reason is that GeoServer uses X11 windows to draw graphics.
   </p>
   
+  <h3>Configure Metacat</h3>
+  <p>
+  Once you see the Metacat configuration screen, you can follow the instructions in the 
+  <a href="./metacatconfigure.html"> Configuring Metacat Section</a> 
+  to complete the internal configuration of Metacat.
+  </p>
+  
   <h3>Deploy wsdl file (Only for EarthGrid-enabled Metacat installation) </h3>
   <p>
    Once Tomcat is running successfully, there is another step for EarthGrid-enabled Metacat installation. 
Index: build.properties
===================================================================
--- build.properties	(revision 4079)
+++ build.properties	(revision 4080)
@@ -1,35 +1,27 @@
 # Ant build properties files for the metacat build
 
-# Tomcat Properties
-tomcat=/usr/local/devtools/jakarta-tomcat
-deploy.dir=/var/www/org.ecoinformatics.knb
-#deploy.dir=${tomcat}/webapps
+#Version of this build
+metacat.version=1.9.0
 
-# Tomcat version - tomcat4 or tomcat5
-tomcatversion=tomcat5
+# Tomcat dev deployment directory
+# dev.tomcat.dir=/usr/local/tomcat
+dev.deploy.dir=/usr/local/devtools/jakarta-tomcat
 
-# Servlet properties
+
+## metacat.context will be used to name war only
 metacat.context=knb
 authority.context=authority
 
 # Server Properties
-config.hostname=knb.ecoinformatics.org
-config.port=80
-config.port.https=443
-# Server is the domain name for replication purpose, which should be with https port
-server=${config.hostname}:${config.port.https}
-httpserver=${config.hostname}:${config.port}
 http.protocol=http
-config.metacatserver=${http.protocol}://${httpserver}/${metacat.context}/metacat
 config.lsidauthority=ecoinformatics.org
 
 # Installation directory for registry CGI scripts
 inst.cgi.dir=/var/www/cgi-knb
-cgi-prefix=http://${httpserver}/cgi-bin
-ldapUrl=ldap://ldap.ecoinformatics.org/dc=ecoinformatics,dc=org
 
 # Select the database to use for metadata storage
 # Valid values are oracle, postgresql, sqlserver
+# MCD the next line needs to go away
 database=postgresql
 
 # The JDBC connection string used to connect to the database
@@ -36,36 +28,37 @@
 #jdbc-connect=jdbc:oracle:thin:@metacat.nceas.ucsb.edu:1521:knb
 #jdbc-connect=jdbc:postgresql://localhost/postgres
 #jdbc-connect=jdbc:microsoft:sqlserver://fatali.nceas.ucsb.edu:1433
-jdbc-connect=jdbc:postgresql://localhost/metacat
 
 # The base directory for locating JDBC jar files (not needed for postgresql)
 jdbc_base=./lib
 #jdbc-base=F:\\Program Files\\Microsoft SQL Server 2000 Driver for JDBC\\lib
 
-# Metacat database user and password and location of file stores
-user=metacat
-password=yourPasswordHere
-datafilepath=/var/metacat/data
-inlinedatafilepath=/var/metacat/inline-data
+# TODO SCW remove this, should be exposed in initial configuration
+temp-dir=/var/metacat/temporary
 
+# Registry & LDAP properties
+# This section can safely be ignored if installing Metacat without the Perl components
+# LDAP configuration
+ldap.context=unaffiliated
+ldap.url=ldap.ecoinformatics.org
+ldap.password=LDAP_PASSWORD_HERE
+
+# Installation directory for registry CGI scripts
+# SCW: these should be detokenized
+inst.cgi.dir=${deploy.dir}/${metacat.context}/cgi-bin
+cgi-prefix=http://${httpserver}/${metacat.context}/cgi-bin
+
+# SCW: Set the cgi-user, either here or in scripts to properly
+# set the permissions on the temporary folder; cgi-writable files
+cgi-user=www-data
+
 # CVS access to retrieve latest EML 
 cvsroot=:ext:${env.USER}@cvs.ecoinformatics.org:/cvs
 
-# Configure the installed skins, and select the default
-default-style=default
-
-# this is the url to the web context root for the knb site. 
-# It is used for the qformat=knb skin only
-knb-site-url=http://knb.ecoinformatics.org
-
 #Turn off or on for timed replication
 #valide value is true or false
 timedreplication=false
 
-#replication log directory
-#log.dir=/var/log/tomcat
-log.dir=${tomcat}/logs
-
 # The time for starting first timed replication if timedreplication is on
 # The value should be in SHORT format (e.g. 2:00 AM) without date
 # The first timed replication will start at the setting time which is 
@@ -82,20 +75,6 @@
 
 forcereplicationwaitingtime=30000
 
-# Administrator accounts, in a colon separated list
-administrators=uid=jones,o=NCEAS,dc=ecoinformatics,dc=org
-
-# Moderator accounts, in a colon seperated list
-moderators=cn=knb-prod,o=NCEAS,dc=ecoinformatics,dc=org
-
-# Specify the list of users which should be allowed to submit documents. 
-# If no value is specified, all users will be allowed to submit documents.
-allowedSubmitters=
-
-# Specify the list of users which should not be allowed to submit documents. 
-# If no value is specified, all users will be allowed to submit documents.
-deniedSubmitters=
-
 ## Additional configuration options
 # you probably don't want or need to change these
 config.metadataLabelLsid=${config.lsidauthority}
@@ -120,5 +99,5 @@
 
 # The metacat current dir's abolute value. If you set install.ecogrid=false, this variable
 #  do NOT need to be configured
-metacat.dir=/home/tao/project/metacat
+metacat.dir=/home/daigle/workspace/metacat
 
Index: docs/dev/images/registry-login.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: docs/dev/images/registry-login.jpg
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: docs/user/metacatconfigure.html
===================================================================
--- docs/user/metacatconfigure.html	(nonexistent)
+++ docs/user/metacatconfigure.html	(revision 4080)
@@ -0,0 +1,135 @@
+<!-- 
+  *   '$RCSfile$'
+  *     Purpose: web page describing the installation of Metacat
+  *   Copyright: 2008 Regents of the University of California and the
+  *               National Center for Ecological Analysis and Synthesis
+  *     Authors: Chad Berkley
+  *
+  *    '$Author$'
+  *    '$Date$'
+  *    '$Revision$'
+  *
+  *
+  -->
+  
+<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.0//EN">
+<html>
+
+<head>
+  <title>Metacat Configuration Instructions</title>
+  <link rel="stylesheet" type="text/css" href="./default.css">
+</head>
+
+<body>
+
+<table class="tabledefault" width="100%">
+<tr><td rowspan="2"><img src="./images/KNBLogo.gif"></td>
+<td colspan="7">
+<div class="title">Metacat Configuration</div>
+</td>
+</tr>
+<tr>
+  <td><a href="/" class="toollink"> KNB Home </a></td>
+  <td><a href="/data.html" class="toollink"> Data </a></td>
+  <td><a href="/people.html" class="toollink"> People </a></td>
+  <td><a href="/informatics" class="toollink"> Informatics </a></td>
+  <td><a href="/biodiversity" class="toollink"> Biocomplexity </a></td>
+  <td><a href="/education" class="toollink"> Education </a></td>
+  <td><a href="/software" class="toollink"> Software </a></td>
+</tr>
+</table>
+<hr>
+
+<table class="tabledefault" width="100%">
+<td class="tablehead" colspan="2"><p><a name="The Table of Contents"><h2>The Table of Contents</h2></p></td>
+<tr>
+<td>
+  <ul>
+    <li>
+      <a HREF="metacatconfigure.html#introduction">Introduction</a>
+    </li>
+    <li>
+      <a HREF="metacatconfigure.html#ldap-config">LDAP Configuration</a>
+    </li>
+    <li>
+      <a HREF="metacatconfigure.html#admin-login">Admin Log In</a>
+    </li>
+    <li>
+      <a HREF="metacatconfigure.html#main-config">Main Configuration Page</a>
+    </li>
+    <li>
+      <a HREF="metacatconfigure.html#properties-config">Main Properties Configuration</a>
+    </li>
+    <li>
+      <a HREF="metacatconfigure.html#database-config">Database Configuration</a>
+    </li>   
+  </ul>
+</td>
+</tr>
+</table>
+
+<table class="tabledefault" width="100%">
+<td class="tablehead" colspan="2"><p><a name="introduction"><h2>Introduction</h2></p></td>
+<tr>
+<td>
+  <p>
+    The first time you go to Metacat after installation or upgrade, you will be directed to 
+    a series of configuration screens.  You can also get there explicitly even after Metacat
+    is configured by typing:
+    
+    <pre>
+      http://&lt;yourserver.yourdomain.com&gt;/&lt;yourcontext&gt;/admin
+    </pre>
+    or if you are not running apache:
+    <pre>
+      http://&lt;yourserver.yourdomain.com&gt;:8080/&lt;yourcontext&gt;/admin
+    </pre>
+  </p>
+
+  <p>
+  The system will follow these rules in order to determine the order
+  that the configuration will occur:
+  </p>
+  
+  <ul>
+    <li>
+      Is LDAP Configured? If not, show 
+      <a HREF="metacatconfigure.html#ldap-config">LDAP Configuration Section</a>.  
+      You will need to have LDAP configured in order to define administrative accounts
+      and authenticate as one of these users via LDAP.
+    </li>
+    <li>
+      Are you logged in as an administrative user?  If not, show 
+      <a HREF="metacatconfigure.html#admin-login">Administrator Login Page</a>.
+      You can only configure Metacat as an administrator.
+    </li>
+    <li>
+      Are main properties, skins or database unconfigured.  If so, show 
+      <a HREF="metacatconfigure.html#main-config">Main Configuration Page</a>
+      <ul>
+        <li>
+          Note that you will not be able to select the database configuration utility 
+          until main properties have been configured.
+        </li>
+    </ul>  
+    <li>
+      Are all sections configured.  If so, show 
+      <a HREF="metacatconfigure.html#main-config">Main Configuration Page</a> but
+      Include instructions for restarting Metacat server.
+    </li> 
+    </li>
+  </ul>
+  
+  <p> See the following sections for descriptions of how each of these work.</p>
+</td>
+</tr>
+</table>
+
+<table class="tabledefault" width="100%">
+<td class="tablehead" colspan="2"><p><a name="ldap-config"><h2>LDAP Configuration</h2></p></td>
+<tr>
+<td>
+<img class="screenshot" src="./images/main-config.png"/>
+</td>
+</tr>
+</table>

Property changes on: docs/user/metacatconfigure.html
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: docs/user/default.css
===================================================================
--- docs/user/default.css	(revision 4079)
+++ docs/user/default.css	(revision 4080)
@@ -146,6 +146,10 @@
     padding: 0.25em;
     border: none;
     float: left; }
+img.screenshot {
+	display: block;
+	margin-left: auto;
+	margin-right: auto; }
 .roweven {
     background: #c0d3e7; }
 .rowodd {
Index: docs/dev/images/pagedquery.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: docs/dev/images/pagedquery.jpg
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: docs/dev/default.css
===================================================================
--- docs/dev/default.css	(nonexistent)
+++ docs/dev/default.css	(revision 4080)
@@ -0,0 +1,165 @@
+ /*
+  *   '$RCSfile$'
+  *     Purpose: Default style sheet for KNB project web pages 
+  *              Using this stylesheet rather than placing styles directly in 
+  *              the KNB web documents allows us to globally change the 
+  *              formatting styles of the entire site in one easy place.
+  *   Copyright: 2000 Regents of the University of California and the
+  *               National Center for Ecological Analysis and Synthesis
+  *     Authors: Matt Jones
+  *
+  *    '$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
+  */
+
+body { 
+    color: black; 
+    background: white;
+    font-size: 1em; 
+    font-family: Arial,Helvetica,sans-serif; }
+a {
+    color: green;
+    text-decoration: none; }
+a.toollink {
+    color: green;
+    text-decoration: none; }
+a.sitelink {
+    color: green;
+    text-decoration: none; 
+    font-weight: bold; }
+.logo {
+    background: #ccccff;
+    color: green;
+    width: 3em;
+    margin-left: 0.5em;
+    margin-right: 0.5em;
+    margin-top: 0.5em;
+    margin-bottom: 0.5em;
+    padding: 0.5em;
+    font-size: 2em; 
+    font-weight: bold; }
+.tabledefault {
+    background: white;
+    color: black;
+    width: 100%;
+    font-size: 1em; 
+    left-padding: 0.25em;
+    right-padding: 0.25em; }
+.tablepanel {
+    background: #eeeeee;
+    color: black;
+    font-size: 1em; 
+    left-padding: 0.25em;
+    right-padding: 0.25em; }
+.tablehead {
+    background: #ccccff;
+    vertical-align: baseline;
+    color: black;
+    font-size: 1em;
+    font-weight: bold;
+    }
+.tableheadcontrast {
+    background: #dddddd;
+    vertical-align: baseline;
+    color: black;
+    font-size: 1.2em; 
+    font-weight: bold; }
+.title { 
+    color: black; 
+    margin-top: 1em;
+    font-size: 1.5em; 
+    font-weight: bold; }
+.subtitle { 
+    color: black; 
+    margin-top: 0.5em;
+    margin-left: 3em;
+    font-weight: bold;
+    font-style: italic; }
+.pagetitle {
+    font-family: Arial,Helvetica,sans-serif;
+    font-size: 3em;
+    font-weight: bold;
+    color: green;
+    margin-left: 0.25em; }
+.pagesub {
+    font-family: Arial,Helvetica,sans-serif;
+    font-size: 1em;
+    font-weight: bold;
+    color: green;
+    margin-left: 3em;
+    margin-top: 0.5em;
+    margin-bottom: 2em; }
+.instright { 
+    color: black; 
+    text-align: right;
+    vertical-align: middle;
+    padding: 1em;
+    font-size: 1em; 
+    font-weight: bold; }
+.instleft { 
+    color: black; 
+    text-align: left;
+    vertical-align: middle;
+    padding: 1em;
+    font-size: 1em; 
+    font-weight: bold; }
+p { 
+    margin: 0.25em; }
+.required { 
+    color: red; }
+.emphasis { 
+    color: red; }
+p.label { 
+    color: black; 
+    font-weight: bold; }
+p.contact { 
+    color: black; 
+    padding: 1em;
+    font-size: 0.75em; 
+    font-weight: normal;
+    font-style: italic; }
+p.header {
+    color: black; 
+    padding: 1em;
+    font-size: 0.75em; 
+    font-weight: bold; }
+img.logoright {
+    padding: 0.5em;
+    border: none;
+    float: right; }
+img.logoleft {
+    padding: 0.25em;
+    border: none;
+    float: left; }
+.roweven {
+    background: #c0d3e7; }
+.rowodd {
+    background: white; }
+.highlight  {
+    background-color: #dddddd; 
+    font-size: -1; }
+.plaintext {
+    color: black;
+    font-weight: normal;
+    font-size: 1em;
+    }
+.boldtext {
+    color: black;
+    font-weight: bold;
+    font-size: 1em;
+    }

Property changes on: docs/dev/default.css
___________________________________________________________________
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: docs/user/metacatinstall-backup.html
===================================================================
--- docs/user/metacatinstall-backup.html	(nonexistent)
+++ docs/user/metacatinstall-backup.html	(revision 4080)
@@ -0,0 +1,661 @@
+<table class="tabledefault" width="100%">
+<td class="tablehead" colspan="2"><p><a name="Edit build.properties File"><h2>Edit <code>build.properties</code> File</h2></p></td>
+<tr>
+<td>
+  <p>
+   Once all of the prerequisite software is installed as described above, 
+   the installation of Metacat can begin.  First you must have a current
+   version of the source distribution of Metacat.  You can get it two ways.
+   Authorized users can check it out of the NCEAS 
+   <a href="http://www.nceas.ucsb.edu/cgi-bin/cvsweb.cgi/xmltodb/">CVS</a>
+   system. You'll need both the "metacat" module and the "utilities" module to
+   be checked out in sibling directories. The command is as follows: 
+   <pre>mkdir knb-software</pre>
+   <pre>cd knb-software</pre>
+   <pre>cvs checkout -P metacat</pre>
+   <pre>cvs checkout -P utilities</pre>  
+   Or you can 
+   <a href="/software/download.html">download</a> a gzipped tar file
+   from this site.
+  </p>
+   <p>
+   Once you have either checked out or unzipped and untarred the source
+   distribution, you can begin the installation process.  Change into the 
+   metacat directory and edit the file called "<code>build.properties</code>".  You will need 
+   to change a number of configuration properties to match the setup on
+   your system. The property values that you will likely need to change are described in 
+   detail in the following table:
+  </p>
+  <br/>
+  <table border="1">
+    <tr>
+      <td><b>Property</b></td>
+      <td><b>Description</b></td>
+      <td><b>Default value and examples of other values</b></td>
+    </tr>
+    <tr>
+      <td>tomcat</td>
+      <td>The tomcat property is the location in which tomcat is installed.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>/usr/local/devtools/jakarta-tomcat</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>C:/Tomcat-5.5</code></td>
+    </tr>
+    <tr>
+      <td>deploy.dir</td>
+      <td>The deploy.dir property is the location in which your tomcat servlet 
+          contexts are deployed. This is typically "${tomcat}/webapps",
+          where ${tomcat} is the same value that you entered for the 'tomcat'
+          property above.
+      </td>
+      <td>Default:&nbsp;&nbsp;
+          <code>/var/www/org.ecoinformatics.knb</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>C:/Tomcat-5.5/webapps</code>
+      </td>
+    </tr>
+    <tr>
+      <td>tomcatversion</td>
+      <td>The tomcatversion property is the version of Tomcat in which you 
+          want Metacat to run. This will determine the location of some
+          jar files coming with Tomcat. 
+          <p>
+            <em>Note: Tomcat 3 and 4 are no longer tested or supported by Metacat.
+                Users are highly encouraged to upgrade to Tomcat 5.5.
+            </em>
+          </p>
+          <p>
+            <em>Also note: a property value of 'tomcat5' can be set when using
+                either Tomcat 5.0 or Tomcat 5.5.
+            </em>
+          </p>
+      </td>
+      <td>Default:&nbsp;&nbsp;
+          <code>tomcat5</code>
+      <br><br>Other possible values (deprecated):&nbsp;&nbsp;
+          <code>tomcat3 tomcat4</code>
+      </td>
+      </td>
+    </tr>
+    <tr>
+      <td>metacat.context</td>
+      <td>The metacat.context property is the name of the servlet context in which you 
+          want Metacat to be installed. This will determine the installation 
+          directory for the servlet and many of the URLs that are used to access
+          the installed Metacat server.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>knb</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>mycontext</code>
+      </td>
+    </tr>
+    <tr>
+      <td>config.hostname</td>
+      <td>The config.hostname property is the hostname of the server on which Metacat is 
+          running (note that you should not include the 'http://' in the config.hostname
+          property).
+      </td>
+      <td>Default:&nbsp;&nbsp;
+         <code>knb.ecoinformatics.org</code>
+      <br><br>Example:&nbsp;&nbsp;
+         <code>somehost.university.edu</code>
+      </td>
+    </tr>
+    <tr>
+      <td>config.port</td>
+      <td>The config.port property is the HTTP plain port number that is used to connect to Metacat.
+          If Tomcat is running stand-alone, the value will typically be 8080.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>80</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>8080</code>
+      </td>
+    </tr>
+    <tr>
+      <td>config.port.https</td>
+      <td>The config.port.https property is the HTTP secure port number that is used to connect to Metacat,
+          generally when replicating documents to and from other Metacat servers.
+          If Tomcat is running stand-alone, the value will typically be 8443.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>443</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>8443</code>
+      </td>
+    </tr>
+    <tr>
+      <td><a name="ldap.url">ldapUrl</td>
+      <td>URL to the LDAP server. The LDAP server is used in the default
+          authentication module to authenticate and identify users of the
+          system.  To participate in the KNB network, you should leave this at
+          the default.  But it can be changed if you want to use a 
+          different directory of users.
+      </td>
+      <td>Default:&nbsp;&nbsp;
+          <code>ldap://ldap.ecoinformatics.org/dc=ecoinformatics,dc=org</code>
+      </td>
+    </tr>
+    <tr>
+      <td>database</td>
+      <td>Select the database to use for metadata storage.
+          <p>
+          The build file is preconfigured to install Metacat either using 
+          Oracle, PostgreSQL, or Microsoft SQL Server as a backend database.  
+          To change the database system, simply change the value of the 'database' 
+          property to be the name of the database target that you wish to use.
+          </p>
+          <p>
+          Valid values are <code>oracle</code>, <code>postgresql</code>, or
+          <code>sqlserver</code>. <em>Note that sqlserver support is minimal and
+          probably will not work without substantial changes on your part,
+          possibly including code changes.  We have not recently tested on 
+          sqlserver.</em>
+          </p>
+      </td>
+      <td>Default:&nbsp;&nbsp;
+          <code>postgresql</code>
+      <br><br>Other possible values:&nbsp;&nbsp;
+          <code>oracle</code>&nbsp;&nbsp;
+          <code>sqlserver</code>
+      </td>
+    </tr>
+    <tr>
+      <td>jdbc-connect</td>
+      <td>The JDBC connection string used to connect to the database.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>jdbc:postgresql://localhost/metacat</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>jdbc:oracle:thin:@somehost.university.edu:1521:metacat</code>
+      </td>
+    <tr>
+      <td>jdbc-base</td>
+      <td>The base directory for locating JDBC jar files. When using the postgresql database, the default setting of './lib' can be used,
+          while oracle and sqlserver databases will require a different setting since these jar files are not included in the Metacat
+          distribution.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>./lib</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>/usr/oracle/jdbc/lib</code><br>
+      </td>
+    </tr>
+    <tr>
+      <td>user</td>
+      <td>The database user name that you set up to use Metacat.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>metacat</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>metacatuser</code>
+      </td>
+    </tr>
+    <tr>
+      <td>password</td>
+      <td>The database password that you set up to use Metacat.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>yourPasswordHere</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>metacat123</code>
+      </td>
+    </tr>
+    <tr>
+      <td>datafilepath</td>
+      <td>The datafilepath is the directory to store data files.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>/var/metacat/data</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>C:/Tomcat-5.5/data/metacat/data</code>
+      </td>
+    </tr>
+    <tr>
+      <td>inlinedatafilepath</td>
+      <td>The inlinedatafilepath is the directory to store inline data that
+          has been extracted from EML documents.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>/var/metacat/inline-data</code>
+      <br><br>Example:&nbsp;&nbsp;
+          <code>C:/Tomcat-5.5/data/metacat/inlinedata</code>
+      </td>
+    </tr>
+    <tr>
+      <td>default-style</td>
+      <td>The default-style parameter defines the "style-set" that is to be used
+          by default when the qformat parameter is missing or set to "html"
+          during a query. It is set to "default", which is one of the styles that 
+          ships with the default metacat distribution. Other possible settings
+          are shown in the examples to the right.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>default</code>
+      <br><br>Examples:<code>esa kepler knb knb2 knp lter ltss nceas nrs obfs pisco specnet</code>
+      </td>
+    </tr>
+    <tr>
+      <td>administrators</td>
+      <td>The administrators parameter lists the accounts that are allowed to
+          perform administrative actions such as rebuilding indices for 
+          documents. The list can contain more than one account separated
+          by colons.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>uid=jones,o=NCEAS,dc=ecoinformatics,dc=org</code>
+      <br><br>Examples:&nbsp;&nbsp;
+          <code>uid=localadmin,o=ucnrs.org</code>
+      </td>
+    </tr>
+	
+	<!-- start lsid stuff -->
+	<tr>
+      <td>authority.context</td>
+      <td>This is the context for the (Life Sciences Identifier) LSID authority.
+        LSID support is an optional feature which can be configured to provide
+        metacat access to LSID clients. For more information on LSID's see <a href="http://wiki.gbif.org/guidwiki/wikka.php?wakka=LSID">TDWG
+        site</a>.</td>
+      <td>Default: <code>authority</code></td>
+    </tr>
+	<tr>
+      <td>config.lsidauthority</td>
+      <td>This is the name of the LSID authority that this metacat should use.
+        This authority needs to be defined as SRV record in a DNS.</td>
+      <td><p>Default: <code>ecoinformatics.org</code></p>
+        <p>Examples: <code>esa.org</code> or <code>sulphur.ecoinformatics.org</code></p></td>
+    </tr>
+    <tr>
+      <td>install.ecogrid</td>
+      <td>Enables EarthGrid web services. EarthGrid web services are disabled by default. 
+          To enable EarthGrid web services (including query, put, authentication and 
+          identifier interface), set this value to <code>true</code>, and also set the value
+          of the <em>metacat.dir</em> property as detailed below.</td>
+      <td>
+          Default:&nbsp;&nbsp;<code>false</code>
+      </td>
+    </tr>
+    <tr>
+      <td>metacat.dir</td>
+      <td>If the <em>install.ecogrid</em> property (see above) is set to <code>true</code>, this
+          property should be set to the absolute path of the top-level metacat directory.
+          If <em>install.ecogrid</em> is set to <code>false</code> (the default setting), 
+          the value of <em>metacat.dir</em> is ignored.          
+      </td>
+      <td>Default:&nbsp;&nbsp;<code>/home/tao/project/metacat</code></td>
+    </tr>
+  </table>
+   Note: If property "install.ecogrid" is set to be true(EarthGrid is enabled), you need to change the value of "metacatURL" to your metacat url in
+   seek/projects/ecogrid/conf/MetacatImpl/classes/metacat.properties file.
+  <br>
+
+  <p>
+  Other properties in <code>build.properties</code> that you can (but generally need not) change:
+  </p>
+
+  <table border="1">
+    <tr>
+      <td><b>Property</b></td>
+      <td><b>Description</b></td>
+      <td><b>Default value and examples of other values</b></td>
+    </tr>
+    <tr>
+      <td>server</td>
+      <td>The server property is the hostname and port number of the server that Metacat uses
+          for replicating documents to and from other Metacat servers, which should be with the secure (HTTPS) port.
+          Since this property is usually composed of the <code>config.hostname</code> and <code>config.port.https</code> properties (described above),
+          the default setting can be used in most cases.
+      </td>
+      <td>Default:&nbsp;&nbsp;<code>${config.hostname}:${config.port.https}</code></td>
+    </tr>
+    <tr>
+      <td>httpserver</td>
+      <td>httpserver is the plain HTTP address and port number that Metacat uses for purposes
+          other than replication. Since this property is usually composed of the <code>config.hosthame</code> and <code>config.port</code>
+          properties (described above), the default setting can be used in most cases.</td>
+      <td>Default:&nbsp;&nbsp;<code>${config.hostname}:${config.port}</code>
+      </td>
+    </tr>
+    <tr>
+      <td>http.protocol</td>
+      <td>http.protocol is the string used in the leading part of a URL to indicate use of the HTTP protocol.</td>
+      <td>Default:&nbsp;&nbsp;<code>http</code>
+      </td>
+    </tr>
+    <tr>
+      <td>config.metacatserver</td>
+      <td>The URL to the metacat server, composed in part from three other properties (http.protocol, httpserver, and metacat.context).</td>
+      <td>Default:&nbsp;&nbsp;<code>${http.protocol}://${httpserver}/${metacat.context}/metacat</code>
+      </td>
+    </tr>
+    <tr>
+      <td>inst.cgi.dir</td>
+      <td>Installation directory for registry CGI scripts</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>/var/www/cgi-knb</code>
+      </td>
+    </tr>
+    <tr>
+      <td>cgi-prefix</td>
+      <td>The URL used for executing CGI scripts</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>http://${httpserver}/cgi-bin</code>
+      </td>
+    </tr>
+    <tr>
+      <td>cvsroot</td>
+      <td>CVS access to retrieve latest EML. Only used by
+          developers in building the release.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code><pre>:ext:${env.USER}@cvs.ecoinformatics.org:/cvs</pre></code>
+          Example:&nbsp;&nbsp;
+          <code><pre>:ext:myaccount@cvs.ecoinformatics.org:/cvs</pre></code>
+      </td>
+    </tr>
+    <tr>
+      <td>knb-site-url</td>
+      <td>This is the URL to the web context root for the knb site. 
+          It is used for the qformat=knb skin only.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>http://knb.ecoinformatics.org</code>
+      </td>
+    </tr>
+    <tr>
+      <td>timedreplication</td>
+      <td>Determines whether timed replication to other metacat servers is being used.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>false</code>
+      <br><br>Other possible values:&nbsp;&nbsp;
+          <code>true</code>
+      </td>
+    </tr>
+    <tr>
+      <td>firsttimedreplication</td>
+      <td>The time for starting first timed replication if timedreplication is true.
+          (See comments in build.properties file for additional details.)</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>10:00 PM</code>
+          <code>&nbsp;</code>
+      </td>
+    </tr>
+    <tr>
+      <td>timedreplicationinterval</td>
+      <td>The interval to next timed replication if timedreplication is true.
+          The value is in milliseconds and default value is 48 hours.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>172800000</code>
+          <code>&nbsp;</code>
+      </td>
+    </tr>
+    <tr>
+      <td>forcereplicationwaitingtime</td>
+      <td>The waiting time before replication is forced to begin after
+          uploading a package. The default value should usually suffice.</td>
+      <td>Default:&nbsp;&nbsp;
+          <code>30000</code>
+          <code>&nbsp;</code>
+      </td>
+    </tr>
+    <tr>
+      <td>log.dir</td>
+      <td>The directory where replication log files are to be written by Metacat.</td>
+      <td>Default:&nbsp;&nbsp;<code>${tomcat}/logs</code></td>
+    </tr>
+    <tr>
+      <td>moderators</td>
+      <td>Moderator accounts, in a colon-separated list. Specifies a list of special users who can review a general user's submission. 
+             Moderators can approve, revise and reject the submission after reviewing. This property is only used in the ESA skin.</td>
+      <td>Default:&nbsp;&nbsp;<code>cn=knb-prod,o=NCEAS,dc=ecoinformatics,dc=org</code></td>
+    </tr>
+    <tr>
+      <td>allowedSubmitters</td>
+      <td>Specifies the list of users who should be allowed to submit documents. 
+          If no value is specified (the default setting), all users will be allowed to submit documents.
+      </td>
+      <td>Default:&nbsp;&nbsp;(no value)</td>
+    </tr>
+    <tr>
+      <td>deniedSubmitters</td>
+      <td>Specify the list of users who should not be allowed to submit documents. 
+          If no value is specified (the default setting), all users will be allowed to submit documents.</td>
+      <td>Default:&nbsp;&nbsp;(no value)</td>
+    </tr>
+    <tr>
+      <td>config.metadataLabelLsid</td>
+      <td> </td>
+      <td>Default:&nbsp;&nbsp;<code>${config.lsidauthority}</code></td>
+    </tr>
+    <tr>
+      <td>build.dir</td>
+      <td>The name of the subdirectory that is created when metacat is built by the 'ant' tool.</td>
+      <td>Default:&nbsp;&nbsp;<code>build</code></td>
+    </tr>
+    <tr>
+      <td>lsid.build.dir</td>
+      <td>The name of the subdirectory for building the LSID component of metacat.</td>
+      <td>Default:&nbsp;&nbsp;<code>${build.dir}/lsid</code></td>
+    </tr>
+    <tr>
+      <td>lib.dir</td>
+      <td>The name of the subdirectory where library (.jar) files and a number of other important files are located.</td>
+      <td>Default:&nbsp;&nbsp;<code>lib</code></td>
+    </tr>
+    <tr>
+      <td>lsid.lib.dir</td>
+      <td>The name of the subdirectory where LSID library (.jar) files are located.</td>
+      <td>Default:&nbsp;&nbsp;<code>${lib.dir}/lsid_lib</code></td>
+    </tr>
+    <tr>
+      <td>lsid.classes.dir</td>
+      <td>The relative path to the location of Java classes that support LSID.</td>
+      <td>Default:&nbsp;&nbsp;<code>edu/ucsb/nceas/metacat/lsid</code></td>
+    </tr>
+    <tr>
+      <td>conf.dir</td>
+      <td>The name of the directory where LSID configuration files are located.</td>
+      <td>Default:&nbsp;&nbsp;<code>lib/lsid_conf</code></td>
+    </tr>
+    <tr>
+      <td>services.dir</td>
+      <td>The name of the directory where LSID services configuration files are located.</td>
+      <td>Default:&nbsp;&nbsp;<code>${conf.dir}/services</code></td>
+    </tr>
+    <tr>
+      <td>webinf.dir</td>
+      <td>The name of the directory where additional LSID web services files are located.</td>
+      <td>Default:&nbsp;&nbsp;<code>${conf.dir}/WEB-INF</code></td>
+    </tr>
+    <tr>
+      <td>compile.debug</td>
+      <td>Indicates whether Java source should be compiled with debug information.</td>
+      <td>Default:&nbsp;&nbsp;<code>true</code></td>
+    </tr>
+    <tr>
+      <td>compile.deprecation</td>
+      <td>Indicates whether Java source should be compiled with deprecation information.</td>
+      <td>Default:&nbsp;&nbsp;<code>false</code></td>
+    </tr>
+    <tr>
+      <td>compile.optimize</td>
+      <td>Indicates whether Java source should be compiled with optimization.</td>
+      <td>Default:&nbsp;&nbsp;<code>true</code></td>
+    </tr>
+    <tr>
+      <td>indexPaths</td>
+      <td>The <em>indexPaths</em> property specifies a comma-separated (potentially long) list 
+          of indexed paths that can be utilized to improve the
+          performance of metacat queries. Each component of the <em>indexPaths</em> property
+          should specify an absolute or relative path (using an XPath-like syntax) to an XML element or 
+          attribute present in the XML documents being queried. Metacat stores XML 
+          element and attribute values for indexed paths in a special database table 
+          that optimizes search performance.
+          <p>Metacat queries allow you to specify (using the &lt;pathexpr&gt; tag in search query) 
+          an exact path to which you want
+          to restrict the search. When the &lt;pathexpr&gt; path that is specified in the query
+          is a member of the <em>indexPaths</em> list, search results are returned faster 
+          because metacat can conduct its search using the optimized database table.
+          <p>
+          The default value for the <em>indexPaths</em> property contains numerous paths to EML
+          elements and attributes that are commonly queried by metacat search tools. 
+          For example, <em>keyword</em> is a
+          member of this list because it is common for search tools to query
+          the <em>keyword</em> field in EML documents. For most purposes, the default value will
+          optimize various types of searches on EML documents and need not be changed.
+          <p>
+          For more information about metacat queries, 
+          see <a href="./metacatquery.html">Queries and Results</a>.
+      </td>
+      <td>Default:&nbsp;&nbsp;<code>organizationName,originator/individualName/surName,...</code></td>
+    </tr>
+  </table>
+  <p>
+  Metacat has a number of additional settable properties in file
+  <code>lib/metacat.properties</code>. Under most circumstances,
+  you will not need to modify this file because the properties of interest
+  to you can be controlled by editing <code>build.properties</code> as
+  described above. To learn more about Metacat's additional properties,
+  see <a href="./properties.html">Metacat Properties File</a>.
+  </p>
+  <p class="emphasis">
+   Note: When setting properties, DO NOT add a trailing slash [/] to the end of any paths that are specified.
+   Metacat will not function correctly if you do so.
+  </p>
+
+</td>
+</tr>
+</table>
+
+<table class="tabledefault" width="100%">
+<td class="tablehead" colspan="2"><p><a name="Compilation and Installation"><h2>Compilation and Installation</h2></p></td>
+<tr>
+<td>
+  <a name="protocol"></a>
+  <p>This section is only for a fresh installation. If you are upgrading an existing Metacat, please skip
+  this section and go to the next one -  <a HREF="metacatinstall.html#Upgrade">Compilation and Upgrading Existing Metacat</a>
+  <p>    
+  <h3>Run Ant Build</h3></p>
+  <p>
+   Ant allows compilation and installation to be done in one step.
+   Change into the metacat directory and type: 
+   <pre><b>ant install</b></pre>
+   <p>
+   You should see a bunch of messages telling you the progress of compilation
+   and installation.  When it is done you should see the message 
+   BUILD SUCCESSFUL
+   and you should be returned to a UNIX command prompt.  If you do not see
+   the message BUILD SUCCESSFUL then there was an error that you need to 
+   resolve.
+   This may come up if you are logged in as a user that does not have write
+   access to one or more of the directories that are listed in the build.xml
+   file, or if any of the paths to files are not configured correctly in the
+   "config" target.
+  </p>
+  <p>
+  Note: The 'data' directories that are indicated in the 'datafilepath' and
+  'inlinedatafilepath' build properties must be writable
+  by user account under which Tomcat runs or you will not be able to upload 
+  data files to the system.
+  </p>
+
+  <p class="header">To install metacat LSID support, adjust the LSID-related
+    properties in the build.properties files and type:
+  <p class="header"><b>ant deploy-lsid</b>
+  <p>    
+  <h3>SQL Scripts</h3></p>
+  <p>
+   You now need to set up the table structure in your database.  You can 
+   do this either using the ant build system, or by manually running the
+   scripts using a sql utility.
+  </p>
+  <p><b>WARNING: Do NOT run this on an existing metacat installation as it
+  will delete all of your data.  If you have an existing metacat installation,
+  see the instructions for <a HREF="metacatinstall.html#Upgrade">"Compilation and Upgrading Existing Metacat"</a> below.</b></p>
+
+  <p>To run the scripts using ant, type
+   <pre><b>ant installdb</b></pre> 
+  </p>
+  <p>To run the scripts manually, change to the
+   metacat/build/src directory.  Then run you RDBMS's SQL utility.  In Oracle it is
+   SQLPlus.  This tutorial assumes an Oracle database so this example is for
+   SQLPlus.  Login as the oracle user that was set up for use with Metacat.
+   At the SQLPlus prompt type the following: <pre><b>@xmltables.sql;</b></pre>
+   For postgres, use a command like: 
+   <code>psql -U metacat -W -h localhost -f build/src/xmltables-postgres.sql metacat</code>
+  </p>
+  <p>Either way, 
+   you should see a bunch of output showing the creation of the Metacat table
+   space. The first time you run this script you will get several errors at the 
+   beginning saying that you cannot drop a table/index/trigger because it 
+   does not exist.  This is normal.  Any other errors besides this need to be
+   resolved before continuing. The script file name for PostgreSQL is 
+   xmltables-postgres.sql and for Microsoft SQL server is 
+   xmltables-sqlserver.sql.
+  </p>
+  <p>
+   If the script has run correctly you should be able to type 
+   <pre>describe xml_documents</pre> and it should show:
+   <pre>
+    Name            Null?         Type
+    --------------  ------------  ---------------- 
+     DOCID          NOT NULL      VARCHAR2(250)
+     ROOTNODEID                   NUMBER(20)
+     DOCNAME                      VARCHAR2(100)
+     DOCTYPE                      VARCHAR2(100)
+     DOCTITLE                     VARCHAR2(1000)
+     USER_OWNER                   VARCHAR2(100)
+     USER_UPDATED                 VARCHAR2(100)
+     SERVER_LOCATION              NUMBER(20)
+     REV                          NUMBER(10)
+     DATE_CREATED                 DATE
+     DATE_UPDATED                 DATE
+     PUBLIC_ACCESS                NUMBER(1)
+     UPDATED                      NUMBER(1)
+   </pre>
+  </p>
+  <p><h3>Register schemas and DTDs</h3></p>
+  <p>Once the tables have been created, you should also register the Ecological
+  Metadata Language (EML) DTDs and schemas. <b>However, note that you should 
+  NOT do this if you are upgrading an existing installation -- the upgrade
+  scripts take care of it for you (see the next section).</b>  If you are
+  installing new, you can register the schema documents by running:</p>
+  <pre><b>ant register-schemas</b></pre> 
+  <p>This command registers the EML DTDs' and schemas' location in the 
+  metacat server.  Your database username and password have to be set correctly
+  for this to work.  Also, if for some reason running this script from ant
+  does not work, you could instead try running "build/src/loaddtdschema.sql"
+  from your sql utility (but be sure to use the version in the 'build' directory
+  that has been customized for your installation).
+  </p>
+  <h3>Restart Tomcat</h3>
+  <p>
+   Once you have successfully installed Metacat, there is one more step.  Tomcat
+   (and Apache if you have Tomcat integrated with it) must be restarted.  To do
+   this, login as the user that runs your tomcat server (often "tomcat"),
+   go to $CATALINA_HOME/bin and type:
+   <pre>
+   <b>
+   ./shutdown.sh 
+   ./startup.sh
+   </b> 
+   </pre>
+   In the Tomcat startup messages you should see something in the log file like:
+   <pre>
+	Metacat: [WARN]: Metacat (1.8.1) initialized. [edu.ucsb.nceas.metacat.MetaCatServlet]
+   </pre>
+   If you see that message Tomcat is successfully loading the Metacat servlet.
+   Next, try to run your new servlet.  Go to a web browser and type:
+   <pre>http://yourserver.yourdomain.com/yourcontext/</pre>
+   You should substitute your context name for "yourcontext" in the url above.
+   If everything is working correctly, you should see a query page followed
+   by an empty result set.  Note that if you do not have Tomcat integrated with
+   Apache you will probably have to type
+   <pre>http://yourserver.yourdomain.com:8080/yourcontext/</pre>
+  </p>
+  <p><b>Troubleshooting</b>: If you see something like java.lang.InternalError: 
+  Can't connect to X11 window server using 'yourservanme:0.0' as the value of the DISPLAY variable.
+  <p>You should add this line: 
+  <b>JAVA_OPTS="-Djava.awt.headless=true $JAVA_OPTS"</b> at the first line of
+  catalina.sh file in tomcat bin directory. The reason is that GeoServer uses X11 windows to draw graphics.
+  </p>
+  
+  <h3>Deploy wsdl file (Only for EarthGrid-enabled Metacat installation) </h3>
+  <p>
+   Once Tomcat is running successfully, there is another step for EarthGrid-enabled Metacat installation. 
+   In metacat directory, type:
+   <pre><b>ant deploy-ecogrid</b></pre> 
+   It will generate wsdl files for EarthGrid services.
+   </p>
+
+</td>
+</tr>
+</table>
\ No newline at end of file

Property changes on: docs/user/metacatinstall-backup.html
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: build.xml
===================================================================
--- build.xml	(revision 4079)
+++ build.xml	(revision 4080)
@@ -34,12 +34,15 @@
   <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
 
   <!-- Determine which tomcat we are using and tomcat-specific settings -->
-  <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
+	 <!-- MCD HACK -->
+	<property name="jsdk" value="/usr/local/tomcat/common/lib/servlet-api.jar"/>
+  <!-- MCD BYE condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
     <equals arg1="${tomcatversion}" arg2="tomcat4" />
   </condition>
+
   <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
     <equals arg1="${tomcatversion}" arg2="tomcat5" />
-  </condition>
+  </condition -->
 	
   <!-- Determine if installed ecogrid -->
   <condition property="enable.ecogrid">
@@ -46,6 +49,8 @@
     <equals arg1="${install.ecogrid}" arg2="true" />
   </condition>
 
+  <!-- note, if you change a db driver or add a new database, you will need -->
+  <!-- to update upgrade_db_to_1_5.java -->
   <target name="check-db">
     <condition property="use-oracle">
       <equals arg1="${database}" arg2="oracle" />
@@ -153,7 +158,7 @@
    <target name="init" depends="config">
       <path id="compile.classpath">
         <pathelement location="${jsdk}"/>
-        <pathelement location="lib" />
+        <pathelement location="lib"/>
         <fileset dir="lib">
           <include name="*.jar"/>
         </fileset>
@@ -180,30 +185,16 @@
       
       <!-- It is less likely you'll need to make any changes from here down,
            but customization is possible -->
-      <property name="installdir"          value="${deploy.dir}/${metacat.context}" />
-      <property name="temp-dir"            value="/tmp/${metacat.context}" />
       <property name="name"                value="metacat"/>
       <property name="Name"                value="MetaCat"/>
       <property name="debugprefix"         value="${Name}:"/>
-      <property name="release"             value="1.8.1"/>
-      <property name="replication-path"    value="/${metacat.context}/servlet/replication"/>
-      <property name="harvester-registration-login-path" value="/${metacat.context}/harvesterRegistrationLogin"/>
-      <property name="harvester-registration-path"       value="/${metacat.context}/harvesterRegistration"/>
-      <property name="servlet-path"        value="/${metacat.context}/metacat"/>
-      <property name="html-path"           value="/${metacat.context}"/>
-      <property name="systemidserver"      value="${http.protocol}://${httpserver}"/>
+      <property name="release"             value="${metacat.version}"/>
       <property name="style-common-relpath" value="/style/common"/>
       <property name="style-shared-relpath" value="/style/shared"/>
+      <property name="schema-relpath" value="/schema"/>
       <property name="style-common-cvsrelpath" value="lib${style-common-relpath}"/>
-      <property name="style-common-fullpath" value="/${installdir}${style-common-relpath}"/>
-      <property name="templates.dir"       value="${style-common-fullpath}/templates"/>
-      <property name="style-common-path"   value="/${metacat.context}${style-common-relpath}"/>
-      <property name="style-shared-path"   value="/${metacat.context}${style-shared-relpath}"/>
+   	  <property name="schema-cvsrelpath" value="lib${schema-relpath}"/>
       <property name="style-skins-relpath" value="/style/skins"/>
-      <property name="style-skins-path"    value="/${metacat.context}${style-skins-relpath}"/>
-      <property name="replication-log"     value="${log.dir}/metacatreplication.log"/>
-      <property name="replicationerrorlog" value="${log.dir}/metacatreplication.err"/>
-      <property name="config-dir"          value="${deploy.dir}${style-skins-path}" />
       <property name="util-module"         value="utilities" />
       <property name="eml-module"          value="eml" />
       <property name="eml-version"         value="2.0.0beta6" />
@@ -220,6 +211,7 @@
                                            value="default.css"/>
    	  
       <!-- Config for registry variables -->
+      <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties --> 
       <property name="scope"               value="obfs"/>
       <property name="responseForm"        value="genericResponse.tmpl"/>
       <property name="entryForm"           value="entryForm.tmpl"/>
@@ -229,24 +221,7 @@
       <property name="deleteData"          value="deleteData.tmpl"/>
       <property name="genericHeader"       value="genericHeader.tmpl"/>
       <property name="genericFooter"       value="genericFooter.tmpl"/>
-      <property name="adminname"           value="KNB Support"/>
-      <property name="recipient"           value="knb-software\@nceas.ucsb.edu"/>
 
-      <property name="defaultStage"        value="initregister"/>
-      <property name="defaultHeader"       value="genericHeader.tmpl"/>
-      <property name="defaultFooter"       value="genericFooter.tmpl"/>
-      <property name="defaultChangePass"   value="ldapChangePass.tmpl"/>
-      <property name="defaultResetPass"    value="ldapResetPass.tmpl"/>
-      <property name="changePassSuccess"   value="ldapChangePassSuccess.tmpl"/>
-      <property name="resetPassSuccess"    value="ldapResetPassSuccess.tmpl"/>
-      <property name="registerFailed"      value="ldapRegisterFailed.tmpl"/>
-      <property name="registerLter"        value="ldapRegisterLter.tmpl"/>
-      <property name="registerMatch"       value="ldapRegisterMatch.tmpl"/>
-      <property name="registerSuccess"     value="ldapRegisterSuccess.tmpl"/>
-      <property name="register"            value="ldapRegister.tmpl"/>
-      <property name="searchResults"       value="searchResults.tmpl"/>
-   	  <property name="ldapMainServerFailure" value="ldapMainServerFailure.tmpl"/>
-
       <filter token="scope"                value="${scope}"/>
       <filter token="responseForm"         value="${responseForm}"/>
       <filter token="entryForm"            value="${entryForm}"/>
@@ -258,70 +233,26 @@
       <filter token="genericFooter"        value="${genericFooter}"/>
       <filter token="adminname"            value="${adminname}"/>
       <filter token="recipient"            value="${recipient}"/>
+   	  <filter token="metacatVersion"       value="${metacat.version}"/>
 
-      <filter token="ldapurl"              value="ldap.ecoinformatics.org"/>
-      <filter token="ldapSearchBase"       value="dc=ecoinformatics,dc=org"/>
-      <filter token="ldap_user"            value="cn=Manager,dc=ecoinformatics,dc=org"/>
-      <filter token="ldap_password"        value="ldap_password"/>
-      <filter token="mailhost"             value="localhost"/>
-      <filter token="sender"               value="knb-software\@nceas.ucsb.edu"/>
-      <filter token="cgiurl"               value="${cgi-prefix}/ldapweb.cgi"/>
-
       <filter token="docrooturl" value="./" />
-      <filter token="database" value="${database}" />
-      <filter token="jdbc-connect" value="${jdbc-connect}"/>
-      <filter token="dbDriver" value="${dbDriver}"/>
-      <filter token="dbAdapter" value="${dbAdapter}"/>
-      <filter token="install-dir" value="${installdir}"/>
-      <filter token="temp-dir" value="${temp-dir}"/>
-      <filter token="server" value="${server}"/>
-      <filter token="systemidserver" value="${systemidserver}"/>
-      <filter token="cgi-prefix" value="${cgi-prefix}"/>
-      <filter token="ldapUrl" value="${ldapUrl}"/>
-      <filter token="replication-log" value="${replication-log}"/>
-      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
-      <filter token="servlet-path" value="${servlet-path}"/>
-      <filter token="html-path" value="${html-path}"/>
-      <filter token="user" value="${user}"/>
-      <filter token="password" value="${password}"/>
       <filter token="mcuser" value="${mcuser}"/>
       <filter token="mcpassword" value="${mcpassword}"/>
       <filter token="mcanotheruser" value="${mcanotheruser}"/>
       <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
-      <filter token="knb-site-url" value="${knb-site-url}"/>
       <filter token="eml-css" value="${eml-css}"/>
       <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
-      <filter token="style-skins-path" value="${style-skins-path}"/>
       <filter token="style-common-relpath" value="${style-common-relpath}"/>
-      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
-      <filter token="style-common-path" value="${style-common-path}"/>
-      <filter token="style-shared-path" value="${style-shared-path}"/>
-      <filter token="templates.dir" value="${templates.dir}"/>
 
-      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
-      <filter token="style-path" value="${style-skins-path}"/>
-      <filter token="replication-path" value="${replication-path}"/>
-      <filter token="harvester-registration-login-path" value="${harvester-registration-login-path}"/>
-      <filter token="harvester-registration-path" value="${harvester-registration-path}"/>
-      <filter token="config-dir" value="${config-dir}"/>
-      <filter token="default-style" value="${default-style}"/>
       <filter token="eml-version" value="${eml-version}"/>
       <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}"/>
       <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}"/>
       <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}"/>
       <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
-      <filter token="context" value="${metacat.context}"/>
-   	  <filter token="httpserver" value="${httpserver}"/>
       <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
       <filter token="debuglevel" value="${debuglevel}" />
-      <filter token="datafilepath" value="${datafilepath}" />
-      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
       <filter token="defaultcontenttype" value="${defaultcontenttype}" />
       <filter token="debugprefix" value="${debugprefix}"/>
-      <filter token="administrators" value="${administrators}"/>
-      <filter token="moderators" value="${moderators}"/>
-      <filter token="allowedSubmitters" value="${allowedSubmitters}"/>
-      <filter token="deniedSubmitters" value="${deniedSubmitters}"/>
       <filter token="indexPaths" value="${indexPaths}"/>
 
       <filter token="defaultStage" value="${defaultStage}"/>
@@ -350,14 +281,15 @@
       
    	  <property name="srcdir" value="./src" />
    	  <property name="lib.dir" value="./lib" />
+   	  <property name="docdir" value="./docs" />
       <property name="testdir" value="./test" />
       <property name="testtorun" value="BuildIndexTest" />
       <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
       <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
+   	  <property name="dev.deploy.dir" value="${dev.tomcat.dir}/webapps" />
       <property name="build.dir" value="./build"/>
       <property name="build.src" value="${build.dir}/src"/>
       <property name="build.dest" value="${build.dir}/classes"/>
-      <property name="build.docs" value="${build.dir}/docs"/>
       <property name="build.samples" value="${build.dir}/samples"/>
       <property name="build.tests" value="${build.dir}/tests"/>
       <property name="build.tmp" value="${build.dir}/tmp"/>
@@ -609,6 +541,7 @@
 
    <target  name="copyxsl"
    description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
+
      <delete file="${style-common-cvsrelpath}/${eml-css}"/>
 
      <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
@@ -626,7 +559,7 @@
    </target>
 
 
-
+<!--
    <target name="register-schemas" depends="prepare"
    description="Registers the Schemas with a new Metacat instance">
      <echo/>
@@ -887,7 +820,16 @@
 
     </target>
 
+   <target name="dev-install" depends="clean, install-ecogrid" description="* Full Install For Development *">
+     <copy file="${dist.dir}/${metacat.context}.war" todir="${dev.deploy.dir}"/>
+   	 <delete dir="${dev.deploy.dir}/${metacat.context}" />
+   	   <tstamp>
+   	   	 <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa"/>
+   	   </tstamp>
+   	 <echo>Dev install completed at ${NOW}</echo> 	   	
+   </target>
 
+<!--
    <target name="install" depends="install-ecogrid" description="* Full Install *">
        <mkdir dir="${datafilepath}" />
        <mkdir dir="${inlinedatafilepath}" />
@@ -897,6 +839,7 @@
        <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
    	   <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
    </target>
+-->
 	
    <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
 			    description="Install Ecogrid Compentent">
@@ -927,11 +870,12 @@
 	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
    </target>
 	
-   	
+<!--   	
    <target name="upgrade" depends="install"
           description="* Upgrade an existing metacat installation with a new version *">
        <unwar src="${deploy.dir}/${metacat.context}.war" dest="${deploy.dir}/${metacat.context}" />
    </target>
+-->   
 	
    <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
    	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
@@ -944,17 +888,21 @@
    </target>
 	
    <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
-      <delete file="${deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
+      <delete file="${dev.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
    </target>
 
    <target name="install-registry" depends="init,getConversionXSL"
             description="Install Registry">
 
+      <mkdir dir="${inst.cgi.dir}" />
       <copy file="${srcdir}/perl/register-dataset.cgi"
-            todir="${inst.cgi.dir}" filtering="yes"/>
+            todir="${inst.cgi.dir}"/>
       <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
 
+      <!-- TODO SCW: set the permissions on this folder to be writable by the apache user -->
       <mkdir dir="${temp-dir}" />
+      <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
+                     used in readDocumentFromMetacat -->
       <copy todir="${temp-dir}" filtering="yes">
        <fileset dir="lib/style/common/emlb6toeml2">
          <include name="*.xsl"/>
@@ -965,30 +913,17 @@
       <echo message="Install Registry completed." />
    </target>
 
-   <target name="install-ldap" depends="init">
+   <target name="install-ldap" depends="init"
+            description="Install Metacat LDAP Access">
+
+      <mkdir dir="${inst.cgi.dir}" />
       <copy file="${srcdir}/perl/ldapweb.cgi"
-            todir="${inst.cgi.dir}" filtering="yes"/>
+            todir="${inst.cgi.dir}" />
       <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
-      <copy file="lib/ldapweb.cfg"
-            todir="${inst.cgi.dir}" filtering="yes"/>
-      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
       <mkdir dir="${templates.dir}" />
-      <copy todir="${templates.dir}" filtering="yes">
+      <copy todir="${templates.dir}">
         <fileset dir="lib/style/common/templates">
-            <include name="${defaultChangePass}"/>
-            <include name="${defaultResetPass}"/>
-            <include name="${changePassSuccess}"/>
-            <include name="${resetPassSuccess}"/>
-            <include name="${registerFailed}"/>
-            <include name="${registerLter}"/>
-            <include name="${registerMatch}"/>
-            <include name="${registerSuccess}"/>
-            <include name="${register}"/>
-            <include name="${searchResults}"/>
-            <include name="${defaultHeader}"/>
-            <include name="${defaultFooter}"/>
-            <include name="${responseForm}"/>
-        	<include name="${ldapMainServerFailure}"/>       	
+			<!-- SCW: Copy all files -->
         </fileset>
       </copy>
       <echo message="ldapweb install complete." />
@@ -1065,9 +1000,13 @@
        <property name="war.lib" value="${build.war}/lib" />
        <property name="war.webinf" value="${build.war}/WEB-INF" />
        <property name="war.context" value="${build.war}/${metacat.context}" />
+   	   <property name="war.context.sql" value="${war.context}/sql" />
+   	   <property name="war.context.docs" value="${war.context}/docs" />
        <mkdir dir="${war.lib}" />
        <mkdir dir="${war.webinf}" />
        <mkdir dir="${war.context}" />
+   	   <mkdir dir="${war.context.sql}" />
+   	   <mkdir dir="${war.context.docs}" />
        
        <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
        <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
@@ -1085,12 +1024,17 @@
            <include name="gwt*.jar"/>
          </fileset>
        </copy>
-       <copy file="lib/web.xml.${tomcatversion}"
-             tofile="${build.war}/web.xml" />
+       <!-- MCD copy file="lib/web.xml.${tomcatversion}"
+             tofile="${build.war}/web.xml" / -->
+       <!-- MCD added next - Remove the tomcat5 reference-->
+   	   <copy file="lib/web.xml.tomcat5"
+   	             tofile="${build.war}/web.xml"/>
        <copy file="lib/metacat.properties" todir="${war.webinf}"
              filtering="yes" />
-   	   <copy file="lib/metacat.properties.metadata" todir="${war.webinf}"
+   	   <copy file="lib/metacat.properties.metadata.xml" todir="${war.webinf}"
    	             filtering="no" />
+	   <copy file="lib/org.properties.metadata.xml" todir="${war.webinf}"
+	             filtering="no" />
        <copy todir="${war.webinf}" filtering="yes">
 	   	  <fileset dir="lib">
            <include name="skin.configs/**"/>
@@ -1110,7 +1054,7 @@
          <fileset dir="lib">
            <exclude name="*.jar"/>
            <exclude name="*.properties"/>
-         	<exclude name="*.metadata"/>
+         	<exclude name="*.metadata.xml"/>
            <exclude name="web.xml"/>
            <exclude name="**/*.jpg"/>
            <exclude name="**/*.png"/>
@@ -1123,6 +1067,16 @@
            <exclude name="spatial/WEB-INF/**"/>
          </fileset>
        </copy>
+   	   <copy todir="${war.context.docs}" filtering="yes">
+   	         <fileset dir="docs">
+   	           <include name="user/**"/>
+   	         </fileset>
+   	   </copy>
+	   <copy todir="${war.context.sql}" filtering="yes">
+	         <fileset dir="src">
+	           <include name="**/*.sql"/>
+	         </fileset>
+	   </copy>
    </target>
 
    <target name="warMSSQL" if="MSSQL" depends="warPrepare">
@@ -1270,7 +1224,7 @@
    </target>
 
    <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
-   <target name="nettest" depends="install"
+   <target name="nettest" depends="dev-install"
             description="compiles and runs the metacatnettest code">
 
       <echo>***********************************
@@ -1338,6 +1292,9 @@
            <include name="eml-*/*.xsl" />
            <include name="eml-*" />
          </fileset>
+       	 <fileset dir="${schema-cvsrelpath}">
+       	   <include name="eml-*/*.xsd" />
+       	 </fileset>
        </delete>
    </target>
 
@@ -1513,16 +1470,16 @@
     </path>
 
     <filterset id="configFilters">
-        <filter token="LSID_AUTHORITY_HOSTNAME"
-                value="${config.hostname}" />
-        <filter token="LSID_AUTHORITY_PORT"
-                value="${config.port}" />
-        <filter token="METADATA_LABELS"
-                value="${config.metadataLabelLsid}" />
-        <filter token="METACAT_SERVER"
-                value="${config.metacatserver}" />
-        <filter token="LSID_AUTHORITY_STRING"
-                value="${config.lsidauthority}" />
+        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
+                value="${config.hostname}" / -->
+        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
+                value="${config.port}" / -->
+        <!-- MCD BYE filter token="METADATA_LABELS"
+                value="${config.metadataLabelLsid}" / -->
+        <!-- MCD BYE filter token="METACAT_SERVER"
+                value="${config.metacatserver}" / -->
+        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
+                value="${config.lsidauthority}" / -->
     </filterset>
     
     <target name="prepare-lsid"
@@ -1612,10 +1569,10 @@
     <target name="deploy-lsid"
             depends="war-lsid"
             description="Deploy LSID war to servlet container">
-        <delete dir="${deploy.dir}/${authority.context}" />
-        <delete file="${deploy.dir}/${authority.context}.war" />
-        <mkdir dir="${deploy.dir}" />
-        <copy todir="${deploy.dir}">
+        <delete dir="${dev.deploy.dir}/${authority.context}" />
+        <delete file="${dev.deploy.dir}/${authority.context}.war" />
+        <mkdir dir="${dev.deploy.dir}" />
+        <copy todir="${dev.deploy.dir}">
             <fileset dir="${dist.dir}" />
         </copy>
     </target>
Index: docs/user/images/main-config.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: docs/user/images/main-config.png
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: docs/user/saxparser.html
===================================================================
--- docs/user/saxparser.html	(revision 4079)
+++ docs/user/saxparser.html	(revision 4080)
@@ -43,7 +43,6 @@
       DTDHandler dtdhandler     = new DBDTDHandler(conn);
 
       // Get an instance of the parser
-      MetacatUtil util = new MetacatUtil();
       // Get the class name of SAX driver from some XML parser like:
       // org.apache.xerces.parsers.SAXParser
       <span class="emphasis">String parserName = util.getOption("saxparser");</span>
