Search in sources :

Example 1 with DataInf

use of com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf in project dble by actiontech.

the class EcacheszkToxmlLoader method zktoEhcacheWrite.

/**
 * zktoEhcacheWrite
 *
 * @param zkDirectory
 * @return
 * @Created 2016/9/17
 */
private void zktoEhcacheWrite(ZkDirectoryImpl zkDirectory) {
    DataInf ehcacheZkDirectory = this.getZkData(zkDirectory, KVPathUtil.EHCACHE_NAME);
    Ehcache ehcache = parseJsonEhcacheService.parseJsonToBean(ehcacheZkDirectory.getDataValue());
    String outputPath = ResourceUtil.getResourcePathFromRoot(ZookeeperPath.ZK_LOCAL_WRITE_PATH.getKey());
    outputPath = new File(outputPath).getPath() + File.separator;
    outputPath += KVPathUtil.EHCACHE_NAME;
    parseEcacheXMl.parseToXmlWrite(ehcache, outputPath, null);
    this.zookeeperListen.addWatch(KVPathUtil.getEhcacheNamePath(), this);
    DataInf cacheserZkDirectory = this.getZkData(zkDirectory, KVPathUtil.CACHESERVER_NAME);
    if (null != cacheserZkDirectory) {
        ZkDataImpl cacheData = (ZkDataImpl) cacheserZkDirectory;
        try {
            ConfFileRWUtils.writeFile(cacheData.getName(), cacheData.getValue());
        } catch (IOException e) {
            LOGGER.warn(AlarmCode.CORE_ZK_WARN + "EcacheszkToxmlLoader wirteMapFile IOException", e);
        }
        this.zookeeperListen.addWatch(KVPathUtil.getCacheServerNamePath(), this);
    }
}
Also used : Ehcache(com.actiontech.dble.config.loader.zkprocess.entity.cache.Ehcache) DataInf(com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf) IOException(java.io.IOException) File(java.io.File) ZkDataImpl(com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDataImpl)

Example 2 with DataInf

use of com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf 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;
}
Also used : TableRule(com.actiontech.dble.config.loader.zkprocess.entity.rule.tablerule.TableRule) Function(com.actiontech.dble.config.loader.zkprocess.entity.rule.function.Function) DataInf(com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf) Rules(com.actiontech.dble.config.loader.zkprocess.entity.Rules)

Example 3 with DataInf

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

use of com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf in project dble by actiontech.

the class ServerzkToxmlLoader method zktoServerBean.

/**
 * zktoServerBean
 *
 * @param zkDirectory
 * @return
 * @Created 2016/9/17
 * @create
 */
private Server zktoServerBean(DirectoryInf zkDirectory) {
    Server server = new Server();
    DataInf serverZkDirectory = this.getZkData(zkDirectory, KVPathUtil.DEFAULT);
    System systemValue = parseJsonSystem.parseJsonToBean(serverZkDirectory.getDataValue());
    server.setSystem(systemValue);
    DataInf firewallZkDirectory = this.getZkData(zkDirectory, KVPathUtil.FIREWALL);
    FireWall fireWall = parseJsonFireWall.parseJsonToBean(firewallZkDirectory.getDataValue());
    server.setFirewall(fireWall);
    DataInf userZkDirectory = this.getZkData(zkDirectory, KVPathUtil.USER);
    List<User> userList = parseJsonUser.parseJsonToBean(userZkDirectory.getDataValue());
    server.setUser(userList);
    return server;
}
Also used : FireWall(com.actiontech.dble.config.loader.zkprocess.entity.server.FireWall) User(com.actiontech.dble.config.loader.zkprocess.entity.server.User) Server(com.actiontech.dble.config.loader.zkprocess.entity.Server) DataInf(com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf) System(com.actiontech.dble.config.loader.zkprocess.entity.server.System)

Aggregations

DataInf (com.actiontech.dble.config.loader.zkprocess.zookeeper.DataInf)4 Rules (com.actiontech.dble.config.loader.zkprocess.entity.Rules)1 Schemas (com.actiontech.dble.config.loader.zkprocess.entity.Schemas)1 Server (com.actiontech.dble.config.loader.zkprocess.entity.Server)1 Ehcache (com.actiontech.dble.config.loader.zkprocess.entity.cache.Ehcache)1 Function (com.actiontech.dble.config.loader.zkprocess.entity.rule.function.Function)1 TableRule (com.actiontech.dble.config.loader.zkprocess.entity.rule.tablerule.TableRule)1 DataHost (com.actiontech.dble.config.loader.zkprocess.entity.schema.datahost.DataHost)1 DataNode (com.actiontech.dble.config.loader.zkprocess.entity.schema.datanode.DataNode)1 Schema (com.actiontech.dble.config.loader.zkprocess.entity.schema.schema.Schema)1 FireWall (com.actiontech.dble.config.loader.zkprocess.entity.server.FireWall)1 System (com.actiontech.dble.config.loader.zkprocess.entity.server.System)1 User (com.actiontech.dble.config.loader.zkprocess.entity.server.User)1 ZkDataImpl (com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDataImpl)1 File (java.io.File)1 IOException (java.io.IOException)1