Search in sources :

Example 1 with BrokerConfPersistUtil

use of com.cubrid.common.ui.spi.persist.BrokerConfPersistUtil in project cubrid-manager by CUBRID.

the class UnifyHostConfigUtil method saveBrokerConf.

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

Aggregations

BrokerConfig (com.cubrid.common.ui.spi.model.BrokerConfig)1 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 BrokerConfPersistUtil (com.cubrid.common.ui.spi.persist.BrokerConfPersistUtil)1 SetBrokerConfParameterTask (com.cubrid.cubridmanager.core.broker.task.SetBrokerConfParameterTask)1 ArrayList (java.util.ArrayList)1