Search in sources :

Example 81 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class GetDatabasesParameterTask method getConfContents.

/**
	 * Get databases.txt config parameters content
	 * 
	 * @return
	 */
public List<String> getConfContents() {
    String[] confData = null;
    List<String> confContents = new ArrayList<String>();
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    for (int i = 0; i < response.childrenSize(); i++) {
        TreeNode node = response.getChildren().get(i);
        if (node != null && node.getValue("open").equals("conflist")) {
            confData = node.getValues("confdata");
        }
    }
    if (confData != null) {
        for (String line : confData) {
            confContents.add(line);
        }
    }
    return confContents;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ArrayList(java.util.ArrayList)

Example 82 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class CancelTransFileTaskTest method testReceive.

public void testReceive() throws Exception {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
        return;
    String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/replication/task/test.message/CancelTransFile_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    //compare 
    assertEquals("success", node.getValue("status"));
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 83 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class GetManagerLogListTask method getLogContentV1.

private ManagerLogInfos getLogContentV1() {
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    ManagerLogInfos managerLogInfos = new ManagerLogInfos();
    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("accesslog")) {
            // for
            ManagerLogInfoList managerLogList = new ManagerLogInfoList();
            String[] users = node.getValues("user");
            String[] tasknames = node.getValues("taskname");
            String[] times = node.getValues("time");
            if (users != null) {
                addLogToManagerLogList(managerLogList, users, tasknames, times);
                managerLogInfos.setAccessLog(managerLogList);
            }
        } else if (node != null && node.getValue("open") != null && node.getValue("open").equals("errorlog")) {
            // for
            ManagerLogInfoList managerLogList = new ManagerLogInfoList();
            String[] users = null;
            users = node.getValues("user");
            String[] tasknames = node.getValues("taskname");
            String[] times = node.getValues("time");
            String[] errornotes = node.getValues("errornote");
            if (users != null) {
                addLogToManagerLogList(managerLogList, users, tasknames, times, errornotes);
                managerLogInfos.setErrorLog(managerLogList);
            }
        }
    }
    return managerLogInfos;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ManagerLogInfos(com.cubrid.cubridmanager.core.logs.model.ManagerLogInfos) ManagerLogInfoList(com.cubrid.cubridmanager.core.logs.model.ManagerLogInfoList)

Example 84 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class GetDbModeTask method getDbModes.

/**
	 * 
	 * Get database modes list
	 * 
	 * @return The List<HADatabaseStatus>
	 */
public List<HADatabaseStatusInfo> getDbModes() {
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    List<HADatabaseStatusInfo> dbStatusList = new ArrayList<HADatabaseStatusInfo>();
    for (int i = 0; i < response.childrenSize(); i++) {
        TreeNode node1 = response.getChildren().get(i);
        if (node1.getValue("open") == null) {
            continue;
        }
        if (node1.getValue("open").trim().equals("dbserver")) {
            String dbName = node1.getValue("dbname");
            String serverMode = node1.getValue("server_mode");
            String error = node1.getValue("server_msg");
            HADatabaseStatusInfo dbStatus = new HADatabaseStatusInfo();
            dbStatus.setDbName(dbName);
            if (error == null || error.equals("none")) {
                dbStatus.setStatusType(DBStatusType.getType(serverMode, serverInfo.isHAMode(dbName)));
            } else {
                dbStatus.setErrorInfo(error);
                dbStatus.setStatusType(DBStatusType.UNKNOWN);
            }
            dbStatusList.add(dbStatus);
        }
    }
    return dbStatusList;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ArrayList(java.util.ArrayList) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Example 85 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class GetHeartbeatNodeInfoTask method buildHaNodeList.

/**
	 * 
	 * Parse the node and build HAHostStatus object
	 * 
	 * @param parent The TreeNode
	 * @param hostStatusList The List<HAHostStatus>
	 * @param currentHostName The String
	 * @return The HAHostStatus
	 */
private HAHostStatusInfo buildHaNodeList(TreeNode parent, List<HAHostStatusInfo> hostStatusList, String currentHostName) {
    HAHostStatusInfo reHaHostStatus = null;
    List<HAHostStatusInfo> slaveHostStatusInfoList = new ArrayList<HAHostStatusInfo>();
    HAHostStatusInfo masterHostStatusInfo = null;
    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("node")) {
            String hostName = node.getValue("hostname");
            String ip = node.getValue("ip");
            String priority = node.getValue("priority");
            String state = node.getValue("state");
            HAHostStatusInfo haHostStatus = new HAHostStatusInfo();
            haHostStatus.setHostName(hostName);
            haHostStatus.setIp(ip);
            haHostStatus.setPriority(priority);
            haHostStatus.setStatusType(HostStatusType.getType(state));
            if (hostName.equals(currentHostName)) {
                reHaHostStatus = haHostStatus;
            }
            if (haHostStatus.getStatusType() == HostStatusType.MASTER) {
                masterHostStatusInfo = haHostStatus;
            } else if (haHostStatus.getStatusType() == HostStatusType.SLAVE || haHostStatus.getStatusType() == HostStatusType.REPLICA) {
                slaveHostStatusInfoList.add(haHostStatus);
            }
            hostStatusList.add(haHostStatus);
        }
    }
    //set master and slave relation
    for (int i = 0; i < slaveHostStatusInfoList.size(); i++) {
        slaveHostStatusInfoList.get(i).setMasterHostStatusInfo(masterHostStatusInfo);
    }
    if (masterHostStatusInfo != null) {
        masterHostStatusInfo.setSlaveHostStatusInfoList(slaveHostStatusInfoList);
    }
    return reHaHostStatus;
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) 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