Index: test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java
===================================================================
--- test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java	(revision 5373)
+++ test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java	(revision 5374)
@@ -137,7 +137,7 @@
             //the correct objects
             
             ObjectList list = cs.listObjects(token, null, null, null);
-            System.out.println("list size: " + list.sizeObjectInfoList());
+            //System.out.println("list size: " + list.sizeObjectInfoList());
 	        
             //should return sm1 and sm2
             ObjectList list1 = cs.listObjects(token, d1, d3, null);
Index: src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java	(revision 5374)
@@ -58,6 +58,7 @@
 import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
 import edu.ucsb.nceas.metacat.MetacatHandler;
 import edu.ucsb.nceas.metacat.dataone.CrudService;
+import edu.ucsb.nceas.metacat.service.SessionService;
 import edu.ucsb.nceas.metacat.util.RequestUtil;
 import edu.ucsb.nceas.metacat.util.SessionData;
 
@@ -203,6 +204,7 @@
     private static final String FUNCTION_NAME_GETNEXTOBJ = "getnextobject";
     private static final String FUNCTION_NAME_INSERT = "insert";
     private static final String FUNCTION_NAME_UPDATE = "update";
+    private static final String FUNCTION_NAME_GENERATE_MISSING_SYSTEM_METADATA = "generatemissingsystemmetadata";
 
     private ServletContext servletContext;
     private Logger logMetacat;
@@ -225,43 +227,6 @@
     }
 
     /**
-     *  copies request parameters to a hashtable which is given as argument to native metacathandler functions  
-     */
-    private void initParams() {
-
-        String name = null;
-        String[] value = null;
-        Enumeration paramlist = request.getParameterNames();
-        while (paramlist.hasMoreElements()) {
-            name = (String) paramlist.nextElement();
-            value = request.getParameterValues(name);
-            //System.out.println("adding param: " + name + " = " + value);
-            params.put(name, value);
-        }
-
-    }
-
-    /**
-     * 
-     * Load user details of metacat session from the request 
-     * 
-     */
-    private void loadSessionData() {
-        SessionData sessionData = RequestUtil.getSessionData(request);
-
-        // TODO: validate the session before allowing these values to be set
-        username = sessionData.getUserName();
-        password = sessionData.getPassword();
-        groupNames = sessionData.getGroupNames();
-        sessionId = sessionData.getId();
-        //System.out.println("setting sessionid to " + sessionId);
-        
-        if (username == null) {
-            username = "public";
-        }
-    }
-
-    /**
      * This function is called from REST APU servlet and handles each request to the servlet 
      * 
      * @param httpVerb (GET, POST, PUT or DELETE)
@@ -302,14 +267,25 @@
                             //System.out.println("done setting access");
                         }
                     } else if (resource.equals(RESOURCE_META)) {
-                        loadSessionData();
-                        String objectId = request.getPathInfo();
-                        if (objectId != null && objectId.length() > 1) 
+                        if(params.get(FUNCTION_KEYWORD)[0].equals(FUNCTION_NAME_GENERATE_MISSING_SYSTEM_METADATA))
+                        { //generate system metadata for any object that is
+                          //a) not system metadata itself
+                          //b) does not already have a system metadata id in the systemmetadata table
+                          //c) not a BIN object (data)
+                            generateMissingSystemMetadata();
+                            status = true;
+                        }
+                        else
                         {
-                            objectId = request.getPathInfo().substring(1);
+                            loadSessionData();
+                            String objectId = request.getPathInfo();
+                            if (objectId != null && objectId.length() > 1) 
+                            {
+                                objectId = request.getPathInfo().substring(1);
+                            }
+                            getSystemMetadataObject(objectId);
+                            status = true;
                         }
-                        getSystemMetadataObject(objectId);
-                        status = true;
                             
                     } else if (resource.equals(RESOURCE_OBJECTS)) {
                     logMetacat.debug("D1 Rest: Starting resource processing...");
@@ -383,9 +359,87 @@
             e.printStackTrace();
         }
     }
+    
+    /**
+     *  copies request parameters to a hashtable which is given as argument to native metacathandler functions  
+     */
+    private void initParams() {
 
+        String name = null;
+        String[] value = null;
+        Enumeration paramlist = request.getParameterNames();
+        while (paramlist.hasMoreElements()) {
+            name = (String) paramlist.nextElement();
+            value = request.getParameterValues(name);
+            //System.out.println("adding param: " + name + " = " + value);
+            params.put(name, value);
+        }
+
+    }
+
     /**
-     *  Earthgrid API > Identifier Service > isRegistered Function : calls MetacatHandler > handleIdIsRegisteredAction
+     * 
+     * Load user details of metacat session from the request 
+     * 
+     */
+    private void loadSessionData()
+      throws Exception
+    {
+        SessionData sessionData = RequestUtil.getSessionData(request);
+        try
+        {
+            username = null;
+            password = null;
+            groupNames = null;
+            sessionId = null;
+            
+            boolean validSession = false;
+            SessionService ss = SessionService.getInstance();
+            //validate the session
+            if(ss.isSessionRegistered(sessionData.getId()))
+            {
+                validSession = true;
+            }
+            
+            if(validSession)
+            {
+                //if the session is valid, set these variables
+                username = sessionData.getUserName();
+                password = sessionData.getPassword();
+                groupNames = sessionData.getGroupNames();
+                sessionId = sessionData.getId();
+                //System.out.println("setting sessionid to " + sessionId);
+            }
+            
+            //if the session is not valid or the username is null, set
+            //username to public
+            if (username == null) 
+            {
+                username = "public";
+            }
+        }
+        catch(Exception e)
+        {
+            throw new Exception("Could not load the session data: " + e.getMessage());
+        }
+    }
+    
+    /**
+     * generate missing system metadata for any science metadata objects
+     * that don't already have it. https://trac.dataone.org/ticket/591
+     */
+    private void generateMissingSystemMetadata()
+    {
+        //generate system metadata for any object that is
+        //a) not system metadata itself
+        //b) does not already have a system metadata id in the systemmetadata table
+        //c) not a BIN object (data)
+        
+    }
+
+    /**
+     *  Earthgrid API > Identifier Service > isRegistered Function : 
+     *  calls MetacatHandler > handleIdIsRegisteredAction
      * @param guid
      * @throws IOException
      */
@@ -408,7 +462,8 @@
     }
 
     /**
-     * Earthgrid API > Identifier Service > getAllDocIds Function : calls MetacatHandler > handleGetAllDocidsAction
+     * Earthgrid API > Identifier Service > getAllDocIds Function : 
+     * calls MetacatHandler > handleGetAllDocidsAction
      * @throws IOException
      */
     private void getAllDocIds() throws IOException {
@@ -418,7 +473,8 @@
     }
 
     /**
-     * Earthgrid API > Identifier Service > getNextRevision Function : calls MetacatHandler > handleGetRevisionAndDocTypeAction
+     * Earthgrid API > Identifier Service > getNextRevision Function : 
+     * calls MetacatHandler > handleGetRevisionAndDocTypeAction
      * @param guid
      * @throws IOException
      */
@@ -467,7 +523,8 @@
     }
 
     /**
-     * Earthgrid API > Identifier Service > getNextObject Function : calls MetacatHandler > handleGetMaxDocidAction
+     * Earthgrid API > Identifier Service > getNextObject Function : 
+     * calls MetacatHandler > handleGetMaxDocidAction
      * @throws IOException
      */
     private void getNextObject() throws IOException {
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 5374)
@@ -416,7 +416,7 @@
 			System.setProperty("replication.logfile.name", replicationLogPath);			
 			PropertyConfigurator.configureAndWatch(LOG_CONFIG_NAME);
 			
-			SessionService.unRegisterAllSessions();
+			SessionService.getInstance().unRegisterAllSessions();
 			
 	         //Initialize Metacat Handler
             handler = new MetacatHandler(timer);
@@ -632,7 +632,7 @@
 		// 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());
+		    SessionService.getInstance().touchSession(httpSession.getId());
 		}
 		
 		// Each time metacat is called, check to see if metacat has been 
@@ -788,7 +788,7 @@
 				if (idsToValidate != null) {
 					idToValidate = idsToValidate[0];
 				}
-				SessionService.validateSession(out, response, idToValidate);
+				SessionService.getInstance().validateSession(out, response, idToValidate);
 				out.close();
 
 				// handle shrink DBConnection request
Index: src/edu/ucsb/nceas/metacat/clientview/ClientViewHelper.java
===================================================================
--- src/edu/ucsb/nceas/metacat/clientview/ClientViewHelper.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/clientview/ClientViewHelper.java	(revision 5374)
@@ -334,9 +334,9 @@
         }
         
         boolean oldLoginValue = result.loggedIn;
-        result.setLoggedIn(SessionService.validateSession(sessionId));
+        result.setLoggedIn(SessionService.getInstance().validateSession(sessionId));
         if (result.isLoggedIn()) {
-        	SessionData sessionData = SessionService.getRegisteredSession(sessionId);
+        	SessionData sessionData = SessionService.getInstance().getRegisteredSession(sessionId);
         	result.setUserName(sessionData.getName());
         }
         
Index: src/edu/ucsb/nceas/metacat/PermissionController.java
===================================================================
--- src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 5374)
@@ -47,6 +47,7 @@
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.metacat.util.SessionData;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
+import edu.ucsb.nceas.metacat.shared.ServiceException;
 
 public class PermissionController
 {
@@ -97,10 +98,11 @@
    }
 
    public boolean hasPermission(String sessionId, String myPermission) throws SQLException {
-	   SessionData sessionData = SessionService.getRegisteredSession(sessionId);
-	   if (sessionData == null) {
-		   return false;
-	   }
+       SessionData sessionData = null;
+       sessionData = SessionService.getInstance().getRegisteredSession(sessionId);
+       if (sessionData == null) {
+           return false;
+       }
 	   
 	   return hasPermission(sessionData.getUserName(), sessionData.getGroupNames(), myPermission); 
    }
Index: src/edu/ucsb/nceas/metacat/MetacatHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetacatHandler.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/MetacatHandler.java	(revision 5374)
@@ -356,7 +356,7 @@
                     + " which has username" + session.getAttribute("username")
                     + " into hash in login method");
             try {
-                SessionService.registerSession(id, 
+                SessionService.getInstance().registerSession(id, 
                         (String) session.getAttribute("username"), 
                         (String[]) session.getAttribute("groupnames"), 
                         (String) session.getAttribute("password"), 
@@ -411,7 +411,7 @@
                     + sess.getAttribute("username")
                     + " will be invalidate in logout action");
             sess.invalidate();
-            SessionService.unRegisterSession(sess.getId());
+            SessionService.getInstance().unRegisterSession(sess.getId());
         }
         
         // produce output
Index: src/edu/ucsb/nceas/metacat/service/SessionService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/SessionService.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/service/SessionService.java	(revision 5374)
@@ -82,11 +82,20 @@
 	 * 
 	 * @return the single instance of SessionService
 	 */
-	public static SessionService getInstance() throws ServiceException {
-		if (sessionService == null) {
-			sessionService = new SessionService();
-		}
-		return sessionService;
+	public static SessionService getInstance() {
+	    try
+	    {
+	        if (sessionService == null) {
+	            sessionService = new SessionService();
+	        }
+	        return sessionService;
+	    }
+	    catch(ServiceException se)
+	    {
+	        logMetacat.error("SessionService.getInstance - could not get " +
+	                "an instance of SessionService: " + se.getMessage());
+	    }
+		return null;
 	}
 	
 	public boolean refreshable() {
@@ -114,7 +123,7 @@
 	 * @param password
 	 *            the password for the session
 	 */
-	public static void registerSession(String sessionId, String userName,
+	public void registerSession(String sessionId, String userName,
 			String[] groupNames, String password, String name) throws ServiceException {
 		synchronized(lockObj) {
 			if (sessionId == null) {
@@ -134,7 +143,7 @@
 	 * @param sessionData
 	 *            the session data object to add to the session hash
 	 */
-	public static void registerSession(SessionData sessionData) throws ServiceException {
+	public void registerSession(SessionData sessionData) throws ServiceException {
 		synchronized(lockObj) {
 			if (sessionData == null) {
 				throw new ServiceException("SessionService.registerSession - " + 
@@ -152,7 +161,7 @@
 	 * @param sessionId
 	 *            the id of the session to remove.
 	 */
-	public static void unRegisterSession(String sessionId) {
+	public void unRegisterSession(String sessionId) {
 		synchronized(lockObj) {
 			if (sessionId == null) {
 				logMetacat.error("SessionService.unRegisterSession - trying to " + 
@@ -170,7 +179,7 @@
 	 * @param sessionId
 	 *            the id of the session to remove.
 	 */
-	public static void unRegisterAllSessions() {
+	public void unRegisterAllSessions() {
 		synchronized(lockObj) {
 			Enumeration<String> keyEnum = sessionHash.keys();
 			while (keyEnum.hasMoreElements()) {
@@ -189,7 +198,7 @@
 	 * @param sessionId
 	 *            the id of the session to look for.
 	 */
-	public static boolean isSessionRegistered(String sessionId) {		
+	public boolean isSessionRegistered(String sessionId) {		
 		if (sessionId == null) {
 			logMetacat.error("SessionService.isSessionRegistered - trying to check if a " + 
 					"session with null id is registered");
@@ -210,7 +219,7 @@
 	 * @param sessionId
 	 *            the id of the session to look for.
 	 */
-	public static void validateSession(PrintWriter out, HttpServletResponse response, 
+	public void validateSession(PrintWriter out, HttpServletResponse response, 
 			String sessionId) {		
 		
 		response.setContentType("text/xml");
@@ -232,7 +241,7 @@
 	 * @param sessionId
 	 *            the id of the session to look for.
 	 */
-	public static boolean validateSession(String sessionId) {				
+	public boolean validateSession(String sessionId) {				
 		if (sessionId != null && !sessionId.equals(PUBLIC_SESSION_ID) && isSessionRegistered(sessionId)) {
 			return true;
 		} else {
@@ -247,7 +256,7 @@
 	 * @param sessionId
 	 *            the id of the session to retrieve.
 	 */
-	public static SessionData getRegisteredSession(String sessionId) {
+	public SessionData getRegisteredSession(String sessionId) {
 		if (sessionId == null) {
 			logMetacat.error("SessionService.getRegisteredSession - trying to get a session with null id");
 			return null;
@@ -260,7 +269,7 @@
 	/**
 	 * Get the public session from the session hash table. 
 	 */
-	public static SessionData getPublicSession() {
+	public SessionData getPublicSession() {
 		return sessionHash.get(PUBLIC_SESSION_ID);
 	}
 	
@@ -270,7 +279,7 @@
 	 * @param sessionId
 	 *            the id of the session to update.
 	 */
-	public static synchronized void touchSession(String sessionId) {
+	public synchronized void touchSession(String sessionId) {
 		if (sessionId == null) {
 			logMetacat.error("SessionService.touchSession - trying to touch a session with null id");
 		} else if (isSessionRegistered(sessionId)) {
@@ -281,7 +290,7 @@
 		}
 	}
 	
-	private static void checkTimeout (String sessionId) {
+	private void checkTimeout (String sessionId) {
 		SessionData sessionData = null;
 		if ((sessionData = sessionHash.get(sessionId)) != null) {
 			Calendar expireTime = Calendar.getInstance();
Index: src/edu/ucsb/nceas/metacat/util/AuthUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/AuthUtil.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/util/AuthUtil.java	(revision 5374)
@@ -198,7 +198,7 @@
 		String sessionId = session.getId();
 		
 		try {
-		SessionService.registerSession(sessionId, 
+		SessionService.getInstance().registerSession(sessionId, 
 				(String) session.getAttribute("username"), 
 				(String[]) session.getAttribute("groupnames"),
 				(String) session.getAttribute("password"),
@@ -223,9 +223,9 @@
 
 		try {
 
-			if (sessionId != null && SessionService.isSessionRegistered(sessionId)) {
+			if (sessionId != null && SessionService.getInstance().isSessionRegistered(sessionId)) {
 				// get the registered session data
-				sessionData = SessionService.getRegisteredSession(sessionId);
+				sessionData = SessionService.getInstance().getRegisteredSession(sessionId);
 
 				// get the timeout limit
 				String sessionTimeout = PropertyService.getProperty("auth.timeoutMinutes");
@@ -240,7 +240,7 @@
 				// 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);
+					SessionService.getInstance().unRegisterSession(sessionId);
 					return false;
 				}
 
@@ -301,7 +301,7 @@
 	 */
 	public static String[] getGroupNames(HttpServletRequest request) {
 		String sessionId = request.getSession().getId();;
-		SessionData sessionData = SessionService.getRegisteredSession(sessionId);
+		SessionData sessionData = SessionService.getInstance().getRegisteredSession(sessionId);
 		String[] groupNames = { "" };
 
 		if (sessionData != null) {
Index: src/edu/ucsb/nceas/metacat/util/RequestUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/RequestUtil.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/util/RequestUtil.java	(revision 5374)
@@ -297,14 +297,14 @@
 
 		// if the session id is registered in SessionService, get the
 		// SessionData for it. Otherwise, use the public session.
-		if (SessionService.isSessionRegistered(sessionId)) {
+		if (SessionService.getInstance().isSessionRegistered(sessionId)) {
 			logMetacat.debug("retrieving session data from session service "
 					+ "for session id " + sessionId);
-			sessionData = SessionService.getRegisteredSession(sessionId);
+			sessionData = SessionService.getInstance().getRegisteredSession(sessionId);
 		} else {
 			logMetacat.debug("using public session.  Given session id is "
 					+ "registered: " + sessionId);
-			sessionData = SessionService.getPublicSession();
+			sessionData = SessionService.getInstance().getPublicSession();
 		}
 		
 		return sessionData;
Index: src/edu/ucsb/nceas/metacat/util/DocumentUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/DocumentUtil.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/util/DocumentUtil.java	(revision 5374)
@@ -470,10 +470,10 @@
     	result += "<permission>" + permission + "</permission>";
     	result += "<sessionId>" + sessionId + "</sessionId>";
 
-    	if (!SessionService.isSessionRegistered(sessionId)) {
+    	if (!SessionService.getInstance().isSessionRegistered(sessionId)) {
     		message = "Session is not logged in";
     	} else {
-    		SessionData sessionData = SessionService.getRegisteredSession(sessionId);
+    		SessionData sessionData = SessionService.getInstance().getRegisteredSession(sessionId);
     		
     		String docId = null;
     		try {
Index: src/edu/ucsb/nceas/metacat/cart/CartManager.java
===================================================================
--- src/edu/ucsb/nceas/metacat/cart/CartManager.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/cart/CartManager.java	(revision 5374)
@@ -56,7 +56,7 @@
 	}
 	
 	private void init() {
-		documentCart = SessionService.getRegisteredSession(sessionId).getDocumentCart();
+		documentCart = SessionService.getInstance().getRegisteredSession(sessionId).getDocumentCart();
 		if (documentCart == null) {
 			documentCart = new DocumentCart();
 		}
@@ -95,7 +95,7 @@
 			}
 		}
 		
-		SessionService.getRegisteredSession(sessionId).setDocumentCart(documentCart);
+		SessionService.getInstance().getRegisteredSession(sessionId).setDocumentCart(documentCart);
 	}
 
 }
Index: src/edu/ucsb/nceas/metacat/dataone/CrudService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/dataone/CrudService.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/dataone/CrudService.java	(revision 5374)
@@ -696,10 +696,10 @@
         
         // if the session id is registered in SessionService, get the
         // SessionData for it. Otherwise, use the public session.
-        if (SessionService.isSessionRegistered(sessionId)) {
-            sessionData = SessionService.getRegisteredSession(sessionId);
+        if (SessionService.getInstance().isSessionRegistered(sessionId)) {
+            sessionData = SessionService.getInstance().getRegisteredSession(sessionId);
         } else {
-            sessionData = SessionService.getPublicSession();
+            sessionData = SessionService.getInstance().getPublicSession();
         }
         
         return sessionData;
Index: src/edu/ucsb/nceas/metacat/admin/MetacatAdminServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/admin/MetacatAdminServlet.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/admin/MetacatAdminServlet.java	(revision 5374)
@@ -100,7 +100,7 @@
 			// 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());
+				SessionService.getInstance().touchSession(httpSession.getId());
 			}
 			
 			if (!ConfigurationUtil.isBackupDirConfigured()) {
Index: src/edu/ucsb/nceas/metacat/replication/ReplicationServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/replication/ReplicationServlet.java	(revision 5373)
+++ src/edu/ucsb/nceas/metacat/replication/ReplicationServlet.java	(revision 5374)
@@ -126,9 +126,9 @@
 				if (params.containsKey("sessionid")) {
 					sess_id = ((String[]) params.get("sessionid"))[0];
 					logReplication.info("ReplicationServlet.handleGetOrPost - in has sessionid " + sess_id);
-					if (SessionService.isSessionRegistered(sess_id)) {
+					if (SessionService.getInstance().isSessionRegistered(sess_id)) {
 						logReplication.info("ReplicationServlet.handleGetOrPost - find the id " + sess_id + " in hash table");
-						sessionData = SessionService.getRegisteredSession(sess_id);
+						sessionData = SessionService.getInstance().getRegisteredSession(sess_id);
 					}
 				}
 				if (sessionData == null) {
