use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method loadServerBrokerInfo.
/**
* Load Server Broker Info
*/
private void loadServerBrokerInfo(final ServerInfo serverInfo, final String key) {
final CommonQueryTask<BrokerInfos> task = new CommonQueryTask<BrokerInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), new BrokerInfos());
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
Object input = serviceTreeViewer.getInput();
ServiceDashboardInfo sDashInfo = getSelectedDashInfo(input, serverInfo.getServerName(), key);
BrokerInfos brokerInfos = task.getResultModel();
setBrokerData(sDashInfo, brokerInfos);
serviceTreeViewer.refresh(input);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskJobExec.addTask(task);
executeTask(taskJobExec, serverInfo.getServerName(), Messages.taskGetServerBrokerInfo);
}
use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec 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);
}
use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class RestoreDatabaseDialog method restoreDb.
/**
*
* Restore database
*
*
*/
private void restoreDb() {
if (!valid()) {
return;
}
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
String databaseName = databaseNameText.getText();
ServerInfo serverInfo = database.getServer().getServerInfo();
boolean isLocalServer = serverInfo.isLocalServer();
RestoreDbTask restoreDbTask = new RestoreDbTask(database.getServer().getServerInfo());
restoreDbTask.setDbName(databaseName);
String level = "0";
String path = "none";
if (selectBackupButton.getSelection()) {
if (level0Button.getSelection()) {
level = "0";
path = level0Text.getText();
} else if (level1Button.getSelection()) {
level = "1";
path = level1Text.getText();
} else if (level2Button.getSelection()) {
level = "2";
path = level2Text.getText();
}
if (!isLocalServer) {
CheckFileTask checkFileTask = new CheckFileTask(serverInfo);
checkFileTask.setFile(new String[] { path });
checkFileTask.putData("filePath", path);
taskExec.addTask(checkFileTask);
}
}
if (selectTimeButton.getSelection()) {
if (backupTimeButton.getSelection()) {
restoreDbTask.setDate("backuptime");
} else if (restoredDataTimeButton.getSelection()) {
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumIntegerDigits(2);
String timeStr = nf.format(hourSpn.getSelection()) + ":" + nf.format(minuteSpn.getSelection()) + ":" + nf.format(secondSpn.getSelection());
String dateStr = nf.format(daySpn.getSelection()) + "-" + nf.format(monthSpn.getSelection()) + "-" + yearSpn.getSelection();
dateStr += ":" + timeStr;
restoreDbTask.setDate(dateStr);
}
} else {
restoreDbTask.setDate("none");
}
if (!CompatibleUtil.isSupportRestorePath(database.getServer().getServerInfo())) {
path = "none";
}
restoreDbTask.setLevel(level);
restoreDbTask.setPathName(path);
if (partialButton.getSelection()) {
restoreDbTask.setPartial(true);
} else {
restoreDbTask.setPartial(false);
}
if (dbPathButton == null || !dbPathButton.getSelection()) {
restoreDbTask.setRecoveryPath("none");
} else {
restoreDbTask.setRecoveryPath(dbPathText.getText());
if (!isLocalServer) {
CheckDirTask checkDirTask = new CheckDirTask(serverInfo);
checkDirTask.setDirectory(new String[] { dbPathText.getText() });
taskExec.addTask(checkDirTask);
}
}
taskExec.addTask(restoreDbTask);
JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
String jobName = Messages.msgRestoreDBRearJobName + " - " + dbName + "@" + serverName;
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
}
use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class ParamDumpDialog 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 ParamDumpTask(database.getServer().getServerInfo());
task.setDbName(database.getName());
task.setBoth(repairButton.getSelection() ? YesNoType.Y : YesNoType.N);
String serverName = database.getServer().getName();
String dbName = database.getName();
jobName = Messages.titleParamDumpDialog + " - " + 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);
}
use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class DatabaseLogListDialog method initial.
/**
*
* Initial the value of dialog field
*
*/
private void initial() {
DbLogInfos dbLogInfos = new DbLogInfos();
final CommonQueryTask<DbLogInfos> task = new CommonQueryTask<DbLogInfos>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), dbLogInfos);
task.setDbName(dbName);
CommonTaskJobExec jobExecutor = new CommonTaskJobExec(this) {
/**
* Close the dialog
*/
protected void closeDialog() {
//empty
}
/**
* Set the dialog visible or invisible.
*
* @param flag whether it is visible
*/
protected void setDialogVisible(boolean flag) {
//empty
}
};
jobExecutor.addTask(task);
JobFamily jobFamily = new JobFamily();
String serverName = serverInfo.getServerName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
jobExecutor.schedule(Messages.jobGetLogList, jobFamily, false, Job.SHORT);
}
Aggregations