Search in sources :

Example 6 with AutoKeeperCluster

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

the class CanalInfo method execute.

public void execute(@Param("canalId") Long canalId, Context context) throws Exception {
    Canal canal = canalService.findById(canalId);
    AutoKeeperCluster zkCluster = autoKeeperClusterService.findAutoKeeperClusterById(canal.getCanalParameter().getZkClusterId());
    List<Pipeline> pipelines = pipelineService.listByDestinationWithoutOther(canal.getName());
    List<Long> channelIds = new ArrayList<Long>();
    for (Pipeline pipeline : pipelines) {
        channelIds.add(pipeline.getChannelId());
    }
    List<Channel> channels = channelService.listOnlyChannels(channelIds.toArray(new Long[channelIds.size()]));
    Map<Long, Channel> channelMap = new HashMap<Long, Channel>();
    for (Channel channel : channels) {
        channelMap.put(channel.getId(), channel);
    }
    context.put("canal", canal);
    context.put("pipelines", pipelines);
    context.put("channelMap", channelMap);
    context.put("zkCluster", zkCluster);
}
Also used : HashMap(java.util.HashMap) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) ArrayList(java.util.ArrayList) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Example 7 with AutoKeeperCluster

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

the class EditCanal method execute.

/**
     * @param context
     * @throws WebxException
     */
public void execute(@Param("canalId") Long canalId, Context context) throws Exception {
    Canal canal = canalService.findById(canalId);
    List<AutoKeeperCluster> zkClusters = autoKeeperClusterService.listAutoKeeperClusters();
    context.put("zkClusters", zkClusters);
    context.put("canal", canal);
}
Also used : Canal(com.alibaba.otter.canal.instance.manager.model.Canal) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)

Example 8 with AutoKeeperCluster

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

the class CanalServiceImpl method doToModel.

/**
     * 用于DO对象转化为Model对象
     * 
     * @param canalDo
     * @return Canal
     */
private Canal doToModel(CanalDO canalDo) {
    Canal canal = new Canal();
    try {
        canal.setId(canalDo.getId());
        canal.setName(canalDo.getName());
        canal.setStatus(canalDo.getStatus());
        canal.setDesc(canalDo.getDescription());
        CanalParameter parameter = canalDo.getParameters();
        AutoKeeperCluster zkCluster = autoKeeperClusterService.findAutoKeeperClusterById(parameter.getZkClusterId());
        if (zkCluster != null) {
            parameter.setZkClusters(Arrays.asList(StringUtils.join(zkCluster.getServerList(), ',')));
        }
        canal.setCanalParameter(canalDo.getParameters());
        canal.setGmtCreate(canalDo.getGmtCreate());
        canal.setGmtModified(canalDo.getGmtModified());
    } catch (Exception e) {
        logger.error("ERROR ## change the canal Do to Model has an exception");
        throw new ManagerException(e);
    }
    return canal;
}
Also used : CanalParameter(com.alibaba.otter.canal.instance.manager.model.CanalParameter) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) 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 9 with AutoKeeperCluster

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

the class AutoKeeperClusterAction method doRefresh.

public void doRefresh(@Param("clusterId") Long clusterId, Navigator nav) throws Exception {
    AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(clusterId);
    for (String address : autoKeeperCluster.getServerList()) {
        autoKeeperCollector.collectorServerStat(address);
        autoKeeperCollector.collectorConnectionStat(address);
        autoKeeperCollector.collectorWatchStat(address);
        autoKeeperCollector.collectorEphemeralStat(address);
    }
    nav.redirectToLocation("/auto_keeper_clusters_list.htm");
}
Also used : AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)

Example 10 with AutoKeeperCluster

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

the class NodeAction method doEdit.

/**
     * 修改Node
     */
public void doEdit(@FormGroup("nodeInfo") Group nodeInfo, @FormGroup("nodeParameterInfo") Group nodeParameterInfo, @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @FormField(name = "formNodeError", group = "nodeInfo") CustomErrors err, Navigator nav) throws Exception {
    Node node = new Node();
    NodeParameter parameter = new NodeParameter();
    nodeInfo.setProperties(node);
    nodeParameterInfo.setProperties(parameter);
    if (parameter.getDownloadPort() == null || parameter.getDownloadPort() == 0) {
        parameter.setDownloadPort(node.getPort().intValue() + 1);
    }
    if (parameter.getMbeanPort() == null || parameter.getMbeanPort() == 0) {
        parameter.setMbeanPort(node.getPort().intValue() + 2);
    }
    Long autoKeeperclusterId = nodeParameterInfo.getField("autoKeeperclusterId").getLongValue();
    if (autoKeeperclusterId != null && autoKeeperclusterId > 0) {
        AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(autoKeeperclusterId);
        parameter.setZkCluster(autoKeeperCluster);
    }
    node.setParameters(parameter);
    try {
        nodeService.modify(node);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidNode");
        return;
    }
    nav.redirectToLocation("nodeList.htm?pageIndex=" + pageIndex + "&searchKey=" + urlEncode(searchKey));
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) 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)

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