incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1390329 - /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
Date Wed, 26 Sep 2012 08:49:09 GMT
Author: cziegeler
Date: Wed Sep 26 08:49:09 2012
New Revision: 1390329

URL: http://svn.apache.org/viewvc?rev=1390329&view=rev
Log:
SLING-2530 : Implement CRUD based on resources

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java?rev=1390329&r1=1390328&r2=1390329&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
Wed Sep 26 08:49:09 2012
@@ -387,7 +387,20 @@ public class JcrResourceProvider
         final Object nodeObj = (properties != null ? properties.get("jcr:primaryType") :
null);
         final String nodeType = (nodeObj != null ? nodeObj.toString() : null);
         try {
-            final Node node = JcrResourceUtil.createPath(path, null, nodeType, this.session,
false);
+            final int lastPos = path.lastIndexOf('/');
+            final Node parent;
+            if ( lastPos == 0 ) {
+                parent = this.session.getRootNode();
+            } else {
+                parent = (Node)this.session.getItem(path.substring(0, lastPos));
+            }
+            final String name = path.substring(lastPos + 1);
+            final Node node;
+            if ( nodeType != null ) {
+                node = parent.addNode(name, nodeType);
+            } else {
+                node = parent.addNode(name);
+            }
 
             if ( properties != null ) {
                 // create modifiable map



Mime
View raw message