use of com.cubrid.cubridmanager.core.shard.task.StartShardTask in project cubrid-manager by CUBRID.
the class StartShardAction method run.
/**
* Override the run method in order to complete starting broker environment
*
*/
public void run() {
final Object[] obj = this.getSelectedObj();
CubridShard selection = (CubridShard) obj[0];
if (null == selection) {
return;
}
ServerInfo serverInfo = selection.getServer().getServerInfo();
StartShardTask task = new StartShardTask(serverInfo, selection.getName());
IMessageHandler messageHandler = new IMessageHandler() {
public String translate(String message) {
if (message == null) {
return "";
}
if (message.indexOf("failed to metadata validate check") != -1) {
return Messages.errStartShardNotConfigOrFailed + StringUtil.NEWLINE + StringUtil.NEWLINE + Messages.msgShardGuide;
}
return "";
}
};
TaskExecutor taskExecutor = new CommonTaskExec(Messages.startShardActionName, messageHandler);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
if (!task.isSuccess()) {
String msg = Messages.bind(Messages.errCanNotStartShardBroker, Messages.msgShardGuide);
CommonUITool.openErrorBox(msg);
return;
}
selection.setRunning(true);
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
CommonUITool.refreshNavigatorTree(treeViewer, selection);
ActionManager.getInstance().fireSelectionChanged(getSelection());
}
use of com.cubrid.cubridmanager.core.shard.task.StartShardTask in project cubrid-manager by CUBRID.
the class StartShardEnvAction method run.
/**
* Override the run method in order to complete starting broker environment
*
*/
public void run() {
final Object[] obj = this.getSelectedObj();
CubridShardFolder selection = (CubridShardFolder) obj[0];
if (null == selection) {
return;
}
ServerInfo serverInfo = selection.getServer().getServerInfo();
StartShardTask task = new StartShardTask(serverInfo, null);
IMessageHandler messageHandler = new IMessageHandler() {
public String translate(String message) {
if (message == null) {
return "";
}
if (message.indexOf("failed to metadata validate check") != -1) {
return Messages.errStartShardNotConfigOrFailed + StringUtil.NEWLINE + StringUtil.NEWLINE + Messages.msgShardGuide;
}
return "";
}
};
TaskExecutor taskExecutor = new CommonTaskExec(Messages.startShardEnvActionName, messageHandler);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
if (!task.isSuccess()) {
String msg = Messages.bind(Messages.errCanNotStartShardBroker, Messages.msgShardGuide);
CommonUITool.openErrorBox(msg);
return;
}
selection.setRunning(true);
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
CommonUITool.refreshNavigatorTree(treeViewer, selection);
ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Aggregations