jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1394132 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: plugins/index/lucene/ plugins/memory/ plugins/type/ spi/state/
Date Thu, 04 Oct 2012 16:20:31 GMT
Author: mduerig
Date: Thu Oct  4 16:20:31 2012
New Revision: 1394132

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

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java?rev=1394132&r1=1394131&r2=1394132&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java
Thu Oct  4 16:20:31 2012
@@ -16,13 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.lucene;
 
-import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
-import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
-import static org.apache.jackrabbit.oak.plugins.index.lucene.FieldFactory.newPathField;
-import static org.apache.jackrabbit.oak.plugins.index.lucene.FieldFactory.newPropertyField;
-import static org.apache.jackrabbit.oak.plugins.index.lucene.TermFactory.newPathTerm;
-import static org.apache.jackrabbit.oak.spi.query.IndexDefinition.INDEX_DATA_CHILD_NAME;
-
 import java.io.IOException;
 
 import javax.jcr.PropertyType;
@@ -30,7 +23,6 @@ import javax.jcr.PropertyType;
 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.LongValue;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.IndexDefinition;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
@@ -48,6 +40,13 @@ import org.apache.lucene.util.Version;
 import org.apache.tika.Tika;
 import org.apache.tika.exception.TikaException;
 
+import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
+import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
+import static org.apache.jackrabbit.oak.plugins.index.lucene.FieldFactory.newPathField;
+import static org.apache.jackrabbit.oak.plugins.index.lucene.FieldFactory.newPropertyField;
+import static org.apache.jackrabbit.oak.plugins.index.lucene.TermFactory.newPathTerm;
+import static org.apache.jackrabbit.oak.spi.query.IndexDefinition.INDEX_DATA_CHILD_NAME;
+
 /**
  * This class updates a Lucene index when node content is changed.
  */
@@ -98,8 +97,7 @@ class LuceneEditor implements CommitHook
                 diff.postProcess(after);
             } finally {
                 writer.close();
-                builder.setProperty(INDEX_UPDATE,
-                        new LongValue(System.currentTimeMillis()));
+                builder.setProperty(INDEX_UPDATE, System.currentTimeMillis());
             }
             return rootBuilder.getNodeState();
         } catch (IOException e) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java?rev=1394132&r1=1394131&r2=1394132&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
Thu Oct  4 16:20:31 2012
@@ -18,8 +18,6 @@ package org.apache.jackrabbit.oak.plugin
 
 import java.io.IOException;
 
-import org.apache.jackrabbit.oak.plugins.memory.BinaryValue;
-import org.apache.jackrabbit.oak.plugins.memory.LongValue;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
@@ -106,10 +104,8 @@ public class ReadWriteOakDirectory exten
             }
 
             NodeBuilder fileBuilder = directoryBuilder.getChildBuilder(name);
-            fileBuilder.setProperty(
-                    "jcr:lastModified",
-                    new LongValue(System.currentTimeMillis()));
-            fileBuilder.setProperty("jcr:data", new BinaryValue(data));
+            fileBuilder.setProperty("jcr:lastModified", System.currentTimeMillis());
+            fileBuilder.setProperty("jcr:data", data);
         }
 
         @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1394132&r1=1394131&r2=1394132&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Thu Oct  4 16:20:31 2012
@@ -281,14 +281,6 @@ public class MemoryNodeBuilder implement
     }
 
     @Override @Nonnull @Deprecated
-    public NodeBuilder setProperty(String name, CoreValue value) {
-        MutableNodeState mstate = write();
-        mstate.props.put(name, new SinglePropertyState(name, value));
-        updated();
-        return this;
-    }
-
-    @Override @Nonnull @Deprecated
     public NodeBuilder setProperty(String name, List<CoreValue> values) {
         MutableNodeState mstate = write();
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java?rev=1394132&r1=1394131&r2=1394132&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java
Thu Oct  4 16:20:31 2012
@@ -16,11 +16,7 @@
  */
 package org.apache.jackrabbit.oak.plugins.type;
 
-import javax.jcr.PropertyType;
-
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.plugins.memory.GenericValue;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff;
@@ -37,11 +33,9 @@ public class DefaultTypeEditor implement
     public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
         // TODO: Calculate default type from the node definition
-        CoreValue defaultType =
-                new GenericValue(PropertyType.NAME, "nt:unstructured");
         NodeBuilder builder = after.getBuilder();
         after.compareAgainstBaseState(
-                before, new DefaultTypeDiff(builder, defaultType));
+                before, new DefaultTypeDiff(builder, "nt:unstructured"));
         return builder.getNodeState();
     }
 
@@ -49,9 +43,9 @@ public class DefaultTypeEditor implement
 
         private final NodeBuilder builder;
 
-        private final CoreValue defaultType;
+        private final String defaultType;
 
-        public DefaultTypeDiff(NodeBuilder builder, CoreValue defaultType) {
+        public DefaultTypeDiff(NodeBuilder builder, String defaultType) {
             this.builder = builder;
             this.defaultType = defaultType;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java?rev=1394132&r1=1394131&r2=1394132&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
Thu Oct  4 16:20:31 2012
@@ -108,17 +108,6 @@ public interface NodeBuilder {
      * Set a property.
      *
      * @param name property name
-     * @param value
-     * @return this builder
-     */
-    @Deprecated
-    @Nonnull
-    NodeBuilder setProperty(String name, @Nonnull CoreValue value);
-
-    /**
-     * Set a property.
-     *
-     * @param name property name
      * @param values
      * @return this builder
      */

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java?rev=1394132&r1=1394131&r2=1394132&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
Thu Oct  4 16:20:31 2012
@@ -86,11 +86,6 @@ public class ReadOnlyBuilder implements 
     }
 
     @Override @Nonnull @Deprecated
-    public NodeBuilder setProperty(String name, CoreValue value) {
-        throw unsupported();
-    }
-
-    @Override @Nonnull @Deprecated
     public NodeBuilder setProperty(String name, List<CoreValue> values) {
         throw unsupported();
     }



Mime
View raw message