Index: src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java
===================================================================
--- src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java	(revision 6705)
+++ src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java	(revision 6706)
@@ -71,316 +71,370 @@
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 public class SystemMetadataFactory {
-	
-    private static Logger logMetacat = Logger.getLogger(SystemMetadataFactory.class);
-	
+
+	private static Logger logMetacat = Logger
+			.getLogger(SystemMetadataFactory.class);
+
 	/**
-     * Creates a system metadata object for insertion into metacat
-     *
-     * @param localId  The local document identifier
-     * @param user  The user submitting the system metadata document
-     * @param groups  The groups the user belongs to
-     *
-     * @return sysMeta  The system metadata object created
-     */
-    public static SystemMetadata createSystemMetadata(String localId) 
-      throws McdbException, McdbDocNotFoundException, SQLException, 
-      IOException, AccessionNumberException, ClassNotFoundException,
-      InsufficientKarmaException, ParseLSIDException, PropertyNotFoundException,
-      BaseException, NoSuchAlgorithmException, JiBXException
-    {
-      logMetacat.debug("MetacatHandler.createSystemMetadata() called.");
-      logMetacat.debug("provided localId: " + localId);
-      
-      // create system metadata for the document
-      SystemMetadata sysMeta = new SystemMetadata();
-      sysMeta.setSerialVersion(BigInteger.valueOf(1));
-      int rev = IdentifierManager.getInstance().getLatestRevForLocalId(localId);
-      AccessionNumber accNum = new AccessionNumber(localId, "NONE");
-      String guid = null;
-      try {
-    	  // get the guid if it exists
-    	  guid = IdentifierManager.getInstance().getGUID(accNum.getDocid(), rev);
-      } catch ( McdbDocNotFoundException dnfe ) {
-        // otherwise create the mapping
-        logMetacat.debug("There was a problem getting the guid from " +
-          "the given localId (docid and revision). The error message was: " + dnfe.getMessage());
-        logMetacat.debug("No guid in the identifier table.  adding it for " + localId);
-        IdentifierManager.getInstance().createMapping(localId, localId);
-        logMetacat.debug("Mapping created for " + localId);
-        logMetacat.debug("accessionNumber: " + accNum);
-  	  	guid = IdentifierManager.getInstance().getGUID(accNum.getDocid(), rev);
-      }
-      Identifier identifier = new Identifier();
-      identifier.setValue(guid);
-      
-      //set the id
-      sysMeta.setIdentifier(identifier);
-      
-      // get the data or metadata object
-      InputStream inputStream;
-      try {
-          inputStream = MetacatHandler.read(localId);
-      } catch ( ParseLSIDException ple ) {
-        logMetacat.debug("There was a problem parsing the LSID from " +
-          localId + ". The error message was: " + ple.getMessage());
-        throw ple;
-      
-      } catch ( PropertyNotFoundException pnfe ) {
-        logMetacat.debug("There was a problem finding a property. " +
-          "The error message was: " + pnfe.getMessage());
-        throw pnfe;
-        
-      } catch ( McdbException me ) {
-        logMetacat.debug("There was a Metacat problem. " +
-          "The error message was: " + me.getMessage());
-        throw me;
-        
-      } catch ( SQLException sqle ) {
-        logMetacat.debug("There was a SQL problem. " +
-          "The error message was: " + sqle.getMessage());
-        throw sqle;
-        
-      } catch ( ClassNotFoundException cnfe ) {
-        logMetacat.debug("There was a problem finding a class. " +
-          "The error message was: " + cnfe.getMessage());
-        throw cnfe;
-        
-      } catch ( IOException ioe ) {
-        logMetacat.debug("There was an I/O exception. " +
-          "The error message was: " + ioe.getMessage());
-        throw ioe;
-        
-      } // end try()
-      
-      // get additional docinfo
-      Hashtable<String, Object> docInfo = IdentifierManager.getInstance().getDocumentInfo(localId);
-      //set the default object format
-      String doctype = (String) docInfo.get("doctype");
-      ObjectFormatIdentifier fmtid = null;
-      
-      // set the object format, fall back to defaults
-      try {
-	      fmtid = ObjectFormatCache.getInstance().getFormat(doctype).getFormatId();
+	 * Creates a system metadata object for insertion into metacat
+	 * 
+	 * @param localId
+	 *            The local document identifier
+	 * @param user
+	 *            The user submitting the system metadata document
+	 * @param groups
+	 *            The groups the user belongs to
+	 * 
+	 * @return sysMeta The system metadata object created
+	 */
+	public static SystemMetadata createSystemMetadata(String localId)
+			throws McdbException, McdbDocNotFoundException, SQLException,
+			IOException, AccessionNumberException, ClassNotFoundException,
+			InsufficientKarmaException, ParseLSIDException,
+			PropertyNotFoundException, BaseException, NoSuchAlgorithmException,
+			JiBXException {
+		logMetacat.debug("MetacatHandler.createSystemMetadata() called.");
+		logMetacat.debug("provided localId: " + localId);
 
-      } catch (NotFound nfe) {
-        
-        try {
-        	// format is not registered, use default
-	        if (doctype.trim().equals("BIN")) {
-	        	fmtid = ObjectFormatCache.getInstance().getFormat(
-	        			"application/octet-stream").getFormatId();
-	        
-	        } else {
-	        	fmtid = ObjectFormatCache.getInstance().getFormat("text/plain").getFormatId();
-	        }
-        
-        } catch (NotFound nf) {
-          logMetacat.error("There was a problem getting the default format " +
-          	"from the ObjectFormatCache: " + nf.getMessage());
-          throw nf;
-        }
+		// create system metadata for the document
+		SystemMetadata sysMeta = new SystemMetadata();
+		sysMeta.setSerialVersion(BigInteger.valueOf(1));
+		int rev = IdentifierManager.getInstance().getLatestRevForLocalId(
+				localId);
+		AccessionNumber accNum = new AccessionNumber(localId, "NONE");
+		String guid = null;
+		try {
+			// get the guid if it exists
+			guid = IdentifierManager.getInstance().getGUID(accNum.getDocid(),
+					rev);
+		} catch (McdbDocNotFoundException dnfe) {
+			// otherwise create the mapping
+			logMetacat
+					.debug("There was a problem getting the guid from "
+							+ "the given localId (docid and revision). The error message was: "
+							+ dnfe.getMessage());
+			logMetacat.debug("No guid in the identifier table.  adding it for "
+					+ localId);
+			IdentifierManager.getInstance().createMapping(localId, localId);
+			logMetacat.debug("Mapping created for " + localId);
+			logMetacat.debug("accessionNumber: " + accNum);
+			guid = IdentifierManager.getInstance().getGUID(accNum.getDocid(),
+					rev);
+		}
+		Identifier identifier = new Identifier();
+		identifier.setValue(guid);
 
-      }
-      
-      sysMeta.setFormatId(fmtid);
-      logMetacat.debug("The ObjectFormat for " + localId + " is " + fmtid.getValue());
-      
-      // further parse EML documents to get data object format,
-      // describes and describedBy information
-      if ( fmtid == ObjectFormatCache.getInstance().getFormat("eml://ecoinformatics.org/eml-2.0.0").getFormatId() ||
-           fmtid == ObjectFormatCache.getInstance().getFormat("eml://ecoinformatics.org/eml-2.0.1").getFormatId() ||
-           fmtid == ObjectFormatCache.getInstance().getFormat("eml://ecoinformatics.org/eml-2.1.0").getFormatId() ||
-           fmtid == ObjectFormatCache.getInstance().getFormat("eml://ecoinformatics.org/eml-2.1.1").getFormatId() ) {
-        
-        try {
-        	
-        	DatabaseConnectionPoolInterface connectionPool = MetacatDatabaseConnectionPoolFactory.getDatabaseConnectionPoolInterface();
-        	DataManager dataManager = DataManager.getInstance(connectionPool, connectionPool.getDBAdapterName());
-        	DataPackage dataPackage = dataManager.parseMetadata(inputStream);
-          
-          // iterate through the data objects in the EML doc and add sysmeta
-          logMetacat.debug("In createSystemMetadata() the number of data " + 
-            "entities is: " + dataPackage.getEntityNumber());
-                          
-          // iterate through data objects described by the EML
-          for (int j = 0; j < dataPackage.getEntityList().length; j++) {
-            
-            	
-            String dataDocUrl = dataPackage.getEntityList()[j].getURL();
-            String dataDocMimeType = dataPackage.getEntityList()[j].getDataFormat();
-            // default to binary
-            if (dataDocMimeType == null) {
-                dataDocMimeType = 
-                	ObjectFormatCache.getInstance().getFormat("application/octet-stream").getFormatId().getValue();
-            }
-            String dataDocLocalId = "";
-            logMetacat.debug("Data local ID: " + dataDocLocalId);
-            logMetacat.debug("Data URL     : " + dataDocUrl);
-            logMetacat.debug("Data mime    : " + dataDocMimeType);
-            
-            //we only handle ecogrid urls right now
-            String ecogridPrefix = "ecogrid://knb/";
-            if ( dataDocUrl.trim().startsWith(ecogridPrefix) ) {
-              dataDocLocalId = 
-                dataDocUrl.substring(dataDocUrl.indexOf(ecogridPrefix) + ecogridPrefix.length());
-              
-              // look up the guid for the data
-              String dataDocid = DocumentUtil.getSmartDocId(dataDocLocalId);
-              int dataRev = DocumentUtil.getRevisionFromAccessionNumber(dataDocLocalId);
-              
-              SystemMetadata dataSysMeta = null;
-              // check if data system metadata exists
-              String dataGuidString = null;
-              try {
-            	  dataGuidString = IdentifierManager.getInstance().getGUID(dataDocid, dataRev);
-            	  dataSysMeta = IdentifierManager.getInstance().getSystemMetadata(dataGuidString);
-              } catch ( McdbDocNotFoundException nf ) {
-            	  // System metadata for data doesn't exist yet, so create it
-            	  logMetacat.debug("There was not an existing system metadata " + "document for " + dataDocLocalId);
-            	  try {
-            		  logMetacat.debug("Creating a system metadata " + "document for " + dataDocLocalId);
-            		  dataSysMeta = createSystemMetadata(dataDocLocalId);
-            		  
-            		  // now look it up again
-                	  dataGuidString = IdentifierManager.getInstance().getGUID(dataDocid, dataRev);
+		// set the id
+		sysMeta.setIdentifier(identifier);
 
-                	  //set the guid
-                      Identifier dataGuid = new Identifier();
-                      dataGuid.setValue(dataGuidString);
-                      
-                      // set object format
-                      logMetacat.debug("Updating system metadata for " + dataGuid.getValue() + " to " + dataDocMimeType);
-                      try {
-	                      ObjectFormatIdentifier fmt = 
-	                      ObjectFormatCache.getInstance().getFormat(dataDocMimeType).getFormatId();
-	                      dataSysMeta.setFormatId(fmt);
-                      
-                      } catch (NotFound nfe) {
-                      	logMetacat.debug("Couldn't find format identifier for: " +
-                      			dataDocMimeType + ". Setting it to application/octet-stream.");
-                        ObjectFormatIdentifier newFmtid = new ObjectFormatIdentifier();
-                        newFmtid.setValue("application/octet-stream");
-                      	
-                      }
-                  
-            		  // update the values
-                     HazelcastService.getInstance().getSystemMetadataMap().put(dataSysMeta.getIdentifier(), dataSysMeta);
-                  
-                } catch ( McdbDocNotFoundException mdnf) {
-                  mdnf.printStackTrace();
-                  throw mdnf;
-                } catch ( NumberFormatException nfe) {
-                  nfe.printStackTrace();
-                  throw nfe;
-                } catch ( AccessionNumberException ane) {
-                  ane.printStackTrace();
-                  throw ane;
-                } catch ( SQLException sqle) {
-                  sqle.printStackTrace();
-                  throw sqle;
-                } catch ( NoSuchAlgorithmException nsae) {
-                  nsae.printStackTrace();
-                  throw nsae;
-                } catch ( IOException ioe) {
-                  ioe.printStackTrace();
-                  throw ioe;
-                } catch ( PropertyNotFoundException pnfe) {
-                  pnfe.printStackTrace();
-                  throw pnfe;
-                } catch ( BaseException be) {
-                  be.printStackTrace();
-                  throw be;
-                }
-              }
-              
-            } // end if()
-            
-          } // end for()
-         
-        } catch ( ParserConfigurationException pce ) {
-          logMetacat.debug("There was a problem parsing the EML document. " +
-                           "The error message was: " + pce.getMessage());
-        
-        } catch ( SAXException saxe ) {
-          logMetacat.debug("There was a problem traversing the EML document. " +
-                           "The error message was: " + saxe.getMessage());
-        
-        } catch ( XPathExpressionException xpee ) {
-          logMetacat.debug("There was a problem searching the EML document. " +
-                           "The error message was: " + xpee.getMessage());
-        } catch ( Exception e ) {
-            logMetacat.debug("There was a problem creating System Metadata. " +
-                    "The error message was: " + e.getMessage());
-        } // end try()
-         
-      } // end if()
-      
-      
-      //create the checksum
-      inputStream = MetacatHandler.read(localId);
-      String algorithm = "MD5";
-      Checksum checksum = ChecksumUtil.checksum(inputStream, algorithm);
-      sysMeta.setChecksum(checksum);
-      
-      //set the size
-      inputStream = MetacatHandler.read(localId);
-      String sizeStr = new Long(sizeOfStream(inputStream)).toString();
-      sysMeta.setSize(new BigInteger(sizeStr));
-      
-      //submitter
-      Subject subject = new Subject();
-      subject.setValue((String) docInfo.get("user_owner"));
-      sysMeta.setSubmitter(subject);
-      sysMeta.setRightsHolder(subject);
+		// get the data or metadata object
+		InputStream inputStream;
+		try {
+			inputStream = MetacatHandler.read(localId);
+		} catch (ParseLSIDException ple) {
+			logMetacat.debug("There was a problem parsing the LSID from "
+					+ localId + ". The error message was: " + ple.getMessage());
+			throw ple;
 
-      try {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-DD");
-        dateFormat.setTimeZone(TimeZone.getDefault());
-        
-        Date dateCreated = dateFormat.parse((String) docInfo.get("date_created"));
-        sysMeta.setDateUploaded(dateCreated);
-        Date dateUpdated = dateFormat.parse((String) docInfo.get("date_updated"));
-        sysMeta.setDateSysMetadataModified(dateUpdated);
-      
-      } catch (ParseException pe) {
-        logMetacat.debug("There was a problem parsing a Metacat date. The " + 
-          "error message was: " + pe.getMessage());
-        Date dateCreated = new Date();
-        sysMeta.setDateUploaded(dateCreated);
-        Date dateUpdated = new Date();
-        sysMeta.setDateSysMetadataModified(dateUpdated);
-      
-      }
-      NodeReference nr = new NodeReference();
-      nr.setValue(PropertyService.getProperty("dataone.memberNodeId"));
-      sysMeta.setOriginMemberNode(nr);
-      sysMeta.setAuthoritativeMemberNode(nr);
-      
-      return sysMeta;
-    }
-    
-    /*
-     * Find the size (in bytes) of a stream. Note: This needs to refactored out
-     * of MetacatHandler and into a utility when stream i/o in Metacat is
-     * evaluated.
-     *
-     * @param is  The InputStream of bytes
-     * @return size  The size in bytes of the input stream as a long
-     * @throws IOException
-     */
-    private static long sizeOfStream(InputStream is)
-      throws IOException {
-      
-      long size = 0;
-      byte[] b = new byte[1024];
-      int numread = is.read(b, 0, 1024);
-      while(numread != -1)
-      {
-          size += numread;
-          numread = is.read(b, 0, 1024);
-      }
-      return size;
-      
-    }
+		} catch (PropertyNotFoundException pnfe) {
+			logMetacat.debug("There was a problem finding a property. "
+					+ "The error message was: " + pnfe.getMessage());
+			throw pnfe;
+
+		} catch (McdbException me) {
+			logMetacat.debug("There was a Metacat problem. "
+					+ "The error message was: " + me.getMessage());
+			throw me;
+
+		} catch (SQLException sqle) {
+			logMetacat.debug("There was a SQL problem. "
+					+ "The error message was: " + sqle.getMessage());
+			throw sqle;
+
+		} catch (ClassNotFoundException cnfe) {
+			logMetacat.debug("There was a problem finding a class. "
+					+ "The error message was: " + cnfe.getMessage());
+			throw cnfe;
+
+		} catch (IOException ioe) {
+			logMetacat.debug("There was an I/O exception. "
+					+ "The error message was: " + ioe.getMessage());
+			throw ioe;
+
+		} // end try()
+
+		// get additional docinfo
+		Hashtable<String, Object> docInfo = IdentifierManager.getInstance()
+				.getDocumentInfo(localId);
+		// set the default object format
+		String doctype = (String) docInfo.get("doctype");
+		ObjectFormatIdentifier fmtid = null;
+
+		// set the object format, fall back to defaults
+		try {
+			fmtid = ObjectFormatCache.getInstance().getFormat(doctype)
+					.getFormatId();
+
+		} catch (NotFound nfe) {
+
+			try {
+				// format is not registered, use default
+				if (doctype.trim().equals("BIN")) {
+					fmtid = ObjectFormatCache.getInstance().getFormat(
+							"application/octet-stream").getFormatId();
+
+				} else {
+					fmtid = ObjectFormatCache.getInstance().getFormat(
+							"text/plain").getFormatId();
+				}
+
+			} catch (NotFound nf) {
+				logMetacat
+						.error("There was a problem getting the default format "
+								+ "from the ObjectFormatCache: "
+								+ nf.getMessage());
+				throw nf;
+			}
+
+		}
+
+		sysMeta.setFormatId(fmtid);
+		logMetacat.debug("The ObjectFormat for " + localId + " is "
+				+ fmtid.getValue());
+
+		// further parse EML documents to get data object format,
+		// describes and describedBy information
+		if (fmtid == ObjectFormatCache.getInstance().getFormat(
+				"eml://ecoinformatics.org/eml-2.0.0").getFormatId()
+				|| fmtid == ObjectFormatCache.getInstance().getFormat(
+						"eml://ecoinformatics.org/eml-2.0.1").getFormatId()
+				|| fmtid == ObjectFormatCache.getInstance().getFormat(
+						"eml://ecoinformatics.org/eml-2.1.0").getFormatId()
+				|| fmtid == ObjectFormatCache.getInstance().getFormat(
+						"eml://ecoinformatics.org/eml-2.1.1").getFormatId()) {
+
+			try {
+
+				DatabaseConnectionPoolInterface connectionPool = MetacatDatabaseConnectionPoolFactory
+						.getDatabaseConnectionPoolInterface();
+				DataManager dataManager = DataManager.getInstance(
+						connectionPool, connectionPool.getDBAdapterName());
+				DataPackage dataPackage = dataManager
+						.parseMetadata(inputStream);
+
+				// iterate through the data objects in the EML doc and add
+				// sysmeta
+				logMetacat
+						.debug("In createSystemMetadata() the number of data "
+								+ "entities is: "
+								+ dataPackage.getEntityNumber());
+
+				// iterate through data objects described by the EML
+				for (int j = 0; j < dataPackage.getEntityList().length; j++) {
+
+					String dataDocUrl = dataPackage.getEntityList()[j].getURL();
+					String dataDocMimeType = dataPackage.getEntityList()[j]
+							.getDataFormat();
+					// default to binary
+					if (dataDocMimeType == null) {
+						dataDocMimeType = ObjectFormatCache.getInstance()
+								.getFormat("application/octet-stream")
+								.getFormatId().getValue();
+					}
+					String dataDocLocalId = "";
+					logMetacat.debug("Data local ID: " + dataDocLocalId);
+					logMetacat.debug("Data URL     : " + dataDocUrl);
+					logMetacat.debug("Data mime    : " + dataDocMimeType);
+
+					// we only handle ecogrid urls right now
+					String ecogridPrefix = "ecogrid://knb/";
+					if (dataDocUrl.trim().startsWith(ecogridPrefix)) {
+						dataDocLocalId = dataDocUrl.substring(dataDocUrl
+								.indexOf(ecogridPrefix)
+								+ ecogridPrefix.length());
+
+						// look up the guid for the data
+						String dataDocid = DocumentUtil
+								.getSmartDocId(dataDocLocalId);
+						int dataRev = DocumentUtil
+								.getRevisionFromAccessionNumber(dataDocLocalId);
+
+						SystemMetadata dataSysMeta = null;
+						// check if data system metadata exists
+						String dataGuidString = null;
+						try {
+							dataGuidString = IdentifierManager.getInstance()
+									.getGUID(dataDocid, dataRev);
+							dataSysMeta = IdentifierManager.getInstance()
+									.getSystemMetadata(dataGuidString);
+						} catch (McdbDocNotFoundException nf) {
+							// System metadata for data doesn't exist yet, so
+							// create it
+							logMetacat
+									.debug("There was not an existing system metadata "
+											+ "document for " + dataDocLocalId);
+							try {
+								logMetacat.debug("Creating a system metadata "
+										+ "document for " + dataDocLocalId);
+								dataSysMeta = createSystemMetadata(dataDocLocalId);
+
+								// now look it up again
+								dataGuidString = IdentifierManager
+										.getInstance().getGUID(dataDocid,
+												dataRev);
+
+								// set the guid
+								Identifier dataGuid = new Identifier();
+								dataGuid.setValue(dataGuidString);
+
+								// set object format
+								logMetacat
+										.debug("Updating system metadata for "
+												+ dataGuid.getValue() + " to "
+												+ dataDocMimeType);
+								try {
+									ObjectFormatIdentifier fmt = ObjectFormatCache
+											.getInstance().getFormat(
+													dataDocMimeType)
+											.getFormatId();
+									dataSysMeta.setFormatId(fmt);
+
+								} catch (NotFound nfe) {
+									logMetacat
+											.debug("Couldn't find format identifier for: "
+													+ dataDocMimeType
+													+ ". Setting it to application/octet-stream.");
+									ObjectFormatIdentifier newFmtid = new ObjectFormatIdentifier();
+									newFmtid
+											.setValue("application/octet-stream");
+
+								}
+
+								// update the values
+								HazelcastService.getInstance()
+										.getSystemMetadataMap().put(
+												dataSysMeta.getIdentifier(),
+												dataSysMeta);
+
+							} catch (McdbDocNotFoundException mdnf) {
+								mdnf.printStackTrace();
+								throw mdnf;
+							} catch (NumberFormatException nfe) {
+								nfe.printStackTrace();
+								throw nfe;
+							} catch (AccessionNumberException ane) {
+								ane.printStackTrace();
+								throw ane;
+							} catch (SQLException sqle) {
+								sqle.printStackTrace();
+								throw sqle;
+							} catch (NoSuchAlgorithmException nsae) {
+								nsae.printStackTrace();
+								throw nsae;
+							} catch (IOException ioe) {
+								ioe.printStackTrace();
+								throw ioe;
+							} catch (PropertyNotFoundException pnfe) {
+								pnfe.printStackTrace();
+								throw pnfe;
+							} catch (BaseException be) {
+								be.printStackTrace();
+								throw be;
+							}
+						}
+
+					} // end if()
+
+				} // end for()
+
+			} catch (ParserConfigurationException pce) {
+				logMetacat
+						.debug("There was a problem parsing the EML document. "
+								+ "The error message was: " + pce.getMessage());
+
+			} catch (SAXException saxe) {
+				logMetacat
+						.debug("There was a problem traversing the EML document. "
+								+ "The error message was: " + saxe.getMessage());
+
+			} catch (XPathExpressionException xpee) {
+				logMetacat
+						.debug("There was a problem searching the EML document. "
+								+ "The error message was: " + xpee.getMessage());
+			} catch (Exception e) {
+				logMetacat
+						.debug("There was a problem creating System Metadata. "
+								+ "The error message was: " + e.getMessage());
+			} // end try()
+
+		} // end if()
+
+		// create the checksum
+		inputStream = MetacatHandler.read(localId);
+		String algorithm = "MD5";
+		Checksum checksum = ChecksumUtil.checksum(inputStream, algorithm);
+		sysMeta.setChecksum(checksum);
+
+		// set the size
+		inputStream = MetacatHandler.read(localId);
+		String sizeStr = new Long(sizeOfStream(inputStream)).toString();
+		sysMeta.setSize(new BigInteger(sizeStr));
+
+		// submitter
+		Subject subject = new Subject();
+		subject.setValue((String) docInfo.get("user_owner"));
+		sysMeta.setSubmitter(subject);
+		sysMeta.setRightsHolder(subject);
+
+		try {
+			SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-DD");
+			dateFormat.setTimeZone(TimeZone.getDefault());
+
+			Date dateCreated = dateFormat.parse((String) docInfo
+					.get("date_created"));
+			sysMeta.setDateUploaded(dateCreated);
+			Date dateUpdated = dateFormat.parse((String) docInfo
+					.get("date_updated"));
+			sysMeta.setDateSysMetadataModified(dateUpdated);
+
+		} catch (ParseException pe) {
+			logMetacat.debug("There was a problem parsing a Metacat date. The "
+					+ "error message was: " + pe.getMessage());
+			Date dateCreated = new Date();
+			sysMeta.setDateUploaded(dateCreated);
+			Date dateUpdated = new Date();
+			sysMeta.setDateSysMetadataModified(dateUpdated);
+
+		}
+		NodeReference nr = new NodeReference();
+		nr.setValue(PropertyService.getProperty("dataone.memberNodeId"));
+		sysMeta.setOriginMemberNode(nr);
+		sysMeta.setAuthoritativeMemberNode(nr);
+
+		return sysMeta;
+	}
+
+	/*
+	 * Find the size (in bytes) of a stream. Note: This needs to refactored out
+	 * of MetacatHandler and into a utility when stream i/o in Metacat is
+	 * evaluated.
+	 * 
+	 * @param is The InputStream of bytes
+	 * 
+	 * @return size The size in bytes of the input stream as a long
+	 * 
+	 * @throws IOException
+	 */
+	private static long sizeOfStream(InputStream is) throws IOException {
+
+		long size = 0;
+		byte[] b = new byte[1024];
+		int numread = is.read(b, 0, 1024);
+		while (numread != -1) {
+			size += numread;
+			numread = is.read(b, 0, 1024);
+		}
+		return size;
+
+	}
 }
