Search in sources :

Example 86 with TaskExecutor

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

the class StopShardAction method run.

/**
	 * Override the run method in order to complete stopping broker environment
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    CubridShard selection = (CubridShard) obj[0];
    if (null == selection) {
        return;
    }
    if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
        return;
    }
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    StopShardTask task = new StopShardTask(serverInfo, selection.getName());
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopShardActionName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    if (!task.isSuccess()) {
        String msg = Messages.bind(Messages.errCanNotStopShardBroker, task.getErrorMsg());
        CommonUITool.openErrorBox(msg);
        return;
    }
    selection.setRunning(false);
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection);
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CubridShard(com.cubrid.cubridmanager.ui.spi.model.CubridShard) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) StopShardTask(com.cubrid.cubridmanager.core.shard.task.StopShardTask)

Example 87 with TaskExecutor

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

the class StopShardEnvAction method run.

/**
	 * Override the run method in order to complete stopping broker environment
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    CubridShardFolder selection = (CubridShardFolder) obj[0];
    if (null == selection) {
        return;
    }
    if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
        return;
    }
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    StopShardTask task = new StopShardTask(serverInfo, null);
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopShardEnvActionName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    if (!task.isSuccess()) {
        String msg = Messages.bind(Messages.errCanNotStopShardBroker, task.getErrorMsg());
        CommonUITool.openErrorBox(msg);
        return;
    }
    selection.setRunning(false);
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection);
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CubridShardFolder(com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder) StopShardTask(com.cubrid.cubridmanager.core.shard.task.StopShardTask)

Example 88 with TaskExecutor

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

the class StopBrokerAction method run.

/**
	 * Override the run method in order to complete stopping broker environment
	 */
public void run() {
    if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
        return;
    }
    final Object[] obj = this.getSelectedObj();
    DefaultCubridNode selection = (DefaultCubridNode) obj[0];
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    StopBrokerTask task = new StopBrokerTask(serverInfo);
    task.setBrokerName(selection.getLabel());
    final String taskName = Messages.bind(Messages.stopBrokerTaskName, selection.getLabel());
    TaskExecutor taskExecutor = new CommonTaskExec(taskName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection.getParent());
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) StopBrokerTask(com.cubrid.cubridmanager.core.broker.task.StopBrokerTask)

Example 89 with TaskExecutor

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

the class BrokerStatusView method initValue.

/**
	 * Initializes the parameters of this view
	 */
public void initValue() {
    if (null == getCubridNode() || !CubridNodeType.BROKER.equals(getCubridNode().getType())) {
        return;
    }
    brokerNode = (CubridBroker) getCubridNode();
    nodeName = brokerNode.getLabel().trim();
    serverName = brokerNode.getServer().getLabel();
    port = brokerNode.getServer().getMonPort();
    ServerInfo serverInfo = brokerNode.getServer().getServerInfo();
    //get basic info
    BrokerInfos brokerInfos = new BrokerInfos();
    //brokerInfos.setBname(nodeName);
    final GetBrokerStatusInfosTask<BrokerInfos> basicTask = new GetBrokerStatusInfosTask<BrokerInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerInfos);
    basicTask.setBrokerName(nodeName);
    //get status
    BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
    final GetBrokerStatusInfosTask<BrokerStatusInfos> statisTask = new GetBrokerStatusInfosTask<BrokerStatusInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
    statisTask.setBrokerName(nodeName);
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.showBrokerStatusTaskName);
    taskExecutor.addTask(basicTask);
    taskExecutor.addTask(statisTask);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    brokerInfos = basicTask.getResultModel();
    if (null != brokerInfos) {
        BrokerInfoList list = brokerInfos.getBorkerInfoList();
        if (list != null && list.getBrokerInfoList() != null) {
            basicInfoLst = list.getBrokerInfoList();
        }
    }
    brokerStatusInfos = statisTask.getResultModel();
    if (brokerStatusInfos != null) {
        asinfoLst = brokerStatusInfos.getAsinfo();
        jobinfoLst = brokerStatusInfos.getJobinfo();
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) GetBrokerStatusInfosTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Example 90 with TaskExecutor

use of com.cubrid.common.ui.spi.progress.TaskExecutor 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();
//		}
}
Also used : CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) JobFamily(com.cubrid.common.ui.spi.progress.JobFamily) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) Job(org.eclipse.core.runtime.jobs.Job)

Aggregations

ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)124 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)124 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)81 TreeViewer (org.eclipse.jface.viewers.TreeViewer)38 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)37 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)37 ITask (com.cubrid.common.core.task.ITask)35 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)29 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)25 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)24 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)23 ArrayList (java.util.ArrayList)23 Shell (org.eclipse.swt.widgets.Shell)15 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)14 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)13 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)12 IEditorPart (org.eclipse.ui.IEditorPart)12 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)11 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)10 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9