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%2FModuleFactoryBundleTracker.java;fp=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Fosgi%2FModuleFactoryBundleTracker.java;h=e89d6c87aa7aaa1cd89f0c6b832c5945630b280b;hp=5e706250afe1c9d04df04d371d5d096eaca2f475;hb=2b78ca93f44c372fd72927db6cbd65f5d8387b49;hpb=c0e813ca83ce80d5f3fb340175ddaecd780c6aea diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTracker.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTracker.java index 5e706250af..e89d6c87aa 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTracker.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTracker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -26,8 +26,8 @@ import org.slf4j.LoggerFactory; * line should contain an implementation of ModuleFactory interface. Creates new * instance with default constructor and registers it into OSGi service * registry. There is no need for listening for implementing removedBundle as - * the services are unregistered automatically. - * Code based on http://www.toedter.com/blog/?p=236 + * the services are unregistered automatically. Code based on + * http://www.toedter.com/blog/?p=236 */ public class ModuleFactoryBundleTracker implements BundleTrackerCustomizer { private final BlankTransactionServiceTracker blankTransactionServiceTracker; @@ -40,8 +40,7 @@ public class ModuleFactoryBundleTracker implements BundleTrackerCustomizer clazz = bundle.loadClass(factoryClassName); if (ModuleFactory.class.isAssignableFrom(clazz)) { try { - LOG.debug("Registering {} in bundle {}", - clazz.getName(), bundle); - return bundle.getBundleContext().registerService( - ModuleFactory.class.getName(), clazz.newInstance(), + LOG.debug("Registering {} in bundle {}", clazz.getName(), bundle); + return bundle.getBundleContext().registerService(ModuleFactory.class.getName(), clazz.newInstance(), null); } catch (final InstantiationException e) { - errorMessage = logMessage( - "Could not instantiate {} in bundle {}, reason {}", - factoryClassName, bundle, e); + errorMessage = logMessage("Could not instantiate {} in bundle {}, reason {}", factoryClassName, + bundle, e); ex = e; } catch (final IllegalAccessException e) { - errorMessage = logMessage( - "Illegal access during instantiation of class {} in bundle {}, reason {}", + errorMessage = logMessage("Illegal access during instantiation of class {} in bundle {}, reason {}", factoryClassName, bundle, e); ex = e; } } else { - errorMessage = logMessage( - "Class {} does not implement {} in bundle {}", clazz, - ModuleFactory.class, bundle); + errorMessage = logMessage("Class {} does not implement {} in bundle {}", clazz, ModuleFactory.class, + bundle); } } catch (final ClassNotFoundException e) { - errorMessage = logMessage( - "Could not find class {} in bundle {}, reason {}", - factoryClassName, bundle, e); + errorMessage = logMessage("Could not find class {} in bundle {}, reason {}", factoryClassName, bundle, e); ex = e; }