use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class CopyDatabaseDialog method okPressed.
/**
* When ok button press,call this method
*/
protected void okPressed() {
if (!verify()) {
return;
}
destDbName = destinationDBNameText.getText();
if (!CommonUITool.openConfirmBox(parentComp.getShell(), Messages.warnYesNoCopyDb)) {
return;
}
SocketTask checkTask = getCheckDirsTask();
SocketTask copyTask = getCopyDbTask();
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
taskExec.addTask(checkTask);
taskExec.addTask(copyTask);
JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
jobName = Messages.msgCopyDbRearJobName + " - " + dbName + "@" + serverName;
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
}
use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method executeTask.
/**
* Execute Task Job
*/
private void executeTask(TaskJobExecutor taskJobExec, String serverName, String jobName) {
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 StartServiceAction method doRun.
/**
* Perform do run
*
* @param servers
*/
public void doRun(CubridServer[] servers) {
CubridNavigatorView view = CubridNavigatorView.getNavigatorView(CubridHostNavigatorView.ID);
final TreeViewer viewer = view.getViewer();
if (servers.length > 0) {
CubridServer server = servers[0];
if (isSupported(server)) {
final JobFamily jobFamily = new JobFamily();
final String serverName = server.getName();
String dbName = JobFamily.ALL_DB;
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
Job[] jobs = Job.getJobManager().find(jobFamily);
if (jobs.length > 0) {
CommonUITool.openWarningBox(Messages.bind(Messages.msgStartServiceWithJob, serverName));
return;
}
TaskExecutor taskExcutor = new StartServiceExecutor(server, getShell(), viewer);
ServerInfo serverInfo = server.getServerInfo();
GetCubridConfParameterTask task = new GetCubridConfParameterTask(serverInfo);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).exec();
}
}
// for(CubridServer server : servers) {
// final JobFamily jobFamily = new JobFamily();
// final String serverName = server.getName();
// String dbName = JobFamily.ALL_DB;
// jobFamily.setServerName(serverName);
// jobFamily.setDbName(dbName);
// Job[] jobs = Job.getJobManager().find(jobFamily);
// if (jobs.length > 0) {
// CommonUITool.openWarningBox(Messages.bind(
// Messages.msgStartServiceWithJob, serverName));
// return;
// }
//
// TaskExecutor taskExcutor = new StartServiceExecutor(server, getShell(),
// viewer);
// ServerInfo serverInfo = server.getServerInfo();
// GetCubridConfParameterTask task = new GetCubridConfParameterTask(
// serverInfo);
// taskExcutor.addTask(task);
// new ExecTaskWithProgress(taskExcutor).exec();
// }
}
use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class QuitAction method run.
/**
* Quit CUBRID Manager
*/
public void run() {
boolean hasJobRunning = false;
final JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(JobFamily.ALL_SERVER);
Job[] jobs = Job.getJobManager().find(jobFamily);
if (jobs.length > 0) {
hasJobRunning = true;
}
boolean isExit = false;
if (hasJobRunning) {
isExit = CommonUITool.openConfirmBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.msgExistConfirmWithJob);
if (isExit) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
try {
Job.getJobManager().cancel(jobFamily);
} catch (Exception ignored) {
LOGGER.error(ignored.getMessage(), ignored);
}
}
});
}
} else {
isExit = CommonUITool.openConfirmBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.msgExistConfirm);
}
if (isExit) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().close();
}
}
use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method loadVolumeData.
public void loadVolumeData() {
//if no database on this server ,don't get volumn data
if (serverInfo.getAllDatabaseList().size() == 0 || databaseInfoList == null) {
return;
}
final List<CommonQueryTask<DbSpaceInfoList>> getVolumnTaskList = new ArrayList<CommonQueryTask<DbSpaceInfoList>>();
if (serverInfo.getAllDatabaseList() != null) {
for (String dbName : serverInfo.getAllDatabaseList()) {
for (DatabaseInfo databaseInfo : databaseInfoList) {
// only load start database volumn data
if (dbName.equals(databaseInfo.getDbName()) && databaseInfo.getRunningType() == DbRunningType.CS) {
CommonQueryTask<DbSpaceInfoList> task = new CommonQueryTask<DbSpaceInfoList>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoList());
task.setDbName(dbName);
getVolumnTaskList.add(task);
break;
}
}
}
}
//if no start database don't get volumn data
if (getVolumnTaskList.size() == 0) {
return;
}
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
List<DBVolumeSpaceInfo> dbVolumeSpaceInfoList = new ArrayList<DBVolumeSpaceInfo>();
for (CommonQueryTask<DbSpaceInfoList> task : getVolumnTaskList) {
DbSpaceInfoList dbSpaceInfoList = task.getResultModel();
freespaceOnStorage = ((long) dbSpaceInfoList.getFreespace()) * 1024l * 1024l;
DBVolumeSpaceInfo dbSpaceInfo = new DBVolumeSpaceInfo(dbSpaceInfoList.getDbname());
dbSpaceInfo.setPageSize(dbSpaceInfoList.getPagesize());
dbVolumeSpaceInfoList.add(dbSpaceInfo);
if (dbSpaceInfoList != null) {
for (DbSpaceInfo spaceInfo : dbSpaceInfoList.getSpaceinfo()) {
dbSpaceInfo.addVolumeSpaceInfo(spaceInfo);
}
}
}
setVolumeData(dbVolumeSpaceInfoList);
finishedCount++;
updateToolBar();
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
for (CommonQueryTask<DbSpaceInfoList> task : getVolumnTaskList) {
taskJobExec.addTask(task);
}
String serverName = serverInfo.getServerName();
String jobName = Messages.taskGetVolumeInfo + serverName;
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
taskJobExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
Aggregations