jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1299700 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model: NodeBuilder.java NodeStore.java
Date Mon, 12 Mar 2012 15:02:00 GMT
Author: jukka
Date: Mon Mar 12 15:02:00 2012
New Revision: 1299700

URL: http://svn.apache.org/viewvc?rev=1299700&view=rev
Log:
OAK-9: Internal tree builder

Add the proposed NodeStore and NodeBuilder interfaces

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeBuilder.java
  (with props)
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeStore.java
  (with props)

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeBuilder.java?rev=1299700&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeBuilder.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeBuilder.java
Mon Mar 12 15:02:00 2012
@@ -0,0 +1,50 @@
+/*
+ * 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.model;
+
+/**
+ * Builder interface for constructing new {@link NodeState node states}.
+ */
+public interface NodeBuilder {
+
+    /**
+     * Sets or removes the named property.
+     *
+     * @param name property name
+     * @param encodedValue encoded value of the property,
+     *                     or <code>null</code> to remove the named property
+     */
+    void setProperty(String name, String encodedValue);
+
+    /**
+     * Sets or removes the named child node.
+     *
+     * @param name child node name
+     * @param childNode new child node state,
+     *                  or <code>null</code> to remove the named child node
+     */
+    void setChildNode(String name, NodeState childNode);
+
+    /**
+     * Returns an immutable node state that matches the current state of
+     * the builder.
+     *
+     * @return immutable node state
+     */
+    NodeState getNodeState();
+
+}

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeStore.java?rev=1299700&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeStore.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeStore.java
Mon Mar 12 15:02:00 2012
@@ -0,0 +1,59 @@
+/*
+ * 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.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 using {@link NodeBuilder} instances
+ * based on the root and other node states in the tree. The state of the
+ * entire tree can then be changed by setting the resulting modified root
+ * node state as the new root of the tree.
+ * <p>
+ * This is a low-level interface that doesn't cover functionality like
+ * merging concurrent changes or rejecting new tree states based on some
+ * higher-level consistency constraints.
+ */
+public interface NodeStore {
+
+    /**
+     * Returns the latest state of the content tree.
+     *
+     * @return root node state
+     */
+    NodeState getRoot();
+
+    /**
+     * Updates the state of the content tree.
+     *
+     * @param newRoot new root node state
+     */
+    void setRoot(NodeState newRoot);
+
+    /**
+     * Returns a builder for constructing a new or modified node state.
+     * The builder is initialized with all the properties and child nodes
+     * from the given base node state, or with no properties or child nodes
+     * if no base node state is given.
+     *
+     * @param base base node state,
+     *             or <code>null</code> to construct a new node state
+     * @return builder instance
+     */
+    NodeBuilder getNodeBuilder(NodeState base);
+
+}

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/model/NodeStore.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message