Search in sources :

Example 1 with AutoKeeperCluster

use of com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster in project otter by alibaba.

the class AutoKeeperClusterAction method doEdit.

public void doEdit(@FormGroup("autokeeperClusterInfo") Group autokeeperClusterInfo, @FormField(name = "formAutokeeperClusterError", group = "autokeeperClusterInfo") CustomErrors err, Navigator nav) throws Exception {
    AutoKeeperCluster autoKeeperCluster = new AutoKeeperCluster();
    autokeeperClusterInfo.setProperties(autoKeeperCluster);
    String zkClustersString = autokeeperClusterInfo.getField("zookeeperClusters").getStringValue();
    String[] zkClusters = StringUtils.split(zkClustersString, ";");
    autoKeeperCluster.setServerList(Arrays.asList(zkClusters));
    try {
        autoKeeperClusterService.modifyAutoKeeperCluster(autoKeeperCluster);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidChannelName");
        return;
    }
    nav.redirectTo(WebConstant.AUTO_KEEPER_CLUSTERS_LINK);
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)

Example 2 with AutoKeeperCluster

use of com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster in project otter by alibaba.

the class AutoKeeperClusterAction method doAdd.

public void doAdd(@FormGroup("autokeeperClusterInfo") Group autokeeperClusterInfo, @FormField(name = "formAutokeeperClusterError", group = "autokeeperClusterInfo") CustomErrors err, Navigator nav) throws Exception {
    AutoKeeperCluster autoKeeperCluster = new AutoKeeperCluster();
    autokeeperClusterInfo.setProperties(autoKeeperCluster);
    String zkClustersString = autokeeperClusterInfo.getField("zookeeperClusters").getStringValue();
    String[] zkClusters = StringUtils.split(zkClustersString, ";");
    autoKeeperCluster.setServerList(Arrays.asList(zkClusters));
    try {
        autoKeeperClusterService.createAutoKeeperCluster(autoKeeperCluster);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidNode");
        return;
    }
    nav.redirectTo(WebConstant.AUTO_KEEPER_CLUSTERS_LINK);
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)

Example 3 with AutoKeeperCluster

use of com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster in project otter by alibaba.

the class NodeServiceImpl method doToModel.

/**
     * 用于DO对象转化为Model对象
     * 
     * @param nodeDo
     * @return Node
     */
private Node doToModel(NodeDO nodeDo) {
    Node node = new Node();
    try {
        node.setId(nodeDo.getId());
        node.setIp(nodeDo.getIp());
        node.setName(nodeDo.getName());
        node.setPort(nodeDo.getPort());
        node.setDescription(nodeDo.getDescription());
        node.setStatus(nodeDo.getStatus());
        // 处理下zk集群
        NodeParameter parameter = nodeDo.getParameters();
        if (parameter.getZkCluster() != null) {
            AutoKeeperCluster zkCluster = autoKeeperClusterService.findAutoKeeperClusterById(parameter.getZkCluster().getId());
            parameter.setZkCluster(zkCluster);
        }
        node.setParameters(parameter);
        node.setGmtCreate(nodeDo.getGmtCreate());
        node.setGmtModified(nodeDo.getGmtModified());
    } catch (Exception e) {
        logger.error("ERROR ## change the node Do to Model has an exception");
        throw new ManagerException(e);
    }
    return node;
}
Also used : NodeParameter(com.alibaba.otter.shared.common.model.config.node.NodeParameter) Node(com.alibaba.otter.shared.common.model.config.node.Node) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)

Example 4 with AutoKeeperCluster

use of com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster in project otter by alibaba.

the class AutoKeeperClusterServiceImpl method doToModel.

private AutoKeeperCluster doToModel(AutoKeeperClusterDO autoKeeperClusterDo) {
    AutoKeeperCluster autoKeeperCluster = new AutoKeeperCluster();
    autoKeeperCluster.setId(autoKeeperClusterDo.getId());
    autoKeeperCluster.setClusterName(autoKeeperClusterDo.getClusterName());
    autoKeeperCluster.setDescription(autoKeeperClusterDo.getDescription());
    autoKeeperCluster.setServerList(JsonUtils.unmarshalFromString(autoKeeperClusterDo.getServerList(), new TypeReference<List<String>>() {
    }));
    autoKeeperCluster.setGmtCreate(autoKeeperClusterDo.getGmtCreate());
    autoKeeperCluster.setGmtModified(autoKeeperClusterDo.getGmtModified());
    return autoKeeperCluster;
}
Also used : AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster) TypeReference(com.alibaba.fastjson.TypeReference)

Example 5 with AutoKeeperCluster

use of com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster in project otter by alibaba.

the class AutoKeeperClientPath method execute.

public void execute(@Param("clusterId") String clusterId, @Param("address") String address, Context context) throws Exception {
    AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(Long.valueOf(clusterId));
    Set<AutoKeeperConnectionStat> autoKeeperConnectionStats = new HashSet<AutoKeeperConnectionStat>();
    for (String ipAddress : autoKeeperCluster.getServerList()) {
        if (ipAddress.equalsIgnoreCase(address)) {
            AutoKeeperServerStat autoKeeperServerStat = autoKeeperStatService.findServerStat(ipAddress);
            if (autoKeeperServerStat != null) {
                autoKeeperConnectionStats = autoKeeperServerStat.getConnectionStats();
            } else {
                autoKeeperConnectionStats = new HashSet<AutoKeeperConnectionStat>();
            }
        }
    }
    context.put("autoKeeperConnectionStats", autoKeeperConnectionStats);
}
Also used : AutoKeeperConnectionStat(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperConnectionStat) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster) AutoKeeperServerStat(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperServerStat) HashSet(java.util.HashSet)

Aggregations

AutoKeeperCluster (com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)15 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)6 Node (com.alibaba.otter.shared.common.model.config.node.Node)4 Canal (com.alibaba.otter.canal.instance.manager.model.Canal)3 NodeParameter (com.alibaba.otter.shared.common.model.config.node.NodeParameter)3 HashMap (java.util.HashMap)3 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)2 AutoKeeperServerStat (com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperServerStat)2 Paginator (com.alibaba.citrus.util.Paginator)1 TypeReference (com.alibaba.fastjson.TypeReference)1 CanalParameter (com.alibaba.otter.canal.instance.manager.model.CanalParameter)1 AutoKeeperConnectionStat (com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperConnectionStat)1 Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)1 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1