Migrate OSGI compendium reference
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / LogicalDatastoreType.java
index 2951610e414ab2231a277ff29b12566334c94e41..c72be1c5d7585c259c74a9633aa28dd4773aa220 100644 (file)
@@ -7,8 +7,11 @@
  */
 package org.opendaylight.controller.md.sal.common.api.data;
 
-public enum LogicalDatastoreType {
+import org.eclipse.jdt.annotation.NonNullByDefault;
 
+@Deprecated(forRemoval = true)
+@NonNullByDefault
+public enum LogicalDatastoreType {
     /**
      * Logical atastore representing operational state of the system
      * and it's components
@@ -18,7 +21,12 @@ public enum LogicalDatastoreType {
      * the system and it's operation related data.
      *
      */
-    OPERATIONAL,
+    OPERATIONAL {
+        @Override
+        public org.opendaylight.mdsal.common.api.LogicalDatastoreType toMdsal() {
+            return org.opendaylight.mdsal.common.api.LogicalDatastoreType.OPERATIONAL;
+        }
+    },
     /**
      * Logical Datastore representing configuration state of the system
      * and it's components.
@@ -28,5 +36,34 @@ public enum LogicalDatastoreType {
      * the system and intended operation mode.
      *
      */
-    CONFIGURATION
+    CONFIGURATION {
+        @Override
+        public org.opendaylight.mdsal.common.api.LogicalDatastoreType toMdsal() {
+            return org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
+        }
+    };
+
+    /**
+     * Convert this logical datastore type to its MD-SAL counterpart.
+     *
+     * @return MD-SAL counterpart of this type.
+     */
+    public abstract org.opendaylight.mdsal.common.api.LogicalDatastoreType toMdsal();
+
+    /**
+     * Convert MD-SAL logical datastore type to this counterpart.
+     *
+     * @param type MD-SAL counterpart of this type.
+     * @return Corresponding value in this type.
+     */
+    public static LogicalDatastoreType fromMdsal(final org.opendaylight.mdsal.common.api.LogicalDatastoreType type) {
+        switch (type) {
+            case CONFIGURATION:
+                return CONFIGURATION;
+            case OPERATIONAL:
+                return OPERATIONAL;
+            default:
+                throw new IllegalArgumentException("Unhandled type " + type);
+        }
+    }
 }