jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1332276 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-it/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/
Date Mon, 30 Apr 2012 16:15:23 GMT
Author: reschke
Date: Mon Apr 30 16:15:23 2012
New Revision: 1332276

URL: http://svn.apache.org/viewvc?rev=1332276&view=rev
Log:
OAK-61: fix getPath on root node properties, various name handling problems on node types,
update test results

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
    jackrabbit/oak/trunk/oak-it/jcr/pom.xml
    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/PropertyDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1332276&r1=1332275&r2=1332276&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Mon Apr 30 16:15:23 2012
@@ -87,8 +87,13 @@ public class ContentRepositoryImpl imple
         NodeState root = nodeStore.getRoot();
 
         NodeState wspNode = root.getChildNode(DEFAULT_WORKSPACE_NAME);
+
+        // FIXME: depends on CoreValue's name mangling
+        String ntUnstructured = "nam:nt:unstructured";
+
         if (wspNode == null) {
-            microKernel.commit("/", "+\"" + DEFAULT_WORKSPACE_NAME + "\":{}" + "^\"" + DEFAULT_WORKSPACE_NAME
+ "/jcr:primaryType\":\"nt:unstructured\" ", null, null);
+            microKernel.commit("/", "+\"" + DEFAULT_WORKSPACE_NAME + "\":{}" + "^\"" + DEFAULT_WORKSPACE_NAME
+                    + "/jcr:primaryType\":\"" + ntUnstructured + "\" ", null, null);
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-it/jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/pom.xml?rev=1332276&r1=1332275&r2=1332276&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Mon Apr 30 16:15:23 2012
@@ -45,7 +45,6 @@
               <name>known.issues</name>
               <value>
 org.apache.jackrabbit.test.api.NodeDiscoveringNodeTypesTest#testIsNodeType
-org.apache.jackrabbit.test.api.NamespaceRemappingTest#testNamespaceRemapping
 org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUIDFailure
 org.apache.jackrabbit.test.api.ExportSysViewTest
 org.apache.jackrabbit.test.api.ExportDocViewTest

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=1332276&r1=1332275&r2=1332276&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
Mon Apr 30 16:15:23 2012
@@ -482,11 +482,11 @@ public class NodeImpl extends ItemImpl i
     public String getIdentifier() throws RepositoryException {
         checkStatus();
 
-        if (isNodeType(JcrConstants.MIX_REFERENCEABLE)) {
-            return getProperty(JcrConstants.JCR_UUID).getString();
+        if (isNodeType(NodeType.MIX_REFERENCEABLE)) {
+            return getProperty(Property.JCR_UUID).getString();
         } else {
             // TODO
-            return getPath();
+            return dlg.getPath();
         }
     }
 
@@ -561,7 +561,8 @@ public class NodeImpl extends ItemImpl i
 
         // TODO: check if transient changes to mixin-types are reflected here
         NodeTypeManager ntMgr = getSession().getWorkspace().getNodeTypeManager();
-        String primaryNtName = getProperty(JcrConstants.JCR_PRIMARYTYPE).getString();
+        String primaryNtName = getProperty(Property.JCR_PRIMARY_TYPE).getString();
+
         return ntMgr.getNodeType(primaryNtName);
     }
 
@@ -590,13 +591,16 @@ public class NodeImpl extends ItemImpl i
     public boolean isNodeType(String nodeTypeName) throws RepositoryException {
         checkStatus();
 
-        if (hasProperty(JcrConstants.JCR_PRIMARYTYPE) && getProperty(JcrConstants.JCR_PRIMARYTYPE).getString().equals(nodeTypeName))
{
+        // TODO: might be expanded, need a better way for this
+        String jcrName = sessionContext.getNamePathMapper().getJcrName(sessionContext.getNamePathMapper().getOakName(nodeTypeName));
+
+        if (hasProperty(Property.JCR_PRIMARY_TYPE) && getProperty(Property.JCR_PRIMARY_TYPE).getString().equals(jcrName))
{
             return true;
         }
-        if (hasProperty(JcrConstants.JCR_MIXINTYPES)) {
-            Value[] mixins = getProperty(JcrConstants.JCR_MIXINTYPES).getValues();
+        if (hasProperty(Property.JCR_MIXIN_TYPES)) {
+            Value[] mixins = getProperty(Property.JCR_MIXIN_TYPES).getValues();
             for (Value mixin : mixins) {
-                if (mixin.getString().equals(nodeTypeName)) {
+                if (mixin.getString().equals(jcrName)) {
                     return true;
                 }
             }

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=1332276&r1=1332275&r2=1332276&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
Mon Apr 30 16:15:23 2012
@@ -156,7 +156,8 @@ public class PropertyDelegate extends It
 
     @Override
     String getPath() {
-        return '/' + getParentContentTree().getPath() + '/' + getName();
+        String parentPath = getParentContentTree().getPath();
+        return parentPath.isEmpty() ? "/" + getName() : "/" + parentPath + "/" + getName();
     }
 
     SessionContext getSessionContext() {



Mime
View raw message