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