use of com.actiontech.dble.config.loader.zkprocess.entity.schema.datahost.DataHost in project dble by actiontech.
the class UXmlSchemaLoader 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;
}
Schemas schema = new Schemas();
// the config Value in ucore is an all in one json config of the schema.xml
JSONObject jsonObj = JSONObject.parseObject(configValue.getValue());
List<Schema> schemaList = parseJsonSchema.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.SCHEMA_SCHEMA).toJSONString());
schema.setSchema(schemaList);
List<DataNode> dataNodeList = parseJsonDataNode.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.DATA_NODE).toJSONString());
schema.setDataNode(dataNodeList);
List<DataHost> dataHostList = parseJsonDataHost.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.DATA_HOST).toJSONString());
schema.setDataHost(dataHostList);
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);
this.parseSchemaXmlService.parseToXmlWrite(schema, path, "schema");
LOGGER.info("SchemasLoader notifyProcess ucore to object zk schema write :" + path + " is success");
}
use of com.actiontech.dble.config.loader.zkprocess.entity.schema.datahost.DataHost in project dble by actiontech.
the class SchemaszkToxmlLoader method zktoSchemasBean.
private Schemas zktoSchemasBean(ZkDirectoryImpl zkDirectory) {
Schemas schema = new Schemas();
DataInf schemaZkDirectory = this.getZkData(zkDirectory, KVPathUtil.SCHEMA_SCHEMA);
List<Schema> schemaList = parseJsonSchema.parseJsonToBean(schemaZkDirectory.getDataValue());
schema.setSchema(schemaList);
DataInf dataNodeZkDirectory = this.getZkData(zkDirectory, KVPathUtil.DATA_NODE);
List<DataNode> dataNodeList = parseJsonDataNode.parseJsonToBean(dataNodeZkDirectory.getDataValue());
schema.setDataNode(dataNodeList);
DataInf dataHostZkDirectory = this.getZkData(zkDirectory, KVPathUtil.DATA_HOST);
List<DataHost> dataHostList = parseJsonDataHost.parseJsonToBean(dataHostZkDirectory.getDataValue());
schema.setDataHost(dataHostList);
return schema;
}
Aggregations