BUG-509: cleanup StoreMetadataNode 91/7291/1
authorRobert Varga <rovarga@cisco.com>
Tue, 20 May 2014 13:10:29 +0000 (15:10 +0200)
committerRobert Varga <rovarga@cisco.com>
Wed, 21 May 2014 09:42:51 +0000 (11:42 +0200)
Removes StoreTreeNode<StoreMetadataNode> interface and tightens
visibility of a few methods.

Change-Id: I3bbf303025046f217bdcea81fcc14c420dbf9478
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/DataTree.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/StoreMetadataNode.java

index 01e2a29..ee9726a 100644 (file)
@@ -13,20 +13,20 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  * Interface representing a data tree which can be modified in an MVCC fashion.
  */
 public interface DataTree {
-       /**
-        * Take a read-only point-in-time snapshot of the tree.
-        *
-        * @return Data tree snapshot.
-        */
-       DataTreeSnapshot takeSnapshot();
+    /**
+     * Take a read-only point-in-time snapshot of the tree.
+     *
+     * @return Data tree snapshot.
+     */
+    DataTreeSnapshot takeSnapshot();
 
-       /**
-        * Make the data tree use a new schema context. The context will be used
-        * only by subsequent operations.
-        *
-        * @param newSchemaContext new SchemaContext
-        * @throws IllegalArgumentException if the new context is incompatible
-        */
+    /**
+     * Make the data tree use a new schema context. The context will be used
+     * only by subsequent operations.
+     *
+     * @param newSchemaContext new SchemaContext
+     * @throws IllegalArgumentException if the new context is incompatible
+     */
     void setSchemaContext(SchemaContext newSchemaContext);
 
     /**
index 0ee0d9b..77186a6 100644 (file)
@@ -13,7 +13,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreTreeNode;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
@@ -24,7 +23,7 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.primitives.UnsignedLong;
 
-class StoreMetadataNode implements Immutable, Identifiable<PathArgument>, StoreTreeNode<StoreMetadataNode> {
+class StoreMetadataNode implements Immutable, Identifiable<PathArgument> {
     private final Map<PathArgument, StoreMetadataNode> children;
     private final UnsignedLong nodeVersion;
     private final UnsignedLong subtreeVersion;
@@ -37,7 +36,7 @@ class StoreMetadataNode implements Immutable, Identifiable<PathArgument>, StoreT
      * @param subtreeVersion
      * @param children Map of children, must not be modified externally
      */
-    protected StoreMetadataNode(final NormalizedNode<?, ?> data, final UnsignedLong nodeVersion,
+    private StoreMetadataNode(final NormalizedNode<?, ?> data, final UnsignedLong nodeVersion,
             final UnsignedLong subtreeVersion, final Map<PathArgument, StoreMetadataNode> children) {
         this.nodeVersion = Preconditions.checkNotNull(nodeVersion);
         this.subtreeVersion = Preconditions.checkNotNull(subtreeVersion);
@@ -50,11 +49,6 @@ class StoreMetadataNode implements Immutable, Identifiable<PathArgument>, StoreT
                 Collections.<PathArgument, StoreMetadataNode>emptyMap());
     }
 
-    public StoreMetadataNode(final NormalizedNode<?, ?> data, final UnsignedLong nodeVersion,
-            final UnsignedLong subtreeVersion) {
-        this(data, nodeVersion, subtreeVersion, Collections.<PathArgument, StoreMetadataNode>emptyMap());
-    }
-
     public static Builder builder() {
         return new Builder();
     }
@@ -80,8 +74,7 @@ class StoreMetadataNode implements Immutable, Identifiable<PathArgument>, StoreT
         return this.data;
     }
 
-    @Override
-    public Optional<StoreMetadataNode> getChild(final PathArgument key) {
+    Optional<StoreMetadataNode> getChild(final PathArgument key) {
         return Optional.fromNullable(children.get(key));
     }
 
@@ -134,7 +127,7 @@ class StoreMetadataNode implements Immutable, Identifiable<PathArgument>, StoreT
             children = new HashMap<>();
         }
 
-        public Builder(StoreMetadataNode node) {
+        private Builder(StoreMetadataNode node) {
             children = new HashMap<>(node.children);
         }