jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1341931 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
Date Wed, 23 May 2012 16:09:04 GMT
Author: jukka
Date: Wed May 23 16:09:04 2012
New Revision: 1341931

URL: http://svn.apache.org/viewvc?rev=1341931&view=rev
Log:
OAK-68: Extension point for commit validation

Fix equals() in ModifiedNodeState

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java?rev=1341931&r1=1341930&r2=1341931&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
Wed May 23 16:09:04 2012
@@ -20,15 +20,17 @@ import org.apache.commons.collections.It
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.collections.PredicateUtils;
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.spi.state.AbstractNodeState;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
-import org.apache.jackrabbit.oak.spi.state.ProxyNodeState;
 
 import java.util.Iterator;
 import java.util.Map;
 
-public class ModifiedNodeState extends ProxyNodeState {
+public class ModifiedNodeState extends AbstractNodeState {
+
+    private final NodeState base;
 
     private final Map<String, PropertyState> properties;
 
@@ -38,18 +40,18 @@ public class ModifiedNodeState extends P
             NodeState base,
             Map<String, PropertyState> properties,
             Map<String, NodeState> nodes) {
-        super(base);
+        this.base = base;
         this.properties = properties;
         this.nodes = nodes;
     }
 
     NodeState getBase() {
-        return delegate;
+        return base;
     }
 
     void diffAgainstBase(NodeStateDiff diff) {
         for (Map.Entry<String, PropertyState> entry : properties.entrySet()) {
-            PropertyState before = super.getProperty(entry.getKey());
+            PropertyState before = base.getProperty(entry.getKey());
             PropertyState after = entry.getValue();
             if (after == null) {
                 assert before != null;
@@ -63,7 +65,7 @@ public class ModifiedNodeState extends P
 
         for (Map.Entry<String, NodeState> entry : nodes.entrySet()) {
             String name = entry.getKey();
-            NodeState before = super.getChildNode(name);
+            NodeState before = base.getChildNode(name);
             NodeState after = entry.getValue();
             if (after == null) {
                 assert before != null;
@@ -83,15 +85,15 @@ public class ModifiedNodeState extends P
         if (properties.containsKey(name)) {
             return properties.get(name);
         } else {
-            return super.getProperty(name);
+            return base.getProperty(name);
         }
     }
 
     @Override
     public long getPropertyCount() {
-        long count = super.getPropertyCount();
+        long count = base.getPropertyCount();
         for (Map.Entry<String, PropertyState> entry : properties.entrySet()) {
-            if (super.getProperty(entry.getKey()) != null) {
+            if (base.getProperty(entry.getKey()) != null) {
                 if (entry.getValue() == null) {
                     count--;
                 }
@@ -107,10 +109,10 @@ public class ModifiedNodeState extends P
     @Override
     public Iterable<? extends PropertyState> getProperties() {
         if (properties.isEmpty()) {
-            return super.getProperties(); // shortcut
+            return base.getProperties(); // shortcut
         }
         final Iterable<? extends PropertyState> unmodified =
-                super.getProperties();
+                base.getProperties();
         final Iterable<? extends PropertyState> modified =
                 properties.values();
         return new Iterable<PropertyState>() {
@@ -132,15 +134,15 @@ public class ModifiedNodeState extends P
         if (nodes.containsKey(name)) {
             return nodes.get(name);
         } else {
-            return super.getChildNode(name);
+            return base.getChildNode(name);
         }
     }
 
     @Override
     public long getChildNodeCount() {
-        long count = super.getChildNodeCount();
+        long count = base.getChildNodeCount();
         for (Map.Entry<String, NodeState> entry : nodes.entrySet()) {
-            if (super.getChildNode(entry.getKey()) != null) {
+            if (base.getChildNode(entry.getKey()) != null) {
                 if (entry.getValue() == null) {
                     count--;
                 }
@@ -156,10 +158,10 @@ public class ModifiedNodeState extends P
     @Override
     public Iterable<? extends ChildNodeEntry> getChildNodeEntries() {
         if (nodes.isEmpty()) {
-            return super.getChildNodeEntries(); // shortcut
+            return base.getChildNodeEntries(); // shortcut
         }
         final Iterable<? extends ChildNodeEntry> unmodified =
-                super.getChildNodeEntries();
+                base.getChildNodeEntries();
         final Iterable<? extends ChildNodeEntry> modified =
                 MemoryChildNodeEntry.iterable(nodes);
         return new Iterable<ChildNodeEntry>() {



Mime
View raw message