jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1420811 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/
Date Wed, 12 Dec 2012 16:31:36 GMT
Author: angela
Date: Wed Dec 12 16:31:33 2012
New Revision: 1420811

URL: http://svn.apache.org/viewvc?rev=1420811&view=rev
Log:
OAK-494 : Cleanup ReadOnlyNodeTypeManager  (Work in Progress)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefinitionProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeConstants.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.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/plugins/nodetype/DefinitionProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefinitionProvider.java?rev=1420811&r1=1420810&r2=1420811&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefinitionProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefinitionProvider.java
Wed Dec 12 16:31:33 2012
@@ -20,6 +20,7 @@ import javax.annotation.Nonnull;
 import javax.jcr.Node;
 import javax.jcr.Property;
 import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.PropertyDefinition;
@@ -36,39 +37,135 @@ public interface DefinitionProvider {
     NodeDefinition getRootDefinition() throws RepositoryException;
 
     /**
-     * Returns the node definition for a child node of <code>parent</code> named
-     * <code>nodeName</code> with a default primary type. First the non-residual
-     * child node definitions of <code>parent</code> are checked matching the
+     * Returns the node definition for a child node of {@code parent} named
+     * {@code nodeName} with a default primary type. First the non-residual
+     * child node definitions of {@code parent} are checked matching the
      * given node name. Then the residual definitions are checked.
      *
+     *
      * @param parent   the parent node.
-     * @param nodeName the name of the child node.
+     * @param nodeName The internal oak name of the child node.
      * @return the applicable node definition.
-     * @throws RepositoryException if there is no applicable node definition
-     *                             with a default primary type.
+     * @throws ConstraintViolationException If no matching definition can be found.
+     * @throws RepositoryException If another error occurs.
      */
     @Nonnull
     NodeDefinition getDefinition(@Nonnull Node parent, @Nonnull String nodeName)
-            throws RepositoryException;
+            throws ConstraintViolationException, RepositoryException;
 
+    /**
+     * Calculates the applicable definition for the child node under the given
+     * parent node.
+     *
+     * @param parent The parent node.
+     * @param targetNode The child node for which the definition is calculated.
+     * @return the defintion of the target node.
+     * @throws ConstraintViolationException If no matching definition can be found.
+     * @throws RepositoryException If another error occurs.
+     */
     @Nonnull
-    NodeDefinition getDefinition(Node parent, Node targetNode) throws RepositoryException;
+    NodeDefinition getDefinition(Node parent, Node targetNode)
+            throws ConstraintViolationException, RepositoryException;
 
+    /**
+     * Calculates the applicable definition for the child node with the
+     * specified name and node type under the given parent node.
+     *
+     * @param parentNodeTypes The node types of the parent node.
+     * @param nodeName The internal oak name of the child node.
+     * @param nodeType The target node type of the child.
+     * @return the applicable definition for the child node with the specified
+     * name and primary type.
+     * @throws ConstraintViolationException If no matching definition can be found.
+     * @throws RepositoryException If another error occurs.
+     */
     @Nonnull
-    NodeDefinition getDefinition(Iterable<NodeType> parentNodeTypes, String nodeName,
NodeType nodeType) throws RepositoryException;
+    NodeDefinition getDefinition(Iterable<NodeType> parentNodeTypes, String nodeName,
+                                 NodeType nodeType) throws ConstraintViolationException,
RepositoryException;
 
+    /**
+     * Calculates the definition of the specified property.
+     *
+     * @param parent The parent node.
+     * @param targetProperty The target property.
+     * @return The definition of the specified property.
+     * @throws ConstraintViolationException If no matching definition can be
+     * found.
+     * @throws RepositoryException If another error occurs.
+     */
     @Nonnull
-    PropertyDefinition getDefinition(Node parent, Property targetProperty) throws RepositoryException;
+    PropertyDefinition getDefinition(Node parent, Property targetProperty)
+            throws ConstraintViolationException, RepositoryException;
 
+    /**
+     * Calculates the applicable definition for the property state under the
+     * given parent tree.
+     *
+     * @param parent The parent tree.
+     * @param propertyState The target property.
+     * @return the definition for the target property.
+     * @throws ConstraintViolationException If no matching definition can be found.
+     * @throws RepositoryException If another error occurs.
+     */
     @Nonnull
-    PropertyDefinition getDefinition(Tree parent, PropertyState propertyState) throws RepositoryException;
+    PropertyDefinition getDefinition(Tree parent, PropertyState propertyState)
+            throws ConstraintViolationException,RepositoryException;
 
+    /**
+     * Calculates the applicable definition for the property with the specified
+     * characteristics under the given parent node.
+     *
+     * @param parent The parent node.
+     * @param propertyName The internal oak name of the property for which the
+     * definition should be retrieved.
+     * @param isMultiple {@code true} if the target property is multi-valued.
+     * @param type The target type of the property.
+     * @param exactTypeMatch {@code true} if the required type of the definition
+     * must exactly match the type of the target property.
+     * @return the applicable definition for the target property.
+     * @throws ConstraintViolationException If no matching definition can be found.
+     * @throws RepositoryException If another error occurs.
+     */
     @Nonnull
-    PropertyDefinition getDefinition(Node parent, String propertyName, boolean isMultiple,
int type, boolean exactTypeMatch) throws RepositoryException;
+    PropertyDefinition getDefinition(Node parent, String propertyName,
+                                     boolean isMultiple, int type, boolean exactTypeMatch)
+            throws ConstraintViolationException, RepositoryException;
 
+    /**
+     * Calculates the applicable definition for the property with the specified
+     * characteristics under the given parent tree.
+     *
+     * @param parent The parent tree.
+     * @param propertyName The internal oak name of the property for which the
+     * definition should be retrieved.
+     * @param isMultiple {@code true} if the target property is multi-valued.
+     * @param type The target type of the property.
+     * @param exactTypeMatch {@code true} if the required type of the definition
+     * must exactly match the type of the target property.
+     * @return the applicable definition for the target property.
+     * @throws ConstraintViolationException If no matching definition can be found.
+     * @throws RepositoryException If another error occurs.
+     */
     @Nonnull
-    PropertyDefinition getDefinition(Tree parent, String propertyName, boolean isMultiple,
int type, boolean exactTypeMatch) throws RepositoryException;
+    PropertyDefinition getDefinition(Tree parent, String propertyName, boolean isMultiple,
+                                     int type, boolean exactTypeMatch)
+            throws ConstraintViolationException, RepositoryException;
 
+    /**
+     * Calculates the applicable definition for the property with the specified
+     * characteristics under a parent with the specified node types.
+     *
+     * @param nodeTypes The node types of the parent tree.
+     * @param propertyName The internal oak name of the property for which the
+     * definition should be retrieved.
+     * @param isMultiple {@code true} if the target property is multi-valued.
+     * @param type The target type of the property.
+     * @param exactTypeMatch {@code true} if the required type of the definition
+     * must exactly match the type of the target property.
+     * @return the applicable definition for the target property.
+     * @throws ConstraintViolationException If no matching definition can be found.
+     * @throws RepositoryException If another error occurs.
+     */
     @Nonnull
-    PropertyDefinition getDefinition(Iterable<NodeType> nodeTypes, String propertyName,
boolean isMultiple, int type, boolean exactTypeMatch) throws RepositoryException;
+    PropertyDefinition getDefinition(Iterable<NodeType> nodeTypes, String propertyName,
boolean isMultiple, int type, boolean exactTypeMatch) throws ConstraintViolationException,
RepositoryException;
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java?rev=1420811&r1=1420810&r2=1420811&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java
Wed Dec 12 16:31:33 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.plugins.nodetype;
 
+import javax.annotation.Nonnull;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NodeDefinition;
@@ -74,13 +75,39 @@ public interface EffectiveNodeType {
 
     Iterable<PropertyDefinition> getMandatoryPropertyDefinitions();
 
-    Iterable<NodeDefinition> getNamedNodeDefinitions(String name);
+    /**
+     * Return all node definitions that match the specified oak name.
+     *
+     * @param oakName An internal oak name.
+     * @return All node definitions that match the given internal oak name.
+     */
+    @Nonnull
+    Iterable<NodeDefinition> getNamedNodeDefinitions(String oakName);
 
-    Iterable<PropertyDefinition> getNamedPropertyDefinitions(String name);
+    /**
+     * Return all property definitions that match the specified oak name.
+     *
+     * @param oakName An internal oak name.
+     * @return All property definitions that match the given internal oak name.
+     */
+    @Nonnull
+    Iterable<PropertyDefinition> getNamedPropertyDefinitions(String oakName);
 
-    Iterable<NodeDefinition> getUnnamedNodeDefinitions();
+    /**
+     * Return all residual node definitions.
+     *
+     * @return All residual node definitions.
+     */
+    @Nonnull
+    Iterable<NodeDefinition> getResidualNodeDefinitions();
 
-    Iterable<PropertyDefinition> getUnnamedPropertyDefinitions();
+    /**
+     * Return all residual property definitions.
+     *
+     * @return All residual property definitions.
+     */
+    @Nonnull
+    Iterable<PropertyDefinition> getResidualPropertyDefinitions();
 
     void checkSetProperty(PropertyState property) throws RepositoryException;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java?rev=1420811&r1=1420810&r2=1420811&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java
Wed Dec 12 16:31:33 2012
@@ -19,9 +19,11 @@ package org.apache.jackrabbit.oak.plugin
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import javax.annotation.Nullable;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.ItemDefinition;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.PropertyDefinition;
@@ -33,7 +35,10 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl;
 
 /**
- * EffectiveNodeTypeImpl... TODO implementation needs optimization
+ * EffectiveNodeTypeImpl...
+ *
+ * TODO implementation needs optimization
+ * FIXME: add validation of the effective node type
  */
 class EffectiveNodeTypeImpl implements EffectiveNodeType {
 
@@ -135,43 +140,31 @@ class EffectiveNodeTypeImpl implements E
     }
 
     @Override
-    public Iterable<NodeDefinition> getNamedNodeDefinitions(final String name) {
-        return Iterables.filter(getNodeDefinitions(), new Predicate<NodeDefinition>()
{
-            @Override
-            public boolean apply(NodeDefinition nodeDefinition) {
-                String childName = nodeDefinition.getName();
-                return childName.equals(name);
-            }
-        });
+    public Iterable<NodeDefinition> getNamedNodeDefinitions(String oakName) {
+        return Iterables.filter(getNodeDefinitions(), new DefinitionNamePredicate(oakName));
     }
 
     @Override
-    public Iterable<PropertyDefinition> getNamedPropertyDefinitions(final String name)
{
-        return Iterables.filter(getPropertyDefinitions(), new Predicate<PropertyDefinition>()
{
-            @Override
-            public boolean apply(PropertyDefinition propertyDefinition) {
-                String propName = propertyDefinition.getName();
-                return propName.equals(name);
-            }
-        });
+    public Iterable<PropertyDefinition> getNamedPropertyDefinitions(String oakName)
{
+        return Iterables.filter(getPropertyDefinitions(), new DefinitionNamePredicate(oakName));
     }
 
     @Override
-    public Iterable<NodeDefinition> getUnnamedNodeDefinitions() {
+    public Iterable<NodeDefinition> getResidualNodeDefinitions() {
         return Iterables.filter(getNodeDefinitions(), new Predicate<NodeDefinition>()
{
             @Override
             public boolean apply(NodeDefinition nodeDefinition) {
-                return "*".equals(nodeDefinition.getName());
+                return NodeTypeConstants.RESIDUAL_NAME.equals(nodeDefinition.getName());
             }
         });
     }
 
     @Override
-    public Iterable<PropertyDefinition> getUnnamedPropertyDefinitions() {
+    public Iterable<PropertyDefinition> getResidualPropertyDefinitions() {
         return Iterables.filter(getPropertyDefinitions(), new Predicate<PropertyDefinition>()
{
             @Override
             public boolean apply(PropertyDefinition propertyDefinition) {
-                return "*".equals(propertyDefinition.getName());
+                return NodeTypeConstants.RESIDUAL_NAME.equals(propertyDefinition.getName());
             }
         });
     }
@@ -288,4 +281,17 @@ class EffectiveNodeTypeImpl implements E
         }
         return ntMgr.getDefinition(nodeTypes, nameToCheck, nodeType);
     }
+
+    private class DefinitionNamePredicate implements Predicate<ItemDefinition> {
+
+        private final String oakName;
+
+        DefinitionNamePredicate(String oakName) {
+            this.oakName = oakName;
+        }
+        @Override
+        public boolean apply(@Nullable ItemDefinition definition) {
+            return definition instanceof ItemDefinitionImpl && ((ItemDefinitionImpl)
definition).getOakName().equals(oakName);
+        }
+    }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java?rev=1420811&r1=1420810&r2=1420811&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
Wed Dec 12 16:31:33 2012
@@ -39,8 +39,7 @@ import org.slf4j.LoggerFactory;
  */
 class ItemDefinitionImpl implements ItemDefinition {
 
-    private static final Logger log =
-            LoggerFactory.getLogger(ItemDefinitionImpl.class);
+    private static final Logger log = LoggerFactory.getLogger(ItemDefinitionImpl.class);
 
     private final NodeType type;
 
@@ -51,6 +50,7 @@ class ItemDefinitionImpl implements Item
         this.node = node;
     }
 
+    //-----------------------------------------------------< ItemDefinition >---
     @Override
     public NodeType getDeclaringNodeType() {
         return type;
@@ -58,7 +58,7 @@ class ItemDefinitionImpl implements Item
 
     @Override
     public String getName() {
-        return node.getName(JcrConstants.JCR_NAME, "*");
+        return node.getName(JcrConstants.JCR_NAME, NodeTypeConstants.RESIDUAL_NAME);
     }
 
     @Override
@@ -92,4 +92,9 @@ class ItemDefinitionImpl implements Item
     public String toString() {
         return getName();
     }
+
+    //-----------------------------------------------------------< internal >---
+    String getOakName() {
+        return node.getString(JcrConstants.JCR_NAME, NodeTypeConstants.RESIDUAL_NAME);
+    }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeConstants.java?rev=1420811&r1=1420810&r2=1420811&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeConstants.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeConstants.java
Wed Dec 12 16:31:33 2012
@@ -56,4 +56,6 @@ public interface NodeTypeConstants exten
     String CHANGE_CHANGED = "changeChanged";
     String DELETE_CHANGED = "deleteChanged";
     String DELETE_DELETED = "deleteDeleted";
+
+    String RESIDUAL_NAME = "*";
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java?rev=1420811&r1=1420810&r2=1420811&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
Wed Dec 12 16:31:33 2012
@@ -64,6 +64,7 @@ import static org.apache.jackrabbit.JcrC
 import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.apache.jackrabbit.oak.api.Type.STRINGS;
 import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.NODE_TYPES_PATH;
+import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.RESIDUAL_NAME;
 
 /**
  * Base implementation of a {@link NodeTypeManager} with support for reading
@@ -424,6 +425,16 @@ public abstract class ReadOnlyNodeTypeMa
         return new EffectiveNodeTypeImpl(types.values(), this);
     }
 
+    /**
+     *
+     * @param effectiveNodeType
+     * @param propertyName The internal oak name of the property.
+     * @param isMultiple
+     * @param type
+     * @param exactTypeMatch
+     * @return
+     * @throws ConstraintViolationException
+     */
     private static PropertyDefinition getPropertyDefinition(EffectiveNodeType effectiveNodeType,
             String propertyName, boolean isMultiple,
             int type, boolean exactTypeMatch) throws ConstraintViolationException {
@@ -437,7 +448,7 @@ public abstract class ReadOnlyNodeTypeMa
         }
 
         // try if there is a residual definition
-        for (PropertyDefinition def : effectiveNodeType.getUnnamedPropertyDefinitions())
{
+        for (PropertyDefinition def : effectiveNodeType.getResidualPropertyDefinitions())
{
             int defType = def.getRequiredType();
             if (isMultiple == def.isMultiple()
                     && (!exactTypeMatch || (type == defType || UNDEFINED == type
|| UNDEFINED == defType))) {
@@ -448,8 +459,9 @@ public abstract class ReadOnlyNodeTypeMa
         // FIXME: Shouldn't be needed
         for (NodeType nt : effectiveNodeType.getAllNodeTypes()) {
             for (PropertyDefinition def : nt.getDeclaredPropertyDefinitions()) {
+                // FIXME: compares oak propertyName with JCR name exposed by def.getName()
                 String defName = def.getName();
-                if ((propertyName.equals(defName) || "*".equals(defName))
+                if ((propertyName.equals(defName) || RESIDUAL_NAME.equals(defName))
                         && type == PropertyType.STRING
                         && isMultiple == def.isMultiple()) {
                     return def;
@@ -459,6 +471,14 @@ public abstract class ReadOnlyNodeTypeMa
         throw new ConstraintViolationException("No matching property definition found for
" + propertyName);
     }
 
+    /**
+     *
+     * @param effectiveNodeType
+     * @param childName The internal oak name of the target node.
+     * @param childEffective
+     * @return
+     * @throws ConstraintViolationException
+     */
     private static NodeDefinition getNodeDefinition(EffectiveNodeType effectiveNodeType,
                                                     String childName,
                                                     EffectiveNodeType childEffective) throws
ConstraintViolationException {
@@ -472,7 +492,7 @@ public abstract class ReadOnlyNodeTypeMa
             }
         }
 
-        for (NodeDefinition def : effectiveNodeType.getUnnamedNodeDefinitions()) {
+        for (NodeDefinition def : effectiveNodeType.getResidualNodeDefinitions()) {
             boolean match = true;
             if (childEffective != null && !childEffective.includesNodeTypes(def.getRequiredPrimaryTypeNames()))
{
                 match = false;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java?rev=1420811&r1=1420810&r2=1420811&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
Wed Dec 12 16:31:33 2012
@@ -243,8 +243,7 @@ public abstract class ReadWriteNodeTypeM
             if (allowUpdate) {
                 type.remove();
             } else {
-                throw new NodeTypeExistsException(
-                        "Node type " + jcrName + " already exists");
+                throw new NodeTypeExistsException("Node type " + jcrName + " already exists");
             }
         }
         type = types.addChild(oakName);
@@ -314,7 +313,7 @@ public abstract class ReadWriteNodeTypeM
         node.setBoolean(JCR_MULTIPLE, def.isMultiple());
         node.setBoolean(JCR_IS_FULLTEXT_SEARCHABLE, def.isFullTextSearchable());
         node.setBoolean(JCR_IS_QUERY_ORDERABLE, def.isQueryOrderable());
-        node.setStrings(JCR_AVAILABLE_QUERY_OPERATORS, def.getAvailableQueryOperators());
+        node.setNames(JCR_AVAILABLE_QUERY_OPERATORS, def.getAvailableQueryOperators());
 
         String[] constraints = def.getValueConstraints();
         if (constraints != null) {
@@ -395,5 +394,4 @@ public abstract class ReadWriteNodeTypeM
             throw new RepositoryException("Failed to unregister node types", e);
         }
     }
-
 }

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=1420811&r1=1420810&r2=1420811&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 Dec 12 16:31:33 2012
@@ -250,8 +250,9 @@ public class NodeImpl extends ItemImpl<N
                 if (ntName == null) {
                     DefinitionProvider dp = sessionDelegate.getDefinitionProvider();
                     try {
-                        ntName = dp.getDefinition(new NodeImpl(parent),
-                                PathUtils.getName(relPath)).getDefaultPrimaryTypeName();
+                        String childName = sessionDelegate.getOakNameOrThrow(PathUtils.getName(relPath));
+                        NodeDefinition def = dp.getDefinition(new NodeImpl(parent), childName);
+                        ntName = def.getDefaultPrimaryTypeName();
                     } catch (RepositoryException e) {
                         throw new ConstraintViolationException(
                                 "no matching child node definition found for " + relPath);



Mime
View raw message