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;
}
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");
}
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;
}
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());
}
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;
}
Aggregations