Search in sources :

Example 1 with GetHAConfParameterTask

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

the class PropertyAction method run.

/**
	 * Open property dialog,view and set property
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    final ICubridNode node = (ICubridNode) obj[0];
    String type = node.getType();
    if (CubridNodeType.SERVER.equals(type) || CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type) || CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
        TaskExecutor taskExcutor = new GetPropertyExecutor(node, getShell());
        ServerInfo serverInfo = node.getServer().getServerInfo();
        GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
        GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo);
        GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
        if (CubridNodeType.SERVER.equals(type)) {
            taskExcutor.addTask(getCubridConfParameterTask);
            taskExcutor.addTask(getBrokerConfParameterTask);
            taskExcutor.addTask(getCMConfParameterTask);
            if (CompatibleUtil.isSupportNewHAConfFile(serverInfo)) {
                GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
                taskExcutor.addTask(getHAConfParameterTask);
            }
        }
        if (CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type)) {
            taskExcutor.addTask(getCubridConfParameterTask);
        }
        if (CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
            taskExcutor.addTask(getBrokerConfParameterTask);
        }
        new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    }
    if (!isCancel) {
        Dialog dialog = PreferenceUtil.createPropertyDialog(getShell(), node);
        dialog.open();
    }
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) GetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) GetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask) Dialog(org.eclipse.jface.dialogs.Dialog) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) GetBrokerConfParameterTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask)

Example 2 with GetHAConfParameterTask

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

the class SettingCubridHAConfPage method loadServerData.

private void loadServerData(HAServer haServer) {
    CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.host.Messages.getCubridConfTaskRunning);
    GetHAConfParameterTask getCubridConfParameterTask = new GetHAConfParameterTask(haServer.getServer().getServerInfo());
    taskExcutor.addTask(getCubridConfParameterTask);
    new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    if (taskExcutor.isSuccess()) {
        Map<String, Map<String, String>> haConfigMap = getCubridConfParameterTask.getConfParameters();
        haServer.setOrigincCubridHAParameters(haConfigMap);
        haServer.setCubridHAParameters(getConfigHAWizard().cloneParameters(haConfigMap));
        appendDefaultHAConfig(haServer.getCubridHAParameters());
    } else {
        CommonUITool.openErrorBox(Messages.errLoadCubridHAConf);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) GetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with GetHAConfParameterTask

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

the class ConfigParaHelp method performGetHAConf.

/**
	 * Perform the task of get ha.conf
	 * 
	 * @param serverInfo the CubridServer
	 * @return the List<String>
	 */
public static List<String> performGetHAConf(ServerInfo serverInfo) {
    List<String> confContent = new ArrayList<String>();
    CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.host.Messages.getHaConfTaskRunning);
    GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
    taskExcutor.addTask(getHAConfParameterTask);
    new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    if (taskExcutor.isSuccess()) {
        confContent = getHAConfParameterTask.getConfContents();
    }
    return confContent;
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ArrayList(java.util.ArrayList) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) GetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask)

Example 4 with GetHAConfParameterTask

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

the class HaShardDemo method getHaNodeInfo.

protected NodeInfo getHaNodeInfo(ServerInfo serverInfo, String haMode) {
    //"heartbeatlist"
    GetHeartbeatNodeInfoTask getHeartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(serverInfo);
    getHeartbeatNodeInfoTask.setAllDb(true);
    getHeartbeatNodeInfoTask.execute();
    if (!getHeartbeatNodeInfoTask.isSuccess()) {
        return null;
    }
    String status = getHeartbeatNodeInfoTask.getCurrentHostStatus();
    NodeType type = CMServiceAnalysisUtil.convertHaStatToNodeType(status);
    HaNode nodeInfo = null;
    if (type != NodeType.NORMAL) {
        nodeInfo = new HaNode(type);
        nodeInfo.buildStatus("ON");
        nodeInfo.setHostStatusInfoList(getHeartbeatNodeInfoTask.getHAHostStatusList());
    } else if ("on".equals(haMode)) {
        nodeInfo = new HaNode(NodeType.SLAVE);
        nodeInfo.buildStatus("OFF");
    } else if ("replica".equals(haMode)) {
        nodeInfo = new HaNode(NodeType.REPLICA);
        nodeInfo.buildStatus("OFF");
    }
    //"getallsysparam"/"cubrid_ha.conf"
    GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
    getHAConfParameterTask.execute();
    BrokerInfos brokerInfos = new BrokerInfos();
    GetBrokerStatusInfosTask<BrokerInfos> getBrokerStatusInfosTask = new GetBrokerStatusInfosTask<BrokerInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerInfos);
    getBrokerStatusInfosTask.execute();
    if (!getHAConfParameterTask.isSuccess() || !getBrokerStatusInfosTask.isSuccess()) {
        return null;
    }
    brokerInfos = getBrokerStatusInfosTask.getResultModel();
    if (brokerInfos != null) {
        nodeInfo.setBrokerInfoList(brokerInfos.getBorkerInfoList());
    }
    Map<String, Map<String, String>> haConfParas = getHAConfParameterTask.getConfParameters();
    Map<String, String> haCommonConf = haConfParas.get("[common]");
    //		String haNodeStr = haCommonConf.get("ha_node_list").substring("cubrid@".length());
    //		List<String> haNodeList = Arrays.asList(haNodeStr.split(":"));
    //		String replicaStr = haCommonConf.get("ha_replica_list");
    //		List<String> replicaNodeList = Arrays.asList(replicaStr.substring("cubrid@".length()).split(":"));
    String dbList = haCommonConf.get("ha_db_list");
    if (dbList.indexOf(",") > -1) {
        String[] dbAr = dbList.split(",");
        for (String s : dbAr) {
            if (s.trim().length() > 0) {
                nodeInfo.addDatabase(s);
            }
        }
    } else {
        nodeInfo.addDatabase(dbList);
    }
    return nodeInfo;
}
Also used : HaNode(com.cubrid.cubridmanager.core.cubrid.service.model.HaNode) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) NodeType(com.cubrid.cubridmanager.core.cubrid.service.model.NodeType) GetBrokerStatusInfosTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask) GetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask) Map(java.util.Map) GetHeartbeatNodeInfoTask(com.cubrid.cubridmanager.core.mondashboard.task.GetHeartbeatNodeInfoTask)

Example 5 with GetHAConfParameterTask

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

the class CubridServerLoader method getHostStatus.

/**
	 * Get host status
	 *
	 * @param server - CubridServer
	 */
private void getHostStatus(final CubridServer server) {
    final GetHeartbeatNodeInfoTask getHeartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(server.getServerInfo());
    getHeartbeatNodeInfoTask.setAllDb(true);
    getHeartbeatNodeInfoTask.execute();
    if (getHeartbeatNodeInfoTask.isSuccess()) {
        HAHostStatusInfo haHostStatusInfo = getHeartbeatNodeInfoTask.getHostStatusInfo(server.getServerInfo().getHostAddress());
        if (haHostStatusInfo != null) {
            server.getServerInfo().setHaHostStatusInfo(haHostStatusInfo);
        }
    } else {
        LOGGER.debug("Get host status error:" + getHeartbeatNodeInfoTask.getErrorMsg());
    }
    final GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(server.getServerInfo());
    getHAConfParameterTask.execute();
    if (getHAConfParameterTask.isSuccess()) {
        server.getServerInfo().setHaConfParaMap(getHAConfParameterTask.getConfParameters());
    } else {
        LOGGER.debug("Get host ha status error:" + getHAConfParameterTask.getErrorMsg());
    }
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) GetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask) GetHeartbeatNodeInfoTask(com.cubrid.cubridmanager.core.mondashboard.task.GetHeartbeatNodeInfoTask)

Aggregations

GetHAConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask)5 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)3 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 GetHeartbeatNodeInfoTask (com.cubrid.cubridmanager.core.mondashboard.task.GetHeartbeatNodeInfoTask)2 Map (java.util.Map)2 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)1 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)1 GetBrokerConfParameterTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask)1 GetBrokerStatusInfosTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask)1 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)1 GetCMConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask)1 GetCubridConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask)1 HaNode (com.cubrid.cubridmanager.core.cubrid.service.model.HaNode)1 NodeType (com.cubrid.cubridmanager.core.cubrid.service.model.NodeType)1 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Dialog (org.eclipse.jface.dialogs.Dialog)1