* @throws IOException If an error occurs while attempting to read the table or the table does not exist.
*/
public CConfiguration read(Type type, String namespace) throws IOException {
String tableName = getTableName(namespace);
CConfiguration conf = null;
HTable table = null;
try {
table = new HTable(hbaseConf, tableName);
Get get = new Get(Bytes.toBytes(type.name()));
get.addFamily(FAMILY);
Result result = table.get(get);
int propertyCnt = 0;
if (result != null && !result.isEmpty()) {
conf = CConfiguration.create();
conf.clear();
Map<byte[], byte[]> kvs = result.getFamilyMap(FAMILY);
for (Map.Entry<byte[], byte[]> e : kvs.entrySet()) {
conf.set(Bytes.toString(e.getKey()), Bytes.toString(e.getValue()));
propertyCnt++;
}
}
LOG.info("Read " + propertyCnt + " properties from configuration table = " +
tableName + ", row = " + type.name());