Search in sources :

Example 1 with Server

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

the class ServerxmlTozkLoader method notifyProcess.

@Override
public boolean notifyProcess() throws Exception {
    Server server = this.parseServerXMl.parseXmlToBean(SERVER_PATH);
    LOGGER.info("ServerxmlTozkLoader notifyProcessxml to zk server Object  :" + server);
    this.xmlTozkServerJson(currZkPath, server);
    LOGGER.info("ServerxmlTozkLoader notifyProcess xml to zk is success");
    return true;
}
Also used : Server(com.actiontech.dble.config.loader.zkprocess.entity.Server)

Example 2 with Server

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

the class UXmlServerLoader 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;
    }
    Server server = new Server();
    JSONObject jsonObj = JSONObject.parseObject(configValue.getValue());
    if (jsonObj.get(UcorePathUtil.FIREWALL) != null) {
        server.setFirewall(parseJsonFireWall.parseJsonToBean(jsonObj.getJSONObject(UcorePathUtil.FIREWALL).toJSONString()));
    }
    server.setSystem(parseJsonSystem.parseJsonToBean(jsonObj.getJSONObject(UcorePathUtil.DEFAULT).toJSONString()));
    server.setUser(parseJsonUser.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.USER).toJSONString()));
    if (jsonObj.get(UcorePathUtil.ALARM) != null) {
        server.setAlarm(parseJsonAlarm.parseJsonToBean(jsonObj.getJSONObject(UcorePathUtil.ALARM).toJSONString()));
    }
    String path = ResourceUtil.getResourcePathFromRoot(UcorePathUtil.UCORE_LOCAL_WRITE_PATH);
    path = new File(path).getPath() + File.separator;
    path += WRITEPATH;
    this.parseServerXMl.parseToXmlWrite(server, path, "server");
}
Also used : Server(com.actiontech.dble.config.loader.zkprocess.entity.Server) JSONObject(com.alibaba.fastjson.JSONObject) UKvBean(com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean) File(java.io.File)

Example 3 with Server

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

the class ServerzkToxmlLoader method notifyProcess.

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

Example 4 with Server

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

the class UXmlServerLoader method notifyCluster.

@Override
public void notifyCluster() throws Exception {
    Server servers = this.parseServerXMl.parseXmlToBean(UcorePathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH);
    JSONObject server = new JSONObject();
    server.put(UcorePathUtil.DEFAULT, servers.getSystem());
    server.put(UcorePathUtil.FIREWALL, servers.getFirewall());
    server.put(UcorePathUtil.USER, servers.getUser());
    server.put(UcorePathUtil.ALARM, servers.getAlarm());
    ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, server.toJSONString());
}
Also used : Server(com.actiontech.dble.config.loader.zkprocess.entity.Server) JSONObject(com.alibaba.fastjson.JSONObject)

Example 5 with Server

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

Server (com.actiontech.dble.config.loader.zkprocess.entity.Server)5 JSONObject (com.alibaba.fastjson.JSONObject)2 File (java.io.File)2 UKvBean (com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean)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 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