Add warning when user destroys default module.
[controller.git] / opendaylight / config / config-manager / src / main / java / org / opendaylight / controller / config / manager / impl / ModuleInternalInfo.java
index fefc88651c4a6d54854b610361dda71208f68180..14a706dd9b990e9251233aacef2db022502fb1dc 100644 (file)
@@ -14,13 +14,13 @@ import org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicReada
 import org.opendaylight.controller.config.manager.impl.jmx.ModuleJMXRegistrator;
 import org.opendaylight.controller.config.manager.impl.jmx.RootRuntimeBeanRegistratorImpl;
 import org.opendaylight.controller.config.manager.impl.osgi.BeanToOsgiServiceManager.OsgiRegistration;
-import org.opendaylight.protocol.concepts.NamedObject;
+import org.opendaylight.yangtools.concepts.Identifiable;
 
 /**
  * Provides metadata about Module from controller to registry.
  */
-public class ModuleInternalInfo implements NamedObject<ModuleIdentifier>,
-        Comparable<ModuleInternalInfo> {
+public class ModuleInternalInfo implements Comparable<ModuleInternalInfo>,
+                Identifiable<ModuleIdentifier>{
 
     private final ModuleIdentifier name;
     // this registrator is passed to runtime bean registrator and config
@@ -35,12 +35,14 @@ public class ModuleInternalInfo implements NamedObject<ModuleIdentifier>,
     private final OsgiRegistration osgiRegistration;
     private final ModuleJMXRegistrator moduleJMXRegistrator;
     private final int orderingIdx;
+    private final boolean isDefaultBean;
 
     public ModuleInternalInfo(ModuleIdentifier name,
             @Nullable DynamicReadableWrapper readableModule,
             OsgiRegistration osgiRegistration,
             RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator,
-            ModuleJMXRegistrator moduleJMXRegistrator, int orderingIdx) {
+            ModuleJMXRegistrator moduleJMXRegistrator, int orderingIdx,
+            boolean isDefaultBean) {
 
         if (osgiRegistration == null) {
             throw new IllegalArgumentException(
@@ -56,6 +58,7 @@ public class ModuleInternalInfo implements NamedObject<ModuleIdentifier>,
         this.name = name;
         this.moduleJMXRegistrator = moduleJMXRegistrator;
         this.orderingIdx = orderingIdx;
+        this.isDefaultBean = isDefaultBean;
     }
 
     public DynamicReadableWrapper getReadableModule() {
@@ -87,7 +90,7 @@ public class ModuleInternalInfo implements NamedObject<ModuleIdentifier>,
         return osgiRegistration;
     }
 
-    @Override
+    @Deprecated
     public ModuleIdentifier getName() {
         return name;
     }
@@ -112,4 +115,13 @@ public class ModuleInternalInfo implements NamedObject<ModuleIdentifier>,
                 getReadableModule().getInstance(), getModuleJMXRegistrator(),
                 getOsgiRegistration(), getOrderingIdx());
     }
+
+    @Override
+    public ModuleIdentifier getIdentifier() {
+        return name;
+    }
+
+    public boolean isDefaultBean() {
+        return isDefaultBean;
+    }
 }