@RequestParam("comment") String comment,
@RequestParam("keyCache") double keyCache,
@RequestParam("rowCache") double rowCache,
ModelMap model) throws Exception {
Client client = clientProvider.getThriftClient();
client.set_keyspace(keyspaceName);
// trim name
name = name.trim();
if (name.length() == 0) {
throw new IllegalArgumentException("CFName must not be empty");
}
// clear sub comparator if the type is Standard.
if ("Standard".equals(type)) {
subComparator = "";
}
// creating definition.
CfDef cfdef = new CfDef(keyspaceName, name);
cfdef.setComment(comment);
cfdef.setColumn_type(type);
cfdef.setComparator_type(comparator);
if (subComparator != null && subComparator.length() > 0) {
cfdef.setSubcomparator_type(subComparator);
}
cfdef.setKey_cache_size(keyCache);
cfdef.setRow_cache_size(rowCache);
client.system_add_column_family(cfdef);
// redirecting to keyspace page.
model.clear();
return "redirect:/keyspace/" + keyspaceName + "/";
}