jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1368490 - in /jackrabbit/oak/trunk/oak-jcr: pom.xml src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Date Thu, 02 Aug 2012 14:38:55 GMT
Author: angela
Date: Thu Aug  2 14:38:54 2012
New Revision: 1368490

URL: http://svn.apache.org/viewvc?rev=1368490&view=rev
Log:
OAK-218 : Session methods rely on accessibility of root node (WIP)

Modified:
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1368490&r1=1368489&r2=1368490&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Thu Aug  2 14:38:54 2012
@@ -33,6 +33,7 @@
 
   <properties>
     <known.issues>
+org.apache.jackrabbit.test.api.PathTest#testGetItem<!-- OAK-23 -->
 org.apache.jackrabbit.test.api.SessionTest#testMoveConstraintViolationExceptionSrc<!--OAK-132-->
 org.apache.jackrabbit.test.api.SessionTest#testMoveConstraintViolationExceptionDest<!--OAK-132-->
 org.apache.jackrabbit.test.api.SessionTest#testSaveConstraintViolationException<!--OAK-66-->

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1368490&r1=1368489&r2=1368490&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Thu Aug  2 14:38:54 2012
@@ -29,6 +29,7 @@ import javax.jcr.Item;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.NamespaceException;
 import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
 import javax.jcr.Property;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
@@ -160,26 +161,50 @@ public class SessionImpl extends Abstrac
 
     @Override
     public Item getItem(String absPath) throws RepositoryException {
-        // FIXME OAK-218
-        return super.getItem(absPath);
+        if (nodeExists(absPath)) {
+            return getNode(absPath);
+        } else {
+            return getProperty(absPath);
+        }
     }
 
     @Override
     public boolean itemExists(String absPath) throws RepositoryException {
-        // FIXME OAK-218
-        return super.itemExists(absPath);
+        return nodeExists(absPath) || propertyExists(absPath);
     }
 
     @Override
-    public Node getNode(String absPath) throws RepositoryException {
-        // FIXME OAK-218
-        return super.getNode(absPath);
+    public Node getNode(final String absPath) throws RepositoryException {
+        ensureIsAlive();
+
+        // FIXME: deal with identifier path (OAK-23)
+
+        return dlg.perform(new SessionOperation<NodeImpl>() {
+            @Override
+            public NodeImpl perform() throws RepositoryException {
+                String oakPath = dlg.getOakPathOrThrow(absPath);
+                NodeDelegate d = dlg.getNode(oakPath);
+                if (d == null) {
+                    throw new PathNotFoundException("Node with path " + absPath + " does
not exist.");
+                }
+                return new NodeImpl(d);
+            }
+        });
     }
 
     @Override
-    public boolean nodeExists(String absPath) throws RepositoryException {
-        // FIXME OAK-218
-        return super.nodeExists(absPath);
+    public boolean nodeExists(final String absPath) throws RepositoryException {
+        ensureIsAlive();
+
+        // FIXME: deal with identifier path (OAK-23)
+
+        return dlg.perform(new SessionOperation<Boolean>() {
+            @Override
+            public Boolean perform() throws RepositoryException {
+                String oakPath = dlg.getOakPathOrThrow(absPath);
+                return dlg.getNode(oakPath) != null;
+            }
+        });
     }
 
     @Override



Mime
View raw message