Search in sources :

Example 71 with CommonTaskExec

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

the class ConfigHAWizard method performFinish.

public boolean performFinish() {
    ServerInfo masterServerInfo = haModel.getMasterServer().getServer().getServerInfo();
    ServerInfo slaveServerInfo = haModel.getSlaveServer().getServer().getServerInfo();
    Map<String, Map<String, String>> masterParams = haModel.getMasterServer().getCubridParameters();
    Map<String, Map<String, String>> slaveParams = haModel.getSlaveServer().getCubridParameters();
    Map<String, Map<String, String>> masterHaParams = haModel.getMasterServer().getCubridHAParameters();
    Map<String, Map<String, String>> slaveHaParams = haModel.getSlaveServer().getCubridHAParameters();
    setCubridConfParameterTaskMaster = new SetCubridConfParameterTask(masterServerInfo);
    setCubridConfParameterTaskMaster.setConfParameters(masterParams);
    setHAConfParameterTaskMaster = new SetHAConfParameterTask(masterServerInfo);
    setHAConfParameterTaskMaster.setConfParameters(masterHaParams);
    setCubridConfParameterTaskSlave = new SetCubridConfParameterTask(slaveServerInfo);
    setCubridConfParameterTaskSlave.setConfParameters(slaveParams);
    setHAConfParameterTaskSlave = new SetHAConfParameterTask(slaveServerInfo);
    setHAConfParameterTaskSlave.setConfParameters(slaveHaParams);
    CommonTaskExec taskExec = new CommonTaskExec(Messages.msgUploading);
    taskExec.addTask(setCubridConfParameterTaskMaster);
    taskExec.addTask(setCubridConfParameterTaskSlave);
    taskExec.addTask(setHAConfParameterTaskMaster);
    taskExec.addTask(setHAConfParameterTaskSlave);
    new ExecTaskWithProgress(taskExec).exec();
    if (taskExec.isSuccess()) {
        StartHAServiceDialog dialog = new StartHAServiceDialog(getShell(), haModel);
        dialog.open();
        return true;
    } else {
        CommonUITool.openErrorBox(getErrMsg());
        return false;
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) SetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetHAConfParameterTask) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) SetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) Map(java.util.Map) HashMap(java.util.HashMap)

Example 72 with CommonTaskExec

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

the class SettingCubridConfPage method loadServerData.

/**
	 * Load server data
	 * 
	 * @param haServer
	 */
private void loadServerData(HAServer haServer) {
    CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.host.Messages.getCubridConfTaskRunning);
    GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(haServer.getServer().getServerInfo());
    taskExcutor.addTask(getCubridConfParameterTask);
    new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    if (taskExcutor.isSuccess()) {
        Map<String, Map<String, String>> allConfigMap = getCubridConfParameterTask.getConfParameters();
        haServer.setOriginCubridParameters(allConfigMap);
        haServer.setCubridParameters(getConfigHAWizard().cloneParameters(allConfigMap));
        appendDefaultHAConfig(haServer.getCubridParameters());
    } else {
        CommonUITool.openErrorBox(Messages.errLoadCubridConf);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) HashMap(java.util.HashMap) Map(java.util.Map)

Example 73 with CommonTaskExec

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

the class GenCertDialog method genCertFile.

private void genCertFile() {
    GenerateCertificateTask task = new GenerateCertificateTask(serverInfo);
    if (!StringUtil.isEmpty(countryText.getText())) {
        task.setCName(countryText.getText());
    }
    if (!StringUtil.isEmpty(stateText.getText())) {
        task.setStName(stateText.getText());
    }
    if (!StringUtil.isEmpty(cityText.getText())) {
        task.setLonName(cityText.getText());
    }
    if (!StringUtil.isEmpty(organizationText.getText())) {
        task.setOrgname(organizationText.getText());
    }
    if (!StringUtil.isEmpty(emailText.getText())) {
        task.setEmail(emailText.getText());
    }
    int index = dateCombo.getSelectionIndex();
    task.setDays(validValues[index]);
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.msgGenCert);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (task.isSuccess()) {
        serverInfo.setCertStatus(CertStatus.CUSTOMIZED);
        CommonUITool.openInformationBox(Messages.titleRestartCMS, Messages.msgRestartCMS);
    } else {
        CommonUITool.openErrorBox(task.getErrorMsg());
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) GenerateCertificateTask(com.cubrid.cubridmanager.core.common.task.GenerateCertificateTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Example 74 with CommonTaskExec

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

the class ShardsParameterPropertyPage method performOk.

/**
	 * Save the page content
	 * 
	 * @return <code>true</code> if it saved successfully;<code>false</code>
	 *         otherwise
	 */
public boolean performOk() {
    // TODO
    shardListGroupPanel.save();
    CommonTaskExec taskExec = new CommonTaskExec(Messages.msgOperating);
    taskExec.setTask(shardListGroupPanel.generateTasks());
    new ExecTaskWithProgress(taskExec).exec();
    if (taskExec.isSuccess()) {
        CommonUITool.openInformationBox(Messages.titleSuccess, Messages.restartShardBrokerMsg);
        return true;
    } else {
        CommonUITool.openErrorBox(Messages.msgOperationFailed);
        return false;
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Example 75 with CommonTaskExec

use of com.cubrid.common.ui.spi.progress.CommonTaskExec 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)

Aggregations

CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)106 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)106 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)81 TreeViewer (org.eclipse.jface.viewers.TreeViewer)31 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)24 ArrayList (java.util.ArrayList)24 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)23 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)18 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)14 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)13 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)13 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)12 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)11 IEditorPart (org.eclipse.ui.IEditorPart)11 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)9 HashMap (java.util.HashMap)9 AbstractUITask (com.cubrid.common.core.task.AbstractUITask)8 Map (java.util.Map)8 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)8 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)8