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%2FNormalizedNodeInputOutput.java;h=bcb4cbf16f569c3584f10e28d04a6b88059162c1;hb=refs%2Fchanges%2F62%2F82462%2F1;hp=f46a9e2a5b13e6a312a6663f53157121b74bd730;hpb=733db329220a7d83f78c424da69eeb2c58c4b061;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputOutput.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputOutput.java index f46a9e2a5b..bcb4cbf16f 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputOutput.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputOutput.java @@ -43,7 +43,8 @@ public final class NormalizedNodeInputOutput { } /** - * Creates a new {@link NormalizedNodeDataOutput} instance that writes to the given output. + * Creates a new {@link NormalizedNodeDataOutput} instance that writes to the given output and latest current + * stream version. * * @param output the DataOutput to write to * @return a new {@link NormalizedNodeDataOutput} instance @@ -51,4 +52,24 @@ public final class NormalizedNodeInputOutput { public static NormalizedNodeDataOutput newDataOutput(final @NonNull DataOutput output) { return new NormalizedNodeOutputStreamWriter(output); } + + /** + * Creates a new {@link NormalizedNodeDataOutput} instance that writes to the given output. + * + * @param output the DataOutput to write to + * @param version Streaming version to use + * @return a new {@link NormalizedNodeDataOutput} instance + */ + public static NormalizedNodeDataOutput newDataOutput(final @NonNull DataOutput output, + final @NonNull NormalizedNodeStreamVersion version) { + switch (version) { + case LITHIUM: + return new LithiumNormalizedNodeOutputStreamWriter(output); + case SODIUM: + return new SodiumNormalizedNodeOutputStreamWriter(output); + default: + throw new IllegalStateException("Unhandled version " + version); + } + } + }