jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1338229 - in /jackrabbit/oak/trunk: oak-it/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/
Date Mon, 14 May 2012 14:43:23 GMT
Author: reschke
Date: Mon May 14 14:43:22 2012
New Revision: 1338229

URL: http://svn.apache.org/viewvc?rev=1338229&view=rev
Log:
OAK-23: implement identifier paths in property values (WIP); update test exclusions

Modified:
    jackrabbit/oak/trunk/oak-it/jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java

Modified: jackrabbit/oak/trunk/oak-it/jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/pom.xml?rev=1338229&r1=1338228&r2=1338229&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Mon May 14 14:43:22 2012
@@ -47,8 +47,6 @@
 org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetUUID
 org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUID
 org.apache.jackrabbit.test.api.PathTest#testGetItem
-org.apache.jackrabbit.test.api.PathTest#testCreatePathValue
-org.apache.jackrabbit.test.api.PathTest#testCreateMultiplePathValue
 org.apache.jackrabbit.test.api.AddNodeTest#testConstraintViolation
 org.apache.jackrabbit.test.api.AddNodeTest#testRepositoryException
 org.apache.jackrabbit.test.api.ReferencesTest#testNonReferenceable

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=1338229&r1=1338228&r2=1338229&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
Mon May 14 14:43:22 2012
@@ -394,10 +394,17 @@ public class PropertyImpl extends ItemIm
             case PropertyType.PATH:
             case PropertyType.NAME:
                 String path = value.getString();
-                try {
-                    return (path.charAt(0) == '/') ? getSession().getNode(path) : getParent().getNode(path);
-                } catch (PathNotFoundException e) {
-                    throw new ItemNotFoundException(path);
+                if (path.startsWith("[") && path.endsWith("]")) {
+                    // TODO OAK-23
+                    // TODO correct for NAME?
+                    return getSession().getNodeByIdentifier(path.substring(1, path.length()
- 1));
+                }
+                else {
+                    try {
+                        return (path.charAt(0) == '/') ? getSession().getNode(path) : getParent().getNode(path);
+                    } catch (PathNotFoundException e) {
+                        throw new ItemNotFoundException(path);
+                    }
                 }
 
             case PropertyType.STRING:

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java?rev=1338229&r1=1338228&r2=1338229&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
Mon May 14 14:43:22 2012
@@ -149,6 +149,11 @@ public class ValueFactoryImpl implements
 
     @Override
     public Value createValue(String value, int type) throws ValueFormatException {
+
+        if (value == null) {
+            throw new ValueFormatException();
+        }
+
         try {
             CoreValue cv;
 
@@ -162,11 +167,19 @@ public class ValueFactoryImpl implements
                     break;
 
                 case PropertyType.PATH:
-                    String oakPath = namePathMapper.getOakPath(value);
-                    if (oakPath == null) {
-                        throw new ValueFormatException("Invalid path: " + value);
+                    // TODO we special case identifier paths here for now
+                    // eventually this should be done in the path mapper (OAK-23)
+
+                    String oakValue;
+                    if (value.startsWith("[") && value.endsWith("]")) {
+                        oakValue = value;
+                    } else {
+                        oakValue = namePathMapper.getOakPath(value);
+                        if (oakValue == null) {
+                            throw new ValueFormatException("Invalid path: " + value);
+                        }
                     }
-                    cv = factory.createValue(oakPath, type);
+                    cv = factory.createValue(oakValue, type);
                     break;
 
                 case PropertyType.DATE:

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java?rev=1338229&r1=1338228&r2=1338229&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java
Mon May 14 14:43:22 2012
@@ -169,10 +169,16 @@ class ValueImpl implements Value {
     @Override
     public String getString() throws RepositoryException {
         switch (getType()) {
-            case PropertyType.NAME :
+            case PropertyType.NAME:
                 return namePathMapper.getJcrName(value.toString());
             case PropertyType.PATH:
-                return namePathMapper.getJcrPath(value.toString());
+                String s = value.toString();
+                // TODO special handling for identifier paths; should happen in path mapper
(OAK-23)
+                if (s.startsWith("[") && s.endsWith("]")) {
+                    return s;
+                } else {
+                    return namePathMapper.getJcrPath(value.toString());
+                }
             case PropertyType.BINARY:
                 InputStream stream = getStream();
                 try {



Mime
View raw message