jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1394094 - in /jackrabbit/oak/trunk: oak-core/src/test/java/org/apache/jackrabbit/oak/query/ oak-http/src/main/java/org/apache/jackrabbit/oak/http/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/
Date Thu, 04 Oct 2012 14:41:02 GMT
Author: mduerig
Date: Thu Oct  4 14:41:01 2012
New Revision: 1394094

URL: http://svn.apache.org/viewvc?rev=1394094&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
- Replace usages of deprecated methods in tests, oak-jcr, oak-http with new methods

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
    jackrabbit/oak/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.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/NodeImpl.java

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=1394094&r1=1394093&r2=1394094&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
Thu Oct  4 14:41:01 2012
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.oak.query;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.jackrabbit.mk.json.JsopTokenizer;
@@ -27,6 +26,8 @@ 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;
 
 /**
  * Utility class for working with jsop string diffs
@@ -81,9 +82,7 @@ public class JsopUtil {
 
     private static void removeTree(Tree t, JsopTokenizer tokenizer) {
         String path = tokenizer.readString();
-        Iterator<String> pathIterator = PathUtils.elements(path).iterator();
-        while (pathIterator.hasNext()) {
-            String p = pathIterator.next();
+        for (String p : PathUtils.elements(path)) {
             if (!t.hasChild(p)) {
                 return;
             }
@@ -108,10 +107,9 @@ public class JsopUtil {
                     mvp.add(CoreValueMapper.fromJsopReader(tokenizer, vf));
                 } while (tokenizer.matches(','));
                 tokenizer.read(']');
-                t.setProperty(key, mvp);
+                t.setProperty(new MultiPropertyState(key, mvp));
             } else {
-                t.setProperty(key, 
-                        CoreValueMapper.fromJsopReader(tokenizer, vf));
+                t.setProperty(new SinglePropertyState(key, CoreValueMapper.fromJsopReader(tokenizer,
vf)));
             }
         } while (tokenizer.matches(','));
     }

Modified: jackrabbit/oak/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.java?rev=1394094&r1=1394093&r2=1394094&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.java
(original)
+++ jackrabbit/oak/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.java
Thu Oct  4 14:41:01 2012
@@ -35,10 +35,8 @@ import com.fasterxml.jackson.dataformat.
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.plugins.memory.MemoryValueFactory;
 import org.apache.tika.mime.MediaType;
 
 public class OakServlet extends HttpServlet {
@@ -135,19 +133,18 @@ public class OakServlet extends HttpServ
                 if (child != null) {
                     child.remove();
                 }
-                CoreValueFactory vf = MemoryValueFactory.INSTANCE;
                 if (value.isNull()) {
                     tree.removeProperty(name);
                 } else if (value.isBoolean()) {
-                    tree.setProperty(name, vf.createValue(value.asBoolean()));
+                    tree.setProperty(name, value.asBoolean());
                 } else if (value.isLong()) {
-                    tree.setProperty(name, vf.createValue(value.asLong()));
+                    tree.setProperty(name, value.asLong());
                 } else if (value.isDouble()) {
-                    tree.setProperty(name, vf.createValue(value.asDouble()));
+                    tree.setProperty(name, value.asDouble());
                 } else if (value.isBigDecimal()) {
-                    tree.setProperty(name, vf.createValue(value.decimalValue()));
+                    tree.setProperty(name, value.decimalValue());
                 } else {
-                    tree.setProperty(name, vf.createValue(value.asText()));
+                    tree.setProperty(name, value.asText());
                 }
             }
         }

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=1394094&r1=1394093&r2=1394094&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 14:41:01 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.SinglePropertyState;
 
 /**
  * {@code NodeDelegate} serve as internal representations of {@code Node}s.
@@ -256,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(name, value);
+        tree.setProperty(new SinglePropertyState(name, value));
         return new PropertyDelegate(sessionDelegate, tree.getLocation().getChild(name));
     }
 

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=1394094&r1=1394093&r2=1394094&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
Thu Oct  4 14:41:01 2012
@@ -64,7 +64,6 @@ import org.apache.jackrabbit.commons.ite
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.Tree.Status;
@@ -1216,14 +1215,13 @@ public class NodeImpl extends ItemImpl<N
         String lockIsDeep = sessionDelegate.getOakPathOrThrow(JCR_LOCK_IS_DEEP);
         try {
             ContentSession session = sessionDelegate.getContentSession();
-            CoreValueFactory factory = session.getCoreValueFactory();
             Root root = session.getLatestRoot();
             Tree tree = root.getTree(dlg.getPath());
             if (tree == null) {
                 throw new ItemNotFoundException();
             }
-            tree.setProperty(lockOwner, factory.createValue(userID));
-            tree.setProperty(lockIsDeep, factory.createValue(isDeep));
+            tree.setProperty(lockOwner, userID);
+            tree.setProperty(lockIsDeep, isDeep);
             root.commit(); // TODO: fail instead?
         } catch (CommitFailedException e) {
             throw new RepositoryException("Unable to lock " + this, e);



Mime
View raw message