Search in sources :

Example 56 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class BrokerStatusView method refresh.

/**
	 * 
	 * Refresh the page content
	 * 
	 * @param isUpdateTable whether update table
	 * @param isRefreshChanged whether refresh changed
	 */
public void refresh(boolean isUpdateTable, boolean isRefreshChanged) {
    ServerInfo site = brokerNode.getServer().getServerInfo();
    if (isSupportNewBrokerParamPropery) {
        refreshBasicTable(site);
    }
    BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
    final GetBrokerStatusInfosTask<BrokerStatusInfos> task = new GetBrokerStatusInfosTask<BrokerStatusInfos>(site, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
    task.setBrokerName(nodeName);
    task.execute();
    if (!task.isSuccess()) {
        return;
    }
    brokerStatusInfos = task.getResultModel();
    //job queue
    if (brokerStatusInfos != null) {
        jobinfoLst = brokerStatusInfos.getJobinfo();
        jqTableViewer.setInput(jobinfoLst);
        jqTableViewer.refresh();
    }
    //apply server
    List<ApplyServerInfo> newAsInfoLst = null;
    if (null != brokerStatusInfos) {
        newAsInfoLst = brokerStatusInfos.getAsinfo();
    }
    List<ApplyServerInfo> changedAsInfoLst = new ArrayList<ApplyServerInfo>();
    for (int i = 0; newAsInfoLst != null && i < newAsInfoLst.size(); i++) {
        ApplyServerInfo newAsInfo = newAsInfoLst.get(i);
        ApplyServerInfo changedAsInfo = newAsInfo.clone();
        for (int j = 0; oldAsInfoLst != null && j < oldAsInfoLst.size(); j++) {
            ApplyServerInfo oldAsInfo = oldAsInfoLst.get(j);
            if (newAsInfo.getAs_id().equalsIgnoreCase(oldAsInfo.getAs_id())) {
                long newQuery = StringUtil.intValue(newAsInfo.getAs_num_query());
                long newTran = StringUtil.intValue(newAsInfo.getAs_num_tran());
                long newLongQuery = StringUtil.longValue(newAsInfo.getAs_long_query());
                long newLongTran = StringUtil.longValue(newAsInfo.getAs_long_tran());
                long newErrQuery = StringUtil.intValue(newAsInfo.getAs_error_query());
                long oldQuery = StringUtil.intValue(oldAsInfo.getAs_num_query());
                long oldTran = StringUtil.intValue(oldAsInfo.getAs_num_tran());
                long oldLongQuery = StringUtil.longValue(oldAsInfo.getAs_long_query());
                long oldLongTran = StringUtil.longValue(oldAsInfo.getAs_long_tran());
                long oldErrQuery = StringUtil.intValue(oldAsInfo.getAs_error_query());
                long changedQuery = newQuery - oldQuery;
                long changedTran = newTran - oldTran;
                long changedLongTran = newLongTran - oldLongTran;
                long changedLongQuery = newLongQuery - oldLongQuery;
                long changedErrQuery = newErrQuery - oldErrQuery;
                changedAsInfo.setAs_num_query(String.valueOf(changedQuery > 0 ? changedQuery : 0));
                changedAsInfo.setAs_num_tran(String.valueOf(changedTran > 0 ? changedTran : 0));
                changedAsInfo.setAs_long_tran(String.valueOf(changedLongTran > 0 ? changedLongTran : 0));
                changedAsInfo.setAs_long_query(String.valueOf(changedLongQuery > 0 ? changedLongQuery : 0));
                changedAsInfo.setAs_error_query(String.valueOf(changedErrQuery > 0 ? changedErrQuery : 0));
                break;
            }
        }
        changedAsInfoLst.add(changedAsInfo);
    }
    oldAsInfoLst = newAsInfoLst;
    if (isUpdateTable) {
        if (isRefreshChanged) {
            asTableViewer.setInput(changedAsInfoLst);
        } else {
            asTableViewer.setInput(oldAsInfoLst);
        }
    }
    asTableViewer.refresh();
    //job queue
    jobinfoLst = brokerStatusInfos.getJobinfo();
    jqTableViewer.setInput(jobinfoLst);
    jqTableViewer.refresh();
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) GetBrokerStatusInfosTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask) ArrayList(java.util.ArrayList) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Example 57 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class BrokerStatusView method createBasicTable.

/**
	 * Create basic info table
	 * 
	 * @param comp the parent composite
	 * 
	 */
private void createBasicTable(Composite comp) {
    final Composite basicComposite = new Composite(comp, SWT.NONE);
    GridData gdBasic = new GridData(SWT.FILL, SWT.NONE, false, false);
    basicComposite.setLayoutData(gdBasic);
    basicComposite.setLayout(new GridLayout());
    basicTableViewer = new TableViewer(basicComposite, SWT.NO_SCROLL | SWT.BORDER);
    Table basicTable = basicTableViewer.getTable();
    basicTable.setHeaderVisible(true);
    basicTable.setLinesVisible(true);
    GridData tblBasic = new GridData(SWT.FILL, SWT.TOP, true, false);
    tblBasic.heightHint = CommonUITool.getHeightHintOfTable(basicTable);
    basicTable.setLayoutData(tblBasic);
    TableLayout basicLayout = new TableLayout();
    setBasicLayout(basicLayout);
    basicTable.setLayout(basicLayout);
    basicTable.setBackground(basicComposite.getBackground());
    TableColumn tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscPid);
    tblColumn.setToolTipText(Messages.tblBscPid);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscPort);
    tblColumn.setToolTipText(Messages.tblBscPort);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscJobQueue);
    tblColumn.setToolTipText(Messages.tblBscJobQueue);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscAutoAddAs);
    tblColumn.setToolTipText(Messages.tblBscAutoAddAs);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscSqlLogMode);
    tblColumn.setToolTipText(Messages.tblBscSqlLogMode);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscLongTranTime);
    tblColumn.setToolTipText(Messages.tblBscLongTranTime);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscLongQueryTime);
    tblColumn.setToolTipText(Messages.tblBscLongQueryTime);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscSessionTimeout);
    tblColumn.setToolTipText(Messages.tblBscSessionTimeout);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscKeepConn);
    tblColumn.setToolTipText(Messages.tblBscKeepConn);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscAccessMode);
    tblColumn.setToolTipText(Messages.tblBscAccessMode);
    basicTableViewer.setContentProvider(new BrokerBasicInfoContentProvider());
    ServerInfo serverInfo = cubridNode.getServer().getServerInfo();
    BrokerBasicInfoLabelProvider basicInfoLabelProvider = new BrokerBasicInfoLabelProvider();
    basicInfoLabelProvider.setServerInfo(serverInfo);
    basicTableViewer.setLabelProvider(basicInfoLabelProvider);
    basicTableViewer.setInput(basicInfoLst);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 58 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class BrokerStatusView method refresh.

/**
	 * Refresh this view
	 * 
	 */
public void refresh() {
    ServerInfo site = brokerNode.getServer().getServerInfo();
    if (isSupportNewBrokerParamPropery) {
        refreshBasicTable(site);
    }
    BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
    final GetBrokerStatusInfosTask<BrokerStatusInfos> task = new GetBrokerStatusInfosTask<BrokerStatusInfos>(site, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
    task.setBrokerName(nodeName);
    task.execute();
    if (!task.isSuccess()) {
        return;
    }
    brokerStatusInfos = task.getResultModel();
    asinfoLst = brokerStatusInfos.getAsinfo();
    jobinfoLst = brokerStatusInfos.getJobinfo();
    asTableViewer.setInput(asinfoLst);
    asTableViewer.refresh();
    jqTableViewer.setInput(jobinfoLst);
    jqTableViewer.refresh();
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) GetBrokerStatusInfosTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Example 59 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class StartBrokerAction method run.

/**
	 * Override the run method in order to complete starting broker environment
	 * 
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    DefaultCubridNode selection = (DefaultCubridNode) obj[0];
    ServerInfo site = selection.getServer().getServerInfo();
    StartBrokerTask task = new StartBrokerTask(site);
    task.setBrokerName(selection.getLabel());
    final String taskName = Messages.bind(Messages.startBrokerTaskName, selection.getLabel());
    TaskExecutor taskExecutor = new CommonTaskExec(taskName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection.getParent());
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) StartBrokerTask(com.cubrid.cubridmanager.core.broker.task.StartBrokerTask) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Example 60 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class StartBrokerEnvAction method run.

/**
	 * Override the run method in order to complete starting broker environment
	 * 
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    CubridBrokerFolder selection = (CubridBrokerFolder) obj[0];
    if (null == selection) {
        return;
    }
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    StartBrokerEnvTask task = new StartBrokerEnvTask(serverInfo);
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.startBrokerEnvTaskName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    selection.setRunning(true);
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection);
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) StartBrokerEnvTask(com.cubrid.cubridmanager.core.broker.task.StartBrokerEnvTask) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Aggregations

ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)255 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)40 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)40 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)39 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)37 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)35 ArrayList (java.util.ArrayList)30 EnvInfo (com.cubrid.cubridmanager.core.common.model.EnvInfo)29 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)28 TreeViewer (org.eclipse.jface.viewers.TreeViewer)27 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)24 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)24 MonitoringTask (com.cubrid.cubridmanager.core.common.task.MonitoringTask)24 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)21 SelectionEvent (org.eclipse.swt.events.SelectionEvent)20 GridData (org.eclipse.swt.layout.GridData)17 GridLayout (org.eclipse.swt.layout.GridLayout)17 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)16 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)16 ITask (com.cubrid.common.core.task.ITask)15