Merge "Statistics-Manager - Performance Improvement 1) Introduced statistics request...
[controller.git] / opendaylight / config / config-manager / src / main / java / org / opendaylight / controller / config / manager / impl / ModuleInternalInfo.java
index 0d5f18eff0b727454582ba2bb18fb457dc32d7a5..76299e67a287fc922dbd034bddeeecd8df361602 100644 (file)
@@ -10,15 +10,20 @@ package org.opendaylight.controller.config.manager.impl;
 import javax.annotation.Nullable;
 
 import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.controller.config.manager.impl.dependencyresolver.DestroyedModule;
 import org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicReadableWrapper;
 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.controller.config.spi.ModuleFactory;
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.osgi.framework.BundleContext;
 
 /**
  * Provides metadata about Module from controller to registry.
  */
-public class ModuleInternalInfo implements Comparable<ModuleInternalInfo> {
+public class ModuleInternalInfo implements Comparable<ModuleInternalInfo>,
+                Identifiable<ModuleIdentifier>{
 
     private final ModuleIdentifier name;
     // this registrator is passed to runtime bean registrator and config
@@ -33,12 +38,16 @@ public class ModuleInternalInfo implements Comparable<ModuleInternalInfo> {
     private final OsgiRegistration osgiRegistration;
     private final ModuleJMXRegistrator moduleJMXRegistrator;
     private final int orderingIdx;
+    private final boolean isDefaultBean;
+    private final ModuleFactory moduleFactory;
+    private final BundleContext bundleContext;
 
     public ModuleInternalInfo(ModuleIdentifier name,
             @Nullable DynamicReadableWrapper readableModule,
             OsgiRegistration osgiRegistration,
             RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator,
-            ModuleJMXRegistrator moduleJMXRegistrator, int orderingIdx) {
+            ModuleJMXRegistrator moduleJMXRegistrator, int orderingIdx,
+            boolean isDefaultBean, ModuleFactory moduleFactory, BundleContext bundleContext) {
 
         if (osgiRegistration == null) {
             throw new IllegalArgumentException(
@@ -54,6 +63,9 @@ public class ModuleInternalInfo implements Comparable<ModuleInternalInfo> {
         this.name = name;
         this.moduleJMXRegistrator = moduleJMXRegistrator;
         this.orderingIdx = orderingIdx;
+        this.isDefaultBean = isDefaultBean;
+        this.moduleFactory = moduleFactory;
+        this.bundleContext = bundleContext;
     }
 
     public DynamicReadableWrapper getReadableModule() {
@@ -85,10 +97,6 @@ public class ModuleInternalInfo implements Comparable<ModuleInternalInfo> {
         return osgiRegistration;
     }
 
-    public ModuleIdentifier getName() {
-        return name;
-    }
-
     /**
      * Get index representing dependency ordering within a transaction.
      */
@@ -105,8 +113,25 @@ public class ModuleInternalInfo implements Comparable<ModuleInternalInfo> {
     }
 
     public DestroyedModule toDestroyedModule() {
-        return new DestroyedModule(getName(),
+        return new DestroyedModule(getIdentifier(),
                 getReadableModule().getInstance(), getModuleJMXRegistrator(),
                 getOsgiRegistration(), getOrderingIdx());
     }
+
+    @Override
+    public ModuleIdentifier getIdentifier() {
+        return name;
+    }
+
+    public boolean isDefaultBean() {
+        return isDefaultBean;
+    }
+
+    public ModuleFactory getModuleFactory() {
+        return moduleFactory;
+    }
+
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
 }