X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2Futils%2Fstream%2FLithiumNormalizedNodeOutputStreamWriter.java;h=b14bc1904ac8c59e49f7d68e83cee34429caec9b;hb=7086c00686a2641790773574c608c1dbb60abd48;hp=a0aa813f64dd90cc0cceea7608f1c9aae5e950e8;hpb=f746b92d9aa9495a13ce92c01c5c1ae3228bb662;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/LithiumNormalizedNodeOutputStreamWriter.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/LithiumNormalizedNodeOutputStreamWriter.java index a0aa813f64..b14bc1904a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/LithiumNormalizedNodeOutputStreamWriter.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/LithiumNormalizedNodeOutputStreamWriter.java @@ -9,11 +9,9 @@ package org.opendaylight.controller.cluster.datastore.node.utils.stream; import java.io.DataOutput; import java.io.IOException; -import java.util.HashMap; -import java.util.Map; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; -import org.opendaylight.yangtools.yang.common.Revision; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier; /** * NormalizedNodeOutputStreamWriter will be used by distributed datastore to send normalized node in @@ -29,43 +27,28 @@ import org.opendaylight.yangtools.yang.common.Revision; *

Based on the each node, the node type is also written to the stream, that helps in reconstructing the object, * while reading. */ -class LithiumNormalizedNodeOutputStreamWriter extends AbstractNormalizedNodeDataOutput { - private final Map stringCodeMap = new HashMap<>(); - +final class LithiumNormalizedNodeOutputStreamWriter extends AbstractLithiumDataOutput { LithiumNormalizedNodeOutputStreamWriter(final DataOutput output) { super(output); } @Override - protected short streamVersion() { + short streamVersion() { return TokenTypes.LITHIUM_VERSION; } @Override - protected void writeQName(final QName qname) throws IOException { - writeString(qname.getLocalName()); - writeModule(qname.getModule()); + void writeQNameInternal(final QName qname) throws IOException { + defaultWriteQName(qname); } + @Override void writeModule(final QNameModule module) throws IOException { - writeString(module.getNamespace().toString()); - writeString(module.getRevision().map(Revision::toString).orElse(null)); + defaultWriteModule(module); } @Override - protected final void writeString(final String string) throws IOException { - if (string != null) { - final Integer value = stringCodeMap.get(string); - if (value == null) { - stringCodeMap.put(string, stringCodeMap.size()); - writeByte(TokenTypes.IS_STRING_VALUE); - writeUTF(string); - } else { - writeByte(TokenTypes.IS_CODE_VALUE); - writeInt(value); - } - } else { - writeByte(TokenTypes.IS_NULL_VALUE); - } + void writeAugmentationIdentifier(final AugmentationIdentifier aid) throws IOException { + defaultWriteAugmentationIdentifier(aid); } }