property.setProperty(CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
property.setValue(hbaseRestServerPropertyValue);
connectionToTest.addProperty(property);
try {
HBaseFacade hbaseFacade = getHBaseFacade();
boolean isValidConnection = hbaseFacade
.isValidConnection(connectionToTest);
logger.debug("isValidConnection : " + isValidConnection);
if (isValidConnection) {
connection = connectionDAO.findById(connection.getId());
Connection connectionToUpdate = connection;
connection.setName(connectionName);
hbaseRestServerProperty = connection.getProperties().get(
CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
hbaseRestServerProperty.setValue(hbaseRestServerPropertyValue);
pool.update(connectionToUpdate, connection);
// Now checking whether this connection holds all the associated
// childrens.
String[] tables = hbaseFacade.getTableList(connection);
ArrayList<String> tableList = new ArrayList<String>();
for (int i = 0; i < tables.length; i++) {
tableList.add(tables[i]);
}
long count = 0l;
for (Mapping mapping : mappingDAO.findAll()) {
long id = connection.getId();
if (id == mapping.getConnection().getId()) {
String tableName = mapping.getTableName();
if (!tableList.contains(tableName)) {
count++;
} else {
ArrayList<String> columnFamilyList = new ArrayList<String>();
ArrayList<HColumnDescriptor> columnList = new ArrayList<HColumnDescriptor>(
hbaseFacade.getColumnFamilies(connection,
tableName));
for (HColumnDescriptor hcolumnDescriptor : columnList) {
columnFamilyList.add(hcolumnDescriptor
.getNameAsString());
}