Search in sources :

Example 16 with HADatabaseStatusInfo

use of com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo in project cubrid-manager by CUBRID.

the class HAUtil method getHADatabaseStatusInfo.

/**
	 * 
	 * Get HADatabaseStatusInfo object and handle with the status type
	 * 
	 * @param dbName The String
	 * @param haHostStatusInfo The HAHostStatusInfo
	 * @param serverInfo The ServerInfo
	 * @return The HADatabaseStatusInfo
	 */
public static HADatabaseStatusInfo getHADatabaseStatusInfo(String dbName, HAHostStatusInfo haHostStatusInfo, ServerInfo serverInfo) {
    if (haHostStatusInfo != null && haHostStatusInfo.getDbStatusList() != null) {
        for (HADatabaseStatusInfo dbStatusInfo : haHostStatusInfo.getDbStatusList()) {
            if (dbName.equals(dbStatusInfo.getDbName())) {
                return dbStatusInfo;
            }
        }
    }
    HADatabaseStatusInfo haDbStatusInfo = new HADatabaseStatusInfo();
    haDbStatusInfo.setDbName(dbName);
    DatabaseInfo dbInfo = serverInfo == null || serverInfo.getLoginedUserInfo() == null ? null : serverInfo.getLoginedUserInfo().getDatabaseInfo(dbName);
    if (dbInfo != null && dbInfo.getRunningType() == DbRunningType.CS && !serverInfo.isHAMode(dbName)) {
        haDbStatusInfo.setStatusType(DBStatusType.CS_Mode);
    } else if (dbInfo != null && dbInfo.getRunningType() == DbRunningType.STANDALONE) {
        haDbStatusInfo.setStatusType(serverInfo.isHAMode(dbName) ? DBStatusType.STOPPED_HA : DBStatusType.STOPPED);
    }
    if (haHostStatusInfo != null) {
        haDbStatusInfo.setHaHostStatusInfo(haHostStatusInfo);
        haHostStatusInfo.addHADatabaseStatus(haDbStatusInfo);
    }
    return haDbStatusInfo;
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Aggregations

HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)16 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)7 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)5 ArrayList (java.util.ArrayList)5 DbProcessStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo)4 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)3 DBStatusType (com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType)3 IDiagPara (com.cubrid.cubridmanager.core.monitoring.model.IDiagPara)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)2 GetDbModeTask (com.cubrid.cubridmanager.core.mondashboard.task.GetDbModeTask)2 GetHeartbeatNodeInfoTask (com.cubrid.cubridmanager.core.mondashboard.task.GetHeartbeatNodeInfoTask)2 VerifyDbUserPasswordTask (com.cubrid.cubridmanager.core.mondashboard.task.VerifyDbUserPasswordTask)2 MondashDataResult (com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult)2 List (java.util.List)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2