Use constructor injection in OSGiRemoteOpsProvider 44/109444/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Dec 2023 20:18:13 +0000 (21:18 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Dec 2023 20:18:13 +0000 (21:18 +0100)
We have a simple component here, use constructor injection to preempty
upgraded SpotBugs issuing errors on it.

Change-Id: Id65f63b374497aabccb98ebe06b52195f76f8099
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/OSGiRemoteOpsProvider.java

index 605337111c15c512333792e9d69788ada2c16578..9de0152be0f736125625988e4758eab48461bee7 100644 (file)
@@ -25,7 +25,7 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Component(immediate = true, configurationPid = "org.opendaylight.controller.remoterpc")
+@Component(configurationPid = "org.opendaylight.controller.remoterpc")
 @Designate(ocd = OSGiRemoteOpsProvider.Config.class)
 public final class OSGiRemoteOpsProvider {
     @ObjectClassDefinition()
@@ -38,21 +38,13 @@ public final class OSGiRemoteOpsProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(OSGiRemoteOpsProvider.class);
 
-    @Reference
-    ActorSystemProvider actorSystemProvider = null;
-    @Reference
-    DOMRpcProviderService rpcProviderService = null;
-    @Reference
-    DOMRpcService rpcService = null;
-    @Reference
-    DOMActionProviderService actionProviderService = null;
-    @Reference
-    DOMActionService actionService = null;
-
     private ActorRef opsManager;
 
     @Activate
-    void activate(final Config config) {
+    public OSGiRemoteOpsProvider(@Reference final ActorSystemProvider actorSystemProvider,
+            @Reference final DOMRpcProviderService rpcProviderService, @Reference final DOMRpcService rpcService,
+            @Reference final DOMActionProviderService actionProviderService,
+            @Reference final DOMActionService actionService, final Config config) {
         LOG.info("Remote Operations service starting");
         final ActorSystem actorSystem = actorSystemProvider.getActorSystem();
         final RemoteOpsProviderConfig opsConfig = RemoteOpsProviderConfig.newInstance(actorSystem.name(),