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%2FSodiumNormalizedNodeOutputStreamWriter.java;h=5f5c0a01fd7fd5a3a9de020a6aa50795776140bb;hb=2d72ea2f5f6860a8e2bb2ae12212ac35b0cd8b99;hp=c549290f8114e99f7619c93cc0d14196a6ad01df;hpb=8edae6ac0a05f2f6263241ce132061aceeae2f04;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/SodiumNormalizedNodeOutputStreamWriter.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/SodiumNormalizedNodeOutputStreamWriter.java index c549290f81..5f5c0a01fd 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/SodiumNormalizedNodeOutputStreamWriter.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/SodiumNormalizedNodeOutputStreamWriter.java @@ -12,6 +12,7 @@ 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.data.api.YangInstanceIdentifier.AugmentationIdentifier; /** @@ -30,6 +31,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.Augmentat */ class SodiumNormalizedNodeOutputStreamWriter extends LithiumNormalizedNodeOutputStreamWriter { private final Map aidCodeMap = new HashMap<>(); + private final Map moduleCodeMap = new HashMap<>(); private final Map qnameCodeMap = new HashMap<>(); SodiumNormalizedNodeOutputStreamWriter(final DataOutput output) { @@ -60,14 +62,29 @@ class SodiumNormalizedNodeOutputStreamWriter extends LithiumNormalizedNodeOutput void writeAugmentationIdentifier(final AugmentationIdentifier aid) throws IOException { final Integer value = aidCodeMap.get(aid); if (value == null) { - // Fresh QName, remember it and emit as three strings + // Fresh AugmentationIdentifier, remember it and emit as three strings aidCodeMap.put(aid, aidCodeMap.size()); writeByte(TokenTypes.IS_AUGMENT_VALUE); super.writeAugmentationIdentifier(aid); } else { - // We have already seen this QName set: write its code + // We have already seen this AugmentationIdentifier: write its code writeByte(TokenTypes.IS_AUGMENT_CODE); writeInt(value); } } + + @Override + void writeModule(final QNameModule module) throws IOException { + final Integer value = moduleCodeMap.get(module); + if (value == null) { + // Fresh QNameModule, remember it and emit as three strings + moduleCodeMap.put(module, moduleCodeMap.size()); + writeByte(TokenTypes.IS_MODULE_VALUE); + super.writeModule(module); + } else { + // We have already seen this QNameModule: write its code + writeByte(TokenTypes.IS_MODULE_CODE); + writeInt(value); + } + } }