use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetHeartbeatNodeInfoTask method getHAHostStatusList.
/**
*
* Get host status list
*
* @return The List<HAHostStatus>
*/
public List<HAHostStatusInfo> getHAHostStatusList() {
TreeNode response = getResponse();
if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
return null;
}
String currentHostName = response.getValue("currentnode");
String currentHostStatus = response.getValue("currentnodestate");
HAHostStatusInfo currentHaHostStatus = null;
hostStatusList = new ArrayList<HAHostStatusInfo>();
for (int i = 0; i < response.childrenSize(); i++) {
TreeNode node = response.getChildren().get(i);
if (node.getValue("open") == null) {
continue;
}
if (node.getValue("open").trim().equals("hanodelist")) {
currentHaHostStatus = buildHaNodeList(node, hostStatusList, currentHostName);
} else if (node.getValue("open").trim().equals("hadbinfolist")) {
buildHaDbInfoList(node, currentHaHostStatus);
}
}
if (currentHaHostStatus != null) {
currentHaHostStatus.setStatusType(HostStatusType.getType(currentHostStatus));
}
return hostStatusList;
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetHeartbeatNodeInfoTask method buildProcessList.
/**
*
* Parse the node and build DbProcessStatusInfo object
*
* @param parent The TreeNode
* @param dbStatus The HADatabaseStatusInfo
* @param type The String
*/
private void buildProcessList(TreeNode parent, HADatabaseStatusInfo dbStatus, String type) {
for (int i = 0; i < parent.childrenSize(); i++) {
TreeNode node = parent.getChildren().get(i);
if (node.getValue("open") == null) {
continue;
}
if (node.getValue("open").trim().equals("element")) {
String hostName = node.getValue("hostname");
String dbName = node.getValue("dbname");
String pid = node.getValue("pid");
String state = node.getValue("state");
String logPath = node.getValue("logpath");
String mode = node.getValue("mode");
DbProcessStatusInfo logDbProcessStatus = new DbProcessStatusInfo();
logDbProcessStatus.setHostName(hostName);
logDbProcessStatus.setDbName(dbName);
logDbProcessStatus.setPid(pid);
logDbProcessStatus.setLogPath(logPath);
logDbProcessStatus.setProcessStatus(ProcessStatusType.getType(state));
logDbProcessStatus.setMode(SyncModeType.getType(mode));
if ("applylogdb".equals(type)) {
dbStatus.addApplyLogDbProcessStatus(logDbProcessStatus);
} else if ("copylogdb".equals(type)) {
dbStatus.addCopyLogDbProcessStatus(logDbProcessStatus);
}
}
}
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetHeartbeatNodeInfoTask method buildHaServerList.
/**
*
* Parse the node and build HADatabaseStatus object
*
* @param parent The TreeNode
* @param currentHaHostStatus The HAHostStatus
*/
private void buildHaServerList(TreeNode parent, HAHostStatusInfo currentHaHostStatus) {
HADatabaseStatusInfo dbStatus = new HADatabaseStatusInfo();
for (int i = 0; i < parent.childrenSize(); i++) {
TreeNode node = parent.getChildren().get(i);
if (node.getValue("open") == null) {
continue;
}
if (node.getValue("open").trim().equals("dbmode")) {
String dbName = node.getValue("dbname");
String serverMode = node.getValue("server_mode");
String error = node.getValue("server_msg");
dbStatus.setDbName(dbName);
if (error != null && !error.equals("none")) {
dbStatus.setErrorInfo(error);
}
dbStatus.setStatusType(DBStatusType.getType(serverMode, serverInfo.isHAMode(dbName)));
dbStatus.setHaHostStatusInfo(currentHaHostStatus);
currentHaHostStatus.addHADatabaseStatus(dbStatus);
} else if (node.getValue("open").trim().equals("dbprocinfo")) {
String dbName = node.getValue("dbname");
String pid = node.getValue("pid");
String state = node.getValue("state");
DbProcessStatusInfo dbProcessStatusInfo = new DbProcessStatusInfo();
dbProcessStatusInfo.setDbName(dbName);
dbProcessStatusInfo.setPid(pid);
dbProcessStatusInfo.setProcessStatus(ProcessStatusType.getType(state));
dbStatus.setDbServerProcessStatus(dbProcessStatusInfo);
} else if (node.getValue("open").trim().equals("applylogdb")) {
buildProcessList(node, dbStatus, "applylogdb");
} else if (node.getValue("open").trim().equals("copylogdb")) {
buildProcessList(node, dbStatus, "copylogdb");
}
}
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetHeartbeatNodeInfoTask method getCurrentHostStatus.
public String getCurrentHostStatus() {
TreeNode response = getResponse();
if (response == null || this.isSuccess() != true) {
return null;
}
String currentHostStatus = response.getValue("currentnodestate");
return currentHostStatus;
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class ErrorTraceTask method getErrorLogs.
/**
*
* Get the error logs
*
* @return List<String>
*/
public List<String> getErrorLogs() {
TreeNode response = getResponse();
if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
return null;
}
List<String> errLogList = new ArrayList<String>();
for (int i = 0; i < response.childrenSize(); i++) {
TreeNode node = response.getChildren().get(i);
if (node != null && node.getValue("open") != null && node.getValue("open").equals("errbloc")) {
String[] lines = node.getValues("line");
for (int j = 0; lines != null && j < lines.length; j++) {
String str = lines[j];
if (str != null && str.trim().length() > 0) {
errLogList.add(str);
}
}
}
}
return errLogList;
}
Aggregations