use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method loadDbData.
public void loadDbData() {
final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
final GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
List<String> orignAutoStartDBList = getCubridConfParameterTask.getAutoStartDb(false);
setDatabaseData(databaseInfoList, orignAutoStartDBList);
finishedCount++;
updateToolBar();
//after get database data ,load volumn data
loadVolumeData();
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskJobExec.addTask(getDatabaseListTask);
taskJobExec.addTask(getCubridConfParameterTask);
String serverName = serverInfo.getServerName();
String jobName = Messages.taskGetDBInfo + serverName;
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
taskJobExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
use of com.cubrid.common.ui.spi.progress.JobFamily 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.JobFamily 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);
}
use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class LoadDatabaseDialog method loadDb.
/**
* Execute task and load database
*
* @param buttonId the button id
*/
private void loadDb(final int buttonId) {
TaskJobExecutor taskExcutor = new LoadDbTaskExecutor(buttonId);
LoadDbTask loadDbTask1 = new LoadDbTask(database.getServer().getServerInfo());
LoadDbTask loadDbTask2 = new LoadDbTask(database.getServer().getServerInfo());
loadDbTask1.setDbName(databaseNameText.getText());
loadDbTask2.setDbName(databaseNameText.getText());
loadDbTask1.setDbUser(userNameText.getText());
loadDbTask2.setDbUser(userNameText.getText());
if (checkSyntaxButton.getSelection()) {
loadDbTask1.setCheckOption("both");
loadDbTask2.setCheckOption("both");
} else {
loadDbTask1.setCheckOption("load");
loadDbTask2.setCheckOption("load");
}
if (commitPeriodButton.getSelection()) {
loadDbTask1.setUsedPeriod(true, commitPeriodText.getText());
loadDbTask2.setUsedPeriod(true, commitPeriodText.getText());
} else {
loadDbTask1.setUsedPeriod(false, "");
loadDbTask2.setUsedPeriod(false, "");
}
if (estimatedSizeButton.getSelection()) {
loadDbTask1.setUsedEstimatedSize(true, estimatedSizeText.getText());
loadDbTask2.setUsedEstimatedSize(true, estimatedSizeText.getText());
} else {
loadDbTask1.setUsedEstimatedSize(false, "");
loadDbTask2.setUsedEstimatedSize(false, "");
}
if (useErrorControlFileButton.getSelection()) {
loadDbTask1.setUsedErrorContorlFile(true, errorControlFileText.getText());
loadDbTask2.setUsedErrorContorlFile(true, errorControlFileText.getText());
} else {
loadDbTask1.setUsedErrorContorlFile(false, "");
loadDbTask2.setUsedErrorContorlFile(false, "");
}
if (ignoreClassFileButton.getSelection()) {
loadDbTask1.setUsedIgnoredClassFile(true, ignoredClassFileText.getText());
loadDbTask2.setUsedIgnoredClassFile(true, ignoredClassFileText.getText());
} else {
loadDbTask1.setUsedIgnoredClassFile(false, "");
loadDbTask2.setUsedIgnoredClassFile(false, "");
}
loadDbTask1.setNoUsedOid(oidButton.getSelection());
loadDbTask2.setNoUsedOid(oidButton.getSelection());
if (noStatisButton != null) {
loadDbTask1.setNoUsedStatistics(noStatisButton.getSelection());
loadDbTask2.setNoUsedStatistics(noStatisButton.getSelection());
}
loadDbTask1.setNoUsedLog(false);
loadDbTask2.setNoUsedLog(false);
if (selectLoadFileFromListButton.getSelection()) {
String schemaPath = "";
String objectPath = "";
String indexPath = "";
String triggerPath = "";
for (int i = 0, n = unloadInfoTable.getItemCount(); i < n; i++) {
if (unloadInfoTable.getItem(i).getChecked()) {
String type = unloadInfoTable.getItem(i).getText(0);
String path = unloadInfoTable.getItem(i).getText(1);
if (type != null && type.trim().equals("schema")) {
schemaPath = path;
}
if (type != null && type.trim().equals("object")) {
objectPath = path;
}
if (type != null && type.trim().equals("index")) {
indexPath = path;
}
if (type != null && type.trim().equals("trigger")) {
triggerPath = path;
}
}
}
boolean isAddTask1 = false;
if (schemaPath != null && schemaPath.trim().length() > 0) {
loadDbTask1.setSchemaPath(schemaPath);
isAddTask1 = true;
} else {
loadDbTask1.setSchemaPath("none");
}
if (objectPath != null && objectPath.trim().length() > 0) {
loadDbTask1.setObjectPath(objectPath);
isAddTask1 = true;
} else {
loadDbTask1.setObjectPath("none");
}
if (indexPath != null && indexPath.trim().length() > 0) {
loadDbTask1.setIndexPath(indexPath);
isAddTask1 = true;
} else {
loadDbTask1.setIndexPath("none");
}
boolean isAddTask2 = false;
if (triggerPath != null && triggerPath.trim().length() > 0) {
loadDbTask2.setSchemaPath(triggerPath);
isAddTask2 = true;
}
if (isAddTask1) {
taskExcutor.addTask(loadDbTask1);
}
if (isAddTask2) {
taskExcutor.addTask(loadDbTask2);
}
} else if (selectUnloadFileFromSysButton.getSelection()) {
boolean isAddTask1 = false;
if (loadSchemaButton.getSelection()) {
String schemaPath = loadSchemaText.getText();
loadDbTask1.setSchemaPath(schemaPath);
isAddTask1 = true;
} else {
loadDbTask1.setSchemaPath("none");
}
if (loadObjButton.getSelection()) {
String objPath = loadObjText.getText();
loadDbTask1.setObjectPath(objPath);
isAddTask1 = true;
} else {
loadDbTask1.setObjectPath("none");
}
if (loadIndexButton.getSelection()) {
String indexPath = loadIndexText.getText();
loadDbTask1.setIndexPath(indexPath);
isAddTask1 = true;
} else {
loadDbTask1.setIndexPath("none");
}
boolean isAddTask2 = false;
if (loadTriggerButton.getSelection()) {
String triggerPath = loadTriggerText.getText();
loadDbTask2.setSchemaPath(triggerPath);
isAddTask2 = true;
}
if (isAddTask1) {
taskExcutor.addTask(loadDbTask1);
}
if (isAddTask2) {
taskExcutor.addTask(loadDbTask2);
}
}
JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
String jobName = Messages.msgLoadDBRearJobName + " - " + dbName + "@" + serverName;
taskExcutor.schedule(jobName, jobFamily, true, Job.SHORT);
}
use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class PlanDumpDialog method buttonPressed.
/**
* When press button in button bar,call this method
*
* @param buttonId the button id
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (!verify()) {
return;
}
task = new PlanDumpTask(database.getServer().getServerInfo());
task.setDbName(database.getName());
task.setPlanDrop(repairButton.getSelection() ? YesNoType.Y : YesNoType.N);
String serverName = database.getServer().getName();
String dbName = database.getName();
jobName = Messages.titlePlanDumpDialog + " - " + dbName + "@" + serverName;
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
taskExec.addTask(task);
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
return;
}
super.buttonPressed(buttonId);
}
Aggregations