Project

General

Profile

« Previous | Next » 

Revision 5383

Added by berkley over 14 years ago

added EventLog statements to all public methods in CrudService in preparation for addin the getLogRecords() method

View differences:

src/edu/ucsb/nceas/metacat/dataone/CrudService.java
186 186
            SessionService sessionService = SessionService.getInstance();
187 187
            sessionService.registerSession(new SessionData(sessionid, username, new String[0], password, "CrudServiceLogin"));
188 188
            AuthToken token = new AuthToken(sessionid);
189
            EventLog.getInstance().log(metacatUrl,
190
                    username, null, "CrudService.authenticate");
189 191
            return token;
190 192
        }
191 193
        catch(Exception e)
......
231 233
                //insert the systemmetadata object
232 234
                SessionData sessionData = getSessionData(token);
233 235
                insertSystemMetadata(sm, sessionData);
236
                
237
                String username = sessionData.getUserName();
238
                EventLog.getInstance().log(metacatUrl,
239
                        username, localId, "CrudService.generateMissingSystemMetadata");
234 240
            }
235 241
            catch(Exception e)
236 242
            {
......
255 261
        SessionData sessionData = getSessionData(token);
256 262
        String username = sessionData.getUserName();
257 263
        String[] groups = sessionData.getGroupNames();
264
        String localId = null;
258 265

  
259 266
        if (username == null || username.equals("public"))
260 267
        {
......
284 291
            // CASE METADATA:
285 292
            try {
286 293
                this.insertDocument(object, guid, sessionData);
294
                localId = im.getLocalId(guid.getValue());
287 295
            } catch (IOException e) {
288 296
                String msg = "Could not create string from XML stream: " +
289 297
                    " " + e.getMessage();
290 298
                logMetacat.debug(msg);
291 299
                throw new ServiceFailure("1190", msg);
300
            } catch(Exception e) {
301
                String msg = "Unexpected error in CrudService.create: " + e.getMessage();
302
                logMetacat.debug(msg);
303
                throw new ServiceFailure("1190", msg);
292 304
            }
305
            
293 306

  
294 307
        } else {
295 308
            // DEFAULT CASE: DATA (needs to be checked and completed)
......
301 314
        insertSystemMetadata(sysmeta, sessionData);
302 315

  
303 316
        logMetacat.debug("Returning from CrudService.create()");
317
        EventLog.getInstance().log(metacatUrl,
318
                username, localId, "CrudService.create");
304 319
        return guid;
305 320
    }
306 321
    
......
342 357
                //update a data file, not xml
343 358
                insertDataObject(object, guid, sessionData);
344 359
            }
360
            
361
            IdentifierManager im = IdentifierManager.getInstance();
362
            String username = sessionData.getUserName();
363
            EventLog.getInstance().log(metacatUrl,
364
                    username, im.getLocalId(guid.getValue()), "CrudService.update");
345 365
            return guid;
346 366
        }
347 367
        catch(Exception e)
......
379 399
            }
380 400
            handler.setAccess(metacatUrl, sessionData.getUserName(), docid, 
381 401
                    principal, permNum, permissionType, permissionOrder);
402
            
403
            String username = sessionData.getUserName();
404
            EventLog.getInstance().log(metacatUrl,
405
                    username, im.getLocalId(id.getValue()), "CrudService.setAccess");
382 406
        }
383 407
        catch(Exception e)
384 408
        {
......
494 518
          e.printStackTrace();
495 519
          throw new ServiceFailure("1580", "Error retrieving ObjectList: " + e.getMessage());
496 520
      }
521
      String username = sessionData.getUserName();
522
      EventLog.getInstance().log(metacatUrl,
523
              username, null, "CrudService.listObjects");
497 524
      return ol;
498 525
    }
499 526
    
......
589 616
                    return "Completed";
590 617
                }
591 618
            };
619
            
620
            String username = sessionData.getUserName();
621
            EventLog.getInstance().log(metacatUrl,
622
                    username, im.getLocalId(guid.getValue()), "CrudService.get");
592 623
            return objectStream;
593 624

  
594 625
        } catch (McdbDocNotFoundException e) {
......
682 713
            
683 714
            // Deserialize the xml to create a SystemMetadata object
684 715
            SystemMetadata sysmeta = deserializeSystemMetadata(objectStream);
716
            String username = sessionData.getUserName();
717
            EventLog.getInstance().log(metacatUrl,
718
                    username, im.getLocalId(guid.getValue()), "CrudService.getSystemMetadata");
685 719
            return sysmeta;
686 720
            
687 721
        } catch (McdbDocNotFoundException e) {
......
856 890
    
857 891
                    logMetacat.debug("Logging the creation event.");
858 892
                    EventLog.getInstance().log(metacatUrl,
859
                            username, localId, "create");
893
                            username, localId, "CrudService.insertDataObject");
860 894
    
861 895
                    // Schedule replication for this data file
862 896
                    logMetacat.debug("Scheduling replication.");

Also available in: Unified diff