jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1358443 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/
Date Fri, 06 Jul 2012 21:59:34 GMT
Author: mduerig
Date: Fri Jul  6 21:59:34 2012
New Revision: 1358443

URL: http://svn.apache.org/viewvc?rev=1358443&view=rev
Log:
OAK-171: Add NodeState.compareAgainstBaseState()  
No need to keep track of the NodeStore in many diff implementations

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeExtractor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeExtractor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeExtractor.java?rev=1358443&r1=1358442&r2=1358443&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeExtractor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChangeExtractor.java
Fri Jul  6 21:59:34 2012
@@ -18,7 +18,6 @@
  */
 package org.apache.jackrabbit.oak.api;
 
-import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
 
 /**
@@ -32,15 +31,4 @@ public interface ChangeExtractor {
      * @param diff  {@code NodeStateDiff} to receive the changes
      */
     void getChanges(NodeStateDiff diff);
-
-    /**
-     * Compares the given two node states. Any found differences are
-     * reported by calling the relevant added, changed or deleted methods
-     * of the given handler.
-     *
-     * @param before node state before changes
-     * @param after node state after changes
-     * @param diff handler of node state differences
-     */
-    void getChanges(NodeState before, NodeState after, NodeStateDiff diff);
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1358443&r1=1358442&r2=1358443&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Fri Jul  6 21:59:34 2012
@@ -191,14 +191,9 @@ public class RootImpl implements Root {
             @Override
             public void getChanges(NodeStateDiff diff) {
                 NodeState head = observationLimit.get();
-                store.compare(baseLine, head, diff);
+                head.compareAgainstBaseState(baseLine, diff);
                 baseLine = head;
             }
-
-            @Override
-            public void getChanges(NodeState before, NodeState after, NodeStateDiff diff)
{
-                store.compare(before, after, diff);
-            }
         };
     }
 
@@ -271,19 +266,6 @@ public class RootImpl implements Root {
         }
     }
 
-    /**
-     * Compares the given two node states. Any found differences are
-     * reported by calling the relevant added, changed or deleted methods
-     * of the given handler.
-     *
-     * @param before node state before changes
-     * @param after node state after changes
-     * @param diffHandler handler of node state differences
-     */
-    public void compare(NodeState before, NodeState after, NodeStateDiff diffHandler) {
-        store.compare(before, after, diffHandler);
-    }
-
     //------------------------------------------------------------< private >---
 
     // TODO better way to determine purge limit
@@ -327,12 +309,12 @@ public class RootImpl implements Root {
         return child;
     }
 
-    private void merge(NodeState fromState, NodeState toState, final TreeImpl target,
+    private static void merge(NodeState fromState, NodeState toState, final TreeImpl target,
             final ConflictHandler conflictHandler) {
 
         assert target != null;
 
-        store.compare(fromState, toState, new NodeStateDiff() {
+        toState.compareAgainstBaseState(fromState, new NodeStateDiff() {
             @Override
             public void propertyAdded(PropertyState after) {
                 Resolution resolution;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1358443&r1=1358442&r2=1358443&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Fri Jul  6 21:59:34 2012
@@ -384,9 +384,9 @@ public class TreeImpl implements Tree, P
         }
     }
 
-    private boolean isSame(NodeState state1, NodeState state2) {
+    private static boolean isSame(NodeState state1, NodeState state2) {
         final boolean[] isDirty = {false};
-        root.compare(state1, state2, new NodeStateDiff() {
+        state2.compareAgainstBaseState(state1, new NodeStateDiff() {
             @Override
             public void propertyAdded(PropertyState after) {
                 isDirty[0] = true;

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java?rev=1358443&r1=1358442&r2=1358443&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
Fri Jul  6 21:59:34 2012
@@ -152,7 +152,7 @@ class ChangeProcessor extends TimerTask 
             if (!stopped && filterRef.get().includeChildren(jcrPath())) {
                 EventGeneratingNodeStateDiff diff = new EventGeneratingNodeStateDiff(
                         PathUtils.concat(path, name), events, after);
-                changeExtractor.getChanges(before, after, diff);
+                after.compareAgainstBaseState(before, diff);
                 if (events.size() > PURGE_LIMIT) {
                     diff.sendEvents();
                 }



Mime
View raw message