use of com.actiontech.dble.config.loader.zkprocess.entity.rule.tablerule.TableRule in project dble by actiontech.
the class UXmlRuleLoader method notifyProcess.
@Override
public void notifyProcess(UKvBean configValue) throws Exception {
UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getConfChangeLockPath());
if (UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) {
return;
}
Rules rule = new Rules();
// the config Value in ucore is an all in one json config of the schema.xml
JSONObject jsonObj = JSONObject.parseObject(configValue.getValue());
List<Function> functions = parseJsonFunctionService.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.FUNCTION).toJSONString());
rule.setFunction(functions);
List<TableRule> tableRules = parseJsonTableRuleService.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.TABLE_RULE).toJSONString());
rule.setTableRule(tableRules);
String path = ResourceUtil.getResourcePathFromRoot(UcorePathUtil.UCORE_LOCAL_WRITE_PATH);
path = new File(path).getPath() + File.separator;
path += WRITEPATH;
LOGGER.info("SchemasLoader notifyProcess ucore to object writePath :" + path);
writeMapFileAddFunction(functions);
this.parseRulesXMl.parseToXmlWrite(rule, path, "rule");
LOGGER.info("SchemasLoader notifyProcess ucore to object zk schema write :" + path + " is success");
}
use of com.actiontech.dble.config.loader.zkprocess.entity.rule.tablerule.TableRule in project dble by actiontech.
the class RuleszkToxmlLoader method zktoRulesBean.
/**
* zktoRulesBean
*
* @param zkDirectory
* @return
* @Created 2016/9/17
*/
private Rules zktoRulesBean(DirectoryInf zkDirectory) {
Rules rules = new Rules();
// tablerule
DataInf rulesZkData = this.getZkData(zkDirectory, KVPathUtil.TABLE_RULE);
List<TableRule> tableRuleData = parseJsonTableRuleService.parseJsonToBean(rulesZkData.getDataValue());
rules.setTableRule(tableRuleData);
// function
DataInf functionZkData = this.getZkData(zkDirectory, KVPathUtil.FUNCTION);
List<Function> functionList = parseJsonFunctionService.parseJsonToBean(functionZkData.getDataValue());
rules.setFunction(functionList);
return rules;
}
Aggregations