Search in sources :

Example 21 with CommonTaskJobExec

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);
}
Also used : TaskJobExecutor(com.cubrid.common.ui.spi.progress.TaskJobExecutor) ITaskExecutorInterceptor(com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor) ITask(com.cubrid.common.core.task.ITask) IStatus(org.eclipse.core.runtime.IStatus) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask)

Example 22 with CommonTaskJobExec

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);
}
Also used : TaskJobExecutor(com.cubrid.common.ui.spi.progress.TaskJobExecutor) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) PlanDumpTask(com.cubrid.cubridmanager.core.cubrid.database.task.PlanDumpTask) JobFamily(com.cubrid.common.ui.spi.progress.JobFamily)

Example 23 with CommonTaskJobExec

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);
}
Also used : TaskJobExecutor(com.cubrid.common.ui.spi.progress.TaskJobExecutor) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) JobFamily(com.cubrid.common.ui.spi.progress.JobFamily) CheckFileTask(com.cubrid.cubridmanager.core.cubrid.database.task.CheckFileTask) CheckDirTask(com.cubrid.cubridmanager.core.cubrid.database.task.CheckDirTask) RestoreDbTask(com.cubrid.cubridmanager.core.cubrid.database.task.RestoreDbTask) NumberFormat(java.text.NumberFormat)

Example 24 with CommonTaskJobExec

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);
}
Also used : TaskJobExecutor(com.cubrid.common.ui.spi.progress.TaskJobExecutor) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) JobFamily(com.cubrid.common.ui.spi.progress.JobFamily) ParamDumpTask(com.cubrid.cubridmanager.core.cubrid.database.task.ParamDumpTask)

Example 25 with CommonTaskJobExec

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);
}
Also used : DbLogInfos(com.cubrid.cubridmanager.core.logs.model.DbLogInfos) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) JobFamily(com.cubrid.common.ui.spi.progress.JobFamily)

Aggregations

CommonTaskJobExec (com.cubrid.common.ui.spi.progress.CommonTaskJobExec)25 TaskJobExecutor (com.cubrid.common.ui.spi.progress.TaskJobExecutor)24 JobFamily (com.cubrid.common.ui.spi.progress.JobFamily)19 IStatus (org.eclipse.core.runtime.IStatus)14 ITask (com.cubrid.common.core.task.ITask)12 ITaskExecutorInterceptor (com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor)12 ArrayList (java.util.ArrayList)9 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)7 DbSpaceInfoList (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList)6 List (java.util.List)6 BrokerInfoList (com.cubrid.cubridmanager.core.broker.model.BrokerInfoList)4 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)3 TaskJob (com.cubrid.common.ui.spi.progress.TaskJob)2 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)2 EnvInfo (com.cubrid.cubridmanager.core.common.model.EnvInfo)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 CommonUpdateTask (com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)2 GetEnvInfoTask (com.cubrid.cubridmanager.core.common.task.GetEnvInfoTask)2 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)2 CheckDirTask (com.cubrid.cubridmanager.core.cubrid.database.task.CheckDirTask)2