jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1394126 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/ oak-core/src/main/java/org/ap...
Date Thu, 04 Oct 2012 16:08:26 GMT
Author: mduerig
Date: Thu Oct  4 16:08:25 2012
New Revision: 1394126

URL: http://svn.apache.org/viewvc?rev=1394126&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
- Replace usages of deprecated Tree.setProperty method with new method and remove the former

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/AnnotatingConflictHandler.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/util/NodeUtil.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java?rev=1394126&r1=1394125&r2=1394126&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java Thu
Oct  4 16:08:25 2012
@@ -18,8 +18,6 @@
  */
 package org.apache.jackrabbit.oak.api;
 
-import java.util.List;
-
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
@@ -219,17 +217,6 @@ public interface Tree {
     Tree addChild(String name);
 
     /**
-     * Set a multivalued valued property state
-     *
-     * @param name The name of this property
-     * @param values The value of this property
-     * @return the affected property state
-     */
-    @Nonnull
-    @Deprecated
-    PropertyState setProperty(String name, @Nonnull List<CoreValue> values);
-
-    /**
      * Set a property state
      * @param property  The property state to set
      */

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java?rev=1394126&r1=1394125&r2=1394126&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
Thu Oct  4 16:08:25 2012
@@ -19,9 +19,7 @@
 package org.apache.jackrabbit.oak.core;
 
 import java.util.Iterator;
-import java.util.List;
 
-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.api.TreeLocation;
@@ -187,12 +185,6 @@ public class ReadOnlyTree implements Tre
     }
 
     @Override
-    @Deprecated
-    public PropertyState setProperty(String name, List<CoreValue> values) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
     public void setProperty(PropertyState property) {
         throw new UnsupportedOperationException();
     }

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=1394126&r1=1394125&r2=1394126&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 Oct  4 16:08:25 2012
@@ -18,7 +18,6 @@
  */
 package org.apache.jackrabbit.oak.core;
 
-import java.util.List;
 import java.util.Map;
 
 import javax.annotation.CheckForNull;
@@ -28,7 +27,6 @@ import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.collect.Iterables;
-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.api.TreeLocation;
@@ -263,17 +261,6 @@ public class TreeImpl implements Tree, P
     }
 
     @Override
-    @Deprecated
-    public PropertyState setProperty(String name, List<CoreValue> values) {
-        NodeBuilder builder = getNodeBuilder();
-        builder.setProperty(name, values);
-        root.purge();
-        PropertyState property = getProperty(name);
-        assert property != null;
-        return property;
-    }
-
-    @Override
     public void setProperty(PropertyState property) {
         NodeBuilder builder = getNodeBuilder();
         builder.setProperty(property);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/AnnotatingConflictHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/AnnotatingConflictHandler.java?rev=1394126&r1=1394125&r2=1394126&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/AnnotatingConflictHandler.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/AnnotatingConflictHandler.java
Thu Oct  4 16:08:25 2012
@@ -21,6 +21,7 @@ import java.util.List;
 
 import javax.jcr.PropertyType;
 
+import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
 import org.apache.jackrabbit.oak.spi.commit.ConflictHandler;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
@@ -134,7 +135,7 @@ public class AnnotatingConflictHandler i
         }
         if (!mixins.contains(MIX_REP_MERGE_CONFLICT)) {
             mixins.add(valueFactory.createValue(MIX_REP_MERGE_CONFLICT, PropertyType.NAME));
-            parent.setProperty(JCR_MIXINTYPES, mixins);
+            parent.setProperty(new MultiPropertyState(JCR_MIXINTYPES, mixins));
         }
 
         return getOrCreateNode(parent, REP_OURS);

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=1394126&r1=1394125&r2=1394126&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
Thu Oct  4 16:08:25 2012
@@ -36,6 +36,7 @@ import org.apache.jackrabbit.oak.api.Cor
 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.MultiPropertyState;
 import org.apache.jackrabbit.oak.spi.security.user.MembershipProvider;
 import org.apache.jackrabbit.oak.spi.security.user.Type;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
@@ -218,7 +219,7 @@ public class MembershipProviderImpl exte
             } else {
                 values = Collections.singletonList(toAdd);
             }
-            groupTree.setProperty(REP_MEMBERS, values);
+            groupTree.setProperty(new MultiPropertyState(REP_MEMBERS, values));
         }
         return true;
     }
@@ -240,7 +241,7 @@ public class MembershipProviderImpl exte
                     if (values.isEmpty()) {
                         groupTree.removeProperty(REP_MEMBERS);
                     } else {
-                        groupTree.setProperty(REP_MEMBERS, values);
+                        groupTree.setProperty(new MultiPropertyState(REP_MEMBERS, values));
                     }
                     return true;
                 }

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=1394126&r1=1394125&r2=1394126&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
Thu Oct  4 16:08:25 2012
@@ -16,14 +16,13 @@
  */
 package org.apache.jackrabbit.oak.util;
 
-import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.List;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
-import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.ValueFactory;
@@ -38,6 +37,7 @@ import org.apache.jackrabbit.oak.api.Tre
 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.util.ISO8601;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,6 +45,8 @@ import org.slf4j.LoggerFactory;
 import static org.apache.jackrabbit.oak.api.Type.DATE;
 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;
 
 /**
  * Utility class for accessing and writing typed content of a tree.
@@ -160,11 +162,7 @@ public class NodeUtil {
     }
 
     public void setStrings(String name, String... values) {
-        List<CoreValue> cvs = new ArrayList<CoreValue>(values.length);
-        for (String value : values) {
-            cvs.add(factory.createValue(value));
-        }
-        tree.setProperty(name, cvs);
+        tree.setProperty(name, Arrays.asList(values), STRINGS);
     }
 
     public String getName(String name) {
@@ -197,11 +195,7 @@ public class NodeUtil {
     }
 
     public void setNames(String name, String... values) {
-        List<CoreValue> cvs = new ArrayList<CoreValue>(values.length);
-        for (String value : values) {
-            cvs.add(factory.createValue(getOakName(value), PropertyType.NAME));
-        }
-        tree.setProperty(name, cvs);
+        tree.setProperty(name, Arrays.asList(values), NAMES);
     }
 
     public void setDate(String name, long time) {
@@ -242,7 +236,7 @@ public class NodeUtil {
                 log.warn("Unable to convert a default value", e);
             }
         }
-        tree.setProperty(name, cvs);
+        tree.setProperty(new MultiPropertyState(name, cvs));
     }
 
     public void setValues(String name, String[] values, int type) {
@@ -250,7 +244,7 @@ public class NodeUtil {
         for (String value : values) {
             cvs.add(factory.createValue(value, type));
         }
-        tree.setProperty(name, cvs);
+        tree.setProperty(new MultiPropertyState(name, cvs));
     }
 
     public Value[] getValues(String name, ValueFactory vf) {

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=1394126&r1=1394125&r2=1394126&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
Thu Oct  4 16:08:25 2012
@@ -39,6 +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;
 
 /**
@@ -239,7 +240,7 @@ public class NodeDelegate extends ItemDe
                 order.add(factory.createValue(source));
             }
 
-            tree.setProperty(PropertyState.OAK_CHILD_ORDER, order);
+            tree.setProperty(new MultiPropertyState(PropertyState.OAK_CHILD_ORDER, order));
         }
     }
 
@@ -279,7 +280,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(name, value);
+        tree.setProperty(new MultiPropertyState(name, value));
         return new PropertyDelegate(sessionDelegate, tree.getLocation().getChild(name));
     }
 



Mime
View raw message