jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1394624 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ oak-core...
Date Fri, 05 Oct 2012 16:22:30 GMT
Author: mduerig
Date: Fri Oct  5 16:22:29 2012
New Revision: 1394624

URL: http://svn.apache.org/viewvc?rev=1394624&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
- use static factory instead of instance constructor

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.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/kernel/KernelNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
Fri Oct  5 16:22:29 2012
@@ -18,10 +18,6 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.jackrabbit.oak.kernel.CoreValueMapper.fromJsopReader;
-import static org.apache.jackrabbit.oak.kernel.CoreValueMapper.listFromJsopReader;
-
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -32,6 +28,10 @@ import java.util.concurrent.ExecutionExc
 
 import javax.annotation.Nonnull;
 
+import com.google.common.base.Function;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.mk.json.JsopReader;
@@ -39,8 +39,7 @@ import org.apache.jackrabbit.mk.json.Jso
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder;
-import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.state.AbstractChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeState;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
@@ -48,10 +47,9 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
 
-import com.google.common.base.Function;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.oak.kernel.CoreValueMapper.fromJsopReader;
+import static org.apache.jackrabbit.oak.kernel.CoreValueMapper.listFromJsopReader;
 
 /**
  * Basic {@link NodeState} implementation based on the {@link MicroKernel}
@@ -126,10 +124,10 @@ public final class KernelNodeState exten
                     childPaths.put(name, childPath);
                 } else if (reader.matches('[')) {
                     List<CoreValue> values = listFromJsopReader(reader, kernel);
-                    properties.put(name, new MultiPropertyState(name, values));
+                    properties.put(name, PropertyStates.createProperty(name, values));
                 } else {
                     CoreValue cv = fromJsopReader(reader, kernel);
-                    properties.put(name, new SinglePropertyState(name, cv));
+                    properties.put(name, PropertyStates.createProperty(name, cv));
                 }
             } while (reader.matches(','));
             reader.read('}');

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
Fri Oct  5 16:22:29 2012
@@ -22,19 +22,18 @@ import java.util.Set;
 
 import javax.jcr.PropertyType;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.plugins.memory.CoreValues;
-import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.plugins.memory.StringValue;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
 class PropertyIndexUpdate {
 
     private final String path;
@@ -97,7 +96,7 @@ class PropertyIndexUpdate {
                 if (values.isEmpty()) {
                     index.removeProperty(encoded);
                 } else {
-                    index.setProperty(new MultiPropertyState(encoded, values));
+                    index.setProperty(PropertyStates.createProperty(encoded, values));
                 }
             }
         }
@@ -122,7 +121,7 @@ class PropertyIndexUpdate {
                 throw new CommitFailedException(
                         "Uniqueness constraint violated");
             } else {
-                index.setProperty(new MultiPropertyState(encoded, values));
+                index.setProperty(PropertyStates.createProperty(encoded, values));
             }
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java
Fri Oct  5 16:22:29 2012
@@ -39,7 +39,7 @@ public class MultiPropertyState extends 
 
     private final List<CoreValue> values;
 
-    public MultiPropertyState(String name, List<CoreValue> values) {
+    MultiPropertyState(String name, List<CoreValue> values) {
         super(name, getBaseType(values));
         this.values = Collections.unmodifiableList(
                 new ArrayList<CoreValue>(checkNotNull(values)));

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java
Fri Oct  5 16:22:29 2012
@@ -18,6 +18,16 @@ import org.apache.jackrabbit.oak.api.Typ
 public final class PropertyStates {
     private PropertyStates() {}
 
+    @Nonnull
+    public static PropertyState createProperty(String name, CoreValue value) {
+        return new SinglePropertyState(name, value);
+    }
+
+    @Nonnull
+    public static PropertyState createProperty(String name, List<CoreValue> values)
{
+        return new MultiPropertyState(name, values);
+    }
+
     @SuppressWarnings("unchecked")
     @Nonnull
     public static <T> PropertyState createProperty(String name, T value, Type<T>
type) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java
Fri Oct  5 16:22:29 2012
@@ -23,7 +23,6 @@ import java.util.Collections;
 import javax.jcr.PropertyType;
 
 import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Type;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -32,26 +31,9 @@ import static com.google.common.base.Pre
  * Single-valued property state.
  */
 public class SinglePropertyState extends EmptyPropertyState {
-
-    public static PropertyState create(String name, boolean value) {
-        return new SinglePropertyState(name, BooleanValue.create(value));
-    }
-
-    public static PropertyState create(String name, double value) {
-        return new SinglePropertyState(name, new DoubleValue(value));
-    }
-
-    public static PropertyState create(String name, long value) {
-        return new SinglePropertyState(name, new LongValue(value));
-    }
-
-    public static PropertyState create(String name, String value) {
-        return new SinglePropertyState(name, new StringValue(value));
-    }
-
     private final CoreValue value;
 
-    public SinglePropertyState(String name, CoreValue value) {
+    SinglePropertyState(String name, CoreValue value) {
         super(name, Type.fromTag(value.getType(), false));
         this.value = checkNotNull(value);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
Fri Oct  5 16:22:29 2012
@@ -20,7 +20,7 @@ package org.apache.jackrabbit.oak.query.
 
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.query.Query;
 
 /**
@@ -64,7 +64,7 @@ public class ColumnImpl extends AstEleme
                 return null;
             }
             CoreValue v = query.getValueFactory().createValue(p);
-            return new SinglePropertyState(Query.JCR_PATH, v);
+            return PropertyStates.createProperty(Query.JCR_PATH, v);
         }
         return selector.currentProperty(propertyName);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java
Fri Oct  5 16:22:29 2012
@@ -20,7 +20,7 @@ package org.apache.jackrabbit.oak.query.
 
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.query.Query;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 
@@ -52,7 +52,7 @@ public class FullTextSearchScoreImpl ext
         if (p == null) {
             // TODO if score() is not supported by the index, use the value 0.0?
             CoreValue v = query.getValueFactory().createValue(0.0);
-            p = new SinglePropertyState(Query.JCR_SCORE, v);
+            p = PropertyStates.createProperty(Query.JCR_SCORE, v);
         }
         return p;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
Fri Oct  5 16:22:29 2012
@@ -19,9 +19,10 @@
 package org.apache.jackrabbit.oak.query.ast;
 
 import javax.jcr.PropertyType;
+
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 
 /**
@@ -58,7 +59,7 @@ public class LengthImpl extends DynamicO
         if (!p.isArray()) {
             long length = p.size();
             CoreValue v = query.getValueFactory().createValue(length);
-            return new SinglePropertyState("LENGTH", v);
+            return PropertyStates.createProperty("LENGTH", v);
         }
         // TODO what is the expected result for LENGTH(multiValueProperty)?
         throw new IllegalArgumentException("LENGTH(x) on multi-valued property is not supported");

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java
Fri Oct  5 16:22:29 2012
@@ -18,10 +18,10 @@
  */
 package org.apache.jackrabbit.oak.query.ast;
 
-import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 import org.apache.jackrabbit.util.ISO9075;
 
@@ -60,7 +60,7 @@ public class NodeLocalNameImpl extends D
         // TODO LOCALNAME: evaluation of local name might not be correct
         String localName = colon < 0 ? name : name.substring(colon + 1);
         CoreValue v = query.getValueFactory().createValue(localName);
-        return new SinglePropertyState("LOCALNAME", v);
+        return PropertyStates.createProperty("LOCALNAME", v);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
Fri Oct  5 16:22:29 2012
@@ -19,10 +19,11 @@
 package org.apache.jackrabbit.oak.query.ast;
 
 import javax.jcr.PropertyType;
+
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 import org.apache.jackrabbit.util.ISO9075;
 
@@ -63,7 +64,7 @@ public class NodeNameImpl extends Dynami
         // Name escaping (convert space to _x0020_)
         String name = ISO9075.encode(PathUtils.getName(path));
         CoreValue v2 = query.getValueFactory().createValue(name, PropertyType.NAME);
-        return new SinglePropertyState("NAME", v2);
+        return PropertyStates.createProperty("NAME", v2);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
Fri Oct  5 16:22:29 2012
@@ -28,7 +28,7 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.memory.CoreValues;
-import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.query.SQL2Parser;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 
@@ -125,8 +125,7 @@ public class PropertyValueImpl extends D
                 }
             }
         }
-        MultiPropertyState mv = new MultiPropertyState("*", values);
-        return mv;
+        return PropertyStates.createProperty("*", values);
     }
 
     private boolean matchesPropertyType(PropertyState state) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
Fri Oct  5 16:22:29 2012
@@ -30,7 +30,7 @@ import com.google.common.collect.Immutab
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants;
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
 import org.apache.jackrabbit.oak.query.Query;
@@ -229,7 +229,7 @@ public class SelectorImpl extends Source
                 return null;
             }
             CoreValue v = query.getValueFactory().createValue(local);
-            return new SinglePropertyState(Query.JCR_PATH, v);
+            return PropertyStates.createProperty(Query.JCR_PATH, v);
         }
         if (cursor == null) {
             return null;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
Fri Oct  5 16:22:29 2012
@@ -21,6 +21,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+
 import javax.annotation.Nullable;
 import javax.jcr.PropertyType;
 
@@ -29,16 +30,15 @@ import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Iterators;
 import com.google.common.collect.Lists;
-
 import org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.plugins.memory.CoreValues;
-import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
-import org.apache.jackrabbit.oak.spi.security.user.MembershipProvider;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
+import org.apache.jackrabbit.oak.spi.security.user.MembershipProvider;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.slf4j.Logger;
@@ -221,7 +221,7 @@ public class MembershipProviderImpl exte
             } else {
                 values = Collections.singletonList(toAdd);
             }
-            groupTree.setProperty(new MultiPropertyState(REP_MEMBERS, values));
+            groupTree.setProperty(PropertyStates.createProperty(REP_MEMBERS, values));
         }
         return true;
     }
@@ -243,7 +243,7 @@ public class MembershipProviderImpl exte
                     if (values.isEmpty()) {
                         groupTree.removeProperty(REP_MEMBERS);
                     } else {
-                        groupTree.setProperty(new MultiPropertyState(REP_MEMBERS, values));
+                        groupTree.setProperty(PropertyStates.createProperty(REP_MEMBERS,
values));
                     }
                     return true;
                 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
Fri Oct  5 16:22:29 2012
@@ -22,6 +22,7 @@ import java.security.Principal;
 import java.text.ParseException;
 import java.util.Collections;
 import java.util.Iterator;
+
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ConstraintViolationException;
@@ -36,11 +37,11 @@ import org.apache.jackrabbit.oak.api.Res
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider;
 import org.apache.jackrabbit.oak.spi.security.principal.TreeBasedPrincipal;
-import org.apache.jackrabbit.oak.spi.security.user.PasswordUtility;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
+import org.apache.jackrabbit.oak.spi.security.user.PasswordUtility;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.apache.jackrabbit.oak.spi.security.user.UserProvider;
@@ -303,7 +304,7 @@ class UserProviderImpl extends Authoriza
             authorizableTree.removeProperty(propertyName);
         } else {
             CoreValue cv = valueFactory.createValue(value, propertyType);
-            authorizableTree.setProperty(new SinglePropertyState(propertyName, cv));
+            authorizableTree.setProperty(PropertyStates.createProperty(propertyName, cv));
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
Fri Oct  5 16:22:29 2012
@@ -38,7 +38,7 @@ import org.apache.jackrabbit.oak.api.Typ
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryValueFactory;
-import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.util.ISO8601;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,8 +48,8 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.api.Type.LONG;
 import static org.apache.jackrabbit.oak.api.Type.NAME;
 import static org.apache.jackrabbit.oak.api.Type.NAMES;
-import static org.apache.jackrabbit.oak.api.Type.STRINGS;
 import static org.apache.jackrabbit.oak.api.Type.STRING;
+import static org.apache.jackrabbit.oak.api.Type.STRINGS;
 
 /**
  * Utility class for accessing and writing typed content of a tree.
@@ -230,7 +230,7 @@ public class NodeUtil {
                 log.warn("Unable to convert a default value", e);
             }
         }
-        tree.setProperty(new MultiPropertyState(name, cvs));
+        tree.setProperty(PropertyStates.createProperty(name, cvs));
     }
 
     public void setValues(String name, String[] values, int type) {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java
Fri Oct  5 16:22:29 2012
@@ -19,7 +19,7 @@ package org.apache.jackrabbit.oak.kernel
 import com.google.common.collect.ImmutableMap;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.junit.Test;
 
@@ -30,22 +30,22 @@ public class JsopDiffTest {
     @Test
     public void testPropertyChanges() {
         JsopDiff diff;
-        PropertyState before = SinglePropertyState.create("foo", "bar");
+        PropertyState before = PropertyStates.stringProperty("foo", "bar");
 
         diff = new JsopDiff(null);
         diff.propertyAdded(before);
         assertEquals("^\"/foo\":\"bar\"", diff.toString());
 
         diff = new JsopDiff(null);
-        diff.propertyChanged(before, SinglePropertyState.create("foo", 123));
+        diff.propertyChanged(before, PropertyStates.longProperty("foo", 123L));
         assertEquals("^\"/foo\":123", diff.toString());
 
         diff = new JsopDiff(null);
-        diff.propertyChanged(before, SinglePropertyState.create("foo", 1.23));
+        diff.propertyChanged(before, PropertyStates.doubleProperty("foo", 1.23));
         assertEquals("^\"/foo\":\"dou:1.23\"", diff.toString()); // TODO: 1.23?
 
         diff = new JsopDiff(null);
-        diff.propertyChanged(before, SinglePropertyState.create("foo", true));
+        diff.propertyChanged(before, PropertyStates.booleanProperty("foo", true));
         assertEquals("^\"/foo\":true", diff.toString());
 
         diff = new JsopDiff(null);
@@ -59,7 +59,7 @@ public class JsopDiffTest {
         NodeState before = MemoryNodeState.EMPTY_NODE;
         NodeState after = new MemoryNodeState(
                 ImmutableMap.<String, PropertyState>of(
-                        "a", SinglePropertyState.create("a", 1)),
+                        "a", PropertyStates.longProperty("a", 1L)),
                 ImmutableMap.of(
                         "x", MemoryNodeState.EMPTY_NODE));
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
Fri Oct  5 16:22:29 2012
@@ -34,9 +34,9 @@ public class MemoryNodeBuilderTest {
 
     private static final NodeState BASE = new MemoryNodeState(
             ImmutableMap.<String, PropertyState>of(
-                    "a", SinglePropertyState.create("a", 1),
-                    "b", SinglePropertyState.create("b", 2),
-                    "c", SinglePropertyState.create("c", 3)),
+                    "a", PropertyStates.longProperty("a", 1L),
+                    "b", PropertyStates.longProperty("b", 2L),
+                    "c", PropertyStates.longProperty("c", 3L)),
             ImmutableMap.of(
                     "x", MemoryNodeState.EMPTY_NODE,
                     "y", MemoryNodeState.EMPTY_NODE,

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
Fri Oct  5 16:22:29 2012
@@ -26,8 +26,7 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.kernel.CoreValueMapper;
-import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 
 /**
  * Utility class for working with jsop string diffs
@@ -107,9 +106,9 @@ public class JsopUtil {
                     mvp.add(CoreValueMapper.fromJsopReader(tokenizer, vf));
                 } while (tokenizer.matches(','));
                 tokenizer.read(']');
-                t.setProperty(new MultiPropertyState(key, mvp));
+                t.setProperty(PropertyStates.createProperty(key, mvp));
             } else {
-                t.setProperty(new SinglePropertyState(key, CoreValueMapper.fromJsopReader(tokenizer,
vf)));
+                t.setProperty(PropertyStates.createProperty(key, CoreValueMapper.fromJsopReader(tokenizer,
vf)));
             }
         } while (tokenizer.matches(','));
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1394624&r1=1394623&r2=1394624&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
Fri Oct  5 16:22:29 2012
@@ -39,8 +39,7 @@ 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.api.TreeLocation;
-import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 
 import static org.apache.jackrabbit.oak.api.Type.STRINGS;
 
@@ -240,7 +239,7 @@ public class NodeDelegate extends ItemDe
                 order.add(factory.createValue(source));
             }
 
-            tree.setProperty(new MultiPropertyState(PropertyState.OAK_CHILD_ORDER, order));
+            tree.setProperty(PropertyStates.createProperty(PropertyState.OAK_CHILD_ORDER,
order));
         }
     }
 
@@ -258,7 +257,7 @@ public class NodeDelegate extends ItemDe
         if (old != null && old.isArray()) {
             throw new ValueFormatException("Attempt to set a single value to multi-valued
property.");
         }
-        tree.setProperty(new SinglePropertyState(name, value));
+        tree.setProperty(PropertyStates.createProperty(name, value));
         return new PropertyDelegate(sessionDelegate, tree.getLocation().getChild(name));
     }
 
@@ -280,7 +279,7 @@ public class NodeDelegate extends ItemDe
         if (old != null && ! old.isArray()) {
             throw new ValueFormatException("Attempt to set multiple values to single valued
property.");
         }
-        tree.setProperty(new MultiPropertyState(name, value));
+        tree.setProperty(PropertyStates.createProperty(name, value));
         return new PropertyDelegate(sessionDelegate, tree.getLocation().getChild(name));
     }
 

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=1394624&r1=1394623&r2=1394624&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
Fri Oct  5 16:22:29 2012
@@ -30,8 +30,7 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.api.TreeLocation;
 import org.apache.jackrabbit.oak.core.TreeImpl.PropertyLocation;
 import org.apache.jackrabbit.oak.plugins.memory.CoreValues;
-import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
-import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.util.TODO;
 
 /**
@@ -183,7 +182,7 @@ public class PropertyDelegate extends It
      * @param value
      */
     public void setValue(CoreValue value) throws InvalidItemStateException {
-        getLocation().set(new SinglePropertyState(getName(), value));
+        getLocation().set(PropertyStates.createProperty(getName(), value));
     }
 
     /**
@@ -191,7 +190,7 @@ public class PropertyDelegate extends It
      * @param values
      */
     public void setValues(List<CoreValue> values) throws InvalidItemStateException
{
-        getLocation().set(new MultiPropertyState(getName(), values));
+        getLocation().set(PropertyStates.createProperty(getName(), values));
     }
 
     /**



Mime
View raw message