jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1451410 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/
Date Thu, 28 Feb 2013 22:42:43 GMT
Author: jukka
Date: Thu Feb 28 22:42:43 2013
New Revision: 1451410

URL: http://svn.apache.org/r1451410
Log:
OAK-652: ItemImpl.checkProtected() is too slow

No need to keep a ValueFactory around

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/AbstractTypeDefinition.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/NodeDefinitionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/AbstractTypeDefinition.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/AbstractTypeDefinition.java?rev=1451410&r1=1451409&r2=1451410&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/AbstractTypeDefinition.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/AbstractTypeDefinition.java
Thu Feb 28 22:42:43 2013
@@ -20,7 +20,6 @@ import static com.google.common.base.Pre
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
-import javax.jcr.ValueFactory;
 
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
@@ -37,14 +36,10 @@ abstract class AbstractTypeDefinition {
 
     protected final Tree definition;
 
-    protected final ValueFactory factory;
-
     protected final NamePathMapper mapper;
 
-    protected AbstractTypeDefinition(
-            Tree definition, ValueFactory factory, NamePathMapper mapper) {
+    protected AbstractTypeDefinition(Tree definition, NamePathMapper mapper) {
         this.definition = checkNotNull(definition);
-        this.factory = factory;
         this.mapper = checkNotNull(mapper);
     }
 

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=1451410&r1=1451409&r2=1451410&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
Thu Feb 28 22:42:43 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.nodetype;
 
-import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.ItemDefinition;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.version.OnParentVersionAction;
@@ -40,9 +39,8 @@ import org.apache.jackrabbit.oak.namepat
 class ItemDefinitionImpl extends AbstractTypeDefinition
         implements ItemDefinition {
 
-    protected ItemDefinitionImpl(
-            Tree definition, ValueFactory factory, NamePathMapper mapper) {
-        super(definition, factory, mapper);
+    protected ItemDefinitionImpl(Tree definition, NamePathMapper mapper) {
+        super(definition, mapper);
     }
 
     String getOakName() {
@@ -57,7 +55,7 @@ class ItemDefinitionImpl extends Abstrac
 
     @Override
     public NodeType getDeclaringNodeType() {
-        return new NodeTypeImpl(definition.getParent(), factory, mapper);
+        return new NodeTypeImpl(definition.getParent(), mapper);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java?rev=1451410&r1=1451409&r2=1451410&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
Thu Feb 28 22:42:43 2013
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.plugin
 
 import static com.google.common.base.Preconditions.checkState;
 
-import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
 
@@ -37,9 +36,8 @@ import org.apache.jackrabbit.oak.namepat
  */
 class NodeDefinitionImpl extends ItemDefinitionImpl implements NodeDefinition {
 
-    protected NodeDefinitionImpl(
-            Tree definition, ValueFactory factory, NamePathMapper mapper) {
-        super(definition, factory, mapper);
+    NodeDefinitionImpl(Tree definition, NamePathMapper mapper) {
+        super(definition, mapper);
     }
 
     //-----------------------------------------------------< NodeDefinition >---
@@ -68,7 +66,7 @@ class NodeDefinitionImpl extends ItemDef
         for (int i = 0; i < oakNames.length; i++) {
             Tree type = root.getChild(oakNames[i]);
             checkState(type != null);
-            types[i] = new NodeTypeImpl(type, factory, mapper);
+            types[i] = new NodeTypeImpl(type, mapper);
         }
         return types;
     }
@@ -90,7 +88,7 @@ class NodeDefinitionImpl extends ItemDef
             Tree root = definition.getParent().getParent();
             Tree type = root.getChild(oakName);
             checkState(type != null);
-            return new NodeTypeImpl(type, factory, mapper);
+            return new NodeTypeImpl(type, mapper);
         } else {
             return null;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java?rev=1451410&r1=1451409&r2=1451410&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
Thu Feb 28 22:42:43 2013
@@ -30,7 +30,6 @@ import javax.annotation.CheckForNull;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
@@ -93,8 +92,8 @@ class NodeTypeImpl extends AbstractTypeD
 
     private static final String[] NO_NAMES = new String[0];
 
-    NodeTypeImpl(Tree type, ValueFactory factory, NamePathMapper mapper) {
-        super(type, factory, mapper);
+    NodeTypeImpl(Tree type, NamePathMapper mapper) {
+        super(type, mapper);
     }
 
     private String getOakName() {
@@ -165,8 +164,7 @@ class NodeTypeImpl extends AbstractTypeD
         List<PropertyDefinition> definitions = Lists.newArrayList();
         for (Tree child : definition.getChildren()) {
             if (child.getName().startsWith(JCR_PROPERTYDEFINITION)) {
-                definitions.add(
-                        new PropertyDefinitionImpl(child, factory, mapper));
+                definitions.add(new PropertyDefinitionImpl(child, mapper));
             }
         }
         return definitions.toArray(NO_PROPERTY_DEFINITIONS);
@@ -177,8 +175,7 @@ class NodeTypeImpl extends AbstractTypeD
         List<NodeDefinition> definitions = Lists.newArrayList();
         for (Tree child : definition.getChildren()) {
             if (child.getName().startsWith(JCR_CHILDNODEDEFINITION)) {
-                definitions.add(
-                        new NodeDefinitionImpl(child, factory, mapper));
+                definitions.add(new NodeDefinitionImpl(child, mapper));
             }
         }
         return definitions.toArray(NO_NODE_DEFINITIONS);
@@ -200,7 +197,7 @@ class NodeTypeImpl extends AbstractTypeD
                     Tree supertype = root.getChild(oakName);
                     checkState(supertype != null);
                     supertypes.put(
-                            oakName, new NodeTypeImpl(supertype, factory, mapper));
+                            oakName, new NodeTypeImpl(supertype, mapper));
                     addSupertypes(supertype, supertypes);
                 }
             }
@@ -217,7 +214,7 @@ class NodeTypeImpl extends AbstractTypeD
             for (int i = 0; i < oakNames.length; i++) {
                 Tree type = root.getChild(oakNames[i]);
                 checkState(type != null);
-                supertypes[i] = new NodeTypeImpl(type, factory, mapper);
+                supertypes[i] = new NodeTypeImpl(type, mapper);
             }
         }
         return supertypes;
@@ -256,8 +253,7 @@ class NodeTypeImpl extends AbstractTypeD
             for (String subname : subnames) {
                 if (!subtypes.containsKey(subname)) {
                     Tree tree = root.getChild(subname);
-                    subtypes.put(
-                            subname, new NodeTypeImpl(tree, factory, mapper));
+                    subtypes.put(subname, new NodeTypeImpl(tree, mapper));
                 }
             }
         }
@@ -274,7 +270,7 @@ class NodeTypeImpl extends AbstractTypeD
             if (supertypes != null) {
                 for (String name : supertypes.getValue(Type.NAMES)) {
                     if (oakName.equals(name)) {
-                        subtypes.add(new NodeTypeImpl(child, factory, mapper));
+                        subtypes.add(new NodeTypeImpl(child, mapper));
                         break;
                     }
                 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java?rev=1451410&r1=1451409&r2=1451410&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java
Thu Feb 28 22:42:43 2013
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.plugin
 import java.util.List;
 
 import javax.jcr.Value;
-import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.query.qom.QueryObjectModelConstants;
 
@@ -63,9 +62,8 @@ class PropertyDefinitionImpl extends Ite
 
     private static final Value[] NO_VALUES = new Value[0];
 
-    public PropertyDefinitionImpl(
-            Tree definition, ValueFactory factory, NamePathMapper mapper) {
-        super(definition, factory, mapper);
+    PropertyDefinitionImpl(Tree definition, NamePathMapper mapper) {
+        super(definition, mapper);
     }
 
     /**

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=1451410&r1=1451409&r2=1451410&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
Thu Feb 28 22:42:43 2013
@@ -190,10 +190,9 @@ public abstract class ReadOnlyNodeTypeMa
         List<NodeType> list = Lists.newArrayList();
         Tree types = getTypes();
         if (types != null) {
-            ValueFactory factory = getValueFactory();
             NamePathMapper mapper = getNamePathMapper();
             for (Tree type : types.getChildren()) {
-                list.add(new NodeTypeImpl(type, factory, mapper));
+                list.add(new NodeTypeImpl(type, mapper));
             }
         }
         return new NodeTypeIteratorAdapter(list);
@@ -469,17 +468,14 @@ public abstract class ReadOnlyNodeTypeMa
     //-----------------------------------------------------------< internal >---
 
     NodeTypeImpl internalGetNodeType(String oakName) throws NoSuchNodeTypeException {
-        ValueFactory factory = getValueFactory();
-        NamePathMapper mapper = getNamePathMapper();
-
         Tree types = getTypes();
         if (types != null) {
             Tree type = types.getChild(oakName);
             if (type != null) {
-                return new NodeTypeImpl(type, factory, mapper);
+                return new NodeTypeImpl(type, getNamePathMapper());
             }
         }
-        throw new NoSuchNodeTypeException(mapper.getJcrName(oakName));
+        throw new NoSuchNodeTypeException(getNamePathMapper().getJcrName(oakName));
     }
 
     //------------------------------------------------------------< private >---



Mime
View raw message