diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-09-29 23:20:01 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-09-29 23:20:01 +0200 |
commit | 0d27136b2912ce0dd6ca1c6cc5341ebeba71dc12 (patch) | |
tree | 993a418d59740805db591f96836b611b8c104ad8 /vespaclient-core/src | |
parent | 5e9a24a520d0eb9ffe955944f59c02dddf405c3f (diff) |
Add support for directly passing clusters
Diffstat (limited to 'vespaclient-core/src')
-rwxr-xr-x | vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java | 11 | ||||
-rw-r--r-- | vespaclient-core/src/main/java/com/yahoo/vespaclient/ClusterList.java | 18 |
2 files changed, 20 insertions, 9 deletions
diff --git a/vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java b/vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java index 2d340810b3c..d670ceb4e77 100755 --- a/vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java +++ b/vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java @@ -30,6 +30,11 @@ public class MessageBusSessionFactory implements SessionFactory { String NUM_UPDATES = "num_updates"; } + @SuppressWarnings("unused") // used from extensions + public MessageBusSessionFactory(MessagePropertyProcessor processor) { + this(processor, null, null); + } + public MessageBusSessionFactory(MessagePropertyProcessor processor, DocumentmanagerConfig documentmanagerConfig, SlobroksConfig slobroksConfig) { @@ -37,10 +42,12 @@ public class MessageBusSessionFactory implements SessionFactory { MessageBusParams params = new MessageBusParams(processor.getLoadTypes()); params.setTraceLevel(processor.getFeederOptions().getTraceLevel()); RPCNetworkParams rpcNetworkParams = processor.getFeederOptions().getNetworkParams(); - rpcNetworkParams.setSlobroksConfig(slobroksConfig); + if (slobroksConfig != null) // not set: will subscribe + rpcNetworkParams.setSlobroksConfig(slobroksConfig); params.setRPCNetworkParams(rpcNetworkParams); params.setDocumentManagerConfigId("client"); - params.setDocumentmanagerConfig(documentmanagerConfig); + if (documentmanagerConfig != null) // not set: will subscribe + params.setDocumentmanagerConfig(documentmanagerConfig); access = new MessageBusDocumentAccess(params); } diff --git a/vespaclient-core/src/main/java/com/yahoo/vespaclient/ClusterList.java b/vespaclient-core/src/main/java/com/yahoo/vespaclient/ClusterList.java index 8d214651359..de3a85d9a9e 100644 --- a/vespaclient-core/src/main/java/com/yahoo/vespaclient/ClusterList.java +++ b/vespaclient-core/src/main/java/com/yahoo/vespaclient/ClusterList.java @@ -5,20 +5,24 @@ import com.yahoo.cloud.config.ClusterListConfig; import com.yahoo.config.subscription.ConfigGetter; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** A list of content clusters, either obtained from a list, a given config or by self-subscribing */ public class ClusterList { - List<ClusterDef> storageClusters = new ArrayList<>(); + List<ClusterDef> contentClusters = new ArrayList<>(); public ClusterList() { - this((String)null); + this(Collections.emptyList()); + } + + public ClusterList(List<ClusterDef> contentClusters) { + this.contentClusters = contentClusters; } public ClusterList(String configId) { - if (configId != null) - configure(new ConfigGetter<>(ClusterListConfig.class).getConfig(configId)); + configure(new ConfigGetter<>(ClusterListConfig.class).getConfig(configId)); } public ClusterList(ClusterListConfig config) { @@ -26,13 +30,13 @@ public class ClusterList { } private void configure(ClusterListConfig config) { - storageClusters.clear(); // TODO: Create a new + contentClusters.clear(); // TODO: Create a new for (int i = 0; i < config.storage().size(); i++) - storageClusters.add(new ClusterDef(config.storage(i).name(), config.storage(i).configid())); + contentClusters.add(new ClusterDef(config.storage(i).name(), config.storage(i).configid())); } public List<ClusterDef> getStorageClusters() { - return storageClusters; // TODO: Use immutable list + return contentClusters; // TODO: Use immutable list } } |