2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.manager.impl.dependencyresolver;
10 import javax.annotation.Nullable;
11 import org.opendaylight.controller.config.api.ModuleIdentifier;
12 import org.opendaylight.controller.config.manager.impl.ModuleInternalInfo;
13 import org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicReadableWrapper;
14 import org.opendaylight.controller.config.manager.impl.jmx.TransactionModuleJMXRegistrator.TransactionModuleJMXRegistration;
15 import org.opendaylight.controller.config.spi.Module;
16 import org.opendaylight.controller.config.spi.ModuleFactory;
17 import org.opendaylight.yangtools.concepts.Identifiable;
18 import org.osgi.framework.BundleContext;
20 public class ModuleInternalTransactionalInfo implements Identifiable<ModuleIdentifier> {
21 private final ModuleIdentifier name;
22 private final Module proxiedModule, realModule;
23 private final ModuleFactory moduleFactory;
25 private final ModuleInternalInfo maybeOldInternalInfo;
26 private final TransactionModuleJMXRegistration transactionModuleJMXRegistration;
27 private final boolean isDefaultBean;
28 private final BundleContext bundleContext;
30 public ModuleInternalTransactionalInfo(ModuleIdentifier name, Module proxiedModule,
31 ModuleFactory moduleFactory,
32 ModuleInternalInfo maybeOldInternalInfo,
33 TransactionModuleJMXRegistration transactionModuleJMXRegistration,
34 boolean isDefaultBean, Module realModule, BundleContext bundleContext) {
36 this.proxiedModule = proxiedModule;
37 this.moduleFactory = moduleFactory;
38 this.maybeOldInternalInfo = maybeOldInternalInfo;
39 this.transactionModuleJMXRegistration = transactionModuleJMXRegistration;
40 this.isDefaultBean = isDefaultBean;
41 this.realModule = realModule;
42 this.bundleContext = bundleContext;
46 public boolean hasOldModule() {
47 return maybeOldInternalInfo != null;
50 public DestroyedModule toDestroyedModule() {
51 if (maybeOldInternalInfo == null) {
52 throw new IllegalStateException("Cannot destroy uncommitted module");
54 DynamicReadableWrapper oldModule = maybeOldInternalInfo
56 return new DestroyedModule(name, oldModule.getInstance(),
57 maybeOldInternalInfo.getModuleJMXRegistrator(),
58 maybeOldInternalInfo.getOsgiRegistration(),
59 maybeOldInternalInfo.getOrderingIdx());
63 public Module getProxiedModule() {
67 public ModuleFactory getModuleFactory() {
72 public ModuleInternalInfo getOldInternalInfo() {
73 if (maybeOldInternalInfo == null) {
74 throw new NullPointerException();
76 return maybeOldInternalInfo;
79 public TransactionModuleJMXRegistration getTransactionModuleJMXRegistration() {
80 return transactionModuleJMXRegistration;
84 public ModuleIdentifier getIdentifier() {
88 public boolean isDefaultBean() {
92 public Module getRealModule() {
96 public BundleContext getBundleContext() {