Search in sources :

Example 1 with MondashDataResult

use of com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult in project cubrid-manager by CUBRID.

the class DatabaseDashboardViewPart method performUpdate.

/**
	 * Perform the update data
	 *
	 * @param dataChangedEvent the given event including newest data
	 */
public void performUpdate(DataChangedEvent dataChangedEvent) {
    if (composite == null || composite.isDisposed()) {
        return;
    }
    if (dbNode.getParent().isConnected()) {
        HADatabaseStatusInfo haDbStatusInfo = HAUtil.getDatabaseStatusInfo(dataChangedEvent.getHaHostStatusInfoList(), dbNode.getParent().getIp(), dbNode.getDbName());
        if (haDbStatusInfo == null) {
            haDbStatusInfo = HAUtil.getDatabaseStatusInfo(dataChangedEvent.getDbStatusInfoList(), dbNode.getDbName());
            if (null == haDbStatusInfo) {
                haDbStatusInfo = new HADatabaseStatusInfo();
                haDbStatusInfo.setDbName(dbNode.getDbName());
            }
        }
        dbNode.setHaDatabaseStatus(haDbStatusInfo);
    } else {
        HADatabaseStatusInfo haDatabaseStatus = new HADatabaseStatusInfo();
        haDatabaseStatus.setDbName(dbNode.getDbName());
        dbNode.setHaDatabaseStatus(haDatabaseStatus);
    }
    Set<MondashDataResult> set = dataChangedEvent.getResultSet();
    Map<IDiagPara, String> updateMap = null;
    String hostCpuTotal = "0";
    String hostMemTotal = "0";
    for (MondashDataResult result : set) {
        if (dbNode.getDbName().equals(result.getName())) {
            updateMap = result.getUpdateMap();
        } else if (generator.getName().equals(result.getName())) {
            Map<IDiagPara, String> hostMap = result.getUpdateMap();
            if (hostMap != null) {
                hostCpuTotal = hostMap.get(HostStatEnum.CPU_TOTAL);
                hostCpuTotal = hostCpuTotal == null ? "0" : hostCpuTotal;
                hostMemTotal = hostMap.get(HostStatEnum.MEMPHY_TOTAL);
                hostMemTotal = hostMemTotal == null ? "0" : hostMemTotal;
            }
        }
    }
    performUpdate(updateMap, hostCpuTotal, hostMemTotal);
}
Also used : MondashDataResult(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo) IDiagPara(com.cubrid.cubridmanager.core.monitoring.model.IDiagPara) Map(java.util.Map) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap)

Example 2 with MondashDataResult

use of com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult in project cubrid-manager by CUBRID.

the class DatabaseMonitorPartHelper method performUpdate.

/**
	 * Perform the update data
	 * 
	 * @param dataChangedEvent the given event including newest data
	 */
public void performUpdate(DataChangedEvent dataChangedEvent) {
    if (!dbNode.getParent().isConnected()) {
        HADatabaseStatusInfo haDatabaseStatus = new HADatabaseStatusInfo();
        haDatabaseStatus.setDbName(dbNode.getDbName());
        dbNode.setHaDatabaseStatus(haDatabaseStatus);
        return;
    }
    Set<MondashDataResult> set = dataChangedEvent.getResultSet();
    String dbName = dbNode.getDbName();
    Map<IDiagPara, String> updateMap = null;
    String hostCpuTotal = null;
    String hostMemTotal = null;
    for (MondashDataResult result : set) {
        if (dbName.equals(result.getName())) {
            updateMap = result.getUpdateMap();
        } else if (generator.getName().equals(result.getName())) {
            Map<IDiagPara, String> hostMap = result.getUpdateMap();
            if (hostMap != null) {
                hostCpuTotal = hostMap.get(HostStatEnum.CPU_TOTAL);
                hostMemTotal = hostMap.get(HostStatEnum.MEMPHY_TOTAL);
            }
        }
    }
    int[] value = getValues(updateMap, hostCpuTotal == null ? "0" : hostCpuTotal, hostMemTotal == null ? "0" : hostMemTotal);
    HADatabaseStatusInfo haDbStatusInfo = HAUtil.getDatabaseStatusInfo(dataChangedEvent.getHaHostStatusInfoList(), dbNode.getParent().getIp(), dbNode.getDbName());
    if (haDbStatusInfo == null) {
        haDbStatusInfo = HAUtil.getDatabaseStatusInfo(dataChangedEvent.getDbStatusInfoList(), dbNode.getDbName());
        if (null == haDbStatusInfo) {
            haDbStatusInfo = new HADatabaseStatusInfo();
            haDbStatusInfo.setDbName(dbNode.getDbName());
        }
    }
    haDbStatusInfo.setCpuUsage(value[0]);
    haDbStatusInfo.setMemUsage(value[1]);
    haDbStatusInfo.setDelay(value[2]);
    dbNode.setHaDatabaseStatus(haDbStatusInfo);
}
Also used : MondashDataResult(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo) IDiagPara(com.cubrid.cubridmanager.core.monitoring.model.IDiagPara) Map(java.util.Map)

Example 3 with MondashDataResult

use of com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult in project cubrid-manager by CUBRID.

the class HostMonitorPartHelper method performUpdate.

/**
	 * Perform the update data
	 * 
	 * @param dataChangedEvent the given event including newest data
	 */
public void performUpdate(DataChangedEvent dataChangedEvent) {
    DataProvider dataProvider = (DataProvider) dataChangedEvent.getSource();
    if (dataProvider != null && dataProvider.getServerInfo() != null) {
        hostNode.setConnected(dataProvider.getServerInfo().isConnected());
    }
    if (!hostNode.isConnected()) {
        hostNode.setConnected(false);
        HAHostStatusInfo haHostStatusInfo = new HAHostStatusInfo();
        haHostStatusInfo.setIp(hostNode.getIp());
        hostNode.setHostStatusInfo(haHostStatusInfo);
        return;
    }
    HAHostStatusInfo haHostStatusInfo = HAUtil.getHostStatusInfo(dataChangedEvent.getHaHostStatusInfoList(), hostNode.getIp());
    if (haHostStatusInfo == null) {
        haHostStatusInfo = HAUtil.getHAHostStatusInfo(hostNode.getServerInfo());
        if (haHostStatusInfo == null) {
            haHostStatusInfo = new HAHostStatusInfo();
            haHostStatusInfo.setIp(hostNode.getIp());
        }
    }
    Set<MondashDataResult> set = dataChangedEvent.getResultSet();
    Map<IDiagPara, String> map = null;
    for (MondashDataResult result : set) {
        if (generator.getName().equals(result.getName())) {
            map = result.getUpdateMap();
            break;
        }
    }
    int[] value = getValues(map);
    haHostStatusInfo.setCpuUsage(value[0]);
    haHostStatusInfo.setMemUsage(value[1]);
    haHostStatusInfo.setIoWait(value[2]);
    hostNode.setHostStatusInfo(haHostStatusInfo);
}
Also used : DataProvider(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider) HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) MondashDataResult(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult) IDiagPara(com.cubrid.cubridmanager.core.monitoring.model.IDiagPara)

Aggregations

IDiagPara (com.cubrid.cubridmanager.core.monitoring.model.IDiagPara)3 MondashDataResult (com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult)3 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)2 Map (java.util.Map)2 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)1 DataProvider (com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider)1 HashMap (java.util.HashMap)1 TreeMap (java.util.TreeMap)1