X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2FModuleInternalInfo.java;h=fa263bc9330b6d07f2b732771c13c8951a8f1d4a;hp=fd6262cb8cf34f222b70c0e643bf9edc688d46b5;hb=f43b01b81319959b1907e3e04537f5169e7f33d8;hpb=5b16b5aa030d26cbf2c6dc17b3f7a530fbdb987f diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ModuleInternalInfo.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ModuleInternalInfo.java index fd6262cb8c..fa263bc933 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ModuleInternalInfo.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ModuleInternalInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -8,20 +8,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, - Identifiable{ +public class ModuleInternalInfo implements Comparable, Identifiable { private final ModuleIdentifier name; // this registrator is passed to runtime bean registrator and config @@ -37,21 +37,17 @@ public class ModuleInternalInfo implements Comparable, 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, - boolean isDefaultBean) { + public ModuleInternalInfo(final ModuleIdentifier name, @Nullable final DynamicReadableWrapper readableModule, + final OsgiRegistration osgiRegistration, + @Nullable final RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator, + final ModuleJMXRegistrator moduleJMXRegistrator, final int orderingIdx, final boolean isDefaultBean, + final ModuleFactory moduleFactory, final BundleContext bundleContext) { if (osgiRegistration == null) { - throw new IllegalArgumentException( - "Parameter 'osgiRegistration' is missing"); - } - if (runtimeBeanRegistrator == null) { - throw new IllegalArgumentException( - "Parameter 'runtimeBeanRegistrator' is missing"); + throw new IllegalArgumentException("Parameter 'osgiRegistration' is missing"); } this.readableModule = readableModule; this.osgiRegistration = osgiRegistration; @@ -60,6 +56,8 @@ public class ModuleInternalInfo implements Comparable, this.moduleJMXRegistrator = moduleJMXRegistrator; this.orderingIdx = orderingIdx; this.isDefaultBean = isDefaultBean; + this.moduleFactory = moduleFactory; + this.bundleContext = bundleContext; } public DynamicReadableWrapper getReadableModule() { @@ -71,8 +69,9 @@ public class ModuleInternalInfo implements Comparable, } /** + * Tells if a running instance exists in the system. * - * @return iif an running instance exists in the system. + * @return is there any running instance in the system. */ public boolean hasReadableModule() { return readableModule != null; @@ -93,23 +92,21 @@ public class ModuleInternalInfo implements Comparable, /** * Get index representing dependency ordering within a transaction. + * + * @return index */ public int getOrderingIdx() { return orderingIdx; } - /** - * Compare using orderingIdx - */ @Override - public int compareTo(ModuleInternalInfo o) { - return Integer.compare(orderingIdx, o.orderingIdx); + public int compareTo(final ModuleInternalInfo moduleInternalInfo) { + return Integer.compare(orderingIdx, moduleInternalInfo.orderingIdx); } public DestroyedModule toDestroyedModule() { - return new DestroyedModule(getIdentifier(), - getReadableModule().getInstance(), getModuleJMXRegistrator(), - getOsgiRegistration(), getOrderingIdx()); + return new DestroyedModule(getIdentifier(), getReadableModule().getInstance(), getModuleJMXRegistrator(), + getOsgiRegistration(), getOrderingIdx(), runtimeBeanRegistrator); } @Override @@ -120,4 +117,12 @@ public class ModuleInternalInfo implements Comparable, public boolean isDefaultBean() { return isDefaultBean; } + + public ModuleFactory getModuleFactory() { + return moduleFactory; + } + + public BundleContext getBundleContext() { + return bundleContext; + } }