Search in sources :

Example 16 with TaskJobExecutor

use of com.cubrid.common.ui.spi.progress.TaskJobExecutor in project cubrid-manager by CUBRID.

the class ServiceDashboardEditor method loadServerEnvInfo.

/**
	 * Load Server Environment Info
	 */
private void loadServerEnvInfo(final ServerInfo serverInfo, final String key) {
    if (serverInfo.isConnected() == false) {
        return;
    }
    final GetEnvInfoTask getEnvInfoTask = new GetEnvInfoTask(serverInfo);
    TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {

        public void completeAll() {
            Object input = serviceTreeViewer.getInput();
            ServiceDashboardInfo sDashInfo = getSelectedDashInfo(input, serverInfo.getServerName(), key);
            EnvInfo envInfo = getEnvInfoTask.loadEnvInfo();
            setEnvData(sDashInfo, envInfo);
            serviceTreeViewer.refresh(input);
        }

        public IStatus postTaskFinished(ITask task) {
            return Status.OK_STATUS;
        }
    });
    taskJobExec.addTask(getEnvInfoTask);
    executeTask(taskJobExec, serverInfo.getServerName(), Messages.taskGetServerEnvInfo);
}
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) GetEnvInfoTask(com.cubrid.cubridmanager.core.common.task.GetEnvInfoTask) EnvInfo(com.cubrid.cubridmanager.core.common.model.EnvInfo)

Example 17 with TaskJobExecutor

use of com.cubrid.common.ui.spi.progress.TaskJobExecutor 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);
}
Also used : GetDatabaseListTask(com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask) 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) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) List(java.util.List) ArrayList(java.util.ArrayList) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList)

Example 18 with TaskJobExecutor

use of com.cubrid.common.ui.spi.progress.TaskJobExecutor 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);
}
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) ArrayList(java.util.ArrayList) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask)

Example 19 with TaskJobExecutor

use of com.cubrid.common.ui.spi.progress.TaskJobExecutor 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);
}
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) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) HostStatData(com.cubrid.cubridmanager.core.monitoring.model.HostStatData)

Example 20 with TaskJobExecutor

use of com.cubrid.common.ui.spi.progress.TaskJobExecutor in project cubrid-manager by CUBRID.

the class PstmtOneDataDialog method updateData.

/**
	 * 
	 * Update the data
	 * 
	 * @param parameterList List<PstmtParameter>
	 */
private void updateData(List<PstmtParameter> parameterList) {
    beginTimestamp = System.currentTimeMillis();
    String jobName = Messages.executeSqlJobName;
    JobFamily jobFamily = new JobFamily();
    String serverName = database.getServer().getServerInfo().getServerName();
    String dbName = database.getName();
    jobFamily.setServerName(serverName);
    jobFamily.setDbName(dbName);
    TaskJobExecutor taskExec = new CommonTaskJobExec(this);
    PstmtDataTask task = new PstmtDataTask(sqlTxt.getText(), database, parameterList, null);
    taskExec.addTask(task);
    taskExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
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)

Aggregations

TaskJobExecutor (com.cubrid.common.ui.spi.progress.TaskJobExecutor)41 IStatus (org.eclipse.core.runtime.IStatus)29 ITask (com.cubrid.common.core.task.ITask)28 CommonTaskJobExec (com.cubrid.common.ui.spi.progress.CommonTaskJobExec)24 JobFamily (com.cubrid.common.ui.spi.progress.JobFamily)24 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)18 Status (org.eclipse.core.runtime.Status)15 ITaskExecutorInterceptor (com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor)12 ArrayList (java.util.ArrayList)12 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)11 DbSpaceInfoList (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList)10 List (java.util.List)8 CheckDirTask (com.cubrid.cubridmanager.core.cubrid.database.task.CheckDirTask)6 CheckFileTask (com.cubrid.cubridmanager.core.cubrid.database.task.CheckFileTask)6 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)6 BrokerInfoList (com.cubrid.cubridmanager.core.broker.model.BrokerInfoList)4 IEditorPart (org.eclipse.ui.IEditorPart)4 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)4 PartInitException (org.eclipse.ui.PartInitException)4 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)3