Search in sources :

Example 71 with TreeNode

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

the class GetShardStatusTask method setFieldValueNew.

private static void setFieldValueNew(TreeNode node, final ShardsStatus shardsStatus) {
    if (node == null || shardsStatus == null) {
        return;
    }
    if (node.getChildren() == null || node.getChildren().isEmpty()) {
        return;
    }
    for (TreeNode shard : node.getChildren()) {
        ShardStatus shardStatus = new ShardStatus();
        Class<?> clazz = shardStatus.getClass();
        Field[] fields = clazz.getDeclaredFields();
        for (Field field : fields) {
            Column column = field.getAnnotation(Column.class);
            if (column == null || !column.enable()) {
                continue;
            }
            String propertyName = column.name();
            String value = shard.getValue(propertyName);
            field.setAccessible(true);
            try {
                field.set(shardStatus, field.getType().cast(value));
            } catch (IllegalArgumentException e) {
                LOGGER.error(e.getMessage(), e);
            } catch (IllegalAccessException e) {
                LOGGER.error(e.getMessage(), e);
            }
        }
        shardsStatus.addShardStatus(shardStatus);
    }
}
Also used : ShardStatus(com.cubrid.cubridmanager.core.shard.model.ShardStatus) Field(java.lang.reflect.Field) Column(com.cubrid.cubridmanager.core.shard.model.Column) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 72 with TreeNode

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

the class GetDiagdataTask method getResult.

/**
	 * Gets the instance of Type DiagStatusResult
	 * 
	 * @return DiagStatusResult
	 */
public DiagStatusResult getResult() {
    DiagStatusResult diagStatusResult = new DiagStatusResult();
    TreeNode node = getResponse();
    if (node == null || (getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        finish();
        return diagStatusResult;
    }
    for (TreeNode childNode : node.getChildren()) {
        setFieldValue(childNode, diagStatusResult);
    }
    return diagStatusResult;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) DiagStatusResult(com.cubrid.cubridmanager.core.monitoring.model.DiagStatusResult)

Example 73 with TreeNode

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

the class GetMonitorIntervalTask method getInterval.

/**
	 * Get the monitor statistic interval
	 * 
	 * @return monitor statistic interval
	 */
public String getInterval() {
    TreeNode node = getResponse();
    if (node == null || (getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    String interval = node.getValue("interval");
    return interval;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 74 with TreeNode

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

the class GetReplAgentStatusTask method isActive.

/**
	 * 
	 * Get whether the replication server is active
	 * 
	 * @return <code>true</code> if it is active;<code>false</code>otherwise
	 */
public boolean isActive() {
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return false;
    }
    String str = response.getValue("is_active");
    if (str != null && str.equalsIgnoreCase("Y")) {
        return true;
    }
    return false;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 75 with TreeNode

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

the class GetReplPerformanceTask method loadPerformanceData.

/**
	 * 
	 * Load replication performance data
	 * 
	 * @return the preformance data map
	 */
public List<Map<String, String>> loadPerformanceData() {
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    List<Map<String, String>> replDataList = new ArrayList<Map<String, String>>();
    //String total = response.getValue("total");
    for (int i = 0; i < response.childrenSize(); i++) {
        TreeNode node = response.getChildren().get(i);
        if (node.getValue("open") != null && node.getValue("open").equals("log")) {
            String[] lines = node.getValues("line");
            addToReplDataList(replDataList, lines);
        }
    }
    return replDataList;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap)

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