use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class SetReplicationParamDialog method createBasicGroup.
/**
* Creates basic group
*
* @param parent Composite
*/
private void createBasicGroup(Composite parent) {
final Group group = new Group(parent, SWT.NONE);
group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
group.setText(Messages.repparm0grpReplicationInfo);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 5;
group.setLayout(gridLayout);
Label slaveDbNameLabel = new Label(group, SWT.NONE);
slaveDbNameLabel.setText(Messages.repparm0lblSlaveDbName);
slaveDbNameLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
slaveDbNameCombo = new Combo(group, SWT.NONE | SWT.READ_ONLY);
slaveDbNameCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
Button connectButton = new Button(group, SWT.RIGHT);
connectButton.setText(Messages.repparm0btnConnect);
connectButton.setLayoutData(new GridData());
connectButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
GetReplicationParamTask task = new GetReplicationParamTask(database.getServer().getServerInfo());
task.setMasterDbName(replInfo.getMasterList().get(0).getMasterDbName());
task.setSlaveDbName(slaveDbNameCombo.getText());
task.setDistDbName(database.getLabel());
task.setDistDbDbaPasswd(database.getPassword());
task.setRunningMode(database.getRunningType() == DbRunningType.CS);
TaskExecutor taskExecutor = new CommonTaskExec(null);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
ReplicationParamInfo paramInfo = task.getReplicationParams();
Map<String, String> paramMap = paramInfo.getParamMap();
paramEditor.setReplicationParamMap(paramMap);
}
}
});
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class SetReplicationParamDialog method initial.
/**
*
* initial the page content
*
*/
private void initial() {
setReplInfo((ReplicationInfo) database.getAdapter(ReplicationInfo.class));
for (int j = 0; j < replInfo.getSlaveList().size(); j++) {
slaveDbNameCombo.add(replInfo.getSlaveList().get(j).getSlaveDbName());
}
slaveDbNameCombo.setText(replInfo.getSlaveList().get(0).getSlaveDbName());
GetReplicationParamTask task = new GetReplicationParamTask(database.getServer().getServerInfo());
task.setMasterDbName(replInfo.getMasterList().get(0).getMasterDbName());
task.setSlaveDbName(slaveDbNameCombo.getText());
task.setDistDbName(database.getLabel());
task.setDistDbDbaPasswd(database.getPassword());
task.setRunningMode(database.getRunningType() == DbRunningType.CS);
TaskExecutor taskExecutor = new CommonTaskExec(null);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
ReplicationParamInfo paramInfo = task.getReplicationParams();
Map<String, String> paramMap = paramInfo.getParamMap();
paramEditor.setReplicationParamMap(paramMap);
}
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec 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.common.ui.spi.progress.CommonTaskExec 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());
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class ShardParameterPropertyPage method performOk.
/**
* Save the page content
*
* @return <code>true</code> if it saved successfully;<code>false</code>
* otherwise
*/
public boolean performOk() {
shardParameterPanel.save();
ShardsTaskFactory taskFactory = new ShardsTaskFactory(this.serverInfo, this.shards);
taskFactory.addUpdateFile(this.shard, oldShardName);
CommonTaskExec taskExec = new CommonTaskExec(Messages.msgOperating);
taskExec.setTask(taskFactory.generateTasks());
new ExecTaskWithProgress(taskExec).exec();
if (taskExec.isSuccess()) {
CommonUITool.openInformationBox(Messages.titleSuccess, Messages.restartShardBrokerMsg);
return true;
} else {
CommonUITool.openErrorBox(Messages.msgOperationFailed);
return false;
}
}
Aggregations