Search in sources :

Example 1 with RiakCluster

use of com.basho.riak.client.core.RiakCluster in project jnosql-diana-driver by eclipse.

the class RiakKeyValueConfiguration method get.

@Override
public RiakBucketManagerFactory get(Settings settings) {
    requireNonNull(settings, "settings is required");
    List<RiakNode> nodes = new ArrayList<>();
    settings.keySet().stream().filter(k -> k.startsWith(SERVER_PREFIX)).sorted().map(settings::get).map(a -> new RiakNode.Builder().withRemoteAddress(a.toString()).build()).forEach(nodes::add);
    if (nodes.isEmpty()) {
        nodes.add(DEFAULT_NODE);
    }
    RiakCluster cluster = new RiakCluster.Builder(nodes).build();
    return new RiakBucketManagerFactory(cluster);
}
Also used : RiakNode(com.basho.riak.client.core.RiakNode) List(java.util.List) ConfigurationReader(org.jnosql.diana.driver.ConfigurationReader) Map(java.util.Map) Objects.requireNonNull(java.util.Objects.requireNonNull) RiakCluster(com.basho.riak.client.core.RiakCluster) KeyValueConfiguration(org.jnosql.diana.api.key.KeyValueConfiguration) Settings(org.jnosql.diana.api.Settings) Logger(java.util.logging.Logger) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) RiakCluster(com.basho.riak.client.core.RiakCluster) RiakNode(com.basho.riak.client.core.RiakNode)

Aggregations

RiakCluster (com.basho.riak.client.core.RiakCluster)1 RiakNode (com.basho.riak.client.core.RiakNode)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Logger (java.util.logging.Logger)1 Settings (org.jnosql.diana.api.Settings)1 KeyValueConfiguration (org.jnosql.diana.api.key.KeyValueConfiguration)1 ConfigurationReader (org.jnosql.diana.driver.ConfigurationReader)1