All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dropwizard.cassandra.loadbalancing.WhiteListPolicyFactory Maven / Gradle / Ivy

Go to download

Provides easy integration for Dropwizard applications with Apache Cassandra using the DataStax 4.x client

There is a newer version: 4.0.0
Show newest version
package io.dropwizard.cassandra.loadbalancing;

import com.datastax.driver.core.policies.LoadBalancingPolicy;
import com.datastax.driver.core.policies.WhiteListPolicy;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;

import java.net.InetSocketAddress;
import java.util.Collection;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

@JsonTypeName("whiteList")
public class WhiteListPolicyFactory implements LoadBalancingPolicyFactory {
    @Valid
    @NotNull
    @JsonProperty
    private LoadBalancingPolicyFactory subPolicy;

    @NotNull
    @JsonProperty
    private Collection whiteList;

    public LoadBalancingPolicyFactory getSubPolicy() {
        return subPolicy;
    }

    public void setSubPolicy(LoadBalancingPolicyFactory subPolicy) {
        this.subPolicy = subPolicy;
    }

    public Collection getWhiteList() {
        return whiteList;
    }

    public void setWhiteList(Collection whiteList) {
        this.whiteList = whiteList;
    }

    @Override
    public LoadBalancingPolicy build() {
        return new WhiteListPolicy(subPolicy.build(), whiteList);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy