*
* @return The {@link CreateKeyspaceSpecification}
*/
private CreateKeyspaceSpecification generateCreateKeyspaceSpecification() {
CreateKeyspaceSpecification create = new CreateKeyspaceSpecification();
create.name(name).ifNotExists(ifNotExists).with(KeyspaceOption.DURABLE_WRITES, durableWrites);
Map<Option, Object> replicationStrategyMap = new HashMap<Option, Object>();
replicationStrategyMap.put(new DefaultOption("class", String.class, true, false, true),
replicationStrategy.getValue());
if (replicationStrategy == ReplicationStrategy.SIMPLE_STRATEGY) {
replicationStrategyMap.put(new DefaultOption("replication_factor", Long.class, true, false, false),
replicationFactor);
}
if (replicationStrategy == ReplicationStrategy.NETWORK_TOPOLOGY_STRATEGY) {
int i = 0;
for (String datacenter : networkTopologyDataCenters) {
replicationStrategyMap.put(new DefaultOption(datacenter, Long.class, true, false, false),
networkTopologyReplicationFactors.get(i++));
}
}
create.with(KeyspaceOption.REPLICATION, replicationStrategyMap);
return create;
}