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 bab9143baebb73fced5888a5afffe7f83dbaafaa..c360aecfc512fa8d8eac2060d71f33afb90e0c2d 100644 (file)
@@ -67,43 +67,43 @@ abstract class AbstractLithiumDataInput extends AbstractNormalizedNodeDataInput
 
     private void streamNormalizedNode(final NormalizedNodeStreamWriter writer, final byte nodeType) throws IOException {
         switch (nodeType) {
 
     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;
                 streamAnyxml(writer);
                 break;
-            case NodeTypes.AUGMENTATION_NODE:
+            case LithiumNode.AUGMENTATION_NODE:
                 streamAugmentation(writer);
                 break;
                 streamAugmentation(writer);
                 break;
-            case NodeTypes.CHOICE_NODE:
+            case LithiumNode.CHOICE_NODE:
                 streamChoice(writer);
                 break;
                 streamChoice(writer);
                 break;
-            case NodeTypes.CONTAINER_NODE:
+            case LithiumNode.CONTAINER_NODE:
                 streamContainer(writer);
                 break;
                 streamContainer(writer);
                 break;
-            case NodeTypes.LEAF_NODE:
+            case LithiumNode.LEAF_NODE:
                 streamLeaf(writer);
                 break;
                 streamLeaf(writer);
                 break;
-            case NodeTypes.LEAF_SET:
+            case LithiumNode.LEAF_SET:
                 streamLeafSet(writer);
                 break;
                 streamLeafSet(writer);
                 break;
-            case NodeTypes.ORDERED_LEAF_SET:
+            case LithiumNode.ORDERED_LEAF_SET:
                 streamOrderedLeafSet(writer);
                 break;
                 streamOrderedLeafSet(writer);
                 break;
-            case NodeTypes.LEAF_SET_ENTRY_NODE:
+            case LithiumNode.LEAF_SET_ENTRY_NODE:
                 streamLeafSetEntry(writer);
                 break;
                 streamLeafSetEntry(writer);
                 break;
-            case NodeTypes.MAP_ENTRY_NODE:
+            case LithiumNode.MAP_ENTRY_NODE:
                 streamMapEntry(writer);
                 break;
                 streamMapEntry(writer);
                 break;
-            case NodeTypes.MAP_NODE:
+            case LithiumNode.MAP_NODE:
                 streamMap(writer);
                 break;
                 streamMap(writer);
                 break;
-            case NodeTypes.ORDERED_MAP_NODE:
+            case LithiumNode.ORDERED_MAP_NODE:
                 streamOrderedMap(writer);
                 break;
                 streamOrderedMap(writer);
                 break;
-            case NodeTypes.UNKEYED_LIST:
+            case LithiumNode.UNKEYED_LIST:
                 streamUnkeyedList(writer);
                 break;
                 streamUnkeyedList(writer);
                 break;
-            case NodeTypes.UNKEYED_LIST_ITEM:
+            case LithiumNode.UNKEYED_LIST_ITEM:
                 streamUnkeyedListItem(writer);
                 break;
             default:
                 streamUnkeyedListItem(writer);
                 break;
             default:
@@ -221,8 +221,8 @@ abstract class AbstractLithiumDataInput extends AbstractNormalizedNodeDataInput
         writer.startMapEntryNode(entryIdentifier, NormalizedNodeStreamWriter.UNKNOWN_SIZE);
 
         // Same loop as commonStreamContainer(), but ...
         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 {
                 // ... 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 {
     }
 
     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();
             streamNormalizedNode(writer, nodeType);
         }
         writer.endNode();
index f839bb1ff23425f5d15d5c1044af574506d70c8e..be61f7847dc34a7d9de038f6d89077b00a2261ff 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");
     @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");
         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");
     }
 
     @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 {
     }
 
     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");
 
     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.
 
         // 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");
     @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");
     }
 
     @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");
     }
 
     @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");
     }
 
     @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");
     }
 
     @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");
     }
 
     @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");
         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");
     }
 
     @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
     }
 
     @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");
 
         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");
         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;
     }
 
         inSimple = true;
     }
 
@@ -206,7 +206,7 @@ abstract class AbstractLithiumDataOutput extends AbstractNormalizedNodeDataOutpu
         LOG.trace("Ending the node");
         if (!inSimple) {
             lastLeafSetQName = null;
         LOG.trace("Ending the node");
         if (!inSimple) {
             lastLeafSetQName = null;
-            output.writeByte(NodeTypes.END_NODE);
+            output.writeByte(LithiumNode.END_NODE);
         }
         inSimple = false;
     }
         }
         inSimple = false;
     }
@@ -7,7 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore.node.utils.stream;
 
  */
 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;
     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;
 
     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");
     }
 }
         throw new UnsupportedOperationException("utility class");
     }
 }