jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1324601 - 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/kernel/ oak-core/src/test/java/org/apache/jac...
Date Wed, 11 Apr 2012 07:24:22 GMT
Author: jukka
Date: Wed Apr 11 07:24:21 2012
New Revision: 1324601

URL: http://svn.apache.org/viewvc?rev=1324601&view=rev
Log:
OAK-18: Define Oak API

Copy tree model interfaces from .mk.model in oak-mk to .oak.api in oak-core.
This makes .oak.api independent of oak-mk.

Remove Scalar and NodeStateEditor from oak-mk as they are not used there

Remove PropertyState.getEncodedValue from oak-core as it's not used there

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChildNodeEntry.java
      - copied, changed from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java
      - copied, changed from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStateEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStore.java
      - copied, changed from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java
      - copied, changed from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Scalar.java
      - copied, changed from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractChildNodeEntry.java
      - copied, changed from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractPropertyState.java
      - copied, changed from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ScalarImpl.java
      - copied, changed from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ScalarImpl.java
Removed:
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStateEditor.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ScalarImpl.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelChildNodeEntry.java
    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/kernel/KernelNodeStateEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/util/ValueConverter.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsonBuilder.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/AbstractRevisionStore.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/StoredNodeAsState.java

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChildNodeEntry.java (from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChildNodeEntry.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChildNodeEntry.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java&r1=1324586&r2=1324601&rev=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ChildNodeEntry.java Wed Apr 11 07:24:21 2012
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,32 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mk.model;
-
-import java.io.InputStream;
+package org.apache.jackrabbit.oak.api;
 
 /**
- * An immutable, typed scalar value.
+ * TODO: document
+ *
+ * <h2>Equality and hash codes</h2>
+ * <p>
+ * Two child node entries are considered equal if and only if their names
+ * and referenced node states match. The {@link Object#equals(Object)}
+ * method needs to be implemented so that it complies with this definition.
+ * And while child node entries are not meant for use as hash keys, the
+ * {@link Object#hashCode()} method should still be implemented according
+ * to this equality contract.
  */
-public interface Scalar {
-    enum Type {BOOLEAN, LONG, DOUBLE, BINARY, STRING, NULL}
+public interface ChildNodeEntry {
 
     /**
-     * Returns the value type.
-     * <p>
-     *
-     * @return value type
+     * TODO: document
      */
-    Type getType();
-
-    boolean getBoolean();
-
-    long getLong();
+    String getName();
 
-    double getDouble();
-
-    InputStream getInputStream();
-
-    String getString();
+    /**
+     * TODO: document
+     */
+    NodeState getNode();
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java Wed Apr 11 07:24:21 2012
@@ -16,9 +16,6 @@
  */
 package org.apache.jackrabbit.oak.api;
 
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.NodeStateEditor;
-
 import java.io.Closeable;
 
 /**

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeState.java?rev=1324601&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeState.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeState.java Wed Apr 11 07:24:21 2012
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.api;
+
+/**
+ * A content tree consists of nodes and properties, each of which
+ * evolves through different states during its lifecycle. This interface
+ * represents a specific, immutable state of a node in a content tree.
+ * A node consists of an unordered set of name -&gt; item mappings, where
+ * each item is either a property or a child node.
+ * <p>
+ * Depending on context, a NodeState instance can be interpreted as
+ * representing the state of just that node, of the subtree starting at
+ * that node, or of an entire tree in case it's a root node.
+ * <p>
+ * The crucial difference between this interface and the similarly named
+ * class in Jackrabbit 2.x is that this interface represents a specific,
+ * immutable state of a node, whereas the Jackrabbit 2.x class represented
+ * the <em>current</em> state of a node.
+ *
+ * <h2>Immutability and thread-safety</h2>
+ * <p>
+ * As mentioned above, all node and property states are always immutable.
+ * Thus repeating a method call is always guaranteed to produce the same
+ * result as before unless some internal error occurs (see below). This
+ * immutability only applies to a specific state instance. Different states
+ * of a node can obviously be different, and in some cases even different
+ * instances of the same state may behave slightly differently. For example
+ * due to performance optimization or other similar changes the iteration
+ * order of properties or child nodes may be different for two instances
+ * of the same state.
+ * <p>
+ * In addition to being immutable, a specific state instance guaranteed to
+ * be fully thread-safe. Possible caching or other internal changes need to
+ * be properly synchronized so that any number of concurrent clients can
+ * safely access a state instance.
+ *
+ * <h2>Persistence and error-handling</h2>
+ * <p>
+ * A node state can be (and often is) backed by local files or network
+ * resources. All IO operations or related concerns like caching should be
+ * handled transparently below this interface. Potential IO problems and
+ * recovery attempts like retrying a timed-out network access need to be
+ * handled below this interface, and only hard errors should be thrown up
+ * as {@link RuntimeException unchecked exceptions} that higher level code
+ * is not expected to be able to recover from.
+ * <p>
+ * Since this interface exposes no higher level constructs like access
+ * controls, locking, node types or even path parsing, there's no way
+ * for content access to fail because of such concerns. Such functionality
+ * and related checked exceptions or other control flow constructs should
+ * be implemented on a higher level above this interface.
+ *
+ * <h2>Decoration and virtual content</h2>
+ * <p>
+ * Not all content exposed by this interface needs to be backed by actual
+ * persisted data. An implementation may want to provide derived data,
+ * like for example the aggregate size of the entire subtree as an
+ * extra virtual property. A virtualization, sharding or caching layer
+ * could provide a composite view over multiple underlying content trees.
+ * Or a basic access control layer could decide to hide certain content
+ * based on specific rules. All such features need to be implemented
+ * according to the API contract of this interface. A separate higher level
+ * interface needs to be used if an implementation can't for example
+ * guarantee immutability of exposed content as discussed above.
+ *
+ * <h2>Equality and hash codes</h2>
+ * <p>
+ * Two node states are considered equal if and only if their properties and
+ * child nodes match, regardless of ordering. The
+ * {@link Object#equals(Object)} method needs to be implemented so that it
+ * complies with this definition. And while node states are not meant for
+ * use as hash keys, the {@link Object#hashCode()} method should still be
+ * implemented according to this equality contract.
+ */
+public interface NodeState {
+
+    /**
+     * Returns the named property. The name is an opaque string and
+     * is not parsed or otherwise interpreted by this method.
+     * <p>
+     * The namespace of properties and child nodes is shared, so if
+     * this method returns a non-<code>null</code> value for a given
+     * name, then {@link #getChildNode(String)} is guaranteed to return
+     * <code>null</code> for the same name.
+     *
+     * @param name name of the property to return
+     * @return named property, or <code>null</code> if not found
+     */
+    PropertyState getProperty(String name);
+
+    /**
+     * Returns the number of properties of this node.
+     *
+     * @return number of properties
+     */
+    long getPropertyCount();
+
+    /**
+     * Returns an iterable of the properties of this node. Multiple
+     * iterations are guaranteed to return the properties in the same
+     * order, but the specific order used is implementation-dependent
+     * and may change across different states of the same node.
+     *
+     * @return properties in some stable order
+     */
+    Iterable<? extends PropertyState> getProperties();
+
+    /**
+     * Returns the named child node. The name is an opaque string and
+     * is not parsed or otherwise interpreted by this method.
+     * <p>
+     * The namespace of properties and child nodes is shared, so if
+     * this method returns a non-<code>null</code> value for a given
+     * name, then {@link #getProperty(String)} is guaranteed to return
+     * <code>null</code> for the same name.
+     *
+     * @param name name of the child node to return
+     * @return named child node, or <code>null</code> if not found
+     */
+    NodeState getChildNode(String name);
+
+    /**
+     * Returns the number of child nodes of this node.
+     *
+     * @return number of child nodes
+     */
+    long getChildNodeCount();
+
+    /**
+     * Returns an iterable of the child node entries starting from the
+     * given offset. Multiple iterations are guaranteed to return the
+     * child nodes in the same order, but the specific order used is
+     * implementation-dependent and may change across different states
+     * of the same node. An empty iterable is returned if the given
+     * offset is greater than the offset of the last child node entry.
+     *
+     * @param offset zero-based offset of the first entry to return
+     * @param count  maximum number of entries to return,
+     *               or -1 for all remaining entries
+     * @return requested child node entries in some stable order
+     */
+    Iterable<? extends ChildNodeEntry> getChildNodeEntries(long offset, int count);
+
+}

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateDiff.java?rev=1324601&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateDiff.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateDiff.java Wed Apr 11 07:24:21 2012
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.api;
+
+/**
+ * Handler of node state differences.
+ * The {@link NodeStore#compare(NodeState, NodeState, NodeStateDiff)} reports
+ * detected node state differences by calling methods of a handler instance
+ * that implements this interface. The compare method will go through all
+ * properties and child nodes of the two states, calling the relevant
+ * added, changed or deleted methods where appropriate. Differences in
+ * the ordering of properties or child nodes do not affect the comparison,
+ * and the order in which such differences are reported is unspecified.
+ */
+public interface NodeStateDiff {
+
+    /**
+     * Called for all added properties.
+     *
+     * @param after property state after the change
+     */
+    void propertyAdded(PropertyState after);
+
+    /**
+     * Called for all changed properties. The names of the given two
+     * property states are guaranteed to be the same.
+     *
+     * @param before property state before the change
+     * @param after property state after the change
+     */
+    void propertyChanged(PropertyState before, PropertyState after);
+
+    /**
+     * Called for all deleted properties.
+     *
+     * @param before property state before the change
+     */
+    void propertyDeleted(PropertyState before);
+
+    /**
+     * Called for all added child nodes.
+     *
+     * @param name name of the added child node
+     * @param after child node state after the change
+     */
+    void childNodeAdded(String name, NodeState after);
+
+    /**
+     * Called for all changed child nodes.
+     *
+     * @param name name of the changed child node
+     * @param before child node state before the change
+     * @param after child node state after the change
+     */
+    void childNodeChanged(String name, NodeState before, NodeState after);
+
+    /**
+     * Called for all deleted child nodes.
+     *
+     * @param name name of the deleted child node
+     * @param before child node state before the change
+     */
+    void childNodeDeleted(String name, NodeState before);
+
+}

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java (from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStateEditor.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStateEditor.java&r1=1324586&r2=1324601&rev=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStateEditor.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java Wed Apr 11 07:24:21 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.mk.model;
+package org.apache.jackrabbit.oak.api;
 
 import java.util.List;
 

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStore.java (from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStore.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStore.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java&r1=1324586&r2=1324601&rev=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStore.java Wed Apr 11 07:24:21 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mk.model;
+package org.apache.jackrabbit.oak.api;
 
 /**
  * Storage abstraction for content trees. At any given point in time

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java (from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java&r1=1324586&r2=1324601&rev=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java Wed Apr 11 07:24:21 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mk.model;
+package org.apache.jackrabbit.oak.api;
 
 /**
  * Immutable property state. A property consists of a name and
@@ -37,11 +37,6 @@ public interface PropertyState {
     String getName();
 
     /**
-     * @return the JSON encoded value of this property state.
-     */
-    String getEncodedValue();
-
-    /**
      * Determine whether this is a multi valued property
      * @return  {@code true} if and only if this is a multi valued property.
      */

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Scalar.java (from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Scalar.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Scalar.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java&r1=1324586&r2=1324601&rev=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Scalar.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Scalar.java Wed Apr 11 07:24:21 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mk.model;
+package org.apache.jackrabbit.oak.api;
 
 import java.io.InputStream;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ConnectionImpl.java Wed Apr 11 07:24:21 2012
@@ -18,12 +18,12 @@ package org.apache.jackrabbit.oak.core;
 
 import org.apache.jackrabbit.mk.MicroKernelFactory;
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.NodeStateEditor;
-import org.apache.jackrabbit.mk.model.NodeStore;
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.Connection;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.NodeStateEditor;
+import org.apache.jackrabbit.oak.api.NodeStore;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractChildNodeEntry.java (from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractChildNodeEntry.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractChildNodeEntry.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java&r1=1324586&r2=1324601&rev=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractChildNodeEntry.java Wed Apr 11 07:24:21 2012
@@ -14,56 +14,47 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mk.model;
+package org.apache.jackrabbit.oak.kernel;
 
-import org.apache.jackrabbit.mk.json.JsonBuilder;
+import org.apache.jackrabbit.oak.api.ChildNodeEntry;
 
 /**
- * Abstract base class for {@link PropertyState} implementations.
+ * Abstract base class for {@link ChildNodeEntry} implementations.
  * This base class contains default implementations of the
  * {@link #equals(Object)} and {@link #hashCode()} methods based on
  * the implemented interface.
  */
-public abstract class AbstractPropertyState implements PropertyState {
+public abstract class AbstractChildNodeEntry implements ChildNodeEntry {
 
     /**
-     * Default implementation delegating to {@link JsonBuilder#encode(Scalar)}.
-     * Derived classes may override this with more efficient implementations.
-     */
-    @Override
-    public String getEncodedValue() {
-        return isArray()
-            ? JsonBuilder.encode(getArray())
-            : JsonBuilder.encode(getScalar());
-    }
-
-    /**
-     * Checks whether the given object is equal to this one. Two property
-     * states are considered equal if both their names and encoded values
-     * match. Subclasses may override this method with a more efficient
+     * Checks whether the given object is equal to this one. Two child node
+     * entries are considered equal if both their names and referenced node
+     * states match. Subclasses may override this method with a more efficient
      * equality check if one is available.
      *
      * @param that target of the comparison
-     * @return {@code true} if the objects are equal, {@code false} otherwise
+     * @return <code>true</code> if the objects are equal,
+     *         <code>false</code> otherwise
      */
     @Override
     public boolean equals(Object that) {
         if (this == that) {
             return true;
-        } else if (that instanceof PropertyState) {
-            PropertyState other = (PropertyState) that;
+        } else if (that instanceof ChildNodeEntry) {
+            ChildNodeEntry other = (ChildNodeEntry) that;
             return getName().equals(other.getName())
-                    && getEncodedValue().equals(other.getEncodedValue());
+                    && getNode().equals(other.getNode());
         } else {
             return false;
         }
+
     }
 
     /**
      * Returns a hash code that's compatible with how the
      * {@link #equals(Object)} method is implemented. The current
-     * implementation simply returns the hash code of the property name
-     * since {@link PropertyState} instances are not intended for use as
+     * implementation simply returns the hash code of the child node name
+     * since {@link ChildNodeEntry} instances are not intended for use as
      * hash keys.
      *
      * @return hash code

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractNodeState.java?rev=1324601&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractNodeState.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractNodeState.java Wed Apr 11 07:24:21 2012
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.kernel;
+
+import org.apache.jackrabbit.oak.api.ChildNodeEntry;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.PropertyState;
+
+/**
+ * Abstract base class for {@link NodeState} implementations.
+ * This base class contains default implementations of the
+ * {@link #equals(Object)} and {@link #hashCode()} methods based on
+ * the implemented interface.
+ * <p>
+ * This class also implements trivial (and potentially very slow) versions of
+ * the {@link #getProperty(String)} and {@link #getPropertyCount()} methods
+ * based on {@link #getProperties()}. The {@link #getChildNode(String)} and
+ * {@link #getChildNodeCount()} methods are similarly implemented based on
+ * {@link #getChildNodeEntries(long, int)}. Subclasses should normally
+ * override these method with a more efficient alternatives.
+ */
+public abstract class AbstractNodeState implements NodeState {
+
+    @Override
+    public PropertyState getProperty(String name) {
+        for (PropertyState property : getProperties()) {
+            if (name.equals(property.getName())) {
+                return property;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    @SuppressWarnings("unused")
+    public long getPropertyCount() {
+        long count = 0;
+        for (PropertyState property : getProperties()) {
+            count++;
+        }
+        return count;
+    }
+
+    @Override
+    public NodeState getChildNode(String name) {
+        for (ChildNodeEntry entry : getChildNodeEntries(0, -1)) {
+            if (name.equals(entry.getName())) {
+                return entry.getNode();
+            }
+        }
+        return null;
+    }
+
+    @Override
+    @SuppressWarnings("unused")
+    public long getChildNodeCount() {
+        long count = 0;
+        for (ChildNodeEntry entry : getChildNodeEntries(0, -1)) {
+            count++;
+        }
+        return count;
+    }
+
+    /**
+     * Checks whether the given object is equal to this one. Two node states
+     * are considered equal if all their properties and child nodes match,
+     * regardless of ordering. Subclasses may override this method with a
+     * more efficient equality check if one is available.
+     *
+     * @param that target of the comparison
+     * @return <code>true</code> if the objects are equal,
+     *         <code>false</code> otherwise
+     */
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        } else if (that == null || !(that instanceof NodeState)) {
+            return false;
+        }
+
+        NodeState other = (NodeState) that;
+
+        long propertyCount = 0;
+        for (PropertyState property : getProperties()) {
+            if (!property.equals(other.getProperty(property.getName()))) {
+                return false;
+            }
+            propertyCount++;
+        }
+        if (propertyCount != other.getPropertyCount()) {
+            return false;
+        }
+
+        long childNodeCount = 0;
+        for (ChildNodeEntry entry : getChildNodeEntries(0, -1)) {
+            if (!entry.getNode().equals(other.getChildNode(entry.getName()))) {
+                return false;
+            }
+            childNodeCount++;
+        }
+        if (childNodeCount != other.getChildNodeCount()) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns a hash code that's compatible with how the
+     * {@link #equals(Object)} method is implemented. The current
+     * implementation simply returns zero for everything since
+     * {@link NodeState} instances are not intended for use as hash keys.
+     *
+     * @return hash code
+     */
+    @Override
+    public int hashCode() {
+        return 0;
+    }
+
+}

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractPropertyState.java (from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractPropertyState.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractPropertyState.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java&r1=1324586&r2=1324601&rev=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractPropertyState.java Wed Apr 11 07:24:21 2012
@@ -14,9 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mk.model;
+package org.apache.jackrabbit.oak.kernel;
 
-import org.apache.jackrabbit.mk.json.JsonBuilder;
+import java.util.Iterator;
+
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Scalar;
 
 /**
  * Abstract base class for {@link PropertyState} implementations.
@@ -27,17 +30,6 @@ import org.apache.jackrabbit.mk.json.Jso
 public abstract class AbstractPropertyState implements PropertyState {
 
     /**
-     * Default implementation delegating to {@link JsonBuilder#encode(Scalar)}.
-     * Derived classes may override this with more efficient implementations.
-     */
-    @Override
-    public String getEncodedValue() {
-        return isArray()
-            ? JsonBuilder.encode(getArray())
-            : JsonBuilder.encode(getScalar());
-    }
-
-    /**
      * Checks whether the given object is equal to this one. Two property
      * states are considered equal if both their names and encoded values
      * match. Subclasses may override this method with a more efficient
@@ -52,13 +44,28 @@ public abstract class AbstractPropertySt
             return true;
         } else if (that instanceof PropertyState) {
             PropertyState other = (PropertyState) that;
-            return getName().equals(other.getName())
-                    && getEncodedValue().equals(other.getEncodedValue());
+            return getName().equals(other.getName()) && valueEquals(other);
         } else {
             return false;
         }
     }
 
+    private boolean valueEquals(PropertyState other) {
+        if (isArray() != other.isArray()) {
+            return false;
+        } else if (isArray()) {
+            Iterator<Scalar> iterator = other.getArray().iterator();
+            for (Scalar scalar : getArray()) {
+                if (!iterator.hasNext() || !scalar.equals(iterator.next())) {
+                    return false;
+                }
+            }
+            return !iterator.hasNext();
+        } else {
+            return getScalar().equals(other.getScalar());
+        }
+    }
+
     /**
      * Returns a hash code that's compatible with how the
      * {@link #equals(Object)} method is implemented. The current

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelChildNodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelChildNodeEntry.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelChildNodeEntry.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelChildNodeEntry.java Wed Apr 11 07:24:21 2012
@@ -18,8 +18,7 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
-import org.apache.jackrabbit.mk.model.AbstractChildNodeEntry;
-import org.apache.jackrabbit.mk.model.NodeState;
+import org.apache.jackrabbit.oak.api.NodeState;
 
 class KernelChildNodeEntry extends AbstractChildNodeEntry {
 

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=1324601&r1=1324600&r2=1324601&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 Wed Apr 11 07:24:21 2012
@@ -18,15 +18,13 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
-import org.apache.jackrabbit.mk.model.Scalar;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.json.JsopReader;
 import org.apache.jackrabbit.mk.json.JsopTokenizer;
-import org.apache.jackrabbit.mk.model.AbstractNodeState;
-import org.apache.jackrabbit.mk.model.ChildNodeEntry;
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.PropertyState;
-import org.apache.jackrabbit.mk.model.ScalarImpl;
+import org.apache.jackrabbit.oak.api.ChildNodeEntry;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Scalar;
 
 import java.util.ArrayList;
 import java.util.Iterator;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java Wed Apr 11 07:24:21 2012
@@ -19,10 +19,11 @@
 package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.NodeStateEditor;
-import org.apache.jackrabbit.mk.model.PropertyState;
-import org.apache.jackrabbit.mk.model.Scalar;
+import org.apache.jackrabbit.mk.json.JsonBuilder;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.NodeStateEditor;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Scalar;
 
 import java.util.List;
 
@@ -97,7 +98,7 @@ public class KernelNodeStateEditor imple
         PropertyState propertyState = new KernelPropertyState(name, value);
         transientState.setProperty(propertyState);
         jsop.append("^\"").append(path(propertyState.getName())).append("\":")
-                .append(propertyState.getEncodedValue());
+                .append(encode(propertyState));
     }
 
     @Override
@@ -105,7 +106,7 @@ public class KernelNodeStateEditor imple
         PropertyState propertyState = new KernelPropertyState(name, values);
         transientState.setProperty(propertyState);
         jsop.append("^\"").append(path(propertyState.getName())).append("\":")
-                .append(propertyState.getEncodedValue());
+                .append(encode(propertyState));
     }
 
     @Override
@@ -218,4 +219,36 @@ public class KernelNodeStateEditor imple
         return path.isEmpty() ? name : path + '/' + name;
     }
 
+    private String encode(PropertyState state) {
+        if (state.isArray()) {
+            return encode(state.getArray());
+        } else {
+            return encode(state.getScalar());
+        }
+    }
+
+    private String encode(Scalar scalar) {
+        switch (scalar.getType()) {
+            case BOOLEAN: return JsonBuilder.encode(scalar.getBoolean());
+            case LONG:    return JsonBuilder.encode(scalar.getLong());
+            case DOUBLE:  return JsonBuilder.encode(scalar.getDouble());
+            case BINARY:  return null; // TODO implement encoding of binaries
+            case STRING:  return JsonBuilder.encode(scalar.getString());
+            case NULL:    return "null";
+        }
+        throw new IllegalStateException("unreachable");  // Make javac happy
+    }
+
+    private String encode(Iterable<Scalar> scalars) {
+        StringBuilder sb = new StringBuilder();
+        sb.append('[');
+        for (Scalar scalar : scalars) {
+            sb.append(encode(scalar));
+            sb.append(',');
+        }
+        sb.deleteCharAt(sb.length() - 1);
+        sb.append(']');
+        return sb.toString();
+    }
+
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java Wed Apr 11 07:24:21 2012
@@ -19,10 +19,10 @@
 package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.NodeStateDiff;
-import org.apache.jackrabbit.mk.model.NodeStateEditor;
-import org.apache.jackrabbit.mk.model.NodeStore;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.NodeStateDiff;
+import org.apache.jackrabbit.oak.api.NodeStateEditor;
+import org.apache.jackrabbit.oak.api.NodeStore;
 
 /**
  * {@link MicroKernel}-based {@link NodeStore} implementation.

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java Wed Apr 11 07:24:21 2012
@@ -18,12 +18,11 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
-import org.apache.jackrabbit.mk.model.AbstractPropertyState;
-import org.apache.jackrabbit.mk.model.Scalar;
-
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.jackrabbit.oak.api.Scalar;
+
 class KernelPropertyState extends AbstractPropertyState {
     private final String name;
     private final Scalar value;

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ScalarImpl.java (from r1324586, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ScalarImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ScalarImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ScalarImpl.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ScalarImpl.java&r1=1324586&r2=1324601&rev=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ScalarImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ScalarImpl.java Wed Apr 11 07:24:21 2012
@@ -14,13 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mk.model;
+package org.apache.jackrabbit.oak.kernel;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.concurrent.Callable;
 
+import org.apache.jackrabbit.oak.api.Scalar;
+
 public abstract class ScalarImpl implements Scalar {
 
     public static Scalar numberScalar(String value) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java Wed Apr 11 07:24:21 2012
@@ -22,9 +22,9 @@ import org.apache.commons.collections.it
 import org.apache.commons.collections.iterators.FilterIterator;
 import org.apache.commons.collections.iterators.IteratorChain;
 import org.apache.commons.collections.iterators.TransformIterator;
-import org.apache.jackrabbit.mk.model.ChildNodeEntry;
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.PropertyState;
+import org.apache.jackrabbit.oak.api.ChildNodeEntry;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.kernel.TransientNodeState.Iterators.PagedIterator;
 
 import java.util.HashMap;
@@ -75,7 +75,8 @@ public class TransientNodeState {
     private final Set<String> removedNodes = new HashSet<String>();
 
     /** Transiently added property states */
-    private final Map<String, PropertyState> addedProperties = new HashMap<String, PropertyState>();
+    private final Map<String, PropertyState> addedProperties =
+            new HashMap<String, PropertyState>();
 
     /** Transiently removed property states */
     private final Set<String> removedProperties = new HashSet<String>();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java Wed Apr 11 07:24:21 2012
@@ -19,12 +19,11 @@
 package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.model.ChildNodeEntry;
-import org.apache.jackrabbit.mk.model.PropertyState;
-import org.apache.jackrabbit.mk.model.Scalar;
-import org.apache.jackrabbit.mk.model.ScalarImpl;
 import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
 import org.apache.jackrabbit.mk.util.PathUtils;
+import org.apache.jackrabbit.oak.api.ChildNodeEntry;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Scalar;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorTest.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorTest.java Wed Apr 11 07:24:21 2012
@@ -19,12 +19,10 @@
 package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.PropertyState;
-import org.apache.jackrabbit.mk.model.Scalar;
-import org.apache.jackrabbit.mk.model.Scalar.Type;
-import org.apache.jackrabbit.mk.model.ScalarImpl;
 import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Scalar;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -78,7 +76,7 @@ public class KernelNodeStateEditorTest {
         propertyState = transientState.getProperty("a");
         assertNotNull(propertyState);
         assertFalse(propertyState.isArray());
-        assertEquals(Type.LONG, propertyState.getScalar().getType());
+        assertEquals(Scalar.Type.LONG, propertyState.getScalar().getType());
         assertEquals(1, propertyState.getScalar().getLong());
     }
     

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java Wed Apr 11 07:24:21 2012
@@ -29,10 +29,10 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.model.ChildNodeEntry;
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.PropertyState;
 import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
+import org.apache.jackrabbit.oak.api.ChildNodeEntry;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.PropertyState;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -59,26 +59,27 @@ public class KernelNodeStateTest {
     @Test
     public void testGetProperty() {
         assertEquals("a", state.getProperty("a").getName());
-        assertEquals("1", state.getProperty("a").getEncodedValue());
+        assertEquals(1, state.getProperty("a").getScalar().getLong());
         assertEquals("b", state.getProperty("b").getName());
-        assertEquals("2", state.getProperty("b").getEncodedValue());
+        assertEquals(2, state.getProperty("b").getScalar().getLong());
         assertEquals("c", state.getProperty("c").getName());
-        assertEquals("3", state.getProperty("c").getEncodedValue());
+        assertEquals(3, state.getProperty("c").getScalar().getLong());
         assertNull(state.getProperty("x"));
     }
 
     @Test
     public void testGetProperties() {
         List<String> names = new ArrayList<String>();
-        List<String> values = new ArrayList<String>();
+        List<Long> values = new ArrayList<Long>();
         for (PropertyState property : state.getProperties()) {
             names.add(property.getName());
-            values.add(property.getEncodedValue());
+            values.add(property.getScalar().getLong());
         }
         Collections.sort(names);
         Collections.sort(values);
         assertEquals(Arrays.asList("a", "b", "c"), names);
-        assertEquals(Arrays.asList("1", "2", "3"), values);
+        assertEquals(Arrays.asList(
+                Long.valueOf(1), Long.valueOf(2), Long.valueOf(3)), values);
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java Wed Apr 11 07:24:21 2012
@@ -24,9 +24,9 @@ import static junit.framework.Assert.ass
 import static junit.framework.Assert.assertNull;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.model.ChildNodeEntry;
-import org.apache.jackrabbit.mk.model.NodeState;
 import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
+import org.apache.jackrabbit.oak.api.ChildNodeEntry;
+import org.apache.jackrabbit.oak.api.NodeState;
 import org.junit.Before;
 import org.junit.Test;
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java Wed Apr 11 07:24:21 2012
@@ -1,7 +1,7 @@
 package org.apache.jackrabbit.oak.jcr;
 
-import org.apache.jackrabbit.mk.model.PropertyState;
 import org.apache.jackrabbit.mk.util.PathUtils;
+import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.kernel.TransientNodeState;
 
 public class ItemStateProvider {

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=1324601&r1=1324600&r2=1324601&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 Wed Apr 11 07:24:21 2012
@@ -19,9 +19,8 @@ package org.apache.jackrabbit.oak.jcr;
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
 import org.apache.jackrabbit.commons.iterator.PropertyIteratorAdapter;
-import org.apache.jackrabbit.mk.model.PropertyState;
-import org.apache.jackrabbit.mk.model.ScalarImpl;
 import org.apache.jackrabbit.mk.util.PathUtils;
+import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.jcr.util.Function1;
 import org.apache.jackrabbit.oak.jcr.util.ItemNameMatcher;
 import org.apache.jackrabbit.oak.jcr.util.Iterators;
@@ -29,6 +28,7 @@ import org.apache.jackrabbit.oak.jcr.uti
 import org.apache.jackrabbit.oak.jcr.util.Predicate;
 import org.apache.jackrabbit.oak.jcr.util.ValueConverter;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStateEditor;
+import org.apache.jackrabbit.oak.kernel.ScalarImpl;
 import org.apache.jackrabbit.oak.kernel.TransientNodeState;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.slf4j.Logger;

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java Wed Apr 11 07:24:21 2012
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import org.apache.jackrabbit.mk.model.PropertyState;
 import org.apache.jackrabbit.mk.util.PathUtils;
+import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.jcr.util.LogUtil;
 import org.apache.jackrabbit.oak.jcr.util.ValueConverter;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStateEditor;

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java Wed Apr 11 07:24:21 2012
@@ -17,10 +17,10 @@
 package org.apache.jackrabbit.oak.jcr;
 
 import org.apache.jackrabbit.commons.AbstractSession;
-import org.apache.jackrabbit.mk.model.NodeState;
-import org.apache.jackrabbit.mk.model.NodeStateEditor;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.Connection;
+import org.apache.jackrabbit.oak.api.NodeState;
+import org.apache.jackrabbit.oak.api.NodeStateEditor;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStateEditor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/util/ValueConverter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/util/ValueConverter.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/util/ValueConverter.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/util/ValueConverter.java Wed Apr 11 07:24:21 2012
@@ -19,8 +19,8 @@
 
 package org.apache.jackrabbit.oak.jcr.util;
 
-import org.apache.jackrabbit.mk.model.Scalar;
-import org.apache.jackrabbit.mk.model.ScalarImpl;
+import org.apache.jackrabbit.oak.api.Scalar;
+import org.apache.jackrabbit.oak.kernel.ScalarImpl; // FIXME: Use only the API
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsonBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsonBuilder.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsonBuilder.java (original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsonBuilder.java Wed Apr 11 07:24:21 2012
@@ -19,8 +19,6 @@
 
 package org.apache.jackrabbit.mk.json;
 
-import org.apache.jackrabbit.mk.model.Scalar;
-
 import java.io.IOException;
 
 /**
@@ -443,28 +441,5 @@ public final class JsonBuilder {
         sb.append(']');
         return sb.toString();
     }
-    
-    public static String encode(Scalar scalar) {
-        switch (scalar.getType()) {
-            case BOOLEAN: return encode(scalar.getBoolean());
-            case LONG:    return encode(scalar.getLong());
-            case DOUBLE:  return encode(scalar.getDouble());
-            case BINARY:  return null; // TODO implement encoding of binaries
-            case STRING:  return encode(scalar.getString());
-            case NULL:    return "null";
-        }
-        throw new IllegalStateException("unreachable");  // Make javac happy
-    }
 
-    public static String encode(Iterable<Scalar> scalars) {
-        StringBuilder sb = new StringBuilder();
-        sb.append('[');
-        for (Scalar scalar : scalars) {
-            sb.append(encode(scalar));
-            sb.append(',');
-        }
-        sb.deleteCharAt(sb.length() - 1);
-        sb.append(']');
-        return sb.toString();
-    }
 }

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java (original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/AbstractPropertyState.java Wed Apr 11 07:24:21 2012
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.mk.model;
 
-import org.apache.jackrabbit.mk.json.JsonBuilder;
-
 /**
  * Abstract base class for {@link PropertyState} implementations.
  * This base class contains default implementations of the
@@ -27,17 +25,6 @@ import org.apache.jackrabbit.mk.json.Jso
 public abstract class AbstractPropertyState implements PropertyState {
 
     /**
-     * Default implementation delegating to {@link JsonBuilder#encode(Scalar)}.
-     * Derived classes may override this with more efficient implementations.
-     */
-    @Override
-    public String getEncodedValue() {
-        return isArray()
-            ? JsonBuilder.encode(getArray())
-            : JsonBuilder.encode(getScalar());
-    }
-
-    /**
      * Checks whether the given object is equal to this one. Two property
      * states are considered equal if both their names and encoded values
      * match. Subclasses may override this method with a more efficient

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java (original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeStore.java Wed Apr 11 07:24:21 2012
@@ -19,10 +19,6 @@ package org.apache.jackrabbit.mk.model;
 /**
  * Storage abstraction for content trees. At any given point in time
  * the stored content tree is rooted at a single immutable node state.
- * Changes in the tree are constructed by branching off a private copy
- * using the {@link #branch(NodeState)} method which can be modified
- * and merged back using the {@link #merge(NodeStateEditor, NodeState)}
- * method.
  * <p>
  * This is a low-level interface that doesn't cover functionality like
  * merging concurrent changes or rejecting new tree states based on some
@@ -38,28 +34,6 @@ public interface NodeStore {
     NodeState getRoot();
 
     /**
-     * Creates a private branch from a {@code base} node state
-     * for editing. The branch can later be merged back into
-     * the node store using the {@link #merge(NodeStateEditor, NodeState) merge}
-     * method.
-     *
-     * @param base base node state
-     * @return a private branch rooted at {@code base}
-     */
-    NodeStateEditor branch(NodeState base);
-
-    /**
-     * Atomically merges the changes from {@code branch} back into the
-     * {@code target}.
-     *
-     * @param branch branch for merging into {@code target}
-     * @param target target of the merge operation
-     * @return node state resulting from merging {@code branch} into
-     *         {@code target}.
-     */
-    NodeState merge(NodeStateEditor branch, NodeState target);
-
-    /**
      * Compares the given two node states. Any found differences are
      * reported by calling the relevant added, changed or deleted methods
      * of the given handler.

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java (original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/PropertyState.java Wed Apr 11 07:24:21 2012
@@ -41,22 +41,4 @@ public interface PropertyState {
      */
     String getEncodedValue();
 
-    /**
-     * Determine whether this is a multi valued property
-     * @return  {@code true} if and only if this is a multi valued property.
-     */
-    boolean isArray();
-
-    /**
-     * @return  the single value of this property or {@code null} if this is a multi
-     * valued property.
-     */
-    Scalar getScalar();
-
-    /**
-     * @return  an iterable of the values of this multi valued property or
-     * {@code null} if this is not a multi valued property.
-     */
-    Iterable<Scalar> getArray();
-
 }

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/AbstractRevisionStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/AbstractRevisionStore.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/AbstractRevisionStore.java (original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/AbstractRevisionStore.java Wed Apr 11 07:24:21 2012
@@ -23,7 +23,6 @@ import org.apache.jackrabbit.mk.model.Ch
 import org.apache.jackrabbit.mk.model.Id;
 import org.apache.jackrabbit.mk.model.NodeState;
 import org.apache.jackrabbit.mk.model.NodeStateDiff;
-import org.apache.jackrabbit.mk.model.NodeStateEditor;
 import org.apache.jackrabbit.mk.model.PropertyState;
 import org.apache.jackrabbit.mk.model.StoredNode;
 
@@ -64,16 +63,6 @@ abstract class AbstractRevisionStore imp
     }
 
     @Override
-    public NodeStateEditor branch(NodeState base) {
-        throw new UnsupportedOperationException(); // TODO
-    }
-
-    @Override
-    public NodeState merge(NodeStateEditor branch, NodeState target) {
-        throw new UnsupportedOperationException(); // TODO
-    }
-
-    @Override
     public void compare(NodeState before, NodeState after, NodeStateDiff diff) {
         compareProperties(before, after, diff);
         compareChildNodes(before, after, diff);

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/StoredNodeAsState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/StoredNodeAsState.java?rev=1324601&r1=1324600&r2=1324601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/StoredNodeAsState.java (original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/StoredNodeAsState.java Wed Apr 11 07:24:21 2012
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.mk.store;
 
-import org.apache.jackrabbit.mk.json.JsopReader;
-import org.apache.jackrabbit.mk.json.JsopTokenizer;
 import org.apache.jackrabbit.mk.model.AbstractChildNodeEntry;
 import org.apache.jackrabbit.mk.model.AbstractNodeState;
 import org.apache.jackrabbit.mk.model.AbstractPropertyState;
@@ -26,14 +24,10 @@ import org.apache.jackrabbit.mk.model.Ch
 import org.apache.jackrabbit.mk.model.Id;
 import org.apache.jackrabbit.mk.model.NodeState;
 import org.apache.jackrabbit.mk.model.PropertyState;
-import org.apache.jackrabbit.mk.model.Scalar;
-import org.apache.jackrabbit.mk.model.ScalarImpl;
 import org.apache.jackrabbit.mk.model.StoredNode;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 class StoredNodeAsState extends AbstractNodeState {
@@ -71,50 +65,6 @@ class StoredNodeAsState extends Abstract
             return value;
         }
 
-        @Override
-        public boolean isArray() {
-            return !value.isEmpty() && value.charAt(0) == '[';
-        }
-
-        @Override
-        public Scalar getScalar() {
-            if (isArray()) {
-                throw new IllegalStateException("Array cannot be accessed as scalar");
-            }
-
-            return readScalar(new JsopTokenizer(value));
-        }
-
-        @Override
-        public Iterable<Scalar> getArray() {
-            if (!isArray()) {
-                throw new IllegalStateException("Scalar cannot be accessed as array");
-            }
-
-            List<Scalar> scalars = new ArrayList<Scalar>();
-            JsopReader reader = new JsopTokenizer(value);
-            reader.read('[');
-            while (!reader.matches(']')) {
-                scalars.add(readScalar(reader));
-                reader.matches(',');
-            }
-            return scalars;
-        }
-
-        private static Scalar readScalar(JsopReader reader) {
-            if (reader.matches(JsopTokenizer.NUMBER)) {
-                return ScalarImpl.numberScalar(reader.getToken());
-            } else if (reader.matches(JsopTokenizer.STRING)) {
-                return ScalarImpl.stringScalar(reader.getToken());
-            } else if (reader.matches(JsopTokenizer.TRUE)) {
-                return ScalarImpl.booleanScalar(true);
-            } else if (reader.matches(JsopTokenizer.FALSE)) {
-                return ScalarImpl.booleanScalar(false);
-            } else {
-                throw new IllegalArgumentException("Unexpected token: " + reader.getToken());
-            }
-        }
-
     }
 
     @Override



Mime
View raw message