Remove reliance on org.opendaylight.controller.sal.core.api.Broker
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / RemoteRpcProvider.java
index e4f6a21..51e56d0 100644 (file)
@@ -12,12 +12,8 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.PoisonPill;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import java.util.Collection;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
-import org.opendaylight.controller.sal.core.api.Broker;
-import org.opendaylight.controller.sal.core.api.Provider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -25,28 +21,25 @@ import org.slf4j.LoggerFactory;
  * This is the base class which initialize all the actors, listeners and
  * default RPc implementation so remote invocation of rpcs.
  */
-public class RemoteRpcProvider implements AutoCloseable, Provider {
+public class RemoteRpcProvider implements AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(RemoteRpcProvider.class);
 
     private final DOMRpcProviderService rpcProvisionRegistry;
     private final RemoteRpcProviderConfig config;
     private final ActorSystem actorSystem;
+    private final DOMRpcService rpcService;
 
-    private DOMRpcService rpcService;
     private ActorRef rpcManager;
 
     public RemoteRpcProvider(final ActorSystem actorSystem, final DOMRpcProviderService rpcProvisionRegistry,
-            final RemoteRpcProviderConfig config) {
-        this.actorSystem = actorSystem;
-        this.rpcProvisionRegistry = rpcProvisionRegistry;
+            final DOMRpcService rpcService, final RemoteRpcProviderConfig config) {
+        this.actorSystem = Preconditions.checkNotNull(actorSystem);
+        this.rpcProvisionRegistry = Preconditions.checkNotNull(rpcProvisionRegistry);
+        this.rpcService = Preconditions.checkNotNull(rpcService);
         this.config = Preconditions.checkNotNull(config);
     }
 
-    public void setRpcService(final DOMRpcService rpcService) {
-        this.rpcService = rpcService;
-    }
-
     @Override
     public void close() {
         if (rpcManager != null) {
@@ -56,17 +49,6 @@ public class RemoteRpcProvider implements AutoCloseable, Provider {
         }
     }
 
-    @Override
-    public void onSessionInitiated(final Broker.ProviderSession session) {
-        rpcService = session.getService(DOMRpcService.class);
-        start();
-    }
-
-    @Override
-    public Collection<ProviderFunctionality> getProviderFunctionality() {
-        return ImmutableSet.of();
-    }
-
     public void start() {
         LOG.info("Starting Remote RPC service...");
         rpcManager = actorSystem.actorOf(RpcManager.props(rpcProvisionRegistry, rpcService, config),