use of com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType in project cubrid-manager by CUBRID.
the class DatabaseDataProvider method setDefaultValue.
/**
*
* Set default value
*
*/
private void setDefaultValue() {
boolean isOldExecuteStandbyStaTask = isExecuteStandbyStaTask;
boolean isOldExecuteDbProcessTask = isExecuteDbProcessTask;
isExecuteStandbyStaTask = false;
isExecuteDbDumpTask = false;
isExecuteDbProcessTask = false;
errorMsg = "";
DBStatusType statusType = dbStatusInfo == null ? DBStatusType.UNKNOWN : dbStatusInfo.getStatusType();
boolean isDatabaseStarted = DBStatusType.isDbStarted(statusType);
HostNode hostNode = dbNode.getParent();
if (hostNode != null && hostNode.isConnected()) {
List<DataUpdateListener> listenerList = generator.getListeners();
for (DataUpdateListener listener : listenerList) {
HANode node = listener.getModel();
if (!dbNode.equals(node)) {
continue;
}
if (listener instanceof DatabaseMonitorPartHelper || listener instanceof DatabaseDashboardViewPart) {
isExecuteDbProcessTask = isDatabaseStarted;
isExecuteStandbyStaTask = statusType == DBStatusType.STANDBY || statusType == DBStatusType.MAINTENANCE;
}
if (listener instanceof DatabaseDashboardViewPart) {
isExecuteDbDumpTask = isDatabaseStarted;
}
}
}
if (isOldExecuteStandbyStaTask != isExecuteStandbyStaTask) {
standyServerStatRequestCount = 0;
}
if (isOldExecuteDbProcessTask != isExecuteDbProcessTask) {
dbProcRequestCount = 0;
}
}
use of com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType in project cubrid-manager by CUBRID.
the class NavigatorTreeLabelProvider method decorateDatabaseImgae.
/**
* Decorate the database image
*
* @param label
* @param server
* @return
*/
private Image decorateDatabaseImgae(Image baseImage, CubridDatabase database) {
CubridServer server = database.getServer();
HAHostStatusInfo haHostStatusInfo = server.getServerInfo().getHaHostStatusInfo();
HADatabaseStatusInfo haDatabaseStatusInfo = HAUtil.getHADatabaseStatusInfo(database.getName(), haHostStatusInfo, server.getServerInfo());
List<String> haNodeList = HAUtil.getAllHaDBList(server.getServerInfo());
server.getLoader().setLoaded(true);
if (haNodeList.contains(database.getName())) {
DBStatusType statusType = haDatabaseStatusInfo.getStatusType();
if (DBStatusType.ACTIVE.equals(statusType)) {
DecoratedImage decoratedImage = decoratorManager.decorate(baseImage, "HADatabase", null, null, null, null, null, null, imgDecMaster, "Active");
return decoratedImage.getDecoratedImage();
}
if (DBStatusType.STANDBY.equals(statusType)) {
DecoratedImage decoratedImage = decoratorManager.decorate(baseImage, "HADatabase", null, null, null, null, null, null, imgDecSlave, "Standby");
return decoratedImage.getDecoratedImage();
}
}
return baseImage;
}
use of com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType in project cubrid-manager by CUBRID.
the class DashboardPreferencePage method createContents.
/**
* Create contents of page.
*
* @param parent Composite
* @return the content.
*/
protected Control createContents(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final Group changeFontGroup = new Group(composite, SWT.NONE);
changeFontGroup.setText(Messages.colorSettingsOfDB);
final GridData gdChangeFontGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
changeFontGroup.setLayoutData(gdChangeFontGroup);
changeFontGroup.setLayout(new GridLayout());
final Composite compositeSecond = new Composite(changeFontGroup, SWT.NONE);
compositeSecond.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
final GridLayout gridLayoutFirst = new GridLayout();
gridLayoutFirst.numColumns = 3;
compositeSecond.setLayout(gridLayoutFirst);
for (DBStatusType dbt : DBStatusType.values()) {
Label lbl = new Label(compositeSecond, SWT.NONE);
lbl.setText(Messages.dbStatusType + " \"" + getDBStatusText(dbt) + "\"");
Label lblColor = new Label(compositeSecond, SWT.NONE);
lblColor.setText(COLOR_LABEL_TEXT);
lblColor.setBackground(PREFER.getColor(getDBStatusText(dbt)));
Button btn = new Button(compositeSecond, SWT.FLAT);
btn.setText(COLOR_BUTTON_TEXT);
btn.addSelectionListener(new ColorSelector(btn, lblColor));
colorSettings.put(getDBStatusText(dbt), lblColor);
}
// HA Monitoring Option
{
final Group monitoringGroup = new Group(composite, SWT.NONE);
monitoringGroup.setText(Messages.haMon);
final GridData gdMonitoringGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
monitoringGroup.setLayoutData(gdMonitoringGroup);
monitoringGroup.setLayout(new GridLayout());
final Composite compositeMonitoring = new Composite(monitoringGroup, SWT.NONE);
compositeMonitoring.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
final GridLayout gridLayoutMonitoring = new GridLayout();
gridLayoutMonitoring.numColumns = 2;
compositeMonitoring.setLayout(gridLayoutMonitoring);
Label lbl = new Label(compositeMonitoring, SWT.NONE);
lbl.setText(Messages.haMonHertbeatTimeout);
monitoringSpinner = new Spinner(compositeMonitoring, SWT.BORDER);
monitoringSpinner.setMinimum(1);
monitoringSpinner.setMaximum(3600);
final GridData gdSpinner = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
gdSpinner.widthHint = 40;
monitoringSpinner.setLayoutData(gdSpinner);
haHeartBeatTimeout = PREFER.getHAHeartBeatTimeout();
if (haHeartBeatTimeout < 1000) {
haHeartBeatTimeout = 1000;
}
monitoringSpinner.setSelection(haHeartBeatTimeout / 1000);
monitoringSpinner.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent event) {
haHeartBeatTimeout = monitoringSpinner.getSelection() * 1000;
}
public void widgetDefaultSelected(SelectionEvent event) {
haHeartBeatTimeout = monitoringSpinner.getSelection() * 1000;
}
});
lbl = new Label(compositeMonitoring, SWT.NONE);
lbl.setText(Messages.haMonHertbeatTimeoutMsg);
lbl.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
}
return composite;
}
use of com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType in project cubrid-manager by CUBRID.
the class HAUtil method getActiveCopyLogDbProcessStatusInfo.
/**
*
* Get the Copy Log DB process status information of active node from
* standby node
*
* @param dbNode DatabaseNode
* @return DbProcessStatusInfo
*/
public static DbProcessStatusInfo getActiveCopyLogDbProcessStatusInfo(DatabaseNode dbNode) {
HADatabaseStatusInfo dbStatusInfo = dbNode.getHaDatabaseStatus();
if (dbStatusInfo == null) {
return null;
}
DBStatusType dbStatusType = dbStatusInfo.getStatusType();
if (dbStatusType != DBStatusType.STANDBY && dbStatusType != DBStatusType.MAINTENANCE) {
return null;
}
List<DbProcessStatusInfo> dbProcessList = dbStatusInfo.getCopyLogDbProcessStatusList();
if (dbProcessList == null || dbProcessList.isEmpty()) {
return null;
}
HAHostStatusInfo hostStatusInfo = dbNode.getParent().getHostStatusInfo();
if (hostStatusInfo.getStatusType() != HostStatusType.SLAVE && hostStatusInfo.getStatusType() != HostStatusType.REPLICA) {
return null;
}
HAHostStatusInfo masterHostStatusInfo = hostStatusInfo.getMasterHostStatusInfo();
if (masterHostStatusInfo == null) {
return null;
}
String masterHostName = masterHostStatusInfo.getHostName();
for (DbProcessStatusInfo processStatusInfo : dbProcessList) {
if (masterHostName.equals(processStatusInfo.getHostName())) {
return processStatusInfo;
}
}
return null;
}
Aggregations