jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r720164 - /jackrabbit/sandbox/jackrabbit-journalwalker/src/main/java/org/apache/jackrabbit/journalwalker/JournalWalker.java
Date Mon, 24 Nov 2008 11:00:19 GMT
Author: dpfister
Date: Mon Nov 24 03:00:19 2008
New Revision: 720164

URL: http://svn.apache.org/viewvc?rev=720164&view=rev
Log:
Parent path was displayed instead of path to item itself
- add userid in output, where available

Modified:
    jackrabbit/sandbox/jackrabbit-journalwalker/src/main/java/org/apache/jackrabbit/journalwalker/JournalWalker.java

Modified: jackrabbit/sandbox/jackrabbit-journalwalker/src/main/java/org/apache/jackrabbit/journalwalker/JournalWalker.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-journalwalker/src/main/java/org/apache/jackrabbit/journalwalker/JournalWalker.java?rev=720164&r1=720163&r2=720164&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-journalwalker/src/main/java/org/apache/jackrabbit/journalwalker/JournalWalker.java
(original)
+++ jackrabbit/sandbox/jackrabbit-journalwalker/src/main/java/org/apache/jackrabbit/journalwalker/JournalWalker.java
Mon Nov 24 03:00:19 2008
@@ -153,10 +153,14 @@
      * @param workspace workspace name
      * @param id item id
      */
-    public void log(char op, String workspace, ItemId id) {
+    public void log(char op, String userId, String workspace, ItemId id) {
         StringBuffer buf = new StringBuffer();
         buf.append(op);
         buf.append("    ");
+        if (userId != null) {
+            buf.append(userId);
+            buf.append('@');
+        }
         buf.append(workspace != null ? workspace : "version");
         buf.append(':');
         buf.append(lookupPath(id));
@@ -212,6 +216,8 @@
      * {@inheritDoc}
      */
     public void process(ChangeLogRecord record) {
+        String userId = null;
+
         Iterator iter = record.getEvents().iterator();
         while (iter.hasNext()) {
             EventState event = (EventState) iter.next();
@@ -219,23 +225,26 @@
                     event.getParentPath(), event.getChildId(),
                     event.getChildRelPath(), event.getNodeType(),
                     event.getMixinNames(), event.getUserId());
+            if (userId == null) {
+                userId = event.getUserId();
+            }
         }
 
         ChangeLog changes = record.getChanges();
         iter = changes.deletedStates();
         while (iter.hasNext()) {
             ItemState state = (ItemState) iter.next();
-            log('D', record.getWorkspace(), state.getId());
+            log('D', userId, record.getWorkspace(), state.getId());
         }
         iter = changes.modifiedStates();
         while (iter.hasNext()) {
             ItemState state = (ItemState) iter.next();
-            log('U', record.getWorkspace(), state.getId());
+            log('U', userId, record.getWorkspace(), state.getId());
         }
         iter = changes.addedStates();
         while (iter.hasNext()) {
             ItemState state = (ItemState) iter.next();
-            log('A', record.getWorkspace(), state.getId());
+            log('A', userId, record.getWorkspace(), state.getId());
         }
     }
 
@@ -243,7 +252,8 @@
      * {@inheritDoc}
      */
     public void process(LockRecord record) {
-        log(record.isLock() ? 'L' : 'l', record.getWorkspace(), record.getNodeId());
+        log(record.isLock() ? 'L' : 'l', record.getUserId(),
+                record.getWorkspace(), record.getNodeId());
     }
 
     /**
@@ -420,7 +430,7 @@
         Path.Element[] result = new Path.Element[elements.length + 1];
         System.arraycopy(elements, 0, result, 0, elements.length);
         result[result.length - 1] = childRelPath;
-        return PathFactoryImpl.getInstance().create(elements);
+        return PathFactoryImpl.getInstance().create(result);
     }
 
     /**



Mime
View raw message