systems.composable.dropwizard.cassandra.loadbalancing.WhiteListPolicyFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-cassandra Show documentation
Show all versions of dropwizard-cassandra Show documentation
Cassandra library for Dropwizard
package systems.composable.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 javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.net.InetSocketAddress;
import java.util.Collection;
/**
* A factory for configuring and building {@link com.datastax.driver.core.policies.WhiteListPolicy} instances.
*
* Configuration Parameters:
*
*
* Name
* Default
* Description
*
*
* subPolicy
* No default. You must provide a child policy.
* The wrapped policy.
*
*
* whiteList
* No default.
* The white listed hosts.
*
*
*/
@JsonTypeName("whiteList")
public class WhiteListPolicyFactory implements LoadBalancingPolicyFactory {
@Valid
@NotNull
private LoadBalancingPolicyFactory subPolicy;
@NotNull
private Collection whiteList;
@JsonProperty
public LoadBalancingPolicyFactory getSubPolicy() {
return subPolicy;
}
@JsonProperty
public void setSubPolicy(LoadBalancingPolicyFactory subPolicy) {
this.subPolicy = subPolicy;
}
@JsonProperty
public Collection getWhiteList() {
return whiteList;
}
@JsonProperty
public void setWhiteList(Collection whiteList) {
this.whiteList = whiteList;
}
@Override
public LoadBalancingPolicy build() {
return new WhiteListPolicy(subPolicy.build(), whiteList);
}
}