jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1390594 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type: TypeValidator.java TypeValidatorProvider.java
Date Wed, 26 Sep 2012 16:34:21 GMT
Author: mduerig
Date: Wed Sep 26 16:34:21 2012
New Revision: 1390594

URL: http://svn.apache.org/viewvc?rev=1390594&view=rev
Log:
OAK-66: JCR Node Type Management
replace extra Value wrapper with proper ValueImpl instances: simplify

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java?rev=1390594&r1=1390593&r2=1390594&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
Wed Sep 26 16:34:21 2012
@@ -28,7 +28,6 @@ import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.nodetype.PropertyDefinition;
 
-import com.google.common.base.Function;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -36,8 +35,10 @@ import org.apache.jackrabbit.oak.api.Cor
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.core.ReadOnlyTree;
+import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.value.ValueImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -50,7 +51,7 @@ class TypeValidator implements Validator
 
     private final NodeTypeManager ntm;
     private final ReadOnlyTree parent;
-    private final Function<CoreValue, Value> valueFactory;
+    private final NamePathMapper mapper;
 
     private EffectiveNodeType parentType;
 
@@ -62,10 +63,10 @@ class TypeValidator implements Validator
         return parentType;
     }
 
-    public TypeValidator(NodeTypeManager ntm, ReadOnlyTree parent, Function<CoreValue,
Value> valueFactory) {
+    public TypeValidator(NodeTypeManager ntm, ReadOnlyTree parent, NamePathMapper mapper)
{
         this.ntm = ntm;
         this.parent = parent;
-        this.valueFactory = valueFactory;
+        this.mapper = mapper;
     }
 
     //-------------------------------------------------------< NodeValidator >
@@ -132,7 +133,7 @@ class TypeValidator implements Validator
             ReadOnlyTree addedTree = new ReadOnlyTree(parent, name, after);
             EffectiveNodeType addedType = getEffectiveNodeType(addedTree);
             addedType.checkMandatoryItems(addedTree);
-            return new TypeValidator(ntm, new ReadOnlyTree(parent, name, after), valueFactory);
+            return new TypeValidator(ntm, new ReadOnlyTree(parent, name, after), mapper);
         }
         catch (RepositoryException e) {
             throw new CommitFailedException(
@@ -146,7 +147,7 @@ class TypeValidator implements Validator
 
     @Override
     public Validator childNodeChanged(String name, NodeState before, NodeState after) throws
CommitFailedException {
-        return new TypeValidator(ntm, new ReadOnlyTree(parent, name, after), valueFactory);
+        return new TypeValidator(ntm, new ReadOnlyTree(parent, name, after), mapper);
     }
 
     @Override
@@ -331,7 +332,7 @@ class TypeValidator implements Validator
         }
 
         private Value jcrValue(CoreValue value) {
-            return valueFactory.apply(value);
+            return new ValueImpl(value, mapper);
         }
 
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java?rev=1390594&r1=1390593&r2=1390594&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
Wed Sep 26 16:34:21 2012
@@ -16,12 +16,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.type;
 
-import javax.jcr.Value;
-
-import com.google.common.base.Function;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.core.ReadOnlyTree;
@@ -31,7 +27,6 @@ import org.apache.jackrabbit.oak.namepat
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.value.ValueImpl;
 
 import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.NODE_TYPES_PATH;
 
@@ -65,14 +60,7 @@ public class TypeValidatorProvider imple
 
         Tree root = new ReadOnlyTree(after);
         final NamePathMapper mapper = new NamePathMapperImpl(new NameMapperImpl(root));
-        Function<CoreValue, Value> valueFactory = new Function<CoreValue, Value>()
{
-            @Override
-            public Value apply(CoreValue coreValue) {
-                return new ValueImpl(coreValue, mapper);
-            }
-        };
-
-        return new TypeValidator(ntm, new ReadOnlyTree(after), valueFactory);
+        return new TypeValidator(ntm, new ReadOnlyTree(after), mapper);
     }
 
 }



Mime
View raw message