X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fblueprint%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fblueprint%2FBlueprintBundleTracker.java;h=8812650aa681474e881c9ea39f7476671b85a1e3;hb=refs%2Fchanges%2F02%2F83802%2F42;hp=ebc697592348b2815b9de511f1bc639ff3bc0890;hpb=b4bf55727093657662d8c16a50fa85f87978a586;p=controller.git diff --git a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java index ebc6975923..8812650aa6 100644 --- a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java +++ b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java @@ -7,6 +7,7 @@ */ package org.opendaylight.controller.blueprint; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -21,6 +22,7 @@ import org.apache.aries.blueprint.services.BlueprintExtenderService; import org.apache.aries.quiesce.participant.QuiesceParticipant; import org.apache.aries.util.AriesFrameworkUtil; import org.eclipse.jdt.annotation.Nullable; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import org.opendaylight.controller.blueprint.ext.OpendaylightNamespaceHandler; import org.opendaylight.yangtools.util.xml.UntrustedXML; import org.osgi.framework.Bundle; @@ -88,7 +90,7 @@ public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCus bundleTracker = new BundleTracker<>(context, Bundle.ACTIVE, this); - blueprintExtenderServiceTracker = new ServiceTracker<>(context, BlueprintExtenderService.class.getName(), + blueprintExtenderServiceTracker = new ServiceTracker<>(context, BlueprintExtenderService.class, new ServiceTrackerCustomizer() { @Override public BlueprintExtenderService addingService( @@ -108,7 +110,7 @@ public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCus }); blueprintExtenderServiceTracker.open(); - quiesceParticipantTracker = new ServiceTracker<>(context, QuiesceParticipant.class.getName(), + quiesceParticipantTracker = new ServiceTracker<>(context, QuiesceParticipant.class, new ServiceTrackerCustomizer() { @Override public QuiesceParticipant addingService( @@ -129,6 +131,8 @@ public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCus quiesceParticipantTracker.open(); } + @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", + justification = "https://github.com/spotbugs/spotbugs/issues/811") private QuiesceParticipant onQuiesceParticipantAdded(final ServiceReference reference) { quiesceParticipant = reference.getBundle().getBundleContext().getService(reference); @@ -139,6 +143,8 @@ public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCus return quiesceParticipant; } + @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", + justification = "https://github.com/spotbugs/spotbugs/issues/811") private BlueprintExtenderService onBlueprintExtenderServiceAdded( final ServiceReference reference) { blueprintExtenderService = reference.getBundle().getBundleContext().getService(reference); @@ -150,21 +156,25 @@ public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCus restartService.setBlueprintExtenderService(blueprintExtenderService); - blueprintContainerRestartReg = bundleContext.registerService( - BlueprintContainerRestartService.class.getName(), restartService, new Hashtable<>()); + blueprintContainerRestartReg = bundleContext.registerService(BlueprintContainerRestartService.class, + restartService, null); return blueprintExtenderService; } private void registerNamespaceHandler(final BundleContext context) { - Dictionary props = new Hashtable<>(); + Dictionary props = emptyDict(); props.put("osgi.service.blueprint.namespace", OpendaylightNamespaceHandler.NAMESPACE_1_0_0); - namespaceReg = context.registerService(NamespaceHandler.class.getName(), - new OpendaylightNamespaceHandler(), props); + namespaceReg = context.registerService(NamespaceHandler.class, new OpendaylightNamespaceHandler(), props); } private void registerBlueprintEventHandler(final BundleContext context) { - eventHandlerReg = context.registerService(BlueprintListener.class.getName(), this, new Hashtable<>()); + eventHandlerReg = context.registerService(BlueprintListener.class, this, null); + } + + @SuppressModernizer + private static Dictionary emptyDict() { + return new Hashtable<>(); } /**