config-manager: final parameters
[controller.git] / opendaylight / config / config-manager / src / main / java / org / opendaylight / controller / config / manager / impl / ConfigTransactionControllerImpl.java
index ad64288ab203a0e9c00d6bbe5964dff33fedf520..97c42803ef618662efacb522244762088eb4f13a 100644 (file)
@@ -86,11 +86,11 @@ class ConfigTransactionControllerImpl implements
     @GuardedBy("this")
     private final SearchableServiceReferenceWritableRegistry writableSRRegistry;
 
-    public ConfigTransactionControllerImpl(ConfigTransactionLookupRegistry txLookupRegistry,
-                                           long parentVersion, BindingContextProvider bindingContextProvider, long currentVersion,
-                                           Map<String, Entry<ModuleFactory, BundleContext>> currentlyRegisteredFactories,
-                                           MBeanServer transactionsMBeanServer, MBeanServer configMBeanServer,
-                                           boolean blankTransaction, SearchableServiceReferenceWritableRegistry  writableSRRegistry) {
+    public ConfigTransactionControllerImpl(final ConfigTransactionLookupRegistry txLookupRegistry,
+                                           final long parentVersion, final BindingContextProvider bindingContextProvider, final long currentVersion,
+                                           final Map<String, Entry<ModuleFactory, BundleContext>> currentlyRegisteredFactories,
+                                           final MBeanServer transactionsMBeanServer, final MBeanServer configMBeanServer,
+                                           final boolean blankTransaction, final SearchableServiceReferenceWritableRegistry  writableSRRegistry) {
         this.txLookupRegistry = txLookupRegistry;
         String transactionName = txLookupRegistry.getTransactionIdentifier().getName();
         this.controllerON = ObjectNameUtil.createTransactionControllerON(transactionName);
@@ -108,19 +108,19 @@ class ConfigTransactionControllerImpl implements
     }
 
     @Override
-    public void copyExistingModulesAndProcessFactoryDiff(Collection<ModuleInternalInfo> existingModules, List<ModuleFactory> lastListOfFactories) {
+    public void copyExistingModulesAndProcessFactoryDiff(final Collection<ModuleInternalInfo> existingModules, final List<ModuleFactory> lastListOfFactories) {
         // copy old configuration to this server
         for (ModuleInternalInfo oldConfigInfo : existingModules) {
             try {
                 copyExistingModule(oldConfigInfo);
-            } catch (InstanceAlreadyExistsException e) {
+            } catch (final InstanceAlreadyExistsException e) {
                 throw new IllegalStateException("Error while copying " + oldConfigInfo, e);
             }
         }
         processDefaultBeans(lastListOfFactories);
     }
 
-    private synchronized void processDefaultBeans(List<ModuleFactory> lastListOfFactories) {
+    private synchronized void processDefaultBeans(final List<ModuleFactory> lastListOfFactories) {
         transactionStatus.checkNotCommitStarted();
         transactionStatus.checkNotAborted();
 
@@ -152,7 +152,7 @@ class ConfigTransactionControllerImpl implements
                     boolean defaultBean = true;
                     objectName = putConfigBeanToJMXAndInternalMaps(module.getIdentifier(), module, moduleFactory, null,
                             dependencyResolver, defaultBean, bundleContext);
-                } catch (InstanceAlreadyExistsException e) {
+                } catch (final InstanceAlreadyExistsException e) {
                     throw new IllegalStateException(e);
                 }
 
@@ -161,7 +161,7 @@ class ConfigTransactionControllerImpl implements
                 for (String qname : InterfacesHelper.getQNames(serviceInterfaceAnnotations)) {
                     try {
                         saveServiceReference(qname, module.getIdentifier().getInstanceName(), objectName);
-                    } catch (InstanceNotFoundException e) {
+                    } catch (final InstanceNotFoundException e) {
                         throw new IllegalStateException("Unable to register default module instance " + module + " as a service of " + qname, e);
                     }
                 }
@@ -178,7 +178,7 @@ class ConfigTransactionControllerImpl implements
                 for (String qname : InterfacesHelper.getQNames(serviceInterfaceAnnotations)) {
                     try {
                         removeServiceReference(qname, name.getInstanceName());
-                    } catch (InstanceNotFoundException e) {
+                    } catch (final InstanceNotFoundException e) {
                         throw new IllegalStateException("Unable to UNregister default module instance " + name + " as a service of " + qname, e);
                     }
                 }
@@ -190,7 +190,7 @@ class ConfigTransactionControllerImpl implements
     }
 
 
-    private synchronized void copyExistingModule(ModuleInternalInfo oldConfigBeanInfo)
+    private synchronized void copyExistingModule(final ModuleInternalInfo oldConfigBeanInfo)
             throws InstanceAlreadyExistsException {
 
         transactionStatus.checkNotCommitStarted();
@@ -203,7 +203,7 @@ class ConfigTransactionControllerImpl implements
         try {
             moduleFactory = factoriesHolder.findByModuleName(moduleIdentifier.getFactoryName());
             bc = getModuleFactoryBundleContext(moduleFactory.getImplementationName());
-        } catch (ModuleFactoryNotFoundException e) {
+        } catch (final ModuleFactoryNotFoundException e) {
             throw new IllegalStateException(e);
         }
 
@@ -214,7 +214,7 @@ class ConfigTransactionControllerImpl implements
             module = moduleFactory.createModule(
                     moduleIdentifier.getInstanceName(), dependencyResolver,
                     oldConfigBeanInfo.getReadableModule(), bc);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new IllegalStateException(String.format(
                     "Error while copying old configuration from %s to %s",
                     oldConfigBeanInfo, moduleFactory), e);
@@ -224,7 +224,7 @@ class ConfigTransactionControllerImpl implements
     }
 
     @Override
-    public synchronized ObjectName createModule(String factoryName, String instanceName)
+    public synchronized ObjectName createModule(final String factoryName, final String instanceName)
             throws InstanceAlreadyExistsException {
 
         transactionStatus.checkNotCommitStarted();
@@ -245,7 +245,7 @@ class ConfigTransactionControllerImpl implements
     }
 
     @Override
-    public synchronized void reCreateModule(ObjectName objectName) throws InstanceNotFoundException {
+    public synchronized void reCreateModule(final ObjectName objectName) throws InstanceNotFoundException {
         transactionStatus.checkNotCommitStarted();
         transactionStatus.checkNotAborted();
         checkTransactionName(objectName);
@@ -260,10 +260,10 @@ class ConfigTransactionControllerImpl implements
     }
 
     private synchronized ObjectName putConfigBeanToJMXAndInternalMaps(
-            ModuleIdentifier moduleIdentifier, Module module,
-            ModuleFactory moduleFactory,
-            @Nullable ModuleInternalInfo maybeOldConfigBeanInfo, DependencyResolver dependencyResolver,
-            boolean isDefaultBean, BundleContext bundleContext)
+            final ModuleIdentifier moduleIdentifier, final Module module,
+            final ModuleFactory moduleFactory,
+            @Nullable final ModuleInternalInfo maybeOldConfigBeanInfo, final DependencyResolver dependencyResolver,
+            final boolean isDefaultBean, final BundleContext bundleContext)
             throws InstanceAlreadyExistsException {
 
         LOG.debug("Adding module {} to transaction {}", moduleIdentifier, this);
@@ -293,7 +293,7 @@ class ConfigTransactionControllerImpl implements
     }
 
     @Override
-    public synchronized void destroyModule(ObjectName objectName) throws InstanceNotFoundException {
+    public synchronized void destroyModule(final ObjectName objectName) throws InstanceNotFoundException {
         checkTransactionName(objectName);
         ObjectNameUtil.checkDomain(objectName);
         ModuleIdentifier moduleIdentifier = ObjectNameUtil.fromON(objectName,
@@ -301,7 +301,7 @@ class ConfigTransactionControllerImpl implements
         destroyModule(moduleIdentifier);
     }
 
-    private void checkTransactionName(ObjectName objectName) {
+    private void checkTransactionName(final ObjectName objectName) {
         String foundTransactionName = ObjectNameUtil
                 .getTransactionName(objectName);
         if (!getTransactionIdentifier().getName().equals(foundTransactionName)) {
@@ -310,7 +310,7 @@ class ConfigTransactionControllerImpl implements
         }
     }
 
-    private synchronized void destroyModule(ModuleIdentifier moduleIdentifier) {
+    private synchronized void destroyModule(final ModuleIdentifier moduleIdentifier) {
         LOG.debug("Destroying module {} in transaction {}", moduleIdentifier, this);
         transactionStatus.checkNotAborted();
 
@@ -324,7 +324,7 @@ class ConfigTransactionControllerImpl implements
         try {
             writableSRRegistry.removeServiceReferences(
                     ObjectNameUtil.createTransactionModuleON(getTransactionName(), moduleIdentifier));
-        } catch (InstanceNotFoundException e) {
+        } catch (final InstanceNotFoundException e) {
             LOG.error("Possible code error: cannot find {} in {}", moduleIdentifier, writableSRRegistry);
             throw new IllegalStateException("Possible code error: cannot find " + moduleIdentifier, e);
         }
@@ -368,7 +368,7 @@ class ConfigTransactionControllerImpl implements
             Module module = entry.getValue();
             try {
                 module.validate();
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 LOG.warn("Validation exception in {}", getTransactionName(),
                         e);
                 collectedExceptions.add(ValidationException
@@ -397,7 +397,7 @@ class ConfigTransactionControllerImpl implements
         configBeanModificationDisabled.set(true);
         try {
             validateNoLocks();
-        } catch (ValidationException e) {
+        } catch (final ValidationException e) {
             LOG.trace("Commit failed on validation");
             // recoverable error
             configBeanModificationDisabled.set(false);
@@ -438,7 +438,7 @@ class ConfigTransactionControllerImpl implements
                         moduleIdentifier, getTransactionIdentifier());
                 AutoCloseable instance = module.getInstance();
                 Preconditions.checkNotNull(instance, "Instance is null:{} in transaction {}", moduleIdentifier, getTransactionIdentifier());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 LOG.error("Commit failed on {} in transaction {}", moduleIdentifier,
                         getTransactionIdentifier(), e);
                 internalAbort();
@@ -495,7 +495,7 @@ class ConfigTransactionControllerImpl implements
      * {@inheritDoc}
      */
     @Override
-    public Set<ObjectName> lookupConfigBeans(String moduleName) {
+    public Set<ObjectName> lookupConfigBeans(final String moduleName) {
         return txLookupRegistry.lookupConfigBeans(moduleName);
     }
 
@@ -503,7 +503,7 @@ class ConfigTransactionControllerImpl implements
      * {@inheritDoc}
      */
     @Override
-    public ObjectName lookupConfigBean(String moduleName, String instanceName)
+    public ObjectName lookupConfigBean(final String moduleName, final String instanceName)
             throws InstanceNotFoundException {
         return txLookupRegistry.lookupConfigBean(moduleName, instanceName);
     }
@@ -512,7 +512,7 @@ class ConfigTransactionControllerImpl implements
      * {@inheritDoc}
      */
     @Override
-    public Set<ObjectName> lookupConfigBeans(String moduleName, String instanceName) {
+    public Set<ObjectName> lookupConfigBeans(final String moduleName, final String instanceName) {
         return txLookupRegistry.lookupConfigBeans(moduleName, instanceName);
     }
 
@@ -520,7 +520,7 @@ class ConfigTransactionControllerImpl implements
      * {@inheritDoc}
      */
     @Override
-    public void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException {
+    public void checkConfigBeanExists(final ObjectName objectName) throws InstanceNotFoundException {
         txLookupRegistry.checkConfigBeanExists(objectName);
     }
 
@@ -537,8 +537,8 @@ class ConfigTransactionControllerImpl implements
      * {@inheritDoc}
      */
     @Override
-    public Set<ObjectName> lookupRuntimeBeans(String moduleName,
-                                              String instanceName) {
+    public Set<ObjectName> lookupRuntimeBeans(final String moduleName,
+                                              final String instanceName) {
         return txLookupRegistry.lookupRuntimeBeans(moduleName, instanceName);
     }
 
@@ -586,7 +586,7 @@ class ConfigTransactionControllerImpl implements
     }
 
     @Override
-    public BundleContext getModuleFactoryBundleContext(String factoryName) {
+    public BundleContext getModuleFactoryBundleContext(final String factoryName) {
         Map.Entry<ModuleFactory, BundleContext> factoryBundleContextEntry = this.currentlyRegisteredFactories.get(factoryName);
         if (factoryBundleContextEntry == null || factoryBundleContextEntry.getValue() == null) {
             throw new NullPointerException("Bundle context of " + factoryName + " ModuleFactory not found.");
@@ -598,7 +598,7 @@ class ConfigTransactionControllerImpl implements
 
 
     @Override
-    public synchronized ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName) {
+    public synchronized ObjectName lookupConfigBeanByServiceInterfaceName(final String serviceInterfaceQName, final String refName) {
         return writableSRRegistry.lookupConfigBeanByServiceInterfaceName(serviceInterfaceQName, refName);
     }
 
@@ -608,27 +608,27 @@ class ConfigTransactionControllerImpl implements
     }
 
     @Override
-    public synchronized Map<String, ObjectName> lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName) {
+    public synchronized Map<String, ObjectName> lookupServiceReferencesByServiceInterfaceName(final String serviceInterfaceQName) {
         return writableSRRegistry.lookupServiceReferencesByServiceInterfaceName(serviceInterfaceQName);
     }
 
     @Override
-    public synchronized Set<String> lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException {
+    public synchronized Set<String> lookupServiceInterfaceNames(final ObjectName objectName) throws InstanceNotFoundException {
         return writableSRRegistry.lookupServiceInterfaceNames(objectName);
     }
 
     @Override
-    public synchronized String getServiceInterfaceName(String namespace, String localName) {
+    public synchronized String getServiceInterfaceName(final String namespace, final String localName) {
         return writableSRRegistry.getServiceInterfaceName(namespace, localName);
     }
 
     @Override
-    public synchronized ObjectName saveServiceReference(String serviceInterfaceName, String refName, ObjectName moduleON) throws InstanceNotFoundException {
+    public synchronized ObjectName saveServiceReference(final String serviceInterfaceName, final String refName, final ObjectName moduleON) throws InstanceNotFoundException {
         return writableSRRegistry.saveServiceReference(serviceInterfaceName, refName, moduleON);
     }
 
     @Override
-    public synchronized void removeServiceReference(String serviceInterfaceName, String refName) throws InstanceNotFoundException {
+    public synchronized void removeServiceReference(final String serviceInterfaceName, final String refName) throws InstanceNotFoundException {
         writableSRRegistry.removeServiceReference(serviceInterfaceName, refName);
     }
 
@@ -638,7 +638,7 @@ class ConfigTransactionControllerImpl implements
     }
 
     @Override
-    public boolean removeServiceReferences(ObjectName objectName) throws InstanceNotFoundException {
+    public boolean removeServiceReferences(final ObjectName objectName) throws InstanceNotFoundException {
         return writableSRRegistry.removeServiceReferences(objectName);
     }
 
@@ -658,12 +658,12 @@ class ConfigTransactionControllerImpl implements
     }
 
     @Override
-    public void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException {
+    public void checkServiceReferenceExists(final ObjectName objectName) throws InstanceNotFoundException {
         writableSRRegistry.checkServiceReferenceExists(objectName);
     }
 
     @Override
-    public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException {
+    public ObjectName getServiceReference(final String serviceInterfaceQName, final String refName) throws InstanceNotFoundException {
         return writableSRRegistry.getServiceReference(serviceInterfaceQName, refName);
     }
 }