jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1376862 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: NodeDelegate.java PropertyDelegate.java
Date Fri, 24 Aug 2012 08:43:27 GMT
Author: mduerig
Date: Fri Aug 24 08:43:26 2012
New Revision: 1376862

URL: http://svn.apache.org/viewvc?rev=1376862&view=rev
Log:
OAK-275 Introduce TreeLocation interface
OAK-212 Move status of property to PropertyState
OAK-226 Property#getPath() relies on accessibility of the parent node

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

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1376862&r1=1376861&r2=1376862&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
Fri Aug 24 08:43:26 2012
@@ -52,8 +52,9 @@ public class NodeDelegate extends ItemDe
     /** The underlying {@link TreeLocation} of this node. */
     private TreeLocation location;
 
-    public NodeDelegate(SessionDelegate sessionDelegate, Tree tree) {
+    NodeDelegate(SessionDelegate sessionDelegate, Tree tree) {
         super(sessionDelegate);
+        assert tree != null;
         this.location = tree.getLocation();
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1376862&r1=1376861&r2=1376862&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
Fri Aug 24 08:43:26 2012
@@ -51,7 +51,7 @@ public class PropertyDelegate extends It
         this.location = parent.getLocation().getChild(propertyState.getName());
     }
 
-    public PropertyDelegate(SessionDelegate sessionDelegate, TreeLocation location) {
+    PropertyDelegate(SessionDelegate sessionDelegate, TreeLocation location) {
         super(sessionDelegate);
         assert location != null;
         this.location = location;
@@ -64,7 +64,12 @@ public class PropertyDelegate extends It
 
     @Override
     public String getPath() throws InvalidItemStateException {
-        return PathUtils.concat(getParent().getPath(), getName());
+        resolve();
+        String path = location.getPath();
+        if (path == null) {
+            throw new InvalidItemStateException("Property is stale");
+        }
+        return path;
     }
 
     @Override
@@ -81,7 +86,8 @@ public class PropertyDelegate extends It
 
     @Override
     public Status getStatus() throws InvalidItemStateException {
-        Status propertyStatus = getParentTree().getPropertyStatus(getName());
+        resolve();
+        Status propertyStatus = location.getStatus();
         if (propertyStatus == null) {
             throw new InvalidItemStateException("Property is stale");
         }
@@ -91,7 +97,7 @@ public class PropertyDelegate extends It
 
     @Override
     public String toString() {
-        // don't disturb the state: avoid calling resolve()
+        // don't disturb the state: avoid resolving the tree
         return "PropertyDelegate[" + location.getPath() + ']';
     }
 



Mime
View raw message