Add support for reusable streaming
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / RemoteRpcProviderConfig.java
index cb5097d24e40f5a73fd675835519b22c7957cec4..1d663877c50f3e07150ba350370c5a8f014bfc0b 100644 (file)
@@ -9,59 +9,67 @@ package org.opendaylight.controller.remote.rpc;
 
 import akka.util.Timeout;
 import com.typesafe.config.Config;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.common.actor.CommonConfig;
 import scala.concurrent.duration.FiniteDuration;
 
-/**
- */
 public class RemoteRpcProviderConfig extends CommonConfig {
 
     protected static final String TAG_RPC_BROKER_NAME = "rpc-broker-name";
+    protected static final String TAG_RPC_REGISTRAR_NAME = "rpc-registrar-name";
     protected static final String TAG_RPC_REGISTRY_NAME = "registry-name";
     protected static final String TAG_RPC_MGR_NAME = "rpc-manager-name";
     protected static final String TAG_RPC_BROKER_PATH = "rpc-broker-path";
     protected static final String TAG_RPC_REGISTRY_PATH = "rpc-registry-path";
     protected static final String TAG_RPC_MGR_PATH = "rpc-manager-path";
     protected static final String TAG_ASK_DURATION = "ask-duration";
+
     private static final String TAG_GOSSIP_TICK_INTERVAL = "gossip-tick-interval";
+    private static final String TAG_RPC_REGISTRY_PERSISTENCE_ID = "rpc-registry-persistence-id";
 
     //locally cached values
     private Timeout cachedAskDuration;
     private FiniteDuration cachedGossipTickInterval;
 
-    public RemoteRpcProviderConfig(Config config){
+    public RemoteRpcProviderConfig(final Config config) {
         super(config);
     }
 
-    public String getRpcBrokerName(){
+    public String getRpcBrokerName() {
         return get().getString(TAG_RPC_BROKER_NAME);
     }
 
-    public String getRpcRegistryName(){
+    public String getRpcRegistrarName() {
+        return get().getString(TAG_RPC_REGISTRAR_NAME);
+    }
+
+    public String getRpcRegistryName() {
         return get().getString(TAG_RPC_REGISTRY_NAME);
     }
 
-    public String getRpcManagerName(){
+    public String getRpcManagerName() {
         return get().getString(TAG_RPC_MGR_NAME);
     }
 
-    public String getRpcBrokerPath(){
+    public String getRpcBrokerPath() {
         return get().getString(TAG_RPC_BROKER_PATH);
     }
 
-    public String getRpcRegistryPath(){
+    public String getRpcRegistryPath() {
         return get().getString(TAG_RPC_REGISTRY_PATH);
+    }
 
+    public String getRpcRegistryPersistenceId() {
+        return get().getString(TAG_RPC_REGISTRY_PERSISTENCE_ID);
     }
 
-    public String getRpcManagerPath(){
+    public String getRpcManagerPath() {
         return get().getString(TAG_RPC_MGR_PATH);
     }
 
-
-    public Timeout getAskDuration(){
-        if (cachedAskDuration != null){
+    public Timeout getAskDuration() {
+        if (cachedAskDuration != null) {
             return cachedAskDuration;
         }
 
@@ -71,7 +79,7 @@ public class RemoteRpcProviderConfig extends CommonConfig {
         return cachedAskDuration;
     }
 
-    public FiniteDuration getGossipTickInterval(){
+    public FiniteDuration getGossipTickInterval() {
         if (cachedGossipTickInterval != null) {
             return cachedGossipTickInterval;
         }
@@ -85,19 +93,24 @@ public class RemoteRpcProviderConfig extends CommonConfig {
     /**
      * This is called via blueprint xml as the builder pattern can't be used.
      */
-    public static RemoteRpcProviderConfig newInstance(String actorSystemName, boolean metricCaptureEnabled,
-            int mailboxCapacity) {
-        return new Builder(actorSystemName).metricCaptureEnabled(metricCaptureEnabled).
-                mailboxCapacity(mailboxCapacity).build();
+    @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE",
+            justification = "Findbugs flags this as an unconfirmed cast of return value but the build method clearly "
+                + "returns RemoteRpcProviderConfig. Perhaps it's confused b/c the build method is overloaded and "
+                + "and differs in return type from the base class.")
+    public static RemoteRpcProviderConfig newInstance(final String actorSystemName, final boolean metricCaptureEnabled,
+            final int mailboxCapacity) {
+        return new Builder(actorSystemName).metricCaptureEnabled(metricCaptureEnabled)
+                .mailboxCapacity(mailboxCapacity).build();
     }
 
-    public static class Builder extends CommonConfig.Builder<Builder>{
+    public static class Builder extends CommonConfig.Builder<Builder> {
 
-        public Builder(String actorSystemName){
+        public Builder(final String actorSystemName) {
             super(actorSystemName);
 
             //Actor names
             configHolder.put(TAG_RPC_BROKER_NAME, "broker");
+            configHolder.put(TAG_RPC_REGISTRAR_NAME, "registrar");
             configHolder.put(TAG_RPC_REGISTRY_NAME, "registry");
             configHolder.put(TAG_RPC_MGR_NAME, "rpc");
 
@@ -110,18 +123,18 @@ public class RemoteRpcProviderConfig extends CommonConfig {
             configHolder.put(TAG_ASK_DURATION, "15s");
             configHolder.put(TAG_GOSSIP_TICK_INTERVAL, "500ms");
 
+            // persistence
+            configHolder.put(TAG_RPC_REGISTRY_PERSISTENCE_ID, "remote-rpc-registry");
         }
 
-        public Builder gossipTickInterval(String interval) {
+        public Builder gossipTickInterval(final String interval) {
             configHolder.put(TAG_GOSSIP_TICK_INTERVAL, interval);
             return this;
         }
 
         @Override
-        public RemoteRpcProviderConfig build(){
+        public RemoteRpcProviderConfig build() {
             return new RemoteRpcProviderConfig(merge());
         }
     }
-
-
 }