Search in sources :

Example 1 with UnifyHostConfigUtil

use of com.cubrid.cubridmanager.ui.spi.util.UnifyHostConfigUtil in project cubrid-manager by CUBRID.

the class UnifyHostConfigEditor method loadData.

/**
	 * load edit data
	 */
public void loadData() {
    if (editorInput.getTaskCountValue() == 0) {
        return;
    }
    try {
        ProgressMonitorDialog progress = new ProgressMonitorDialog(getSite().getShell());
        progress.setCancelable(false);
        progress.run(true, true, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException {
                monitor.beginTask(Messages.unifyHostConfigEditorLoadingDataMsg, editorInput.getTaskCountValue());
                unifyHostConfigUtil = new UnifyHostConfigUtil();
                for (CubridServer cubridServer : editorInput.getCubridServers()) {
                    if (editorInput.isEditCubridConf()) {
                        monitor.subTask(Messages.bind(Messages.unifyHostConfigEditorLoadingDataMsg2, "cubrid.conf", cubridServer.getName()));
                        GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(cubridServer.getServerInfo());
                        getCubridConfParameterTask.execute();
                        if (getCubridConfParameterTask.isSuccess()) {
                            List<String> contentsList = getCubridConfParameterTask.getConfContents();
                            StringBuilder contentBuilder = new StringBuilder();
                            for (String content : contentsList) {
                                contentBuilder.append(content).append(StringUtil.NEWLINE);
                            }
                            CubridConfConfig cubridConfConfig = unifyHostConfigUtil.parseStringLineToCubridConfConfig(contentBuilder.toString());
                            cubridConfConfigDataMap.put(cubridServer.getName(), cubridConfConfig);
                            monitor.worked(1);
                        }
                    }
                    if (editorInput.isEditBrokerConf()) {
                        monitor.subTask(Messages.bind(Messages.unifyHostConfigEditorLoadingDataMsg2, "broker", cubridServer.getName()));
                        GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(cubridServer.getServerInfo());
                        getBrokerConfParameterTask.execute();
                        if (getBrokerConfParameterTask.isSuccess()) {
                            List<String> contentsList = getBrokerConfParameterTask.getConfContents();
                            StringBuilder contentBuilder = new StringBuilder();
                            for (String content : contentsList) {
                                contentBuilder.append(content).append(StringUtil.NEWLINE);
                            }
                            BrokerConfig cubridBrokerConfig = cubridBrokerConfUtil.parseStringLineToBrokerConfig(contentBuilder.toString());
                            cubridBrokerConfigDataMap.put(cubridServer.getName(), cubridBrokerConfig);
                            monitor.worked(1);
                        }
                    }
                    if (editorInput.isEditCMConf()) {
                        monitor.subTask(Messages.bind(Messages.unifyHostConfigEditorLoadingDataMsg2, "cm.conf", cubridServer.getName()));
                        GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(cubridServer.getServerInfo());
                        getCMConfParameterTask.execute();
                        if (getCMConfParameterTask.isSuccess()) {
                            List<String> contentsList = getCMConfParameterTask.getConfContents();
                            StringBuilder contentBuilder = new StringBuilder();
                            for (String content : contentsList) {
                                contentBuilder.append(content).append(StringUtil.NEWLINE);
                            }
                            CubridCMConfConfig cubridCMConfConfig = unifyHostConfigUtil.parseStringLineToCubridCMConfConfig(contentBuilder.toString());
                            cubridConfCMConfigDataMap.put(cubridServer.getName(), cubridCMConfConfig);
                        //								System.out.println(contentBuilder.toString());
                        }
                        monitor.worked(1);
                    }
                    if (editorInput.isEditHAConf()) {
                        monitor.subTask(Messages.bind(Messages.unifyHostConfigEditorLoadingDataMsg2, "cubrid_ha.conf", cubridServer.getName()));
                        monitor.worked(1);
                    }
                    if (editorInput.isEditACLConf()) {
                        monitor.subTask(Messages.bind(Messages.unifyHostConfigEditorLoadingDataMsg2, "acl", cubridServer.getName()));
                        monitor.worked(1);
                    }
                }
            }
        });
    } catch (Exception e) {
        LOGGER.error("", e);
    }
}
Also used : BrokerConfig(com.cubrid.common.ui.spi.model.BrokerConfig) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) UnifyHostConfigUtil(com.cubrid.cubridmanager.ui.spi.util.UnifyHostConfigUtil) InvocationTargetException(java.lang.reflect.InvocationTargetException) CubridConfConfig(com.cubrid.cubridmanager.ui.host.model.CubridConfConfig) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) GetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask) List(java.util.List) ArrayList(java.util.ArrayList) GetBrokerConfParameterTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask) CubridCMConfConfig(com.cubrid.cubridmanager.ui.host.model.CubridCMConfConfig)

Aggregations

BrokerConfig (com.cubrid.common.ui.spi.model.BrokerConfig)1 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 GetBrokerConfParameterTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask)1 GetCMConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask)1 GetCubridConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask)1 CubridCMConfConfig (com.cubrid.cubridmanager.ui.host.model.CubridCMConfConfig)1 CubridConfConfig (com.cubrid.cubridmanager.ui.host.model.CubridConfConfig)1 UnifyHostConfigUtil (com.cubrid.cubridmanager.ui.spi.util.UnifyHostConfigUtil)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 PartInitException (org.eclipse.ui.PartInitException)1