Search in sources :

Example 1 with Schemas

use of com.actiontech.dble.config.loader.zkprocess.entity.Schemas 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 Schemas

use of com.actiontech.dble.config.loader.zkprocess.entity.Schemas in project dble by actiontech.

the class UXmlSchemaLoader method notifyCluster.

@Override
public void notifyCluster() throws Exception {
    Schemas schema = this.parseSchemaXmlService.parseXmlToBean(UcorePathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH);
    JSONObject schemas = new JSONObject();
    schemas.put(UcorePathUtil.SCHEMA_SCHEMA, schema.getSchema());
    schemas.put(UcorePathUtil.DATA_NODE, schema.getDataNode());
    schemas.put(UcorePathUtil.DATA_HOST, schema.getDataHost());
    ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, schemas.toJSONString());
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) Schemas(com.actiontech.dble.config.loader.zkprocess.entity.Schemas)

Example 3 with Schemas

use of com.actiontech.dble.config.loader.zkprocess.entity.Schemas 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)

Example 4 with Schemas

use of com.actiontech.dble.config.loader.zkprocess.entity.Schemas in project dble by actiontech.

the class SchemaszkToxmlLoader method notifyProcess.

@Override
public boolean notifyProcess() throws Exception {
    DirectoryInf schemaDirectory = new ZkDirectoryImpl(currZkPath, null);
    this.getTreeDirectory(currZkPath, KVPathUtil.SCHEMA, schemaDirectory);
    ZkDirectoryImpl zkDirectory = (ZkDirectoryImpl) schemaDirectory.getSubordinateInfo().get(0);
    Schemas schema = this.zktoSchemasBean(zkDirectory);
    LOGGER.info("SchemasLoader notifyProcess zk to object  zk schema Object  :" + schema);
    String path = ResourceUtil.getResourcePathFromRoot(ZookeeperPath.ZK_LOCAL_WRITE_PATH.getKey());
    path = new File(path).getPath() + File.separator;
    path += WRITEPATH;
    LOGGER.info("SchemasLoader notifyProcess zk to object writePath :" + path);
    this.parseSchemaXmlService.parseToXmlWrite(schema, path, "schema");
    LOGGER.info("SchemasLoader notifyProcess zk to object zk schema      write :" + path + " is success");
    return true;
}
Also used : DirectoryInf(com.actiontech.dble.config.loader.zkprocess.zookeeper.DirectoryInf) ZkDirectoryImpl(com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDirectoryImpl) Schemas(com.actiontech.dble.config.loader.zkprocess.entity.Schemas) File(java.io.File)

Example 5 with Schemas

use of com.actiontech.dble.config.loader.zkprocess.entity.Schemas in project dble by actiontech.

the class SchemasxmlTozkLoader method notifyProcess.

@Override
public boolean notifyProcess() throws Exception {
    Schemas schema = this.parseSchemaXmlService.parseXmlToBean(SCHEMA_PATH);
    LOGGER.info("SchemasxmlTozkLoader notifyProcess xml to zk schema Object  :" + schema);
    this.xmlTozkSchemasJson(currZkPath, schema);
    LOGGER.info("SchemasxmlTozkLoader notifyProcess xml to zk is success");
    return true;
}
Also used : Schemas(com.actiontech.dble.config.loader.zkprocess.entity.Schemas)

Aggregations

Schemas (com.actiontech.dble.config.loader.zkprocess.entity.Schemas)5 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 JSONObject (com.alibaba.fastjson.JSONObject)2 File (java.io.File)2 UKvBean (com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean)1 DataInf (com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf)1 DirectoryInf (com.actiontech.dble.config.loader.zkprocess.zookeeper.DirectoryInf)1 ZkDirectoryImpl (com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDirectoryImpl)1