Search in sources :

Example 56 with TreeNode

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

the class GetCMUserListTask method getServerUserInfoList.

/**
	 * 
	 * Get server user information list
	 * 
	 * @return List<ServerUserInfo> A list stored some instance of
	 *         ServerUserInfo
	 */
public List<ServerUserInfo> getServerUserInfoList() {
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    List<ServerUserInfo> serverUserInfoList = new ArrayList<ServerUserInfo>();
    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("dblist")) {
            serverInfo.removeAllDatabase();
            String[] dbNames = node1.getValues("dbname");
            // start
            if (null == dbNames) {
                int length = node1.childrenSize();
                dbNames = new String[length];
                for (int j = 0; j < length; j++) {
                    TreeNode subNode2 = node1.getChildren().get(j);
                    if (subNode2.getValue("open") == null || !subNode2.getValue("open").trim().equals("dbs")) {
                        continue;
                    }
                    dbNames[j] = subNode2.getValue("dbname");
                }
            }
            for (int m = 0; dbNames != null && m < dbNames.length; m++) {
                serverInfo.addDatabase(dbNames[m]);
            }
        } else if (node1.getValue("open").trim().equals("userlist")) {
            buildUserInfo(serverUserInfoList, node1);
        }
    }
    return serverUserInfoList;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ArrayList(java.util.ArrayList) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo)

Example 57 with TreeNode

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

the class GetCubridConfParameterTask method getConfContents.

/**
	 * 
	 * Get cubrid.conf parameters
	 * 
	 * @return List<String> The map that stored configure parameters
	 */
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 58 with TreeNode

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

the class PlanDumpTask method getContent.

/**
	 * get result from the response.
	 * 
	 * @return LogContentInfo
	 */
public PlanDumpInfo getContent() {
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    PlanDumpInfo planDumpInfo = new PlanDumpInfo();
    String path = response.getValue("path");
    planDumpInfo.setPath(path);
    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("log")) {
            String[] lines = node.getValues("line");
            for (int j = 0; j < lines.length; j++) {
                String str = lines[j];
                if (str != null) {
                    planDumpInfo.addLine(str);
                }
            }
        }
    }
    return planDumpInfo;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) PlanDumpInfo(com.cubrid.cubridmanager.core.cubrid.database.model.PlanDumpInfo)

Example 59 with TreeNode

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

the class GetQueryPlanListTask method getQueryPlanInfoList.

/**
	 * Get a list that includes the instances of QueryPlanInfo
	 *
	 * @return List<QueryPlanInfo> a list that includes the instances of
	 *         QueryPlanInfo
	 */
public List<QueryPlanInfo> getQueryPlanInfoList() {
    List<QueryPlanInfo> queryPlanInfoList = new ArrayList<QueryPlanInfo>();
    if (null != getErrorMsg()) {
        return null;
    }
    TreeNode result = getResponse();
    String dbname = result.getValue("dbname");
    if (result.childrenSize() > 0) {
        TreeNode planListNode = result.getChildren().get(0);
        int size = planListNode.childrenSize();
        for (int i = 0; i < size; i++) {
            TreeNode node = planListNode.getChildren().get(i);
            QueryPlanInfo planInfo = new QueryPlanInfo();
            SocketTask.setFieldValue(node, planInfo);
            planInfo.setDbname(dbname);
            queryPlanInfoList.add(planInfo);
        }
    }
    return queryPlanInfoList;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ArrayList(java.util.ArrayList) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)

Example 60 with TreeNode

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

the class TransFileTaskTest 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/transfile_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    TransFileTask task = new TransFileTask(serverInfo);
    task.setResponse(node);
    //compare 
    assertTrue(task.isSuccess());
    assertEquals("2563", task.getTransFilePid());
    //test exception case 1
    task.setResponse(null);
    assertTrue(task.getTransFilePid() == null);
    //test exception case 2
    task.setResponse(node);
    task.setErrorMsg("has error");
    assertTrue(task.getTransFilePid() == null);
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

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