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 org.opendaylight.controller.config.api.ModuleIdentifier;
11 import org.opendaylight.controller.config.manager.impl.ModuleInternalInfo;
12 import org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicReadableWrapper;
13 import org.opendaylight.controller.config.manager.impl.jmx.TransactionModuleJMXRegistrator.TransactionModuleJMXRegistration;
14 import org.opendaylight.controller.config.spi.Module;
15 import org.opendaylight.controller.config.spi.ModuleFactory;
16 import org.opendaylight.yangtools.concepts.Identifiable;
18 import javax.annotation.Nullable;
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;
29 public ModuleInternalTransactionalInfo(ModuleIdentifier name, Module proxiedModule,
30 ModuleFactory moduleFactory,
31 ModuleInternalInfo maybeOldInternalInfo,
32 TransactionModuleJMXRegistration transactionModuleJMXRegistration,
33 boolean isDefaultBean, Module realModule) {
35 this.proxiedModule = proxiedModule;
36 this.moduleFactory = moduleFactory;
37 this.maybeOldInternalInfo = maybeOldInternalInfo;
38 this.transactionModuleJMXRegistration = transactionModuleJMXRegistration;
39 this.isDefaultBean = isDefaultBean;
40 this.realModule = realModule;
44 public boolean hasOldModule() {
45 return maybeOldInternalInfo != null;
48 public DestroyedModule toDestroyedModule() {
49 if (maybeOldInternalInfo == null) {
50 throw new IllegalStateException("Cannot destroy uncommitted module");
52 DynamicReadableWrapper oldModule = maybeOldInternalInfo
54 return new DestroyedModule(name, oldModule.getInstance(),
55 maybeOldInternalInfo.getModuleJMXRegistrator(),
56 maybeOldInternalInfo.getOsgiRegistration(),
57 maybeOldInternalInfo.getOrderingIdx());
61 public Module getProxiedModule() {
65 public ModuleFactory getModuleFactory() {
70 public ModuleInternalInfo getOldInternalInfo() {
71 if (maybeOldInternalInfo == null) {
72 throw new NullPointerException();
74 return maybeOldInternalInfo;
77 public TransactionModuleJMXRegistration getTransactionModuleJMXRegistration() {
78 return transactionModuleJMXRegistration;
82 public ModuleIdentifier getIdentifier() {
86 public boolean isDefaultBean() {
90 public Module getRealModule() {