use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.
the class VolumeFolderInfoEditor method loadData.
/**
* load the editor data
*
* @return boolean
*/
public boolean loadData() {
TaskJobExecutor taskJobExecutor = new TaskJobExecutor() {
@SuppressWarnings("unchecked")
@Override
public IStatus exec(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
for (ITask t : taskList) {
t.execute();
final String msg = t.getErrorMsg();
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
} else {
final DbSpaceInfoList model = ((CommonQueryTask<? extends DbSpaceInfoList>) t).getResultModel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
database.getDatabaseInfo().setDbSpaceInfoList(model);
if (scrolledComp == null || scrolledComp.isDisposed()) {
return;
}
initialize();
paintComp();
scrolledComp.setContent(parentComp);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
}
});
}
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
};
CommonQueryTask<? extends DbSpaceInfoList> task = DbSpaceInfoList.useOld(database.getServer().getServerInfo().getEnvInfo()) ? new CommonQueryTask<DbSpaceInfoListOld>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListOld()) : new CommonQueryTask<DbSpaceInfoListNew>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListNew());
task.setDbName(database.getName());
taskJobExecutor.addTask(task);
String serverName = database.getServer().getName();
String dbName = database.getName();
String jobName = Messages.viewVolumeInfoJobName + " - " + volumeFolderName + "@" + dbName + "@" + serverName;
taskJobExecutor.schedule(jobName, null, false, Job.LONG);
return true;
}
use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.
the class VolumeInformationEditor method loadData.
/**
* load the data
*
* @return boolean
*/
public boolean loadData() {
TaskJobExecutor taskJobExecutor = new TaskJobExecutor() {
@SuppressWarnings("unchecked")
@Override
public IStatus exec(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
for (ITask t : taskList) {
t.execute();
final String msg = t.getErrorMsg();
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
} else {
final DbSpaceInfoList model = ((CommonQueryTask<? extends DbSpaceInfoList>) t).getResultModel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
database.getDatabaseInfo().setDbSpaceInfoList(model);
if (scrolledComp == null || scrolledComp.isDisposed()) {
return;
}
initial();
paintComp();
scrolledComp.setContent(parentComp);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setMinHeight(800);
scrolledComp.setMinWidth(800);
}
});
}
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
};
CommonQueryTask<? extends DbSpaceInfoList> task = DbSpaceInfoList.useOld(database.getServer().getServerInfo().getEnvInfo()) ? new CommonQueryTask<DbSpaceInfoListOld>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListOld()) : new CommonQueryTask<DbSpaceInfoListNew>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListNew());
task.setDbName(database.getName());
taskJobExecutor.addTask(task);
String jobName = Messages.viewVolumeInfoJobName + " - " + dbSpaceInfo.getSpacename() + "@" + database.getName() + "@" + database.getServer().getName();
taskJobExecutor.schedule(jobName, null, false, Job.LONG);
return true;
}
use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.
the class FinishTask method initTask.
public void initTask(ServerInfo serverInfo) {
MonitoringTask monitoringTask = serverInfo.getMonitoringTask();
GetEnvInfoTask getEnvInfoTask = new GetEnvInfoTask(serverInfo);
GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
CommonQueryTask<BrokerInfos> getBrokerTask = new CommonQueryTask<BrokerInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), new BrokerInfos());
GetCMUserListTask getUserInfoTask = new GetCMUserListTask(serverInfo);
UpdateCMUserTask updateTask = new UpdateCMUserTask(serverInfo);
updateTask.setCmUserName(serverInfo.getUserName());
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo);
addTask(monitoringTask);
addTask(getEnvInfoTask);
addTask(getDatabaseListTask);
addTask(getCMConfParameterTask);
addTask(getBrokerTask);
addTask(getUserInfoTask);
addTask(updateTask);
addTask(getCubridConfParameterTask);
addTask(getBrokerConfParameterTask);
addTask(new FinishTask());
}
use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.
the class ConnectHostExecutor method initTasks.
private void initTasks() {
MonitoringTask monitoringTask = serverInfo.getMonitoringTask();
addTask(monitoringTask);
GetEnvInfoTask getEnvInfoTask = new GetEnvInfoTask(serverInfo);
addTask(getEnvInfoTask);
GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
addTask(getDatabaseListTask);
GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
addTask(getCMConfParameterTask);
CommonQueryTask<BrokerInfos> getBrokerTask = new CommonQueryTask<BrokerInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), new BrokerInfos());
addTask(getBrokerTask);
GetCMUserListTask getUserInfoTask = new GetCMUserListTask(serverInfo);
addTask(getUserInfoTask);
UpdateCMUserTask updateTask = new UpdateCMUserTask(serverInfo);
updateTask.setCmUserName(serverInfo.getUserName());
addTask(updateTask);
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
addTask(getCubridConfParameterTask);
GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo);
addTask(getBrokerConfParameterTask);
}
use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method loadBrokerData.
public void loadBrokerData() {
BrokerInfos brokerInfos = new BrokerInfos();
final CommonQueryTask<BrokerInfos> task = new CommonQueryTask<BrokerInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), brokerInfos);
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
BrokerInfos brokerInfos = task.getResultModel();
List<BrokerInfo> newBrokerInfoList = null;
if (null != brokerInfos) {
BrokerInfoList list = brokerInfos.getBorkerInfoList();
if (list != null && list.getBrokerInfoList() != null) {
newBrokerInfoList = list.getBrokerInfoList();
}
}
setBrokerData(newBrokerInfoList);
finishedCount++;
updateToolBar();
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskJobExec.addTask(task);
String serverName = serverInfo.getServerName();
String jobName = Messages.taskGetBrokerInfo + serverName;
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
taskJobExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
Aggregations