You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2012/08/24 10:43:27 UTC
svn commit: r1376862 - in
/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr:
NodeDelegate.java PropertyDelegate.java
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() + ']';
}