Search in sources :

Example 1 with Schema

use of com.actiontech.dble.config.loader.zkprocess.entity.schema.schema.Schema 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");
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) DataHost(com.actiontech.dble.config.loader.zkprocess.entity.schema.datahost.DataHost) DataNode(com.actiontech.dble.config.loader.zkprocess.entity.schema.datanode.DataNode) Schema(com.actiontech.dble.config.loader.zkprocess.entity.schema.schema.Schema) UKvBean(com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean) Schemas(com.actiontech.dble.config.loader.zkprocess.entity.Schemas) File(java.io.File)

Example 2 with Schema

use of com.actiontech.dble.config.loader.zkprocess.entity.schema.schema.Schema 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;
}
Also used : DataHost(com.actiontech.dble.config.loader.zkprocess.entity.schema.datahost.DataHost) DataNode(com.actiontech.dble.config.loader.zkprocess.entity.schema.datanode.DataNode) Schema(com.actiontech.dble.config.loader.zkprocess.entity.schema.schema.Schema) DataInf(com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf) Schemas(com.actiontech.dble.config.loader.zkprocess.entity.Schemas)

Aggregations

Schemas (com.actiontech.dble.config.loader.zkprocess.entity.Schemas)2 DataHost (com.actiontech.dble.config.loader.zkprocess.entity.schema.datahost.DataHost)2 DataNode (com.actiontech.dble.config.loader.zkprocess.entity.schema.datanode.DataNode)2 Schema (com.actiontech.dble.config.loader.zkprocess.entity.schema.schema.Schema)2 UKvBean (com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean)1 DataInf (com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf)1 JSONObject (com.alibaba.fastjson.JSONObject)1 File (java.io.File)1