}
public synchronized void createKeyspace() throws Exception
{
// create Keyspace if it doesnt exist.
KsDef ksd;
try
{
ksd = client.describe_keyspace(ksName);
client.set_keyspace(ksName);
createColumnFamily(ksd, false);
}
catch (NotFoundException ex)
{
ksd = new KsDef(ksName, STATEGY_CLASS, new ArrayList<CfDef>());
Map<String, String> strategy_options = Maps.newHashMap();
String[] splits = Properties.instance.getSchemas().get(0).getStrategy_options().split(",");
for (String split : splits)
{
String[] replication = split.split(":");
assert replication.length == 2;
strategy_options.put(replication[0], replication[1]);
}
ksd.setStrategy_options(strategy_options);
createColumnFamily(ksd, true);
client.send_system_add_keyspace(ksd);
}
}