Search in sources :

Example 1 with SetCubridConfParameterTask

use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.

the class DBSpaceLabelProvider method saveAutoParam.

private void saveAutoParam(Set<String> settingAutoStartDB) {
    GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
    getCubridConfParameterTask.execute();
    if (!getCubridConfParameterTask.isSuccess()) {
        CommonUITool.openInformationBox(com.cubrid.cubridmanager.ui.common.Messages.titleError, getCubridConfParameterTask.getErrorMsg());
        return;
    }
    List<String> cubridConfContentList = getCubridConfParameterTask.getConfContents();
    List<String> currentAutoStartDBList = getCubridConfParameterTask.getAutoStartDb(false);
    /*Merge the data*/
    for (String db : currentAutoStartDBList) {
        if (!settingAutoStartDB.contains(db)) {
            cubridConfContentList = CoreUtils.deleteDatabaseFromServiceServer(getCubridConfParameterTask, cubridConfContentList, db);
        }
    }
    for (String db : settingAutoStartDB) {
        if (!currentAutoStartDBList.contains(db)) {
            cubridConfContentList = CoreUtils.addDatabaseToServiceServer(getCubridConfParameterTask, cubridConfContentList, db);
        }
    }
    /*Update the config*/
    SetCubridConfParameterTask setParaTask = new SetCubridConfParameterTask(serverInfo);
    setParaTask.setConfContents(cubridConfContentList);
    CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.common.Messages.setCubridParameterTaskName);
    taskExcutor.addTask(setParaTask);
    new ExecTaskWithProgress(taskExcutor).exec(true, true);
    if (taskExcutor.isSuccess()) {
        isDirty = false;
        updateToolBar();
        CommonUITool.openInformationBox(com.cubrid.cubridmanager.ui.common.Messages.titleSuccess, com.cubrid.cubridmanager.ui.common.Messages.msgChangeServiceParaSuccess);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) SetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask)

Example 2 with SetCubridConfParameterTask

use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.

the class ServicePropertyPage method perform.

/**
	 *
	 * Perform the task and set cubrid.conf configuration file service section
	 * parameter
	 *
	 * @param confParaMap the conf parameter map
	 */
private void perform(Map<String, Map<String, String>> confParaMap) {
    SetCubridConfParameterTask task = new SetCubridConfParameterTask(node.getServer().getServerInfo());
    task.setConfParameters(confParaMap);
    CommonTaskExec taskExcutor = new CommonTaskExec(Messages.setCubridParameterTaskName);
    taskExcutor.addTask(task);
    new ExecTaskWithProgress(taskExcutor).exec(true, true);
    if (taskExcutor.isSuccess()) {
        CommonUITool.openInformationBox(Messages.titleSuccess, Messages.msgChangeServiceParaSuccess);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) SetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Example 3 with SetCubridConfParameterTask

use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.

the class CreateReplicationUtil method createSlaveMasterTaskGroup.

/**
	 * 
	 * Fill in the related tasks of creating master to executor according to
	 * slave and master information,this slave node is also master node.
	 * 
	 * @param master MasterNode
	 * @param slave SlaveNode
	 * @param executor CreateReplicationJobExecutor
	 * @return null or error message
	 */
public static String createSlaveMasterTaskGroup(MasterNode master, SlaveNode slave, CreateReplicationJobExecutor executor) {
    TaskGroup taskGroup = new TaskGroup(IConstants.REPL_GROUP_NAME_CREATE_MASTER);
    taskGroup.setTarget(master.getDbName());
    HostNode slaveHost = (HostNode) slave.getParent();
    final String ip = slaveHost.getIp();
    final String port = slaveHost.getPort();
    final String userName = slaveHost.getUserName();
    final String password = slaveHost.getPassword();
    boolean isConnected = ServerManager.getInstance().isConnected(ip, Integer.parseInt(port), userName);
    ServerInfo serverInfo = new ServerInfo();
    if (isConnected) {
        serverInfo = ServerManager.getInstance().getServer(ip, Integer.parseInt(port), userName);
        if (!serverInfo.getLoginedUserInfo().isAdmin()) {
            return Messages.bind(Messages.errInvalidUser, ip);
        }
    } else {
        serverInfo.setHostAddress(ip);
        serverInfo.setHostMonPort(Integer.parseInt(port));
        serverInfo.setHostJSPort(Integer.parseInt(port) + 1);
        serverInfo.setUserName(userName);
        serverInfo.setUserPassword(password);
        MonitoringTask monitoringTask = new MonitoringTask(serverInfo);
        taskGroup.addTask(monitoringTask);
    }
    GetReplServerStatusTask getReplServerStatusTask = new GetReplServerStatusTask(serverInfo);
    getReplServerStatusTask.setDbName(slave.getDbName());
    taskGroup.addTask(getReplServerStatusTask);
    StopReplServerTask stopReplServerTask = new StopReplServerTask(serverInfo);
    stopReplServerTask.setDbName(slave.getDbName());
    taskGroup.addTask(stopReplServerTask);
    GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
    getCubridConfParameterTask.putData("dbName", slave.getDbName());
    taskGroup.addTask(getCubridConfParameterTask);
    SetCubridConfParameterTask setCubridConfParameterTask = new SetCubridConfParameterTask(serverInfo);
    taskGroup.addTask(setCubridConfParameterTask);
    GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
    getDatabaseListTask.putData("dbName", slave.getDbName());
    taskGroup.addTask(getDatabaseListTask);
    CommonUpdateTask stopDbTask = new CommonUpdateTask(CommonTaskName.STOP_DB_TASK_NAME, serverInfo, CommonSendMsg.getCommonDatabaseSendMsg());
    stopDbTask.setDbName(slave.getDbName());
    taskGroup.addTask(stopDbTask);
    CommonUpdateTask startDbTask = new CommonUpdateTask(CommonTaskName.START_DB_TASK_NAME, serverInfo, CommonSendMsg.getCommonDatabaseSendMsg());
    startDbTask.setDbName(slave.getDbName());
    taskGroup.addTask(startDbTask);
    BackupDbTask backupDbTask = new BackupDbTask(serverInfo);
    backupDbTask.setDbName(slave.getDbName());
    backupDbTask.setLevel("0");
    backupDbTask.setVolumeName(slave.getDbName() + "_bk0v000");
    backupDbTask.setBackupDir(slave.getDbPath());
    backupDbTask.setRemoveLog(false);
    backupDbTask.setCheckDatabaseConsist(true);
    backupDbTask.setThreadCount(String.valueOf(0));
    backupDbTask.setZiped(false);
    backupDbTask.setSafeReplication(false);
    taskGroup.addTask(backupDbTask);
    executor.addGroupTask(taskGroup);
    return null;
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) HostNode(com.cubrid.cubridmanager.ui.replication.editor.model.HostNode) SetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask) BackupDbTask(com.cubrid.cubridmanager.core.cubrid.database.task.BackupDbTask) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) GetDatabaseListTask(com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask) GetReplServerStatusTask(com.cubrid.cubridmanager.core.replication.task.GetReplServerStatusTask) StopReplServerTask(com.cubrid.cubridmanager.core.replication.task.StopReplServerTask) MonitoringTask(com.cubrid.cubridmanager.core.common.task.MonitoringTask) CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask) TaskGroup(com.cubrid.common.ui.spi.progress.TaskGroup)

Example 4 with SetCubridConfParameterTask

use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.

the class UnifyHostConfigUtil method saveCubridConf.

/**
	 * save cubrid broker conf
	 * @param monitor
	 * @param brokerConfMap
	 * @param editorInput
	 * @return failed server
	 */
public List<String> saveCubridConf(IProgressMonitor monitor, LinkedHashMap<String, CubridConfConfig> cubridConfMap, CubridServer[] cubridServers) {
    List<String> failedServer = new ArrayList<String>();
    for (Entry<String, CubridConfConfig> entry : cubridConfMap.entrySet()) {
        CubridConfConfig cubridConfConfig = entry.getValue();
        String serverName = entry.getKey();
        String contents = parseCubridConfConfigToDocumnetString(cubridConfConfig);
        CubridServer cubridServer = getCubridServer(serverName, cubridServers);
        if (cubridServer != null) {
            monitor.subTask(Messages.bind(Messages.unifyHostConfigEditorSavingDataMsg2, "cubrid.conf", serverName));
            String[] lines = contents.split(System.getProperty("line.separator"));
            SetCubridConfParameterTask task = new SetCubridConfParameterTask(cubridServer.getServerInfo());
            task.setConfContents(Arrays.asList(lines));
            task.execute();
            if (!task.isSuccess()) {
                failedServer.add(cubridServer.getName());
            }
            task.finish();
            monitor.worked(1);
        }
    }
    return failedServer;
}
Also used : SetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask) ArrayList(java.util.ArrayList) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) CubridConfConfig(com.cubrid.cubridmanager.ui.host.model.CubridConfConfig)

Example 5 with SetCubridConfParameterTask

use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask 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)

Aggregations

SetCubridConfParameterTask (com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask)12 GetCubridConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask)7 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)6 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)5 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)5 CommonUpdateTask (com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)5 ITask (com.cubrid.common.core.task.ITask)4 GetDatabaseListTask (com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask)4 GetReplServerStatusTask (com.cubrid.cubridmanager.core.replication.task.GetReplServerStatusTask)4 StopReplServerTask (com.cubrid.cubridmanager.core.replication.task.StopReplServerTask)4 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 MonitoringTask (com.cubrid.cubridmanager.core.common.task.MonitoringTask)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 JobFamily (com.cubrid.common.ui.spi.progress.JobFamily)2 TaskGroup (com.cubrid.common.ui.spi.progress.TaskGroup)2 TaskJobExecutor (com.cubrid.common.ui.spi.progress.TaskJobExecutor)2 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)2 BackupDbTask (com.cubrid.cubridmanager.core.cubrid.database.task.BackupDbTask)2 CheckDirTask (com.cubrid.cubridmanager.core.cubrid.database.task.CheckDirTask)2