*/
package org.opendaylight.controller.config.manager.impl.dependencyresolver;
+import com.google.common.base.Preconditions;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.opendaylight.controller.config.api.ModuleIdentifier;
import org.opendaylight.controller.config.manager.impl.ModuleInternalInfo;
import org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicReadableWrapper;
import org.opendaylight.controller.config.spi.Module;
import org.opendaylight.controller.config.spi.ModuleFactory;
import org.opendaylight.yangtools.concepts.Identifiable;
-
-import javax.annotation.Nullable;
+import org.osgi.framework.BundleContext;
public class ModuleInternalTransactionalInfo implements Identifiable<ModuleIdentifier> {
private final ModuleIdentifier name;
- private final Module proxiedModule, realModule;
+ private final Module proxiedModule;
+ private final Module realModule;
private final ModuleFactory moduleFactory;
- @Nullable
- private final ModuleInternalInfo maybeOldInternalInfo;
+
private final TransactionModuleJMXRegistration transactionModuleJMXRegistration;
private final boolean isDefaultBean;
+ private final BundleContext bundleContext;
+ @Nullable private ModuleInternalInfo maybeOldInternalInfo;
public ModuleInternalTransactionalInfo(ModuleIdentifier name, Module proxiedModule,
ModuleFactory moduleFactory,
ModuleInternalInfo maybeOldInternalInfo,
TransactionModuleJMXRegistration transactionModuleJMXRegistration,
- boolean isDefaultBean, Module realModule) {
+ boolean isDefaultBean, Module realModule, BundleContext bundleContext) {
this.name = name;
this.proxiedModule = proxiedModule;
this.moduleFactory = moduleFactory;
this.transactionModuleJMXRegistration = transactionModuleJMXRegistration;
this.isDefaultBean = isDefaultBean;
this.realModule = realModule;
+ this.bundleContext = bundleContext;
}
return new DestroyedModule(name, oldModule.getInstance(),
maybeOldInternalInfo.getModuleJMXRegistrator(),
maybeOldInternalInfo.getOsgiRegistration(),
- maybeOldInternalInfo.getOrderingIdx());
+ maybeOldInternalInfo.getOrderingIdx(), maybeOldInternalInfo.getRuntimeBeanRegistrator());
}
return moduleFactory;
}
- @Nullable
- public ModuleInternalInfo getOldInternalInfo() {
- if (maybeOldInternalInfo == null) {
- throw new NullPointerException();
- }
- return maybeOldInternalInfo;
+ @Nonnull public ModuleInternalInfo getOldInternalInfo() {
+ return Preconditions.checkNotNull(maybeOldInternalInfo);
+ }
+
+ public void clearOldInternalInfo() {
+ Preconditions.checkState(maybeOldInternalInfo != null, "No old internal info present");
+ maybeOldInternalInfo = null;
}
public TransactionModuleJMXRegistration getTransactionModuleJMXRegistration() {
public Module getRealModule() {
return realModule;
}
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
}