Index: lib/metacat.properties
===================================================================
--- lib/metacat.properties	(revision 6634)
+++ lib/metacat.properties	(revision 6635)
@@ -11,6 +11,7 @@
 configutil.skinsConfigured=false
 configutil.databaseConfigured=false
 configutil.geoserverConfigured=false
+configutil.dataoneConfigured=false
 
 ############### Server Values #################
 
@@ -498,7 +499,6 @@
 #dataone.coordinatingNodeBaseURL=https://cn-dev.dataone.org/cn
 dataone.memberNodeId=METACAT1
 dataone.subject=CN=METACAT1, DC=dataone, DC=org
-dataone.certpath=/etc/dataone/client/certs
 dataone.nodeName=My Metacat Node
 dataone.nodeType=mn
 dataone.nodeDescription=A DataONE member node implemented in Metacat.
Index: lib/admin/dataone-configuration.jsp
===================================================================
--- lib/admin/dataone-configuration.jsp	(nonexistent)
+++ lib/admin/dataone-configuration.jsp	(revision 6635)
@@ -0,0 +1,176 @@
+<%@ page language="java" %>
+<%@ page import="java.util.Set,java.util.Map,java.util.Vector,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
+ */
+%>
+
+<html>
+<head>
+
+<title>DataONE 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>
+<%@ include file="./header-section.jsp"%>
+
+<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
+<h2>DataONE Configuration</h2>
+
+<p>
+	Configure the Metacat as a DataONE Member Node.
+</p>
+<!-- BRL TODO add DataONE instructions and contact info -->
+<br clear="right"/>
+
+<%@ include file="page-message-section.jsp"%>
+
+<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
+                                        onsubmit="return submitForm(this);">
+
+	<h3>Member Node Configuration</h3>
+	<hr class="config-line">
+	
+	<div class="form-row">
+		<img class="question-mark" src="style/images/question-mark.gif" 
+			onClick="helpWindow('<%= request.getContextPath() %>','metacat-configure.html#dataone')"/>
+		<div class="textinput-label">
+			<label for="dataone.nodeName" title="Node Name">Node Name</label>
+		</div>
+		<input class="textinput" 
+			id="dataone.nodeName" 
+			name="dataone.nodeName" 	             		    	    	           		    	             			
+			value="<%= request.getAttribute("dataone.nodeName") %>"/> 
+	</div>
+	<div class="form-row">
+		<img class="question-mark" src="style/images/question-mark.gif" 
+			onClick="helpWindow('<%= request.getContextPath() %>','metacat-configure.html#dataone')"/>
+		<div class="textinput-label">
+			<label for="dataone.nodeDescription" title="Node Description">Node Description</label>
+		</div>
+		<input class="textinput" 
+			id="dataone.nodeDescription" 
+			name="dataone.nodeDescription" 	             		    	    	           		    	             			
+			value="<%= request.getAttribute("dataone.nodeDescription") %>"/> 
+	</div>
+	<div class="form-row">
+		<img class="question-mark" src="style/images/question-mark.gif" 
+			onClick="helpWindow('<%= request.getContextPath() %>','metacat-configure.html#dataone')"/>
+		<div class="textinput-label">
+			<label for="dataone.memberNodeId" title="Node Identifier">Node Identifier</label>
+		</div>
+		<input class="textinput" 
+			id="dataone.memberNodeId" 
+			name="dataone.memberNodeId" 	             		    	    	           		    	             			
+			value="<%= request.getAttribute("dataone.memberNodeId") %>"/> 
+	</div>
+	<div class="form-row">
+		<img class="question-mark" src="style/images/question-mark.gif" 
+			onClick="helpWindow('<%= request.getContextPath() %>','metacat-configure.html#dataone')"/>
+		<div class="textinput-label">
+			<label for="dataone.subject" title="Node Subject">Node Subject</label>
+		</div>
+		<input class="textinput" 
+			id="dataone.subject" 
+			name="dataone.subject" 	             		    	    	           		    	             			
+			value="<%= request.getAttribute("dataone.subject") %>"/> 
+	</div>
+	<div class="form-row">
+		<img class="question-mark" src="style/images/question-mark.gif" 
+			onClick="helpWindow('<%= request.getContextPath() %>','metacat-configure.html#dataone')"/>
+		<div class="textinput-label">
+			<label for="D1Client.certificate.file" title="Node Certificate Path">Node Certificate Path</label>
+		</div>
+		<input class="textinput" 
+			id="D1Client.certificate.file" 
+			name="D1Client.certificate.file" 	             		    	    	           		    	             			
+			value="<%= request.getAttribute("D1Client.certificate.file") %>"/> 
+	</div>
+	<hr class="config-line">
+	<div class="form-row">
+		<img class="question-mark" src="style/images/question-mark.gif" 
+			onClick="helpWindow('<%= request.getContextPath() %>','metacat-configure.html#dataone')"/>
+		<div class="textinput-label"><label for="dataone.nodeSynchronize" title="Synchronize">Synchronize</label></div>
+
+		<%
+		boolean synchronize = (Boolean) request.getAttribute("dataone.nodeSynchronize");
+		if (synchronize) { 
+		%>
+		<input type="checkbox" 
+				class="textinput" 
+				id="dataone.nodeSynchronize" 
+				name="dataone.nodeSynchronize" 	             		    	    	           		    	             			
+				value="true"
+				checked="checked"/>
+		<% } else {%>
+		<input type="checkbox" 
+				class="textinput" 
+				id="dataone.nodeSynchronize" 
+				name="dataone.nodeSynchronize" 	             		    	    	           		    	             			
+				value="true"/>
+		<% } %>
+
+	</div>
+	<div class="form-row">
+		<img class="question-mark" src="style/images/question-mark.gif" 
+			onClick="helpWindow('<%= request.getContextPath() %>','metacat-configure.html#dataone')"/>
+		<div class="textinput-label"><label for="dataone.nodeReplicate" title="Replicate">Replicate</label></div>
+
+		<%
+		boolean replicate = (Boolean) request.getAttribute("dataone.nodeReplicate");
+		if (replicate) { 
+		%>
+		<input type="checkbox" 
+				class="textinput" 
+				id="dataone.nodeReplicate" 
+				name="dataone.nodeReplicate" 	             		    	    	           		    	             			
+				value="true"
+				checked="checked"/>
+		<% } else {%>
+		<input type="checkbox" 
+				class="textinput" 
+				id="dataone.nodeReplicate" 
+				name="dataone.nodeReplicate" 	             		    	    	           		    	             			
+				value="true"/>
+		<% } %>
+
+	</div>
+
+	<input type="hidden" name="configureType" value="dataone"/>
+	<input type="hidden" name="processForm" value="true"/>
+	<input class=button type="submit" value="Update"/>
+	<input class=button type="button" value="Bypass" onClick="forward('./admin?configureType=dataone&bypass=true&processForm=true')">
+	<input class=button type="button" value="Cancel" onClick="forward('./admin')"> 
+
+</form>
+
+<%@ include file="./footer-section.jsp"%>
+
+</body>
+</html>

Property changes on: lib/admin/dataone-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/metacat-configuration.jsp
===================================================================
--- lib/admin/metacat-configuration.jsp	(revision 6634)
+++ lib/admin/metacat-configuration.jsp	(revision 6635)
@@ -37,6 +37,8 @@
     Boolean authConfigured = (Boolean)request.getAttribute("authConfigured");	
     Boolean skinsConfigured = (Boolean)request.getAttribute("skinsConfigured");	
     Boolean dbConfigured = (Boolean)request.getAttribute("dbConfigured");
+    Boolean replicationConfigured = (Boolean)request.getAttribute("replicationConfigured");
+    String dataoneConfigured = (String)request.getAttribute("dataoneConfigured");
     String geoserverConfigured = (String)request.getAttribute("geoserverConfigured");
     Boolean metacatConfigured = (Boolean)request.getAttribute("metacatConfigured");
     Boolean metacatServletInitialized = (Boolean)request.getAttribute("metcatServletInitialized");
@@ -200,6 +202,58 @@
 	}
 %>
 
+<%
+
+    if (dataoneConfigured != null && dataoneConfigured.equals(PropertyService.CONFIGURED)) {
+%>
+    	<tr>
+    	<td class="configured-tag">[configured] </td>
+    	<td class="property-title"> Dataone Configuration </td> 
+		<td class="configure-link"> <a href="<%= request.getContextPath() %>/admin?configureType=dataone">Reconfigure Now</a> </td>   		
+    	</tr>
+<%
+	} else if (dataoneConfigured != null && dataoneConfigured.equals(PropertyService.BYPASSED)){
+%>    		
+    	<tr>
+    	<td class="configured-tag">[bypassed] </td>  
+		<td class="property-title"> Dataone Configuration </td>  
+<%
+		if (propsConfigured != null && propsConfigured) {
+%>
+        	
+		<td class="configure-link"> <a href="<%= request.getContextPath() %>/admin?configureType=dataone">Reconfigure Now</a> </td>			       	
+<%
+		} else {
+%> 
+		<td class="configure-link"> Configure Global Properties First </td>
+<%
+		}
+			%>     	
+    	</tr>
+<%
+	} else {
+%>    		
+    	<tr>
+    	<td class="unconfigured-tag">[unconfigured] </td>  
+    	<td class="property-title"> Dataone Configuration </td>   
+<%
+		if (propsConfigured != null && propsConfigured) {
+%>
+        	
+		<td class="configure-link"> <a href="<%= request.getContextPath() %>/admin?configureType=dataone">Configure Now</a> </td>			
+        	
+<%
+		} else {
+%> 
+		<td class="configure-link"> Configure Global Properties First </td>
+<%
+		}
+%>     	
+    	</tr>
+<%
+	}
+%>
+
 </table>
 
 <%
Index: src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java	(revision 6634)
+++ src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java	(revision 6635)
@@ -263,9 +263,6 @@
 					logMetacat.error(errorString);
 					validationErrors.add(errorString);
 				}
-
-		        // Register as a DataONE Member Node
-				registerDataONEMemberNode();
 				
 				// write the backup properties to a location outside the 
 				// application directories so they will be available after
@@ -348,41 +345,5 @@
 		return errorVector;
 	}
 	
-	/**
-	 * Register as a member node on the DataONE network.  The node description is
-	 * retrieved from the getCapabilities() service, and so this should only be called
-	 * after the properties have been properly set up in Metacat.
-	 */
-	private void registerDataONEMemberNode() {
-        CNode cn;
-        try {
-            logMetacat.debug("Get the Node description.");
-            Node node = MNodeService.getInstance(null).getCapabilities();
-            logMetacat.debug("Setting client certificate location.");
-            String certificatePath = PropertyService.getProperty("dataone.certpath");
-            if (!certificatePath.endsWith(File.separator)) {
-                certificatePath = certificatePath + File.separator;
-            }
-            String mnCertificatePath = certificatePath + node.getIdentifier().getValue() + ".pem";
-            CertificateManager.getInstance().setCertificateLocation(mnCertificatePath);
-            cn = D1Client.getCN();
-            logMetacat.debug("Registering node with DataONE. " + cn.getNodeBaseServiceUrl());
-            // Session is null, because the libclient code automatically sets up an
-            // SSL session for us using the client certificate provided
-            Session session = null;
-            NodeReference mnode = cn.register(session, node);
-        } catch (ServiceFailure e) {
-            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
-        } catch (NotImplemented e) {
-            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
-        } catch (NotAuthorized e) {
-            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
-        } catch (InvalidRequest e) {
-            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
-        } catch (IdentifierNotUnique e) {
-            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
-        } catch (PropertyNotFoundException e) {
-            logMetacat.warn("Could not find the location for client certificates: " + e.getMessage());
-        }
-	}
+
 }
\ No newline at end of file
Index: src/edu/ucsb/nceas/metacat/admin/MetacatAdminServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/MetacatAdminServlet.java	(revision 6634)
+++ src/edu/ucsb/nceas/metacat/admin/MetacatAdminServlet.java	(revision 6635)
@@ -141,6 +141,8 @@
 			    request.setAttribute("metacatConfigured", new Boolean(ConfigurationUtil.isMetacatConfigured()));	
 			    request.setAttribute("geoserverConfigured", 
 			    		PropertyService.getProperty("configutil.geoserverConfigured"));
+			    request.setAttribute("dataoneConfigured", 
+			    		PropertyService.getProperty("configutil.dataoneConfigured"));
 			    request.setAttribute("metcatServletInitialized", MetaCatServlet.isFullyInitialized());
 			    if (PropertyService.arePropertiesConfigured()) {
 					request.setAttribute("databaseVersion", 
@@ -179,6 +181,10 @@
 				// process geoserver password change
 				GeoserverAdmin.getInstance().configureGeoserver(request, response);
 				return;
+			} else if (action.equals("dataone")) {
+				// process dataone config
+				D1Admin.getInstance().configureDataONE(request, response);
+				return;
 			} else {
 				String errorMessage = "MetacatAdminServlet.handleGetOrPost - Invalid action in configuration request: " + action;
 				logMetacat.error(errorMessage);
Index: src/edu/ucsb/nceas/metacat/admin/D1Admin.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/D1Admin.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/admin/D1Admin.java	(revision 6635)
@@ -0,0 +1,338 @@
+/**
+ *  '$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.io.File;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.dataone.client.CNode;
+import org.dataone.client.D1Client;
+import org.dataone.client.auth.CertificateManager;
+import org.dataone.service.exceptions.IdentifierNotUnique;
+import org.dataone.service.exceptions.InvalidRequest;
+import org.dataone.service.exceptions.NotAuthorized;
+import org.dataone.service.exceptions.NotFound;
+import org.dataone.service.exceptions.NotImplemented;
+import org.dataone.service.exceptions.ServiceFailure;
+import org.dataone.service.types.v1.Node;
+import org.dataone.service.types.v1.NodeList;
+import org.dataone.service.types.v1.NodeReference;
+import org.dataone.service.types.v1.Session;
+
+import edu.ucsb.nceas.metacat.dataone.MNodeService;
+import edu.ucsb.nceas.metacat.properties.PropertyService;
+import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
+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.PropertyNotFoundException;
+
+/**
+ * Control the display of the database configuration page and the processing
+ * of the configuration values.
+ */
+public class D1Admin extends MetacatAdmin {
+
+	private static D1Admin instance = null;
+	private Logger logMetacat = Logger.getLogger(D1Admin.class);
+
+	/**
+	 * private constructor since this is a singleton
+	 */
+	private D1Admin() throws AdminException {
+
+	}
+
+	/**
+	 * Get the single instance of D1Admin.
+	 * 
+	 * @return the single instance of D1Admin
+	 */
+	public static D1Admin getInstance() throws AdminException {
+		if (instance == null) {
+			instance = new D1Admin();
+		}
+		return instance;
+	}
+
+	/**
+	 * 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 configureDataONE(HttpServletRequest request,
+			HttpServletResponse response) throws AdminException {
+
+		String processForm = request.getParameter("processForm");
+		String bypass = request.getParameter("bypass");
+		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 {
+				
+				// get the current configuration values
+				String nodeName = PropertyService.getProperty("dataone.nodeName");
+				String nodeDescription = PropertyService.getProperty("dataone.nodeDescription");
+				String memberNodeId = PropertyService.getProperty("dataone.memberNodeId");
+				String nodeSynchronize = PropertyService.getProperty("dataone.nodeSynchronize");
+				String nodeReplicate = PropertyService.getProperty("dataone.nodeReplicate");
+				String subject = PropertyService.getProperty("dataone.subject");
+				String certpath = PropertyService.getProperty("D1Client.certificate.file");
+				
+				boolean synchronize = false;
+				if (nodeSynchronize != null) {
+					synchronize = Boolean.parseBoolean(nodeSynchronize);
+				}
+				boolean replicate = false;
+				if (nodeReplicate != null) {
+					replicate = Boolean.parseBoolean(nodeReplicate);
+				}
+				
+				request.setAttribute("dataone.nodeName", nodeName);
+				request.setAttribute("dataone.nodeDescription", nodeDescription);
+				request.setAttribute("dataone.memberNodeId", memberNodeId);
+				request.setAttribute("dataone.nodeSynchronize", synchronize);
+				request.setAttribute("dataone.nodeReplicate", replicate);
+				request.setAttribute("dataone.subject", subject);
+				request.setAttribute("D1Client.certificate.file", certpath);
+
+				// Forward the request to the JSP page
+				RequestUtil.forwardRequest(request, response, "/admin/dataone-configuration.jsp", null);
+			} catch (GeneralPropertyException gpe) {
+				throw new AdminException("D1Admin.configureDataONE - Problem getting or " + 
+						"setting property while initializing system properties page: " + gpe.getMessage());
+			} catch (MetacatUtilException mue) {
+				throw new AdminException("D1Admin.configureDataONE - utility problem while initializing "
+						+ "system properties page:" + mue.getMessage());
+			} 
+		} else if (bypass != null && bypass.equals("true")) {
+			Vector<String> processingErrors = new Vector<String>();
+			Vector<String> processingSuccess = new Vector<String>();
+			
+			// Bypass the D1 configuration. 
+			// This will keep Metacat running
+			try {
+				PropertyService.setProperty("configutil.dataoneConfigured", PropertyService.BYPASSED);
+				
+			} catch (GeneralPropertyException gpe) {
+				String errorMessage = "D1Admin.configureDataONE - Problem getting or setting property while "
+					+ "processing system properties page: " + gpe.getMessage();
+				logMetacat.error(errorMessage);
+				processingErrors.add(errorMessage);
+			}
+			try {
+				if (processingErrors.size() > 0) {
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestErrors(request, processingErrors);
+					RequestUtil.forwardRequest(request, response, "/admin", null);
+				} else {			
+					// Reload the main metacat configuration page
+					processingSuccess.add("DataONE configuration successfully bypassed");
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestSuccess(request, processingSuccess);
+					RequestUtil.forwardRequest(request, response, 
+							"/admin?configureType=configure&processForm=false", null);
+				}
+			} catch (MetacatUtilException mue) {
+				throw new AdminException("D1Admin.configureDataONE - utility problem while processing dataone page: "
+						+ mue.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> processingErrors = 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));
+				
+				String nodeName = (String)request.getParameter("dataone.nodeName");
+				String nodeDescription = (String)request.getParameter("dataone.nodeDescription");
+				String memberNodeId = (String)request.getParameter("dataone.memberNodeId");
+				String nodeSynchronize = (String)request.getParameter("dataone.nodeSynchronize");
+				String nodeReplicate = (String)request.getParameter("dataone.nodeReplicate");
+				String subject = (String)request.getParameter("dataone.subject");
+				String certpath = (String)request.getParameter("D1Client.certificate.file");
+				
+				boolean synchronize = false;
+				if (nodeSynchronize != null) {
+					synchronize = Boolean.parseBoolean(nodeSynchronize);
+				}
+				boolean replicate = false;
+				if (nodeReplicate != null) {
+					replicate = Boolean.parseBoolean(nodeReplicate);
+				}
+				
+				// process the values, checking for nulls etc..
+				if (nodeName == null ) {
+					validationErrors.add("nodeName cannot be null");
+				} else {
+					
+					PropertyService.setPropertyNoPersist("dataone.nodeName", nodeName);
+					PropertyService.setPropertyNoPersist("dataone.nodeDescription", nodeDescription);
+					PropertyService.setPropertyNoPersist("dataone.memberNodeId", memberNodeId);
+					PropertyService.setPropertyNoPersist("dataone.nodeSynchronize", Boolean.toString(synchronize));
+					PropertyService.setPropertyNoPersist("dataone.nodeReplicate", Boolean.toString(replicate));
+					PropertyService.setPropertyNoPersist("dataone.subject", subject);
+					PropertyService.setPropertyNoPersist("D1Client.certificate.file", certpath);
+					
+					PropertyService.persistProperties();
+
+					// write the backup properties to a location outside the
+					// application directories so they will be available after
+					// the next upgrade
+					PropertyService.persistMainBackupProperties();
+					
+			        // Register as a DataONE Member Node
+					if (replicate) {
+						registerDataONEMemberNode();
+					}
+				}
+			} catch (GeneralPropertyException gpe) {
+				String errorMessage = "D1Admin.configureDataONE - Problem getting or setting property while "
+						+ "processing system properties page: " + gpe.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", null);
+				} else {
+					// Now that the options have been set, change the
+					// 'dataoneConfigured' option to 'true'
+					PropertyService.setProperty("configutil.dataoneConfigured",
+							PropertyService.CONFIGURED);
+					
+					// Reload the main metacat configuration page
+					processingSuccess.add("DataONE successfully configured");
+					RequestUtil.clearRequestMessages(request);
+					RequestUtil.setRequestSuccess(request, processingSuccess);
+					RequestUtil.forwardRequest(request, response, 
+							"/admin?configureType=configure&processForm=false", null);
+				}
+			} catch (MetacatUtilException mue) {
+				throw new AdminException("D1Admin.configureDataONE - utility problem while processing geoservices "
+						+ "geoservices page: " + mue.getMessage());
+			} catch (GeneralPropertyException gpe) {
+				throw new AdminException("D1Admin.configureDataONE - problem with properties while "
+						+ "processing geoservices configuration page: " + gpe.getMessage());
+			}
+		}
+	}
+	
+	/**
+	 * Register as a member node on the DataONE network.  The node description is
+	 * retrieved from the getCapabilities() service, and so this should only be called
+	 * after the properties have been properly set up in Metacat.
+	 */
+	private void registerDataONEMemberNode() {
+        CNode cn;
+        try {
+            logMetacat.debug("Get the Node description.");
+            Node node = MNodeService.getInstance(null).getCapabilities();
+            logMetacat.debug("Setting client certificate location.");
+            String mnCertificatePath = PropertyService.getProperty("D1Client.certificate.file");
+            CertificateManager.getInstance().setCertificateLocation(mnCertificatePath);
+            cn = D1Client.getCN();
+            // check if this is new or an update
+            boolean update = false;
+            NodeList nodes = cn.listNodes();
+            for (Node n: nodes.getNodeList()) {
+            	if (n.getIdentifier().getValue().equals(node.getIdentifier().getValue())) {
+            		update = true;
+            		break;
+            	}
+            }
+            // Session is null, because the libclient code automatically sets up an
+            // SSL session for us using the client certificate provided
+            Session session = null;
+            if (update) {
+            	logMetacat.debug("Updating node with DataONE. " + cn.getNodeBaseServiceUrl());
+	            boolean result = cn.updateNodeCapabilities(session, node.getIdentifier(), node);
+            } else {
+	            logMetacat.debug("Registering node with DataONE. " + cn.getNodeBaseServiceUrl());
+	            NodeReference mnode = cn.register(session, node);
+            }
+        } catch (ServiceFailure e) {
+            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
+        } catch (NotFound e) {
+            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
+        } catch (NotImplemented e) {
+            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
+        } catch (NotAuthorized e) {
+            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
+        } catch (InvalidRequest e) {
+            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
+        } catch (IdentifierNotUnique e) {
+            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
+        } catch (PropertyNotFoundException e) {
+            logMetacat.warn("Could not find the location for client certificates: " + e.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;
+	}
+}

Property changes on: src/edu/ucsb/nceas/metacat/admin/D1Admin.java
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
