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