Add support for reusable streaming
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / RemoteRpcProvider.java
index a0e1f87874df9009728f0a6e732e1d27319ad3e9..6bf84a9783b7edb9c91ca4cc9d68e47742ba1172 100644 (file)
@@ -12,13 +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.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -26,33 +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 SchemaService schemaService;
     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;
-    }
-
-    public void setSchemaService(final SchemaService schemaService) {
-        this.schemaService = schemaService;
-    }
-
     @Override
     public void close() {
         if (rpcManager != null) {
@@ -62,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),