jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1501753 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: NodeImpl.java delegate/ItemDelegate.java delegate/NodeDelegate.java delegate/PropertyDelegate.java
Date Wed, 10 Jul 2013 12:58:20 GMT
Author: mduerig
Date: Wed Jul 10 12:58:20 2013
New Revision: 1501753

URL: http://svn.apache.org/r1501753
Log:
OAK-798: Review / refactor TreeImpl and related classes
Rename ItemDelegate.isStale to ItemDelegate.exists for consistency and simplicity

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1501753&r1=1501752&r2=1501753&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Wed Jul 10 12:58:20 2013
@@ -16,12 +16,23 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.Collections.singleton;
+import static javax.jcr.Property.JCR_LOCK_IS_DEEP;
+import static javax.jcr.Property.JCR_LOCK_OWNER;
+import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.oak.api.Type.BOOLEAN;
+import static org.apache.jackrabbit.oak.api.Type.NAME;
+import static org.apache.jackrabbit.oak.api.Type.NAMES;
+
 import java.io.InputStream;
 import java.math.BigDecimal;
 import java.util.Calendar;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+
 import javax.annotation.Nonnull;
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Binary;
@@ -57,7 +68,6 @@ import com.google.common.collect.Immutab
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Iterators;
 import com.google.common.collect.Lists;
-
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.commons.ItemNameMatcher;
 import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
@@ -81,16 +91,6 @@ import org.apache.jackrabbit.value.Value
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static java.util.Collections.singleton;
-import static javax.jcr.Property.JCR_LOCK_IS_DEEP;
-import static javax.jcr.Property.JCR_LOCK_OWNER;
-import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
-import static org.apache.jackrabbit.oak.api.Type.BOOLEAN;
-import static org.apache.jackrabbit.oak.api.Type.NAME;
-import static org.apache.jackrabbit.oak.api.Type.NAMES;
-
 /**
  * TODO document
  *
@@ -147,7 +147,7 @@ public class NodeImpl<T extends NodeDele
         return safePerform(new ItemReadOperation<Boolean>() {
             @Override
             public Boolean perform() {
-                return !dlg.isStale() && dlg.getStatus() == Status.NEW;
+                return dlg.exists() && dlg.getStatus() == Status.NEW;
             }
         });
     }
@@ -160,7 +160,7 @@ public class NodeImpl<T extends NodeDele
         return safePerform(new ItemReadOperation<Boolean>() {
             @Override
             public Boolean perform() {
-                return !dlg.isStale() && dlg.getStatus() == Status.MODIFIED;
+                return dlg.exists() && dlg.getStatus() == Status.MODIFIED;
             }
         });
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java?rev=1501753&r1=1501752&r2=1501753&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java
Wed Jul 10 12:58:20 2013
@@ -68,13 +68,13 @@ public abstract class ItemDelegate {
     public abstract boolean isProtected() throws InvalidItemStateException;
 
     /**
-     * Determine whether this item is stale
-     * @return  {@code true} iff stale
+     * Determine whether the underlying item exists
+     * @return  {@code true} the underlying tree exists, {@code false} otherwise.
      */
-    public abstract boolean isStale();
+    public abstract boolean exists();
 
     public void checkNotStale() throws InvalidItemStateException {
-        if (isStale()) {
+        if (!exists()) {
             throw new InvalidItemStateException("stale");
         }
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java?rev=1501753&r1=1501752&r2=1501753&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
Wed Jul 10 12:58:20 2013
@@ -141,8 +141,8 @@ public class NodeDelegate extends ItemDe
     }
 
     @Override
-    public boolean isStale() {
-        return !tree.exists();
+    public boolean exists() {
+        return tree.exists();
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java?rev=1501753&r1=1501752&r2=1501753&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java
Wed Jul 10 12:58:20 2013
@@ -82,8 +82,8 @@ public class PropertyDelegate extends It
     }
 
     @Override
-    public boolean isStale() {
-        return !parent.exists() || !parent.hasProperty(name);
+    public boolean exists() {
+        return parent.exists() && parent.hasProperty(name);
     }
 
     @Override



Mime
View raw message