Search in sources :

Example 6 with DBStatusType

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;
    }
}
Also used : DatabaseMonitorPartHelper(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.helper.DatabaseMonitorPartHelper) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) DBStatusType(com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType) HANode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode) DatabaseDashboardViewPart(com.cubrid.cubridmanager.ui.mondashboard.editor.DatabaseDashboardViewPart)

Example 7 with DBStatusType

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;
}
Also used : DecoratedImage(com.cubrid.common.ui.decorator.DecoratedImage) HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) DBStatusType(com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType) StyledString(org.eclipse.jface.viewers.StyledString) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Example 8 with DBStatusType

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DBStatusType(com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 9 with DBStatusType

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;
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) DBStatusType(com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType) DbProcessStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Aggregations

DBStatusType (com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType)9 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)4 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)3 DbProcessStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 Button (org.eclipse.swt.widgets.Button)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 DecoratedImage (com.cubrid.common.ui.decorator.DecoratedImage)1 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 AddHADatabaseDialog (com.cubrid.cubridmanager.ui.mondashboard.dialog.AddHADatabaseDialog)1 DatabaseDashboardViewPart (com.cubrid.cubridmanager.ui.mondashboard.editor.DatabaseDashboardViewPart)1 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)1 HANode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode)1 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)1 DatabaseMonitorPartHelper (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.helper.DatabaseMonitorPartHelper)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1