Search in sources :

Example 86 with TreeNode

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;
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 87 with TreeNode

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);
            }
        }
    }
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) DbProcessStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo)

Example 88 with TreeNode

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");
        }
    }
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) DbProcessStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Example 89 with TreeNode

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;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 90 with TreeNode

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;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ArrayList(java.util.ArrayList)

Aggregations

TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)142 ArrayList (java.util.ArrayList)20 HashMap (java.util.HashMap)7 Map (java.util.Map)6 Trigger (com.cubrid.common.core.common.model.Trigger)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)2 DbBackupInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DbBackupInfo)2 DbUnloadInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DbUnloadInfo)2 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)2 GetExecuteCasRunnerResultInfo (com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo)2 ManagerLogInfoList (com.cubrid.cubridmanager.core.logs.model.ManagerLogInfoList)2 ManagerLogInfos (com.cubrid.cubridmanager.core.logs.model.ManagerLogInfos)2 DbProcessStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo)2 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)2 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)2 ReplicationInfo (com.cubrid.cubridmanager.core.replication.model.ReplicationInfo)2 ReplicationParamInfo (com.cubrid.cubridmanager.core.replication.model.ReplicationParamInfo)2 TransFileProgressInfo (com.cubrid.cubridmanager.core.replication.model.TransFileProgressInfo)2 CasAuthType (com.cubrid.cubridmanager.core.common.model.CasAuthType)1