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=87aec1dc1188536065d84c7587e056b67c08b8a5;hb=fba327c801062a6e802f212a0e8b6efee2f6a90e;hp=f46a9e2a5b13e6a312a6663f53157121b74bd730;hpb=69e914b3889a82fa2f7daa8d55e1aa0de23fb454;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..87aec1dc11 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,12 +43,33 @@ 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 */ public static NormalizedNodeDataOutput newDataOutput(final @NonNull DataOutput output) { - return new NormalizedNodeOutputStreamWriter(output); + return new NeonSR2NormalizedNodeOutputStreamWriter(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 NEON_SR2: + return new NeonSR2NormalizedNodeOutputStreamWriter(output); + default: + throw new IllegalStateException("Unhandled version " + version); + } } + }