Project

General

Profile

« Previous | Next » 

Revision 6068

Added by rnahf about 13 years ago

generateMissingSystemMetadata was swallowing Exceptions instead of throwing. Refactored so that specific exceptions are thrown, affecting [create/update]SystemMetadata methods, too.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CrudService.java
255 255
     * @param token an authtoken with appropriate permissions to read all 
256 256
     * documents in the object store.  To work correctly, this should probably
257 257
     * be an adminstrative credential.
258
     * @throws SQLException 
259
     * @throws AccessionNumberException 
260
     * @throws NoSuchAlgorithmException 
261
     * @throws InvalidRequest 
262
     * @throws NotImplemented 
263
     * @throws NotFound 
264
     * @throws NotAuthorized 
265
     * @throws InvalidToken 
266
     * @throws PropertyNotFoundException 
267
     * @throws McdbDocNotFoundException 
268
     * @throws ServiceFailure 
258 269
     */
259
    public void generateMissingSystemMetadata(AuthToken token) {
270
    public void generateMissingSystemMetadata(AuthToken token) 
271
    throws ServiceFailure, McdbDocNotFoundException, PropertyNotFoundException, InvalidToken, NotAuthorized, 
272
    NotFound, NotImplemented, InvalidRequest, NoSuchAlgorithmException, AccessionNumberException, SQLException 
273
    {
260 274
        IdentifierManager im = IdentifierManager.getInstance();
261 275
        //get the list of ids with no SM
262 276
        List<String> idList = im.getLocalIdsWithNoSystemMetadata();
......
276 290
     *        documents in the object store.  To work correctly, this should
277 291
     *        be an adminstrative credential.
278 292
     * @param localId the identifier of the object to be processed
293
     * @throws ServiceFailure 
294
     * @throws SQLException 
295
     * @throws AccessionNumberException 
296
     * @throws NoSuchAlgorithmException 
297
     * @throws InvalidRequest 
298
     * @throws NotImplemented 
299
     * @throws NotFound 
300
     * @throws NotAuthorized 
301
     * @throws InvalidToken 
302
     * @throws PropertyNotFoundException 
303
     * @throws McdbDocNotFoundException 
279 304
     */
280
    public void generateMissingSystemMetadata(AuthToken token, String localId) {
281
        
282
        logCrud.debug("CrudService.generateMissingSystemMetadata() called.");
283
        
305
    public void generateMissingSystemMetadata(AuthToken token, String localId) 
306
    throws ServiceFailure, McdbDocNotFoundException, PropertyNotFoundException, InvalidToken, NotAuthorized,
307
    NotFound, NotImplemented, InvalidRequest, NoSuchAlgorithmException, AccessionNumberException, SQLException 
308
    {
309
    	logCrud.debug("CrudService.generateMissingSystemMetadata() called.");
284 310
        logCrud.debug("Creating SystemMetadata for localId " + localId);
311
        SystemMetadata sm = null;
312

  
313
        //generate required system metadata fields from the document
285 314
        try {
286
            //generate required system metadata fields from the document
287
            SystemMetadata sm = createSystemMetadata(localId, token);
288
            
289
            //insert the systemmetadata object
290
            SessionData sessionData = getSessionData(token);
291
            String smlocalid = insertSystemMetadata(sm, sessionData);
292
            logCrud.debug("setting access on SM doc with localid " + smlocalid);
293
            handler.setAccess(metacatUrl, sessionData.getUserName(), smlocalid, "public", "4", "allow", "allowFirst");
315
        	sm = createSystemMetadata(localId, token);
316
        } catch (IOException e1) {
317
        	e1.printStackTrace();
318
        	ServiceFailure sf = new ServiceFailure("00","IOException in generateMissingSystemMetadata: " +
319
        			e1.getMessage());
320
        	sf.setStackTrace(e1.getStackTrace());
321
        	throw sf;
322
        }
323
        
324
        //insert the systemmetadata object
325
        SessionData sessionData = getSessionData(token);
326
        String smlocalid = insertSystemMetadata(sm, sessionData);
327
        logCrud.debug("setting access on SM doc with localid " + smlocalid);
328
        try {
329
        	handler.setAccess(metacatUrl, sessionData.getUserName(), smlocalid, "public", "4", "allow", "allowFirst");
330
        } catch (Exception e) {
331
        	logCrud.debug("Unspecified exception thrown by MetacatHandler.setAccess(): " + e.getMessage());
332
        	logMetacat.error("Could not generate missing systemMetadata: " + e.getMessage());
333
        	logMetacat.error(e.getStackTrace());
334
        	ServiceFailure sf = new ServiceFailure("0","Unspecified exception thrown by MetacatHandler.setAccess(): " + e.getMessage());
335
        	sf.setStackTrace(e.getStackTrace());
336
        	throw sf;
337
        }
294 338

  
295
            String username = "public";
296
            if (sessionData != null) {
297
                username = sessionData.getUserName();
298
            }
299
            EventLog.getInstance().log(metacatUrl, username, localId, "generateMissingSystemMetadata");
300
        } catch (Exception e) { // TODO: Please don't catch Exception -- it masks bad things
301
            e.printStackTrace();
302
            logCrud.debug("Exception generating missing system metadata: " + e.getMessage());
303
            logMetacat.error("Could not generate missing system metadata: " + e.getMessage());
339
        String username = "public";
340
        if (sessionData != null) {
341
        	username = sessionData.getUserName();
304 342
        }
343
        EventLog.getInstance().log(metacatUrl, username, localId, "generateMissingSystemMetadata");
344

  
345
//        catch (Exception e) { // TODO: Please don't catch Exception -- it masks bad things
346
//            e.printStackTrace();
347
//            logCrud.debug("Exception generating missing system metadata: " + e.getMessage());
348
//            logMetacat.error("Could not generate missing system metadata: " + e.getMessage());
349
//        }
305 350
        logCrud.info("generateMissingSystemMetadata(token, localId)");
306 351
    }
307 352
    
......
426 471
            throws InvalidToken, ServiceFailure, NotAuthorized, IdentifierNotUnique, 
427 472
            UnsupportedType, InsufficientResources, NotFound, InvalidSystemMetadata, 
428 473
            NotImplemented {
429
        try
430
        {
431
            SessionData sessionData = getSessionData(token);
474
    	try
475
    	{
476
    		SessionData sessionData = getSessionData(token);
432 477
            
433 478
            //find the old systemmetadata (sm.old) document id (the one linked to obsoletedGuid)
434 479
            SystemMetadata sm = getSystemMetadata(token, obsoletedGuid);
......
469 514
                    ":D1SYSMETADATA:"+ sysMetaLocalId + ":");
470 515
            return guid;
471 516
        }
472
        catch(Exception e)
473
        {
517

  
518
    	catch(IOException e) {
474 519
            throw new ServiceFailure("1310", "Error updating document in CrudService: " + e.getMessage());
475 520
        }
521
    	catch( McdbDocNotFoundException e) {
522
    		throw new ServiceFailure("1310", "Error updating document in CrudService: " + e.getMessage());
523
    	}
524
    	catch( InvalidRequest e) {
525
    		throw new ServiceFailure("1310", "Error updating document in CrudService: " + e.getMessage());
526
    	}
476 527
    }
477 528
    
478 529
    /**
......
1650 1701
        }
1651 1702
        catch(Exception e)
1652 1703
        {
1653
            throw new ServiceFailure("1030", "Error updating system metadata: " + e.getMessage());
1704
            throw new ServiceFailure("1030", "Error updating system metadata: " + e.getClass() + ": " + e.getMessage());
1654 1705
        }
1655 1706
    }
1656 1707
    
......
1976 2027
     * @throws IOException 
1977 2028
     * @throws NoSuchAlgorithmException 
1978 2029
     * @throws PropertyNotFoundException 
2030
     * @throws NotImplemented 
2031
     * @throws NotFound 
2032
     * @throws NotAuthorized 
2033
     * @throws InvalidToken 
2034
     * @throws InvalidRequest 
2035
     * @throws NoSuchAlgorithmException 
1979 2036
     */
1980 2037
    private SystemMetadata createSystemMetadata(String localId, AuthToken token) 
1981
        throws McdbDocNotFoundException, NumberFormatException, AccessionNumberException, 
1982
        SQLException, NoSuchAlgorithmException, IOException, PropertyNotFoundException, BaseException {
1983
        
1984
        logCrud.debug("CrudService.createSystemMetadata() called.");
1985
        
1986
        IdentifierManager im = IdentifierManager.getInstance();
1987
        Hashtable<String, Object> docInfo = im.getDocumentInfo(localId);
2038
    throws McdbDocNotFoundException, PropertyNotFoundException, AccessionNumberException, SQLException,
2039
    ServiceFailure, InvalidToken, NotAuthorized, NotFound, NotImplemented, InvalidRequest,
2040
    IOException, NoSuchAlgorithmException
2041
    {     
2042
    	logCrud.debug("CrudService.createSystemMetadata() called.");
1988 2043

  
1989
        //get the document text
1990
        int rev = im.getLatestRevForLocalId(localId);
1991
        Identifier identifier = new Identifier();
1992
        try {
1993
            identifier.setValue(im.getGUID(localId, rev));
1994
            
1995
        } catch (McdbDocNotFoundException mcdbe) { 
1996
            //we're creating a new SM doc for a doc that is not in the identifier table                                       
1997
            //so we need to add it to
1998
            logCrud.debug("No guid in the identifier table.  adding it for " + localId);
1999
            im.createMapping(localId, localId);
2000
            logCrud.debug("Mapping created for " + localId);
2001
            AccessionNumber accNum = new AccessionNumber(localId, "NONE");
2002
            identifier.setValue(im.getGUID(accNum.getDocid(), rev));
2003
        }
2044
    	IdentifierManager im = IdentifierManager.getInstance();
2045
    	Hashtable<String, Object> docInfo = im.getDocumentInfo(localId);
2004 2046

  
2005
        logCrud.debug("Creating system metadata for guid " + identifier.getValue());
2006
        InputStream is = this.get(token, identifier);
2007
        SystemMetadata sm = new SystemMetadata();
2008
        
2009
        //set the id
2010
        sm.setIdentifier(identifier);
2047
    	//get the document text
2048
    	int rev = im.getLatestRevForLocalId(localId);
2049
    	Identifier identifier = new Identifier();
2050
    	try {
2051
    		identifier.setValue(im.getGUID(localId, rev));
2011 2052

  
2012
        //set the default object format
2013
        String doctype = (String) docInfo.get("doctype");
2014
        ObjectFormat format = ObjectFormat.convert(doctype);
2015
        if (format == null) {
2016
            if (doctype.trim().equals("BIN")) {
2017
                format = ObjectFormat.OCTET_STREAM;
2018
            } else {
2019
                format = ObjectFormat.convert("text/plain");
2020
            }
2021
        }
2022
        sm.setObjectFormat(format);
2023
        logCrud.debug("The ObjectFormat for " + localId + " is " + format.toString());
2024
        
2025
        // further parse EML documents to get data object format,
2026
        // describes and describedBy information
2027
        if ( format == ObjectFormat.EML_2_0_0 ||
2028
             format == ObjectFormat.EML_2_0_1 ||
2029
             format == ObjectFormat.EML_2_1_0 ) {
2030
          
2031
          try {
2032
            DataoneEMLParser emlParser = DataoneEMLParser.getInstance();
2033
            EMLDocument emlDocument = emlParser.parseDocument(is);
2034
            
2035
            // iterate through the data objects in the EML doc and add sysmeta
2036
           logCrud.debug("The number of data entities is: " +
2037
                         emlDocument.distributionMetadata.size());
2038
                            
2039
           for( int j = 0; j < emlDocument.distributionMetadata.size(); j++ ) {
2040
             
2041
             DistributionMetadata distMetadata = 
2042
               emlDocument.distributionMetadata.elementAt(j);
2043
             String dataDocUrl = distMetadata.url;
2044
             String dataDocMimeType = distMetadata.mimeType;
2045
             String dataDocLocalId = "";
2046
             logCrud.debug("\tData local ID: " + dataDocLocalId);
2047
             logCrud.debug("\tData URL: " + dataDocUrl);
2048
             logCrud.debug("\tData mime: " + dataDocMimeType);
2049
             
2050
             //we only handle ecogrid urls right now
2051
             if ( dataDocUrl.trim().startsWith("ecogrid://knb/") ) {
2052
               dataDocLocalId = 
2053
                 dataDocUrl.substring(dataDocUrl.indexOf("ecogrid://knb/") + 
2054
                 "ecogrid://knb/".length(), dataDocUrl.length());
2055
               
2056
               //set the id
2057
               Identifier dataDocId = new Identifier();
2058
               dataDocId.setValue(dataDocLocalId);
2059
               
2060
               // add describes into EML system metadata
2061
               sm.addDescribe(dataDocId);
2062
               
2063
               SystemMetadata dataSysMeta = new SystemMetadata();
2064
               // check if data system metadata exists
2065
               try {
2066
                 logCrud.debug("Checking for existing system metadata for " + dataDocId.getValue());
2067
                 dataSysMeta = this.getSystemMetadata(token, dataDocId);
2068
                 // add describedBy sysmeta
2069
                 logCrud.debug("Setting describedBy for " + dataDocId.getValue() +
2070
                                  " to " + identifier.getValue());
2071
                 dataSysMeta.addDescribedBy(identifier);
2072
                 dataSysMeta.setObjectFormat(ObjectFormat.convert(dataDocMimeType));
2073
                 this.updateSystemMetadata(dataSysMeta, getSessionData(token));
2074
                 
2075
               } catch ( NotFound nf ) {
2076
                 // System metadata for data doesn't exist
2077
                 logCrud.debug("There was not an existing system metadata " + "document for " + dataDocId.getValue());
2078
                 try {
2079
                   logCrud.debug("Creating a system metadata " + "document for " + dataDocId.getValue());
2080
                   dataSysMeta = this.createSystemMetadata(dataDocLocalId, token);
2081
                   
2082
                   logCrud.debug("Setting describedBy for " + dataDocId.getValue() + " to " + identifier.getValue());
2083
                   dataSysMeta.addDescribedBy(identifier);
2084
                   
2085
                   logCrud.debug("Setting mimeType for " + dataDocId.getValue() + " to " + dataDocMimeType);
2086
                   dataSysMeta.setObjectFormat(ObjectFormat.convert(dataDocMimeType));
2087
                   
2088
                   logCrud.debug("Updating system metadata for " + dataDocId.getValue() + " to " + dataDocMimeType);
2089
                   this.updateSystemMetadata(dataSysMeta, getSessionData(token));
2090
                   
2091
                 } catch ( McdbDocNotFoundException mdnf) {
2092
                   mdnf.printStackTrace();
2093
                   throw mdnf;
2094
                 } catch ( NumberFormatException nfe) {
2095
                   nfe.printStackTrace();
2096
                   throw nfe;
2097
                 } catch ( AccessionNumberException ane) {
2098
                   ane.printStackTrace();
2099
                   throw ane;
2100
                 } catch ( SQLException sqle) {
2101
                   sqle.printStackTrace();
2102
                   throw sqle;
2103
                 } catch ( NoSuchAlgorithmException nsae) {
2104
                   nsae.printStackTrace();
2105
                   throw nsae;
2106
                 } catch ( IOException ioe) {
2107
                   ioe.printStackTrace();
2108
                   throw ioe;
2109
                 } catch ( PropertyNotFoundException pnfe) {
2110
                   pnfe.printStackTrace();
2111
                   throw pnfe;
2112
                 } catch ( BaseException be) {
2113
                   be.printStackTrace();
2114
                   throw be;
2115
                   
2116
                 }
2117
                 
2118
               }
2119
               
2120
             } // end if()
2121
             
2122
           } // end for()
2123
           
2124
          } catch ( ParserConfigurationException pce ) {
2125
            logCrud.debug("There was a problem parsing the EML document. " +
2126
                             "The error message was: " + pce.getMessage());
2127
          
2128
          } catch ( SAXException saxe ) {
2129
            logCrud.debug("There was a problem traversing the EML document. " +
2130
                             "The error message was: " + saxe.getMessage());
2131
          
2132
          } catch ( XPathExpressionException xpee ) {
2133
            logCrud.debug("There was a problem searching the EML document. " +
2134
                             "The error message was: " + xpee.getMessage());
2135
          } // end try
2136
           
2137
        } // end if()
2138
        
2139
        //create the checksum
2140
        is = this.get(token, identifier);
2141
        String checksumS = checksum(is);
2142
        ChecksumAlgorithm ca = ChecksumAlgorithm.convert("MD5");
2143
        Checksum checksum = new Checksum();
2144
        checksum.setValue(checksumS);
2145
        checksum.setAlgorithm(ca);
2146
        sm.setChecksum(checksum);
2053
    	} catch (McdbDocNotFoundException mcdbe) { 
2054
    		//we're creating a new SM doc for a doc that is not in the identifier table                                       
2055
    		//so we need to add it to
2056
    		logCrud.debug("No guid in the identifier table.  adding it for " + localId);
2057
    		im.createMapping(localId, localId);
2058
    		logCrud.debug("Mapping created for " + localId);
2059
    		AccessionNumber accNum = new AccessionNumber(localId, "NONE");
2060
    		identifier.setValue(im.getGUID(accNum.getDocid(), rev));
2061
    	}
2147 2062

  
2148
        //set the size
2149
        is = this.get(token, identifier);
2150
        sm.setSize(sizeOfStream(is));
2063
    	logCrud.debug("Creating system metadata for guid " + identifier.getValue());
2064
    	InputStream is = this.get(token, identifier);
2065
    	SystemMetadata sm = new SystemMetadata();
2151 2066

  
2152
        //submitter
2153
        Principal p = new Principal();
2154
        p.setValue((String) docInfo.get("user_owner"));
2155
        sm.setSubmitter(p);
2156
        sm.setRightsHolder(p);
2157
        try {
2158
            Date dateCreated = parseMetacatDate((String) docInfo.get("date_created"));
2159
            sm.setDateUploaded(dateCreated);
2160
            Date dateUpdated = parseMetacatDate((String) docInfo.get("date_updated"));
2161
            sm.setDateSysMetadataModified(dateUpdated);
2162
        } catch (Exception e) {
2163
            logCrud.debug("POSSIBLE ERROR: couldn't parse a date: " + e.getMessage());
2164
            Date dateCreated = new Date();
2165
            sm.setDateUploaded(dateCreated);
2166
            Date dateUpdated = new Date();
2167
            sm.setDateSysMetadataModified(dateUpdated);
2168
        }
2169
        NodeReference nr = new NodeReference();
2170
        nr.setValue(PropertyService.getProperty("dataone.memberNodeId"));
2171
        sm.setOriginMemberNode(nr);
2172
        sm.setAuthoritativeMemberNode(nr);
2173
        
2174
        // TODO: Need to set describes/describedBy
2175
        
2176
        return sm;
2067
    	//set the id
2068
    	sm.setIdentifier(identifier);
2069

  
2070
    	//set the default object format
2071
    	String doctype = (String) docInfo.get("doctype");
2072
    	ObjectFormat format = ObjectFormat.convert(doctype);
2073
    	if (format == null) {
2074
    		if (doctype.trim().equals("BIN")) {
2075
    			format = ObjectFormat.OCTET_STREAM;
2076
    		} else {
2077
    			format = ObjectFormat.convert("text/plain");
2078
    		}
2079
    	}
2080
    	sm.setObjectFormat(format);
2081
    	logCrud.debug("The ObjectFormat for " + localId + " is " + format.toString());
2082

  
2083
    	// further parse EML documents to get data object format,
2084
    	// describes and describedBy information
2085
    	if ( format == ObjectFormat.EML_2_0_0 ||
2086
    			format == ObjectFormat.EML_2_0_1 ||
2087
    			format == ObjectFormat.EML_2_1_0 ) {
2088

  
2089
    		try {
2090
    			DataoneEMLParser emlParser = DataoneEMLParser.getInstance();
2091
    			EMLDocument emlDocument = emlParser.parseDocument(is);
2092

  
2093
    			// iterate through the data objects in the EML doc and add sysmeta
2094
    			logCrud.debug("The number of data entities is: " +
2095
    					emlDocument.distributionMetadata.size());
2096

  
2097
    			for( int j = 0; j < emlDocument.distributionMetadata.size(); j++ ) {
2098

  
2099
    				DistributionMetadata distMetadata = 
2100
    					emlDocument.distributionMetadata.elementAt(j);
2101
    				String dataDocUrl = distMetadata.url;
2102
    				String dataDocMimeType = distMetadata.mimeType;
2103
    				String dataDocLocalId = "";
2104
    				logCrud.debug("\tData local ID: " + dataDocLocalId);
2105
    				logCrud.debug("\tData URL: " + dataDocUrl);
2106
    				logCrud.debug("\tData mime: " + dataDocMimeType);
2107

  
2108
    				//we only handle ecogrid urls right now
2109
    				if ( dataDocUrl.trim().startsWith("ecogrid://knb/") ) {
2110
    					dataDocLocalId = 
2111
    						dataDocUrl.substring(dataDocUrl.indexOf("ecogrid://knb/") + 
2112
    								"ecogrid://knb/".length(), dataDocUrl.length());
2113

  
2114
    					//set the id
2115
    					Identifier dataDocId = new Identifier();
2116
    					dataDocId.setValue(dataDocLocalId);
2117

  
2118
    					// add describes into EML system metadata
2119
    					sm.addDescribe(dataDocId);
2120

  
2121
    					SystemMetadata dataSysMeta = new SystemMetadata();
2122
    					// check if data system metadata exists
2123
    					try {
2124
    						logCrud.debug("Checking for existing system metadata for " + dataDocId.getValue());
2125
    						dataSysMeta = this.getSystemMetadata(token, dataDocId);
2126
    						// add describedBy sysmeta
2127
    						logCrud.debug("Setting describedBy for " + dataDocId.getValue() +
2128
    								" to " + identifier.getValue());
2129
    						dataSysMeta.addDescribedBy(identifier);
2130
    						dataSysMeta.setObjectFormat(ObjectFormat.convert(dataDocMimeType));
2131
    						this.updateSystemMetadata(dataSysMeta, getSessionData(token));
2132

  
2133
    					} catch ( NotFound nf ) {
2134
    						// System metadata for data doesn't exist
2135
    						logCrud.debug("There was not an existing system metadata " + "document for " + dataDocId.getValue());
2136
    						logCrud.debug("Creating a system metadata " + "document for " + dataDocId.getValue());
2137
    						dataSysMeta = this.createSystemMetadata(dataDocLocalId, token);
2138

  
2139
    						logCrud.debug("Setting describedBy for " + dataDocId.getValue() + " to " + identifier.getValue());
2140
    						dataSysMeta.addDescribedBy(identifier);
2141

  
2142
    						logCrud.debug("Setting mimeType for " + dataDocId.getValue() + " to " + dataDocMimeType);
2143
    						dataSysMeta.setObjectFormat(ObjectFormat.convert(dataDocMimeType));
2144

  
2145
    						logCrud.debug("Updating system metadata for " + dataDocId.getValue() + " to " + dataDocMimeType);
2146
    						this.updateSystemMetadata(dataSysMeta, getSessionData(token));
2147
    					}
2148
    				} // end if()
2149
    			} // end for()
2150

  
2151
    		} catch ( ParserConfigurationException pce ) {
2152
    			logCrud.debug("There was a problem parsing the EML document. " +
2153
    					"The error message was: " + pce.getMessage());
2154

  
2155
    		} catch ( SAXException saxe ) {
2156
    			logCrud.debug("There was a problem traversing the EML document. " +
2157
    					"The error message was: " + saxe.getMessage());
2158

  
2159
    		} catch ( XPathExpressionException xpee ) {
2160
    			logCrud.debug("There was a problem searching the EML document. " +
2161
    					"The error message was: " + xpee.getMessage());
2162
    		} // end try
2163

  
2164
    	} // end if()
2165

  
2166
    	//create the checksum
2167
    	is = this.get(token, identifier);
2168
    	String checksumS = checksum(is);
2169
    	ChecksumAlgorithm ca = ChecksumAlgorithm.convert("MD5");
2170
    	Checksum checksum = new Checksum();
2171
    	checksum.setValue(checksumS);
2172
    	checksum.setAlgorithm(ca);
2173
    	sm.setChecksum(checksum);
2174

  
2175
    	//set the size
2176
    	is = this.get(token, identifier);
2177
    	sm.setSize(sizeOfStream(is));
2178

  
2179
    	//submitter
2180
    	Principal p = new Principal();
2181
    	p.setValue((String) docInfo.get("user_owner"));
2182
    	sm.setSubmitter(p);
2183
    	sm.setRightsHolder(p);
2184
    	try {
2185
    		Date dateCreated = parseMetacatDate((String) docInfo.get("date_created"));
2186
    		sm.setDateUploaded(dateCreated);
2187
    		Date dateUpdated = parseMetacatDate((String) docInfo.get("date_updated"));
2188
    		sm.setDateSysMetadataModified(dateUpdated);
2189
    	} catch (Exception e) {
2190
    		logCrud.debug("POSSIBLE ERROR: couldn't parse a date: " + e.getMessage());
2191
    		Date dateCreated = new Date();
2192
    		sm.setDateUploaded(dateCreated);
2193
    		Date dateUpdated = new Date();
2194
    		sm.setDateSysMetadataModified(dateUpdated);
2195
    	}
2196
    	NodeReference nr = new NodeReference();
2197
    	nr.setValue(PropertyService.getProperty("dataone.memberNodeId"));
2198
    	sm.setOriginMemberNode(nr);
2199
    	sm.setAuthoritativeMemberNode(nr);
2200

  
2201
    	// TODO: Need to set describes/describedBy
2202

  
2203
    	return sm;
2177 2204
    }
2178 2205
    
2179 2206
    /**

Also available in: Unified diff