Index: src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/dataone/CNodeService.java	(revision 6567)
+++ src/edu/ucsb/nceas/metacat/dataone/CNodeService.java	(revision 6568)
@@ -256,48 +256,63 @@
     throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, 
     InvalidRequest, NotImplemented {
     
-    
-    // get the system metadata
-    String guid1 = pidOfSubject.getValue();
+    boolean asserted = false;
+        
     // are we allowed to do this?
     if (!isAuthorized(session, pidOfSubject, Permission.READ)) {
-      throw new NotAuthorized("4881", Permission.READ + " not allowed on " + guid1);  
+      throw new NotAuthorized("4881", Permission.READ + " not allowed on " + pidOfSubject.getValue());  
     }
     
     SystemMetadata systemMetadata = null;
     try {
-      systemMetadata = IdentifierManager.getInstance().getSystemMetadata(guid1);
-    } catch (McdbDocNotFoundException e) {
-      throw new NotFound("4884", "No record found for: " + guid1);
-    }
+        HazelcastService.getInstance().getSystemMetadataMap().lock(pidOfSubject);
+        systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pidOfSubject);
         
-    // check relationships
-    // TODO: use ORE map
-    if (relationship.equalsIgnoreCase("describes")) {
+        
+        // check relationships
+        // TODO: use ORE map
+        if (relationship.equalsIgnoreCase("describes")) {
+          
+        }
+        
+        if (relationship.equalsIgnoreCase("describedBy")) {
+          
+        }
+        
+        if (relationship.equalsIgnoreCase("derivedFrom")) {
+          
+        }
+        
+        if (relationship.equalsIgnoreCase("obsoletes")) {
+            Identifier pid = systemMetadata.getObsoletes();
+            if (pid.getValue().equals(pidOfObject.getValue())) {
+              asserted = true;
+            
+        }
+          //return systemMetadata.getObsoleteList().contains(pidOfObject);
+        }
+        if (relationship.equalsIgnoreCase("obsoletedBy")) {
+            Identifier pid = systemMetadata.getObsoletedBy();
+            if (pid.getValue().equals(pidOfObject.getValue())) {
+              asserted = true;
+            
+        }
+          //return systemMetadata.getObsoletedByList().contains(pidOfObject);
+        }
+        
+        HazelcastService.getInstance().getSystemMetadataMap().unlock(pidOfSubject);
       
-    }
-    if (relationship.equalsIgnoreCase("describedBy")) {
+    } catch (Exception e) {
+        throw new ServiceFailure("4270", "Could not assert relation for: " + 
+            pidOfSubject.getValue() +
+            ". The error message was: " + e.getMessage());
       
+    } finally {
+        HazelcastService.getInstance().getSystemMetadataMap().unlock(pidOfSubject);
+
     }
-    if (relationship.equalsIgnoreCase("derivedFrom")) {
-      
-    }
-    if (relationship.equalsIgnoreCase("obsoletes")) {
-      Identifier pid = systemMetadata.getObsoletes();
-      if (pid.getValue().equals(pidOfObject.getValue())) {
-        return true;
-      }
-      //return systemMetadata.getObsoleteList().contains(pidOfObject);
-    }
-    if (relationship.equalsIgnoreCase("obsoletedBy")) {
-      Identifier pid = systemMetadata.getObsoletedBy();
-      if (pid.getValue().equals(pidOfObject.getValue())) {
-        return true;
-      }
-      //return systemMetadata.getObsoletedByList().contains(pidOfObject);
-    }
-
-    return false;
+        
+    return asserted;
   }
   
   /**
@@ -319,17 +334,28 @@
   public Checksum getChecksum(Session session, Identifier pid)
     throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, 
     InvalidRequest, NotImplemented {
-    
+        
     if (!isAuthorized(session, pid, Permission.READ)) {
-      throw new NotAuthorized("1400", Permission.READ + " not allowed on " + pid.getValue());  
+        throw new NotAuthorized("1400", Permission.READ + " not allowed on " + pid.getValue());  
     }
+    
     SystemMetadata systemMetadata = null;
+    Checksum checksum = null;
+    
     try {
-      systemMetadata = IdentifierManager.getInstance().getSystemMetadata(pid.getValue());
-    } catch (McdbDocNotFoundException e) {
-      throw new NotFound("1420", "No record found for: " + pid.getValue());
+        HazelcastService.getInstance().getSystemMetadataMap().lock(pid);
+        systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
+        checksum = systemMetadata.getChecksum();
+        HazelcastService.getInstance().getSystemMetadataMap().unlock(pid);
+
+    } catch (Exception e) {
+        throw new ServiceFailure("1410", "An error occurred getting the checksum for " + 
+            pid.getValue() + ". The error message was: " + e.getMessage());
+      
+    } finally {
+        HazelcastService.getInstance().getSystemMetadataMap().unlock(pid);
+        
     }
-    Checksum checksum = systemMetadata.getChecksum();
     
     return checksum;
   }
@@ -539,31 +565,37 @@
         }
         
         // verify that guid == SystemMetadata.getIdentifier()
-        logMetacat.debug("Comparing guid|sysmeta_guid: " + guid.getValue() + "|" + sysmeta.getIdentifier().getValue());
+        logMetacat.debug("Comparing guid|sysmeta_guid: " + guid.getValue() + 
+            "|" + sysmeta.getIdentifier().getValue());
         if (!guid.getValue().equals(sysmeta.getIdentifier().getValue())) {
             throw new InvalidRequest("4863", 
-                "GUID in method call (" + guid.getValue() + ") does not match GUID in system metadata (" +
+                "The identifier in method call (" + guid.getValue() + 
+                ") does not match identifier in system metadata (" +
                 sysmeta.getIdentifier().getValue() + ").");
         }
 
         logMetacat.debug("Checking if identifier exists...");
         // Check that the identifier does not already exist
-        if (IdentifierManager.getInstance().identifierExists(guid.getValue())) {
+        if (HazelcastService.getInstance().getSystemMetadataMap().containsKey(guid)) {
             throw new InvalidRequest("4863", 
-                "GUID is already in use by an existing object.");
+                "The identifier is already in use by an existing object.");
       
         }
-
+        
         // insert the system metadata into the object store
         logMetacat.debug("Starting to insert SystemMetadata...");
-        sysmeta.setDateSysMetadataModified(new Date());
         try {
-          HazelcastService.getInstance().getSystemMetadataMap().lock(sysmeta.getIdentifier());
-          HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
-          HazelcastService.getInstance().getSystemMetadataMap().unlock(sysmeta.getIdentifier());
+            HazelcastService.getInstance().getSystemMetadataMap().lock(sysmeta.getIdentifier());
+            sysmeta.setSerialVersion(BigInteger.ONE);
+            sysmeta.setDateSysMetadataModified(Calendar.getInstance().getTime());
+            HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
+            HazelcastService.getInstance().getSystemMetadataMap().unlock(sysmeta.getIdentifier());
+            
         } catch (Exception e) {
         	logMetacat.error("Problem registering system metadata: " + guid.getValue(), e);
-            throw new ServiceFailure("4862", "Error inserting system metadata: " + e.getClass() + ": " + e.getMessage());
+            throw new ServiceFailure("4862", "Error inserting system metadata: " + 
+                e.getClass() + ": " + e.getMessage());
+            
         } finally {
           HazelcastService.getInstance().getSystemMetadataMap().unlock(sysmeta.getIdentifier());
 
@@ -823,23 +855,26 @@
 	    //lock, get, and unlock the pid
 	    HazelcastService.getInstance().getSystemMetadataMap().lock(pid);
 	    sysmeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
-	    HazelcastService.getInstance().getSystemMetadataMap().unlock(pid);
 	    List<Replica> replicaList = sysmeta.getReplicaList();
 	    
-        // find the replica with the status set to 'requested'
-        for (Replica replica : replicaList) {
-            ReplicationStatus status = replica.getReplicationStatus();
-            NodeReference listedNode = replica.getReplicaMemberNode();
-            if (listedNode.equals(targetNode)
-                    && status.equals(ReplicationStatus.REQUESTED)) {
-                isAllowed = true;
-                break;
+      // find the replica with the status set to 'requested'
+      for (Replica replica : replicaList) {
+          ReplicationStatus status = replica.getReplicationStatus();
+          NodeReference listedNode = replica.getReplicaMemberNode();
+          if (listedNode.equals(targetNode)
+                  && status.equals(ReplicationStatus.REQUESTED)) {
+              isAllowed = true;
+              break;
 
-            }
-        }
+          }
+      }
+      
+      HazelcastService.getInstance().getSystemMetadataMap().unlock(pid);
 
 	  } catch(Exception e) {
-	    // Catch Hazelcast RuntimeExceptions
+	      // Catch Hazelcast RuntimeExceptions
+	      throw new ServiceFailure("4872", 
+	          "Couldn't determine if node is allowed: " + e.getMessage());
 	    
 	  } finally {
 	    // always unlock the pid
