jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1333500 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: ItemDelegate.java ItemImpl.java NodeDelegate.java PropertyDelegate.java PropertyImpl.java
Date Thu, 03 May 2012 15:24:46 GMT
Author: mduerig
Date: Thu May  3 15:24:45 2012
New Revision: 1333500

URL: http://svn.apache.org/viewvc?rev=1333500&view=rev
Log:
OAK-84: Delegates for Session, Node, Property and Item
- push getDepth() down to ItemDelegate

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
    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
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java?rev=1333500&r1=1333499&r2=1333500&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
Thu May  3 15:24:45 2012
@@ -17,9 +17,15 @@
 
 package org.apache.jackrabbit.oak.jcr;
 
+import org.apache.jackrabbit.oak.commons.PathUtils;
+
 public abstract class ItemDelegate {
     
     abstract String getName();
 
     abstract String getPath();
+
+    public int getDepth() {
+        return PathUtils.getDepth(getPath());
+    }
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java?rev=1333500&r1=1333499&r2=1333500&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
Thu May  3 15:24:45 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,7 +51,7 @@ abstract class ItemImpl implements Item 
      */
     @Override
     public int getDepth() throws RepositoryException {
-        return PathUtils.getDepth(dlg.getPath());
+        return dlg.getDepth();
     }
 
     /**

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=1333500&r1=1333499&r2=1333500&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
Thu May  3 15:24:45 2012
@@ -74,10 +74,6 @@ public class NodeDelegate extends ItemDe
         return getTree().getChildrenCount();
     }
 
-    int getDepth() throws RepositoryException {
-        return PathUtils.getDepth(getPath());
-    }
-
     @Override
     String getName() {
         return getTree().getName();
@@ -162,7 +158,7 @@ public class NodeDelegate extends ItemDe
         return tree;
     }
 
-    private Tree check(Tree t) throws InvalidItemStateException {
+    private static Tree check(Tree t) throws InvalidItemStateException {
         if (t == null) {
             throw new InvalidItemStateException();
         }

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=1333500&r1=1333499&r2=1333500&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
Thu May  3 15:24:45 2012
@@ -124,18 +124,18 @@ public class PropertyDelegate extends It
     }
     
     void remove() throws RepositoryException {
-        getParentContentTree().removeProperty(getName());
+        getParentTree().removeProperty(getName());
     }
     
     void setValue(CoreValue value) throws RepositoryException {
-        getParentContentTree().setProperty(getName(), value);
+        getParentTree().setProperty(getName(), value);
     }
 
     void setValues(List<CoreValue> values) throws RepositoryException {
-        getParentContentTree().setProperty(getName(), values);
+        getParentTree().setProperty(getName(), values);
     }
 
-    Tree getParentContentTree() {
+    Tree getParentTree() {
         resolve();
         return parent;
     }
@@ -146,7 +146,7 @@ public class PropertyDelegate extends It
     }
 
     Tree.Status getPropertyStatus() {
-        return getParentContentTree().getPropertyStatus(getName());
+        return getParentTree().getPropertyStatus(getName());
     }
     
     @Override
@@ -156,8 +156,8 @@ public class PropertyDelegate extends It
 
     @Override
     String getPath() {
-        String parentPath = getParentContentTree().getPath();
-        return parentPath.isEmpty() ? "/" + getName() : "/" + parentPath + "/" + getName();
+        String parentPath = getParentTree().getPath();
+        return parentPath.isEmpty() ? '/' + getName() : '/' + parentPath + '/' + getName();
     }
 
     SessionContext getSessionContext() {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1333500&r1=1333499&r2=1333500&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Thu May  3 15:24:45 2012
@@ -16,11 +16,13 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Tree.Status;
+import org.apache.jackrabbit.oak.jcr.util.LogUtil;
+import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
+import org.apache.jackrabbit.value.ValueHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.jcr.Binary;
 import javax.jcr.Item;
@@ -34,14 +36,11 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
 import javax.jcr.nodetype.PropertyDefinition;
-
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.Tree.Status;
-import org.apache.jackrabbit.oak.jcr.util.LogUtil;
-import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
-import org.apache.jackrabbit.value.ValueHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
 
 /**
  * {@code PropertyImpl}...
@@ -56,7 +55,6 @@ public class PropertyImpl extends ItemIm
     private final PropertyDelegate dlg;
     
     PropertyImpl(PropertyDelegate dlg) {
-
         super(dlg.getSessionContext(), dlg);
         this.dlg = dlg;
     }
@@ -76,7 +74,7 @@ public class PropertyImpl extends ItemIm
     @Override
     public Node getParent() throws RepositoryException {
         return new NodeImpl(new NodeDelegate(sessionContext,
-                dlg.getParentContentTree()));
+                dlg.getParentTree()));
     }
 
     /**
@@ -84,10 +82,10 @@ public class PropertyImpl extends ItemIm
      */
     @Override
     public Item getAncestor(int depth) throws RepositoryException {
-        int mydepth = getDepth();
-        if (depth == mydepth) {
+        int myDepth = getDepth();
+        if (depth == myDepth) {
             return this;
-        } else if (depth == mydepth - 1) {
+        } else if (depth == myDepth - 1) {
             return getParent();
         } else {
             return getParent().getAncestor(depth);



Mime
View raw message