X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Fosgi%2FBundleContextBackedModuleFactoriesResolver.java;h=0cbbbab912d3cce521fda7de34837092613b9a47;hp=e8639d588197c146483b434fd83b4fb653a32c49;hb=0e74e5866c506da072cae3a2897335df7170f958;hpb=7a2d5cb49eab242e10233e0218ee1906c13df901 diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BundleContextBackedModuleFactoriesResolver.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BundleContextBackedModuleFactoriesResolver.java index e8639d5881..0cbbbab912 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BundleContextBackedModuleFactoriesResolver.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BundleContextBackedModuleFactoriesResolver.java @@ -22,14 +22,12 @@ import org.slf4j.LoggerFactory; /** * Retrieves list of currently registered Module Factories using bundlecontext. */ -public class BundleContextBackedModuleFactoriesResolver implements - ModuleFactoriesResolver { - private static final Logger LOG = LoggerFactory - .getLogger(BundleContextBackedModuleFactoriesResolver.class); +public class BundleContextBackedModuleFactoriesResolver implements ModuleFactoriesResolver { + private static final Logger LOG = LoggerFactory.getLogger(BundleContextBackedModuleFactoriesResolver.class); private final BundleContext bundleContext; public BundleContextBackedModuleFactoriesResolver( - BundleContext bundleContext) { + final BundleContext bundleContext) { this.bundleContext = bundleContext; } @@ -37,8 +35,7 @@ public class BundleContextBackedModuleFactoriesResolver implements public Map> getAllFactories() { Collection> serviceReferences; try { - serviceReferences = bundleContext.getServiceReferences( - ModuleFactory.class, null); + serviceReferences = bundleContext.getServiceReferences(ModuleFactory.class, null); } catch (InvalidSyntaxException e) { throw new IllegalStateException(e); } @@ -49,7 +46,7 @@ public class BundleContextBackedModuleFactoriesResolver implements // returned by a ServiceFactory does not // implement the classes under which it was registered or the // ServiceFactory threw an exception. - if(factory == null) { + if (factory == null) { throw new NullPointerException("ServiceReference of class" + serviceReference.getClass() + "not found."); } @@ -65,15 +62,15 @@ public class BundleContextBackedModuleFactoriesResolver implements Map.Entry conflicting = result.get(moduleName); if (conflicting != null) { - String error = String - .format("Module name is not unique. Found two conflicting factories with same name '%s': '%s' '%s'", - moduleName, conflicting.getKey(), factory); + String error = String.format( + "Module name is not unique. Found two conflicting factories with same name '%s': '%s' '%s'", + moduleName, conflicting.getKey(), factory); LOG.error(error); throw new IllegalArgumentException(error); - } else { - result.put(moduleName, new AbstractMap.SimpleImmutableEntry<>(factory, - serviceReference.getBundle().getBundleContext())); } + + result.put(moduleName, new AbstractMap.SimpleImmutableEntry<>(factory, + serviceReference.getBundle().getBundleContext())); } return result; }