String[] components = StringUtils.splitPreserveAllTokens(
hbaseTableName, Character.toString(DELIMITER), 4);
// Make sure the first component is 'kiji'.
if (!components[0].equals(KIJI_COMPONENT)) {
throw new NotAKijiManagedTableException(
hbaseTableName, "Doesn't start with kiji name component.");
}
if (components.length == 3) {
// It's a managed kiji meta/schema/system table.
return new KijiManagedHBaseTableName(components[1], components[2]);
} else if (components.length == 4) {
// It's a user-space kiji table.
return new KijiManagedHBaseTableName(components[1], components[2], components[3]);
} else {
// Wrong number of components... must not be a kiji table.
throw new NotAKijiManagedTableException(
hbaseTableName, "Invalid number of name components.");
}
}