use of org.eclipse.core.runtime.IStatus in project cubrid-manager by CUBRID.
the class CreateReplicationJobExecutor method startReplServer.
/**
* start replication server
*
* @param serverName String
* @param monitor IProgressMonitor
* @param taskList List<ITask
* @return status
*/
private IStatus startReplServer(String serverName, final IProgressMonitor monitor, List<ITask> taskList) {
monitor.subTask(Messages.bind(Messages.startReplServerJobName, serverName));
MonitoringTask monitoringTask = null;
MonitorDashboardPreference monPref = new MonitorDashboardPreference();
for (ITask task : taskList) {
if (task instanceof MonitoringTask) {
monitoringTask = (MonitoringTask) task;
ServerInfo serverInfo = monitoringTask.getServerInfo();
CMHostNodePersistManager.getInstance().addServer(serverInfo.getHostAddress(), serverInfo.getHostMonPort(), serverInfo.getUserName(), serverInfo);
monitoringTask.connectServer(Version.releaseVersion, monPref.getHAHeartBeatTimeout());
} else {
task.execute();
}
if (monitor.isCanceled()) {
disConnect(monitoringTask);
return Status.CANCEL_STATUS;
}
final String msg = task.getErrorMsg();
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
disConnect(monitoringTask);
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
}
}
disConnect(monitoringTask);
return Status.OK_STATUS;
}
use of org.eclipse.core.runtime.IStatus in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method loadServerEnvInfo.
/**
* Load Server Environment Info
*/
private void loadServerEnvInfo(final ServerInfo serverInfo, final String key) {
if (serverInfo.isConnected() == false) {
return;
}
final GetEnvInfoTask getEnvInfoTask = new GetEnvInfoTask(serverInfo);
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
Object input = serviceTreeViewer.getInput();
ServiceDashboardInfo sDashInfo = getSelectedDashInfo(input, serverInfo.getServerName(), key);
EnvInfo envInfo = getEnvInfoTask.loadEnvInfo();
setEnvData(sDashInfo, envInfo);
serviceTreeViewer.refresh(input);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskJobExec.addTask(getEnvInfoTask);
executeTask(taskJobExec, serverInfo.getServerName(), Messages.taskGetServerEnvInfo);
}
use of org.eclipse.core.runtime.IStatus in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method loadServerDbInfo.
/**
* Load Server Database Info
*/
private void loadServerDbInfo(final ServerInfo serverInfo, final String key) {
if (serverInfo.isConnected() == false) {
return;
}
final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
Object input = serviceTreeViewer.getInput();
ServiceDashboardInfo sDashInfo = getSelectedDashInfo(input, serverInfo.getServerName(), key);
List<DatabaseInfo> databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
setDbData(sDashInfo, databaseInfoList);
serviceTreeViewer.refresh(input);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskJobExec.addTask(getDatabaseListTask);
executeTask(taskJobExec, serverInfo.getServerName(), Messages.taskGetServerDbInfo);
}
use of org.eclipse.core.runtime.IStatus in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method loadServerVolumeData.
/**
* Load Server Volume Info
*/
private void loadServerVolumeData(final ServerInfo serverInfo, final String key) {
List<String> dbList = serverInfo.getAllDatabaseList();
if (dbList == null || dbList.size() == 0) {
return;
}
final List<CommonQueryTask<DbSpaceInfoList>> getVolumnTaskList = new ArrayList<CommonQueryTask<DbSpaceInfoList>>();
for (String dbname : dbList) {
CommonQueryTask<DbSpaceInfoList> task = new CommonQueryTask<DbSpaceInfoList>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoList());
task.setDbName(dbname);
getVolumnTaskList.add(task);
}
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
Object input = serviceTreeViewer.getInput();
ServiceDashboardInfo sDashInfo = getSelectedDashInfo(input, serverInfo.getServerName(), key);
setVolumeData(sDashInfo, getVolumnTaskList);
serviceTreeViewer.refresh(input);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
for (CommonQueryTask<DbSpaceInfoList> task : getVolumnTaskList) {
taskJobExec.addTask(task);
}
executeTask(taskJobExec, serverInfo.getServerName(), Messages.taskGetServerVolumeInfo);
}
use of org.eclipse.core.runtime.IStatus in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method loadServerHostInfo.
/**
* Load Server Host Info
*/
private void loadServerHostInfo(final ServerInfo serverInfo, final String key) {
final CommonQueryTask<HostStatData> task = new CommonQueryTask<HostStatData>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), new HostStatData());
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
Object input = serviceTreeViewer.getInput();
ServiceDashboardInfo sDashInfo = getSelectedDashInfo(input, serverInfo.getServerName(), key);
HostStatData hostInfo = task.getResultModel();
setHostData(sDashInfo, hostInfo);
serviceTreeViewer.refresh(input);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskJobExec.addTask(task);
executeTask(taskJobExec, serverInfo.getServerName(), Messages.taskGetServerHostInfo);
}
Aggregations