jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r760900 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/cluster/ main/java/org/apache/jackrabbit/core/observation/ main/java/org/apache/jackrabbit/core/state/ test/java/org/apache/jackrabbit/core/cluster/
Date Wed, 01 Apr 2009 14:27:57 GMT
Author: thomasm
Date: Wed Apr  1 14:27:56 2009
New Revision: 760900

URL: http://svn.apache.org/viewvc?rev=760900&view=rev
Log:
JCR-2031 Improved log message: include path

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java?rev=760900&r1=760899&r2=760900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
Wed Apr  1 14:27:56 2009
@@ -636,7 +636,7 @@
         /**
          * {@inheritDoc}
          */
-        public void updateCommitted(Update update) {
+        public void updateCommitted(Update update, String path) {
             if (status != STARTED) {
                 log.info("not started: update commit ignored.");
                 return;
@@ -650,7 +650,7 @@
             try {
                 record.update();
                 setRevision(record.getRevision());
-                log.debug("Appended revision: {}", new Long(record.getRevision()));
+                log.debug("revision {} {}", new Long(record.getRevision()), path);
             } catch (JournalException e) {
                 String msg = "Unable to commit log entry.";
                 log.error(msg, e);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java?rev=760900&r1=760899&r2=760900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java
Wed Apr  1 14:27:56 2009
@@ -39,8 +39,9 @@
      * Called when an a update operation has been committed.
      *
      * @param update update operation
+     * @param path the change path
      */
-    void updateCommitted(Update update);
+    void updateCommitted(Update update, String path);
 
     /**
      * Called when an a update operation has been cancelled.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java?rev=760900&r1=760899&r2=760900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
Wed Apr  1 14:27:56 2009
@@ -35,6 +35,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.jcr.NamespaceException;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.ObservationManager;
@@ -495,7 +496,7 @@
      * Return the session who is the origin of this events.
      * @return event source
      */
-    SessionImpl getSession() {
+    public SessionImpl getSession() {
         return session;
     }
 
@@ -619,4 +620,33 @@
         }
         return builder.getPath();
     }
+
+    /**
+     * Get the longest common path of all event state paths. 
+     * 
+     * @return the longest common path
+     */
+    public String getCommonPath() {
+        String common = null;
+        try {
+            for (int i = 0; i < events.size(); i++) {
+                EventState state = (EventState) events.get(i);
+                String s = session.getJCRPath(state.getParentPath());
+                if (common == null) {
+                    common = s;
+                } else if (!common.equals(s)) {
+                    while (!s.startsWith(common)) {
+                        int idx = s.lastIndexOf('/');
+                        if (idx < 0) {
+                            break;
+                        }
+                        common = s.substring(0, idx);
+                    }
+                }
+            }
+        } catch (NamespaceException e) {
+            // ignore
+        }
+        return common;
+    }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=760900&r1=760899&r2=760900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Wed Apr  1 14:27:56 2009
@@ -756,7 +756,8 @@
 
                 /* let listener know about finished operation */
                 if (eventChannel != null) {
-                    eventChannel.updateCommitted(this);
+                    String path = events.getSession().getUserID() + "@" + events.getCommonPath();
+                    eventChannel.updateCommitted(this, path);
                 }
 
             } catch (InterruptedException e) {
@@ -871,12 +872,12 @@
          */
         private void updateReferences() throws ItemStateException {
             // process added REFERENCE properties
-            for (Iterator i = local.addedStates(); i.hasNext(); ) {
+            for (Iterator i = local.addedStates(); i.hasNext();) {
                 addReferences((ItemState) i.next());
             }
 
             // process modified REFERENCE properties
-            for (Iterator i = local.modifiedStates(); i.hasNext(); ) {
+            for (Iterator i = local.modifiedStates(); i.hasNext();) {
                 ItemState state = (ItemState) i.next();
                 if (!state.isNode()) {
                     // remove old references from the target
@@ -887,7 +888,7 @@
             }
 
             // process removed REFERENCE properties
-            for (Iterator i = local.deletedStates(); i.hasNext(); ) {
+            for (Iterator i = local.deletedStates(); i.hasNext();) {
                 removeReferences((ItemState) i.next());
             }
         }
@@ -910,7 +911,7 @@
                 throws ItemStateException {
             NodeReferencesId refsId = new NodeReferencesId(uuid);
             if (virtualProvider == null
-                    || ! virtualProvider.hasNodeReferences(refsId)) {
+                    || !virtualProvider.hasNodeReferences(refsId)) {
                 // get or create the references instance
                 NodeReferences refs = local.get(refsId);
                 if (refs == null) {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java?rev=760900&r1=760899&r2=760900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java
Wed Apr  1 14:27:56 2009
@@ -107,7 +107,7 @@
         UpdateEventChannel channel = master.createUpdateChannel(DEFAULT_WORKSPACE);
         channel.updateCreated(update);
         channel.updatePrepared(update);
-        channel.updateCommitted(update);
+        channel.updateCommitted(update, null);
 
         SimpleEventListener listener = new SimpleEventListener();
         slave.createUpdateChannel(DEFAULT_WORKSPACE).setListener(listener);



Mime
View raw message