jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1344793 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Date Thu, 31 May 2012 16:08:53 GMT
Author: mduerig
Date: Thu May 31 16:08:52 2012
New Revision: 1344793

URL: http://svn.apache.org/viewvc?rev=1344793&view=rev
Log:
OAK-124: Default to nt:unstructured for nodes where jcr:primaryType is not set
- default to nt:unstructured if jcr:primaryType is not set

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1344793&r1=1344792&r2=1344793&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Thu May 31 16:08:52 2012
@@ -246,13 +246,6 @@ public class RootImpl implements Root {
         store.compare(before, after, diffHandler);
     }
 
-    //------------------------------------------------------------< internal >---
-
-    // FIXME remove
-    NodeStore getNodeStore() {
-        return store;
-    }
-
     //------------------------------------------------------------< private >---
 
     // TODO better way to determine purge limit

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1344793&r1=1344792&r2=1344793&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Thu May 31 16:08:52 2012
@@ -32,7 +32,6 @@ import org.apache.jackrabbit.oak.util.It
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
-import javax.jcr.PropertyType;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -113,35 +112,7 @@ public class TreeImpl implements Tree, P
 
     @Override
     public PropertyState getProperty(String name) {
-        PropertyState propertyState = getNodeState().getProperty(name);
-        // FIXME find a better way to default jcr:primaryType
-        if (propertyState == null && "jcr:primaryType".equals(name)) {
-            propertyState = new PropertyState() {
-                @Override
-                public String getName() {
-                    return "jcr:primaryType";
-                }
-
-                @Override
-                public boolean isArray() {
-                    return false;
-                }
-
-                @Nonnull
-                @Override
-                public CoreValue getValue() {
-                    return root.getNodeStore().getValueFactory().createValue("nt:unstructured",
PropertyType.NAME);
-                }
-
-                @Nonnull
-                @Override
-                public Iterable<CoreValue> getValues() {
-                    throw new IllegalStateException();
-                }
-            };
-        }
-
-        return propertyState;
+        return getNodeState().getProperty(name);
     }
 
     @Override

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=1344793&r1=1344792&r2=1344793&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
Thu May 31 16:08:52 2012
@@ -16,14 +16,22 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.commons.ItemNameMatcher;
+import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
+import org.apache.jackrabbit.commons.iterator.PropertyIteratorAdapter;
+import org.apache.jackrabbit.oak.api.CoreValue;
+import org.apache.jackrabbit.oak.api.Tree.Status;
+import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
+import org.apache.jackrabbit.oak.namepath.NameMapper;
+import org.apache.jackrabbit.oak.util.Function1;
+import org.apache.jackrabbit.oak.util.Iterators;
+import org.apache.jackrabbit.oak.util.Predicate;
+import org.apache.jackrabbit.value.ValueHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import javax.annotation.Nonnull;
 import javax.jcr.Binary;
 import javax.jcr.InvalidItemStateException;
@@ -48,22 +56,14 @@ import javax.jcr.nodetype.NodeTypeManage
 import javax.jcr.version.OnParentVersionAction;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
-
-import org.apache.jackrabbit.JcrConstants;
-import org.apache.jackrabbit.commons.ItemNameMatcher;
-import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
-import org.apache.jackrabbit.commons.iterator.PropertyIteratorAdapter;
-import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.api.Tree.Status;
-import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
-import org.apache.jackrabbit.oak.namepath.NameMapper;
-import org.apache.jackrabbit.oak.util.Function1;
-import org.apache.jackrabbit.oak.util.Iterators;
-import org.apache.jackrabbit.oak.util.Predicate;
-import org.apache.jackrabbit.value.ValueHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
 
 import static org.apache.jackrabbit.oak.util.Iterators.filter;
 
@@ -661,7 +661,10 @@ public class NodeImpl extends ItemImpl i
 
         // TODO: check if transient changes to mixin-types are reflected here
         NodeTypeManager ntMgr = sessionDelegate.getNodeTypeManager();
-        String primaryNtName = getProperty(Property.JCR_PRIMARY_TYPE).getString();
+        String primaryNtName;
+        primaryNtName = hasProperty(Property.JCR_PRIMARY_TYPE)
+            ? getProperty(Property.JCR_PRIMARY_TYPE).getString()
+            : "nt:unstructured";
 
         return ntMgr.getNodeType(primaryNtName);
     }



Mime
View raw message