From: Robert Varga Date: Fri, 20 Sep 2019 17:54:04 +0000 (+0200) Subject: Rename NodeTypes to LithiumNode X-Git-Tag: release/magnesium~87 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=53af8a1af8d2433788c9b9aa512930b57b19d297;hp=cfa32c0058c51a993e5b3e390acf49d7aaeac433 Rename NodeTypes to LithiumNode This makes it clear these constants are only used in Lithium encoding. JIRA: CONTROLLER-1919 Change-Id: I1fb44f49d3409fdd007fe58dc6ce92b0eb6744b8 Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataInput.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataInput.java index bab9143bae..c360aecfc5 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataInput.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataInput.java @@ -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(); diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataOutput.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataOutput.java index f839bb1ff2..be61f7847d 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataOutput.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractLithiumDataOutput.java @@ -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; } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NodeTypes.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/LithiumNode.java similarity index 90% rename from opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NodeTypes.java rename to opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/LithiumNode.java index 6ca1f1306c..fbc2fe8d94 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NodeTypes.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/LithiumNode.java @@ -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"); } }