use of com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor 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 com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor 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 com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor 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);
}
use of com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor in project cubrid-manager by CUBRID.
the class DBAuthComparator method loadData.
/**
* Load the data
*/
private void loadData() {
final GetUserListTask getUserTask = new GetUserListTask(database.getDatabaseInfo());
final GetAllUserAuthorizationsTask getUserAuthTask = new GetAllUserAuthorizationsTask(database.getDatabaseInfo());
TaskJobExecutor taskExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
final List<UserDetailInfo> userDetailList = new ArrayList<UserDetailInfo>();
DbUserInfoList userListInfo = getUserTask.getResultModel();
Map<String, UserDetailInfo> allUserAuthMap = getUserAuthTask.getAllAuthMap();
if (userListInfo != null) {
for (DbUserInfo userInfo : userListInfo.getUserList()) {
UserDetailInfo userDetailInfo = allUserAuthMap.get(userInfo.getName());
if (userDetailInfo == null) {
userDetailInfo = new UserDetailInfo();
userDetailInfo.setUserName(userInfo.getName());
}
userDetailList.add(userDetailInfo);
}
}
setTableData(userDetailList);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskExec.addTask(getUserTask);
taskExec.addTask(getUserAuthTask);
JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
String jobName = Messages.jobLoadUserData + " - " + "@" + dbName + "@" + serverName;
taskExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
use of com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor in project cubrid-manager by CUBRID.
the class TruncateTableAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj)) {
setEnabled(false);
return;
}
StringBuilder sb = new StringBuilder();
int len = obj.length;
final List<String> tableList = new ArrayList<String>();
CubridDatabase database = null;
for (int i = 0; i < len; i++) {
ISchemaNode table = (ISchemaNode) obj[i];
database = table.getDatabase();
final String tableName = table.getName();
tableList.add(tableName);
if (i < 100) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(tableName);
}
}
if (len > 100) {
sb.append("...");
}
String message = Messages.bind(Messages.confirmTableDeleteWarn, sb.toString());
if (!CommonUITool.openConfirmBox(message)) {
return;
}
final TruncateTableTask task = new TruncateTableTask(database.getDatabaseInfo());
TaskJobExecutor taskExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
CommonUITool.openInformationBox(Messages.msg_information, Messages.resultTableDeleteInformantion);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
String[] tableNames = new String[tableList.size()];
tableNames = tableList.toArray(tableNames);
task.setTableName(tableNames);
taskExec.addTask(task);
JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
String jobName = Messages.msgTruncateTableJobName + " - " + tableList.toString() + "@" + dbName + "@" + serverName;
taskExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
Aggregations