BlurException {
CommandLine cmd = CreateTableCommandHelper.parse(args, out);
if (cmd == null) {
throw new CommandException(name() + " missing required arguments");
}
TableDescriptor td = new TableDescriptor();
td.setCluster(Main.getCluster(client));
td.setName(cmd.getOptionValue("t"));
td.setShardCount(Integer.parseInt(cmd.getOptionValue("c")));
if (cmd.hasOption("b")) {
td.setBlockCaching(false);
}
if (cmd.hasOption("B")) {
String[] optionValues = cmd.getOptionValues("B");
Set<String> blockCachingFileTypes = new HashSet<String>();
if (optionValues != null) {
blockCachingFileTypes.addAll(Arrays.asList(cmd.getOptionValues("B")));
}
td.setBlockCachingFileTypes(blockCachingFileTypes);
}
if (cmd.hasOption("mfi")) {
td.setDefaultMissingFieldLessIndexing(false);
}
if (cmd.hasOption("mft")) {
String defaultMissingFieldType = cmd.getOptionValue("mft");
td.setDefaultMissingFieldType(defaultMissingFieldType);
}
if (cmd.hasOption("mfp")) {
Map<String, String> defaultMissingFieldProps = getProps(cmd, "mfp");
td.setDefaultMissingFieldProps(defaultMissingFieldProps);
}
if (cmd.hasOption("d")) {
td.setEnabled(false);
}
if (cmd.hasOption("p")) {
Map<String, String> tableProperties = getProps(cmd, "p");
td.setTableProperties(tableProperties);
}
if (cmd.hasOption("s")) {
td.setStrictTypes(true);
}
if (cmd.hasOption("r")) {
td.setReadOnly(true);
}
if (cmd.hasOption("l")) {
String tableUri = cmd.getOptionValue("l");
td.setTableUri(tableUri);
}
if (cmd.hasOption("P")) {
td.setPreCacheCols(Arrays.asList(cmd.getOptionValues("P")));
}
if (cmd.hasOption("S")) {
td.setSimilarityClass(cmd.getOptionValue("S"));
}
if (Main.debug) {
out.println(td.toString());
out.flush();
}
client.createTable(td);
}