use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class StopShardAction method run.
/**
* Override the run method in order to complete stopping broker environment
*/
public void run() {
final Object[] obj = this.getSelectedObj();
CubridShard selection = (CubridShard) obj[0];
if (null == selection) {
return;
}
if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
return;
}
ServerInfo serverInfo = selection.getServer().getServerInfo();
StopShardTask task = new StopShardTask(serverInfo, selection.getName());
TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopShardActionName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
if (!task.isSuccess()) {
String msg = Messages.bind(Messages.errCanNotStopShardBroker, task.getErrorMsg());
CommonUITool.openErrorBox(msg);
return;
}
selection.setRunning(false);
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
CommonUITool.refreshNavigatorTree(treeViewer, selection);
ActionManager.getInstance().fireSelectionChanged(getSelection());
}
use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class StopShardEnvAction method run.
/**
* Override the run method in order to complete stopping broker environment
*/
public void run() {
final Object[] obj = this.getSelectedObj();
CubridShardFolder selection = (CubridShardFolder) obj[0];
if (null == selection) {
return;
}
if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
return;
}
ServerInfo serverInfo = selection.getServer().getServerInfo();
StopShardTask task = new StopShardTask(serverInfo, null);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopShardEnvActionName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
if (!task.isSuccess()) {
String msg = Messages.bind(Messages.errCanNotStopShardBroker, task.getErrorMsg());
CommonUITool.openErrorBox(msg);
return;
}
selection.setRunning(false);
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
CommonUITool.refreshNavigatorTree(treeViewer, selection);
ActionManager.getInstance().fireSelectionChanged(getSelection());
}
use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class StopBrokerAction method run.
/**
* Override the run method in order to complete stopping broker environment
*/
public void run() {
if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
return;
}
final Object[] obj = this.getSelectedObj();
DefaultCubridNode selection = (DefaultCubridNode) obj[0];
ServerInfo serverInfo = selection.getServer().getServerInfo();
StopBrokerTask task = new StopBrokerTask(serverInfo);
task.setBrokerName(selection.getLabel());
final String taskName = Messages.bind(Messages.stopBrokerTaskName, 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.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class BrokerStatusView method initValue.
/**
* Initializes the parameters of this view
*/
public void initValue() {
if (null == getCubridNode() || !CubridNodeType.BROKER.equals(getCubridNode().getType())) {
return;
}
brokerNode = (CubridBroker) getCubridNode();
nodeName = brokerNode.getLabel().trim();
serverName = brokerNode.getServer().getLabel();
port = brokerNode.getServer().getMonPort();
ServerInfo serverInfo = brokerNode.getServer().getServerInfo();
//get basic info
BrokerInfos brokerInfos = new BrokerInfos();
//brokerInfos.setBname(nodeName);
final GetBrokerStatusInfosTask<BrokerInfos> basicTask = new GetBrokerStatusInfosTask<BrokerInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerInfos);
basicTask.setBrokerName(nodeName);
//get status
BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
final GetBrokerStatusInfosTask<BrokerStatusInfos> statisTask = new GetBrokerStatusInfosTask<BrokerStatusInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
statisTask.setBrokerName(nodeName);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.showBrokerStatusTaskName);
taskExecutor.addTask(basicTask);
taskExecutor.addTask(statisTask);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
brokerInfos = basicTask.getResultModel();
if (null != brokerInfos) {
BrokerInfoList list = brokerInfos.getBorkerInfoList();
if (list != null && list.getBrokerInfoList() != null) {
basicInfoLst = list.getBrokerInfoList();
}
}
brokerStatusInfos = statisTask.getResultModel();
if (brokerStatusInfos != null) {
asinfoLst = brokerStatusInfos.getAsinfo();
jobinfoLst = brokerStatusInfos.getJobinfo();
}
}
use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class StartServiceAction method doRun.
/**
* Perform do run
*
* @param servers
*/
public void doRun(CubridServer[] servers) {
CubridNavigatorView view = CubridNavigatorView.getNavigatorView(CubridHostNavigatorView.ID);
final TreeViewer viewer = view.getViewer();
if (servers.length > 0) {
CubridServer server = servers[0];
if (isSupported(server)) {
final JobFamily jobFamily = new JobFamily();
final String serverName = server.getName();
String dbName = JobFamily.ALL_DB;
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
Job[] jobs = Job.getJobManager().find(jobFamily);
if (jobs.length > 0) {
CommonUITool.openWarningBox(Messages.bind(Messages.msgStartServiceWithJob, serverName));
return;
}
TaskExecutor taskExcutor = new StartServiceExecutor(server, getShell(), viewer);
ServerInfo serverInfo = server.getServerInfo();
GetCubridConfParameterTask task = new GetCubridConfParameterTask(serverInfo);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).exec();
}
}
// for(CubridServer server : servers) {
// final JobFamily jobFamily = new JobFamily();
// final String serverName = server.getName();
// String dbName = JobFamily.ALL_DB;
// jobFamily.setServerName(serverName);
// jobFamily.setDbName(dbName);
// Job[] jobs = Job.getJobManager().find(jobFamily);
// if (jobs.length > 0) {
// CommonUITool.openWarningBox(Messages.bind(
// Messages.msgStartServiceWithJob, serverName));
// return;
// }
//
// TaskExecutor taskExcutor = new StartServiceExecutor(server, getShell(),
// viewer);
// ServerInfo serverInfo = server.getServerInfo();
// GetCubridConfParameterTask task = new GetCubridConfParameterTask(
// serverInfo);
// taskExcutor.addTask(task);
// new ExecTaskWithProgress(taskExcutor).exec();
// }
}
Aggregations