Rename NodeTypes to LithiumNode 60/84560/3
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 20 Sep 2019 17:54:04 +0000 (19:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 23 Sep 2019 08:45:32 +0000 (10:45 +0200)
This makes it clear these constants are only used in Lithium
encoding.

JIRA: CONTROLLER-1919
Change-Id: I1fb44f49d3409fdd007fe58dc6ce92b0eb6744b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataInput.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataOutput.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/LithiumNode.java [moved from opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NodeTypes.java with 90% similarity]

index bab9143..c360aec 100644 (file)
@@ -67,43 +67,43 @@ abstract class AbstractLithiumDataInput extends AbstractNormalizedNodeDataInput
 
     private void streamNormalizedNode(final NormalizedNodeStreamWriter writer, final byte nodeType) throws IOException {
         switch (nodeType) {
-            case NodeTypes.ANY_XML_NODE:
+            case LithiumNode.ANY_XML_NODE:
                 streamAnyxml(writer);
                 break;
-            case NodeTypes.AUGMENTATION_NODE:
+            case LithiumNode.AUGMENTATION_NODE:
                 streamAugmentation(writer);
                 break;
-            case NodeTypes.CHOICE_NODE:
+            case LithiumNode.CHOICE_NODE:
                 streamChoice(writer);
                 break;
-            case NodeTypes.CONTAINER_NODE:
+            case LithiumNode.CONTAINER_NODE:
                 streamContainer(writer);
                 break;
-            case NodeTypes.LEAF_NODE:
+            case LithiumNode.LEAF_NODE:
                 streamLeaf(writer);
                 break;
-            case NodeTypes.LEAF_SET:
+            case LithiumNode.LEAF_SET:
                 streamLeafSet(writer);
                 break;
-            case NodeTypes.ORDERED_LEAF_SET:
+            case LithiumNode.ORDERED_LEAF_SET:
                 streamOrderedLeafSet(writer);
                 break;
-            case NodeTypes.LEAF_SET_ENTRY_NODE:
+            case LithiumNode.LEAF_SET_ENTRY_NODE:
                 streamLeafSetEntry(writer);
                 break;
-            case NodeTypes.MAP_ENTRY_NODE:
+            case LithiumNode.MAP_ENTRY_NODE:
                 streamMapEntry(writer);
                 break;
-            case NodeTypes.MAP_NODE:
+            case LithiumNode.MAP_NODE:
                 streamMap(writer);
                 break;
-            case NodeTypes.ORDERED_MAP_NODE:
+            case LithiumNode.ORDERED_MAP_NODE:
                 streamOrderedMap(writer);
                 break;
-            case NodeTypes.UNKEYED_LIST:
+            case LithiumNode.UNKEYED_LIST:
                 streamUnkeyedList(writer);
                 break;
-            case NodeTypes.UNKEYED_LIST_ITEM:
+            case LithiumNode.UNKEYED_LIST_ITEM:
                 streamUnkeyedListItem(writer);
                 break;
             default:
@@ -221,8 +221,8 @@ abstract class AbstractLithiumDataInput extends AbstractNormalizedNodeDataInput
         writer.startMapEntryNode(entryIdentifier, NormalizedNodeStreamWriter.UNKNOWN_SIZE);
 
         // Same loop as commonStreamContainer(), but ...
-        for (byte nodeType = input.readByte(); nodeType != NodeTypes.END_NODE; nodeType = input.readByte()) {
-            if (nodeType == NodeTypes.LEAF_NODE) {
+        for (byte nodeType = input.readByte(); nodeType != LithiumNode.END_NODE; nodeType = input.readByte()) {
+            if (nodeType == LithiumNode.LEAF_NODE) {
                 // ... leaf nodes may need de-duplication
                 streamLeaf(writer, entryIdentifier);
             } else {
@@ -247,7 +247,7 @@ abstract class AbstractLithiumDataInput extends AbstractNormalizedNodeDataInput
     }
 
     private void commonStreamContainer(final NormalizedNodeStreamWriter writer) throws IOException {
-        for (byte nodeType = input.readByte(); nodeType != NodeTypes.END_NODE; nodeType = input.readByte()) {
+        for (byte nodeType = input.readByte(); nodeType != LithiumNode.END_NODE; nodeType = input.readByte()) {
             streamNormalizedNode(writer, nodeType);
         }
         writer.endNode();
index f839bb1..be61f78 100644 (file)
@@ -83,20 +83,20 @@ abstract class AbstractLithiumDataOutput extends AbstractNormalizedNodeDataOutpu
     @Override
     public final void startLeafNode(final NodeIdentifier name) throws IOException {
         LOG.trace("Starting a new leaf node");
-        startNode(name, NodeTypes.LEAF_NODE);
+        startNode(name, LithiumNode.LEAF_NODE);
         inSimple = true;
     }
 
     @Override
     public final void startLeafSet(final NodeIdentifier name, final int childSizeHint) throws IOException {
         LOG.trace("Starting a new leaf set");
-        commonStartLeafSet(name, NodeTypes.LEAF_SET);
+        commonStartLeafSet(name, LithiumNode.LEAF_SET);
     }
 
     @Override
     public final void startOrderedLeafSet(final NodeIdentifier name, final int childSizeHint) throws IOException {
         LOG.trace("Starting a new ordered leaf set");
-        commonStartLeafSet(name, NodeTypes.ORDERED_LEAF_SET);
+        commonStartLeafSet(name, LithiumNode.ORDERED_LEAF_SET);
     }
 
     private void commonStartLeafSet(final NodeIdentifier name, final byte nodeType) throws IOException {
@@ -108,7 +108,7 @@ abstract class AbstractLithiumDataOutput extends AbstractNormalizedNodeDataOutpu
     public final void startLeafSetEntryNode(final NodeWithValue<?> name) throws IOException {
         LOG.trace("Starting a new leaf set entry node");
 
-        output.writeByte(NodeTypes.LEAF_SET_ENTRY_NODE);
+        output.writeByte(LithiumNode.LEAF_SET_ENTRY_NODE);
 
         // lastLeafSetQName is set if the parent LeafSetNode was previously written. Otherwise this is a
         // stand alone LeafSetEntryNode so write out it's name here.
@@ -121,52 +121,52 @@ abstract class AbstractLithiumDataOutput extends AbstractNormalizedNodeDataOutpu
     @Override
     public final void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
         LOG.trace("Starting a new container node");
-        startNode(name, NodeTypes.CONTAINER_NODE);
+        startNode(name, LithiumNode.CONTAINER_NODE);
     }
 
     @Override
     public final void startYangModeledAnyXmlNode(final NodeIdentifier name, final int childSizeHint)
             throws IOException {
         LOG.trace("Starting a new yang modeled anyXml node");
-        startNode(name, NodeTypes.YANG_MODELED_ANY_XML_NODE);
+        startNode(name, LithiumNode.YANG_MODELED_ANY_XML_NODE);
     }
 
     @Override
     public final void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) throws IOException {
         LOG.trace("Starting a new unkeyed list");
-        startNode(name, NodeTypes.UNKEYED_LIST);
+        startNode(name, LithiumNode.UNKEYED_LIST);
     }
 
     @Override
     public final void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) throws IOException {
         LOG.trace("Starting a new unkeyed list item");
-        startNode(name, NodeTypes.UNKEYED_LIST_ITEM);
+        startNode(name, LithiumNode.UNKEYED_LIST_ITEM);
     }
 
     @Override
     public final void startMapNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
         LOG.trace("Starting a new map node");
-        startNode(name, NodeTypes.MAP_NODE);
+        startNode(name, LithiumNode.MAP_NODE);
     }
 
     @Override
     public final void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint)
             throws IOException {
         LOG.trace("Starting a new map entry node");
-        startNode(identifier, NodeTypes.MAP_ENTRY_NODE);
+        startNode(identifier, LithiumNode.MAP_ENTRY_NODE);
         writeKeyValueMap(identifier.entrySet());
     }
 
     @Override
     public final void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
         LOG.trace("Starting a new ordered map node");
-        startNode(name, NodeTypes.ORDERED_MAP_NODE);
+        startNode(name, LithiumNode.ORDERED_MAP_NODE);
     }
 
     @Override
     public final void startChoiceNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
         LOG.trace("Starting a new choice node");
-        startNode(name, NodeTypes.CHOICE_NODE);
+        startNode(name, LithiumNode.CHOICE_NODE);
     }
 
     @Override
@@ -174,14 +174,14 @@ abstract class AbstractLithiumDataOutput extends AbstractNormalizedNodeDataOutpu
         requireNonNull(identifier, "Node identifier should not be null");
         LOG.trace("Starting a new augmentation node");
 
-        output.writeByte(NodeTypes.AUGMENTATION_NODE);
+        output.writeByte(LithiumNode.AUGMENTATION_NODE);
         writeAugmentationIdentifier(identifier);
     }
 
     @Override
     public final void startAnyxmlNode(final NodeIdentifier name) throws IOException {
         LOG.trace("Starting any xml node");
-        startNode(name, NodeTypes.ANY_XML_NODE);
+        startNode(name, LithiumNode.ANY_XML_NODE);
         inSimple = true;
     }
 
@@ -206,7 +206,7 @@ abstract class AbstractLithiumDataOutput extends AbstractNormalizedNodeDataOutpu
         LOG.trace("Ending the node");
         if (!inSimple) {
             lastLeafSetQName = null;
-            output.writeByte(NodeTypes.END_NODE);
+            output.writeByte(LithiumNode.END_NODE);
         }
         inSimple = false;
     }
@@ -7,7 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore.node.utils.stream;
 
-final class NodeTypes {
+/**
+ * Stream constants identifying individual node types.
+ */
+final class LithiumNode {
     static final byte LEAF_NODE = 1;
     static final byte LEAF_SET = 2;
     static final byte LEAF_SET_ENTRY_NODE = 3;
@@ -24,7 +27,7 @@ final class NodeTypes {
     static final byte ORDERED_LEAF_SET = 14;
     static final byte YANG_MODELED_ANY_XML_NODE = 15;
 
-    private NodeTypes() {
+    private LithiumNode() {
         throw new UnsupportedOperationException("utility class");
     }
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.