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);
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations