Search in sources :

Example 1 with SetCMConfParameterTask

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

the class UnifyHostConfigUtil method saveCubridCMConf.

/**
	 * save cubrid broker conf
	 * @param monitor
	 * @param brokerConfMap
	 * @param editorInput
	 * @return failed server
	 */
public List<String> saveCubridCMConf(IProgressMonitor monitor, LinkedHashMap<String, CubridCMConfConfig> cubridCMConfMap, CubridServer[] cubridServers) {
    List<String> failedServer = new ArrayList<String>();
    for (Entry<String, CubridCMConfConfig> entry : cubridCMConfMap.entrySet()) {
        CubridCMConfConfig cubridCMConfConfig = entry.getValue();
        String serverName = entry.getKey();
        String contents = parseCubridCMConfConfigToDocumnetString(cubridCMConfConfig);
        CubridServer cubridServer = getCubridServer(serverName, cubridServers);
        if (cubridServer != null) {
            monitor.subTask(Messages.bind(Messages.unifyHostConfigEditorSavingDataMsg2, "cm.conf", serverName));
            String[] lines = contents.split(System.getProperty("line.separator"));
            SetCMConfParameterTask task = new SetCMConfParameterTask(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 : SetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCMConfParameterTask) ArrayList(java.util.ArrayList) CubridCMConfConfig(com.cubrid.cubridmanager.ui.host.model.CubridCMConfConfig) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Example 2 with SetCMConfParameterTask

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

the class SetBrokerConfParameterTest method testSetContent.

public void testSetContent() throws Exception {
    SetCMConfParameterTask task = new SetCMConfParameterTask(serverInfo);
    List<String> list = new ArrayList<String>();
    list.add("abc");
    list.add("def");
    task.setConfContents(list);
}
Also used : SetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCMConfParameterTask) ArrayList(java.util.ArrayList)

Example 3 with SetCMConfParameterTask

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

the class ManagerServerPropertyPage method perform.

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

Example 4 with SetCMConfParameterTask

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

the class ConfigParaHelp method performImportCmConf.

/**
	 * Perform the import task for cm.conf
	 * 
	 * @param serverInfo the CubridServer
	 * @param confParamList the List<String>
	 */
public static void performImportCmConf(ServerInfo serverInfo, List<String> confParamList) {
    CommonTaskExec taskExcutor = new CommonTaskExec(Messages.setCMParameterTaskName);
    SetCMConfParameterTask task = new SetCMConfParameterTask(serverInfo);
    task.setConfContents(confParamList);
    taskExcutor.addTask(task);
    new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    if (taskExcutor.isSuccess()) {
        CommonUITool.openInformationBox(Messages.titleSuccess, Messages.msgChangeCMParaSuccess);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) SetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCMConfParameterTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Aggregations

SetCMConfParameterTask (com.cubrid.cubridmanager.core.common.task.SetCMConfParameterTask)4 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 ArrayList (java.util.ArrayList)2 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 CubridCMConfConfig (com.cubrid.cubridmanager.ui.host.model.CubridCMConfConfig)1