Define DataStoreVersions.MAGNESIUM_VERSION
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / VersionedExternalizableMessage.java
index c809029..f28250b 100644 (file)
@@ -37,8 +37,15 @@ public abstract class VersionedExternalizableMessage implements Externalizable,
     }
 
     protected final @NonNull NormalizedNodeStreamVersion getStreamVersion() {
-        return version < DataStoreVersions.NEON_SR2_VERSION
-                ? NormalizedNodeStreamVersion.LITHIUM : NormalizedNodeStreamVersion.NEON_SR2;
+        if (version >= DataStoreVersions.MAGNESIUM_VERSION) {
+            return NormalizedNodeStreamVersion.MAGNESIUM;
+        } else if (version == DataStoreVersions.SODIUM_SR1_VERSION) {
+            return NormalizedNodeStreamVersion.SODIUM_SR1;
+        } else if (version == DataStoreVersions.NEON_SR2_VERSION) {
+            return NormalizedNodeStreamVersion.NEON_SR2;
+        } else {
+            return NormalizedNodeStreamVersion.LITHIUM;
+        }
     }
 
     @Override
@@ -53,9 +60,10 @@ public abstract class VersionedExternalizableMessage implements Externalizable,
 
     @Override
     public final Object toSerializable() {
-        if (getVersion() < DataStoreVersions.BORON_VERSION) {
-            throw new UnsupportedOperationException("Versions prior to " + DataStoreVersions.BORON_VERSION
-                    + " are not supported");
+        final short ver = getVersion();
+        if (ver < DataStoreVersions.BORON_VERSION) {
+            throw new UnsupportedOperationException("Version " + ver
+                + " is older than the oldest version supported version " + DataStoreVersions.BORON_VERSION);
         }
 
         return this;

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.