jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1330166 - in /jackrabbit/oak/trunk/oak-jcr/src: main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Date Wed, 25 Apr 2012 09:11:56 GMT
Author: angela
Date: Wed Apr 25 09:11:55 2012
New Revision: 1330166

URL: http://svn.apache.org/viewvc?rev=1330166&view=rev
Log:
OAK-72 - Implement JCR API

incomplete implementation of 
- Node#getIdentifier
- Session#getNodeByIdentifier

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/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.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=1330166&r1=1330165&r2=1330166&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 Apr 25 09:11:55 2012
@@ -499,8 +499,12 @@ public class NodeImpl extends ItemImpl i
     public String getIdentifier() throws RepositoryException {
         checkStatus();
 
-        // TODO
-        return path();
+        if (isNodeType(JcrConstants.MIX_REFERENCEABLE)) {
+            return getProperty(JcrConstants.JCR_UUID).getString();
+        } else {
+            // TODO
+            return path();
+        }
     }
 
     @Override
@@ -603,7 +607,7 @@ public class NodeImpl extends ItemImpl i
     public boolean isNodeType(String nodeTypeName) throws RepositoryException {
         checkStatus();
 
-        if (getProperty(JcrConstants.JCR_PRIMARYTYPE).getString().equals(nodeTypeName)) {
+        if (hasProperty(JcrConstants.JCR_PRIMARYTYPE) && getProperty(JcrConstants.JCR_PRIMARYTYPE).getString().equals(nodeTypeName))
{
             return true;
         }
         if (hasProperty(JcrConstants.JCR_MIXINTYPES)) {

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=1330166&r1=1330165&r2=1330166&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
Wed Apr 25 09:11:55 2012
@@ -134,7 +134,13 @@ public class SessionImpl extends Abstrac
     @Override
     public Node getNodeByIdentifier(String id) throws RepositoryException {
         ensureIsAlive();
-        throw new UnsupportedRepositoryOperationException("TODO: Session.getNodeByIdentifier");
+
+        if (id.charAt(0) == '/') {
+            return getNode(id);
+        } else {
+            // TODO
+            throw new UnsupportedRepositoryOperationException("TODO: Session.getNodeByIdentifier");
+        }
     }
 
     //------------------------------------------------------------< Writing >---

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1330166&r1=1330165&r2=1330166&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Wed Apr 25 09:11:55 2012
@@ -183,7 +183,6 @@ public class RepositoryTest extends Abst
         assertEquals("/foo", node.getPath());
     }
 
-    @Ignore  // TODO implement getNodeByIdentifier
     @Test
     public void getNodeByIdentifier() throws RepositoryException {
         Node node = getNode("/foo");



Mime
View raw message