.trim().toLowerCase());
if (tempSqlDsIndexMap.get(nomalSql) == null) {
tempSqlDsIndexMap.put(nomalSql,index);
} else {
// have a nice log
throw new ConfigException(
"sql can not be route to different dataSourceIndex:"
+ sql);
}
}
}
this.groupExtraConfig.setSqlDsIndexMap(tempSqlDsIndexMap);
}
else {
this.groupExtraConfig.getSqlDsIndexMap().clear();
}
if (obj.has("tabDsIndex")) {
Map<String, Integer> tempTabDsIndexMap = new HashMap<String, Integer>();
JSONObject sqlDsIndex = obj.getJSONObject("tabDsIndex");
Iterator it=sqlDsIndex.keys();
while(it.hasNext()){
String key=String.valueOf(it.next()).trim();
Integer index=Integer.valueOf(key);
JSONArray array=sqlDsIndex.getJSONArray(key);
for (int i=0;i<array.size();i++) {
String table=array.getString(i);
String nomalTable = table.trim().toLowerCase();
if (tempTabDsIndexMap.get(nomalTable) == null) {
tempTabDsIndexMap.put(nomalTable, index);
} else {
// have a nice log
throw new ConfigException(
"table can not be route to different dataSourceIndex:"
+ table);
}
}
}
this.groupExtraConfig.setTableDsIndexMap(tempTabDsIndexMap);
}
else {
this.groupExtraConfig.getTableDsIndexMap().clear();
}
if (obj.has("defaultMain")) {
this.groupExtraConfig.setDefaultMain(obj.getBoolean("defaultMain"));
}
else {
this.groupExtraConfig.setDefaultMain(false);
}
} catch (JSONException e) {
throw new ConfigException(
"group extraConfig is not json valid string:" + extraConfig,
e);
}
}