return null;
}
private void createDBTable(String payload ) throws StorageDoesNotExistException {
// String payload = pte.getPayLoad();
JsonObject obj = new JsonObject(payload);
String schema = obj.getString("db");
String storage = obj.getString("storage");
String index_row_keys = obj.getString("indexrowkeys");
Map<String, JsonObject> sMap = meta.runQuery(
EntityType.STORAGE.getId(), storage);
JsonObject storageConfig = sMap.get(storage);
String strategy = storageConfig.getString("strategy");
String rf = storageConfig.getString("rf");
if (strategy==null || strategy.equals("") || strategy.equalsIgnoreCase("network")) strategy = "NetworkTopologyStrategy";
if (rf==null || rf.equals("")) rf = "us-east:3";
Map<String,JsonObject> dbMap = meta.runQuery(EntityType.DB.getId(), schema);
JsonObject dbConfig = dbMap.get(schema);
if (dbConfig.getString("strategy")==null || dbConfig.getString("strategy").equals("") || dbConfig.getString("rf")==null || dbConfig.getString("rf").equals(""))
{
dbConfig.putString("strategy", strategy);
dbConfig.putString("rf", rf);
}
if (storageConfig == null) throw new StorageDoesNotExistException();
PaasConnection conn = cfactory.createConnection(storageConfig, schema);
try {
if (storageConfig.getString("type").equals("mysql"))
conn.createDB(dbConfig.getString("name"));
else
conn.createDB(dbConfig.toString());
} catch (Exception e) {
// TODO: handle exception
}
try {
conn.createTable(obj);
if (index_row_keys!=null && index_row_keys.equals("true")) {
JsonObject idxObj = new JsonObject();
idxObj.putString("db", schema);
idxObj.putString("name", obj.getString("name")+"ROWKEYS");
idxObj.putString("columns", "key,column1,value");
idxObj.putString("primarykey", "key,column1");
conn.createTable(idxObj);
//conn.createRowIndexTable(obj)
}
} catch (Exception e) {
// TODO: handle exception