jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1500704 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation: SecurableNodeStateDiff.java SecureNodeStateDiff.java
Date Mon, 08 Jul 2013 12:56:02 GMT
Author: mduerig
Date: Mon Jul  8 12:56:02 2013
New Revision: 1500704

URL: http://svn.apache.org/r1500704
Log:
OAK-144 Implement observation
Let SecurableNodeStateDiff descendants decide whether to look ahead into a subtree or not
and exclude subtree look ahead for hidden child nodes

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecurableNodeStateDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecureNodeStateDiff.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecurableNodeStateDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecurableNodeStateDiff.java?rev=1500704&r1=1500703&r2=1500704&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecurableNodeStateDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecurableNodeStateDiff.java
Mon Jul  8 12:56:02 2013
@@ -19,10 +19,12 @@
 
 package org.apache.jackrabbit.oak.plugins.observation;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
-import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
 
 /**
  * Base class for {@code NodeStateDiff} implementations that can be secured.
@@ -48,6 +50,7 @@ public abstract class SecurableNodeState
         this(null, diff);
     }
 
+    @CheckForNull
     protected abstract SecurableNodeStateDiff create(SecurableNodeStateDiff parent,
             String name, NodeState before, NodeState after);
 
@@ -59,10 +62,12 @@ public abstract class SecurableNodeState
         return true;
     }
 
+    @Nonnull
     protected NodeState secureBefore(String name, NodeState nodeState) {
         return nodeState;
     }
 
+    @Nonnull
     protected NodeState secureAfter(String name, NodeState nodeState) {
         return nodeState;
     }
@@ -108,12 +113,12 @@ public abstract class SecurableNodeState
 
     @Override
     public boolean childNodeChanged(final String name, final NodeState before, final NodeState
after) {
-        // FIXME temporary solution to skip look ahead on hidden child nodes
-        if (NodeStateUtils.isHidden(name)) {
+        final SecurableNodeStateDiff childDiff = create(this, name, before, after);
+        if (childDiff == null) {
+            // Continue with siblings but don't decent into this subtree
             return true;
         }
 
-        final SecurableNodeStateDiff childDiff = create(this, name, before, after);
         deferred = new Deferred() {
             @Override
             boolean call() {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecureNodeStateDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecureNodeStateDiff.java?rev=1500704&r1=1500703&r2=1500704&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecureNodeStateDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/SecureNodeStateDiff.java
Mon Jul  8 12:56:02 2013
@@ -19,6 +19,8 @@
 
 package org.apache.jackrabbit.oak.plugins.observation;
 
+import static org.apache.jackrabbit.oak.spi.state.NodeStateUtils.isHidden;
+
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
@@ -40,7 +42,7 @@ public class SecureNodeStateDiff extends
     protected SecurableNodeStateDiff create(SecurableNodeStateDiff parent,
             String name, NodeState before, NodeState after) {
 
-        return new SecureNodeStateDiff(parent);
+        return isHidden(name) ? null : new SecureNodeStateDiff(parent);
     }
 
     @Override



Mime
View raw message