use of com.cubrid.common.ui.spi.progress.ExecTaskWithProgress in project cubrid-manager by CUBRID.
the class SelectTablesPage method pageChanged.
/**
* @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
* @param event PageChangedEvent
*/
public void pageChanged(PageChangedEvent event) {
setPageComplete(false);
IWizardPage page = (IWizardPage) event.getSelectedPage();
if (page.getName().equals(PAGENAME)) {
SlaveDbInfoPage slaveDbInfoPage = (SlaveDbInfoPage) getWizard().getPage(SlaveDbInfoPage.PAGENAME);
String ip = slaveDbInfoPage.getReplInfo().getMasterList().get(0).getMasterIp();
String port = slaveDbInfoPage.getMasterHostPort();
String userName = "admin";
String password = slaveDbInfoPage.getMasterHostPassword();
String mdbName = slaveDbInfoPage.getMasterDbName();
String mdbDbaPassword = slaveDbInfoPage.getMasterDbDbaPassword();
GetAllClassesTaskExecutor taskExcutor = new GetAllClassesTaskExecutor(getShell(), ip, port, userName, password, mdbName, mdbDbaPassword);
new ExecTaskWithProgress(taskExcutor).exec();
if (taskExcutor.isSuccess()) {
DBClasses dbClasses = taskExcutor.getDBClasses();
selectTableComp.fillTableViewer(dbClasses);
setErrorMessage(null);
setPageComplete(true);
} else {
setErrorMessage(Messages.errPreviousPage);
setPageComplete(false);
}
}
}
use of com.cubrid.common.ui.spi.progress.ExecTaskWithProgress in project cubrid-manager by CUBRID.
the class SetHostInfoDialog method connect.
/**
* connect the host
*
* @param buttonId int
*/
private void connect(final int buttonId) {
final String ip = ipText.getText();
final String port = portText.getText();
final String userName = userNameText.getText();
final String password = passwordText.getText();
boolean isConnected = ServerManager.getInstance().isConnected(ip, Integer.parseInt(port), userName);
if (isConnected && hostInfo != null) {
ServerInfo serverInfo = CMHostNodePersistManager.getInstance().getServerInfo(ip, Integer.parseInt(port), userName);
if (!serverInfo.getLoginedUserInfo().isAdmin()) {
CommonUITool.openErrorBox(Messages.bind(Messages.errInvalidUser, ip));
return;
}
hostInfo.setIp(ip);
hostInfo.setPort(port);
hostInfo.setUserName(userName);
hostInfo.setPassword(password);
hostInfo.setName(ip + ":" + port);
List<DatabaseInfo> databaseInfoList = serverInfo.getLoginedUserInfo().getDatabaseInfoList();
hostInfo.setDatabaseInfoList(databaseInfoList);
hostInfo.setDbPath(serverInfo.getEnvInfo().getDatabaseDir());
hostInfo.setOsInfoType(serverInfo.getServerOsInfo());
setReturnCode(buttonId);
close();
return;
}
if (!isConnected) {
final ServerInfo serverInfo = new ServerInfo();
serverInfo.setHostAddress(ip);
serverInfo.setHostMonPort(Integer.parseInt(port));
serverInfo.setHostJSPort(Integer.parseInt(port) + 1);
serverInfo.setUserName(userName);
serverInfo.setUserPassword(password);
TaskExecutor taskExcutor = new ConnectHostTaskExecutor(serverInfo, buttonId);
MonitoringTask monitoringTask = new MonitoringTask(serverInfo);
taskExcutor.addTask(monitoringTask);
GetEnvInfoTask getEnvInfoTask = new GetEnvInfoTask(serverInfo);
taskExcutor.addTask(getEnvInfoTask);
GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
taskExcutor.addTask(getCMConfParameterTask);
GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
taskExcutor.addTask(getDatabaseListTask);
new ExecTaskWithProgress(taskExcutor).exec(true, true);
}
}
use of com.cubrid.common.ui.spi.progress.ExecTaskWithProgress 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.ExecTaskWithProgress 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.ExecTaskWithProgress in project cubrid-manager by CUBRID.
the class CubridWorkbenchContrItem method connectHostWithErrMsg.
/**
* Connect host
*
* @param serverInfo ServerInfo
* @param showErrMsg boolean
* @return error messages String
*/
public static String connectHostWithErrMsg(ServerInfo serverInfo, boolean showErrMsg) {
String password = serverInfo == null ? null : serverInfo.getUserPassword();
if (password == null || password.trim().length() == 0) {
return com.cubrid.cubridmanager.ui.host.Messages.errUserPasswordConnect;
}
Map<String, String> jdbcVersionMap = CubridJdbcManager.getInstance().getLoadedJdbc();
if (jdbcVersionMap == null || jdbcVersionMap.get(serverInfo.getJdbcDriverVersion()) == null) {
return com.cubrid.cubridmanager.ui.host.Messages.errNoSupportDriver;
}
ConnectHostExecutor taskExcutor = new ConnectHostExecutor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), serverInfo, showErrMsg);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess() && GeneralPreference.isUseHostDashboard() && serverInfo != null && serverInfo.isConnected()) {
HostDashboardAction hostDashboardAction = (HostDashboardAction) ActionManager.getInstance().getAction(HostDashboardAction.ID);
hostDashboardAction.doRun(serverInfo);
}
return taskExcutor.getErrMsg();
}
Aggregations