Merge "Refactor Subnet.isSubnetOf - reduce number of 'if' statements. Added unitests."
[controller.git] / opendaylight / config / config-manager / src / main / java / org / opendaylight / controller / config / manager / impl / ModuleInternalTransactionalInfo.java
index c71c3bb4701c040e825e33807b979a60ff1d6aa3..0a4ceacb439c363a5884b0e2296089d6f10ab6ef 100644 (file)
@@ -11,37 +11,34 @@ import javax.annotation.Nullable;
 
 import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicReadableWrapper;
-import org.opendaylight.controller.config.manager.impl.jmx.TransactionModuleJMXRegistrator;
 import org.opendaylight.controller.config.manager.impl.jmx.TransactionModuleJMXRegistrator
         .TransactionModuleJMXRegistration;
 import org.opendaylight.controller.config.spi.Module;
 import org.opendaylight.controller.config.spi.ModuleFactory;
-import org.opendaylight.protocol.concepts.NamedObject;
+import org.opendaylight.yangtools.concepts.Identifiable;
 
-public class ModuleInternalTransactionalInfo implements
-        NamedObject<ModuleIdentifier> {
+public class ModuleInternalTransactionalInfo implements Identifiable<ModuleIdentifier> {
     private final ModuleIdentifier name;
     private final Module module;
     private final ModuleFactory moduleFactory;
     @Nullable
     private final ModuleInternalInfo maybeOldInternalInfo;
     private final TransactionModuleJMXRegistration transactionModuleJMXRegistration;
+    private final boolean isDefaultBean;
 
     ModuleInternalTransactionalInfo(ModuleIdentifier name, Module module,
             ModuleFactory moduleFactory,
             ModuleInternalInfo maybeOldInternalInfo,
-            TransactionModuleJMXRegistration transactionModuleJMXRegistration) {
+            TransactionModuleJMXRegistration transactionModuleJMXRegistration,
+            boolean isDefaultBean) {
         this.name = name;
         this.module = module;
         this.moduleFactory = moduleFactory;
         this.maybeOldInternalInfo = maybeOldInternalInfo;
         this.transactionModuleJMXRegistration = transactionModuleJMXRegistration;
+        this.isDefaultBean = isDefaultBean;
     }
 
-    @Override
-    public ModuleIdentifier getName() {
-        return name;
-    }
 
     public boolean hasOldModule() {
         return maybeOldInternalInfo != null;
@@ -49,7 +46,7 @@ public class ModuleInternalTransactionalInfo implements
 
     public DestroyedModule toDestroyedModule() {
         if (maybeOldInternalInfo == null) {
-            throw new IllegalStateException("Cannot destoy uncommitted module");
+            throw new IllegalStateException("Cannot destroy uncommitted module");
         }
         DynamicReadableWrapper oldModule = maybeOldInternalInfo
                 .getReadableModule();
@@ -59,6 +56,7 @@ public class ModuleInternalTransactionalInfo implements
                 maybeOldInternalInfo.getOrderingIdx());
     }
 
+
     public Module getModule() {
         return module;
     }
@@ -77,4 +75,13 @@ public class ModuleInternalTransactionalInfo implements
     public TransactionModuleJMXRegistration getTransactionModuleJMXRegistration() {
         return transactionModuleJMXRegistration;
     }
+
+    @Override
+    public ModuleIdentifier getIdentifier() {
+        return name;
+    }
+
+    public boolean isDefaultBean() {
+        return isDefaultBean;
+    }
 }