Search in sources :

Example 11 with AutoKeeperCluster

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

the class NodeAction method doAdd.

public void doAdd(@FormGroup("nodeInfo") Group nodeInfo, @FormGroup("nodeParameterInfo") Group nodeParameterInfo, @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.create(node);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidNode");
        return;
    }
    nav.redirectTo(WebConstant.NODE_LIST_LINK);
}
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)

Example 12 with AutoKeeperCluster

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

the class AutoKeeperClustersDetail method execute.

public void execute(@Param("clusterId") String clusterId, Context context) throws Exception {
    Map<String, AutoKeeperServerStat> statMap = new HashMap<String, AutoKeeperServerStat>();
    AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(Long.valueOf(clusterId));
    for (String address : autoKeeperCluster.getServerList()) {
        AutoKeeperServerStat autoKeeperServerStat = autoKeeperStatService.findServerStat(address);
        statMap.put(address, autoKeeperServerStat);
    }
    context.put("clusterId", clusterId);
    context.put("statMap", statMap);
}
Also used : HashMap(java.util.HashMap) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster) AutoKeeperServerStat(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperServerStat)

Example 13 with AutoKeeperCluster

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

the class AutoKeeperClustersList method execute.

public void execute(@Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, Context context) throws Exception {
    @SuppressWarnings("unchecked") Map<String, Object> condition = new HashMap<String, Object>();
    if ("请输入关键字(目前支持Zookeeper的地址搜索)".equals(searchKey)) {
        searchKey = "";
    }
    condition.put("searchKey", searchKey);
    int count = autoKeeperClusterService.getCount();
    Paginator paginator = new Paginator();
    paginator.setItems(count);
    paginator.setPage(pageIndex);
    condition.put("offset", paginator.getOffset());
    condition.put("length", paginator.getLength());
    List<AutoKeeperCluster> autoKeeperClusters = autoKeeperClusterService.listAutoKeeperClusters();
    context.put("paginator", paginator);
    context.put("autoKeeperClusters", autoKeeperClusters);
}
Also used : HashMap(java.util.HashMap) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster) Paginator(com.alibaba.citrus.util.Paginator)

Example 14 with AutoKeeperCluster

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

the class EditAutoKeeper method execute.

/**
     * 找到单个Channel,用于编辑Channel信息界面加载信息
     * 
     * @param channelId
     * @param context
     * @throws WebxException
     */
public void execute(@Param("clusterId") Long clusterId, Context context, Navigator nav) throws Exception {
    AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(clusterId);
    context.put("autoKeeperCluster", autoKeeperCluster);
}
Also used : AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)

Example 15 with AutoKeeperCluster

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

the class EditNode method execute.

/**
     * 找到单个Channel,用于编辑Channel信息界面加载信息
     * 
     * @param channelId
     * @param context
     * @throws WebxException
     */
public void execute(@Param("nodeId") Long nodeId, @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, Context context, Navigator nav) throws Exception {
    Node node = nodeService.findById(nodeId);
    if (node.getStatus().isStart()) {
        nav.redirectTo(WebConstant.ERROR_FORBIDDEN_Link);
        return;
    }
    List<AutoKeeperCluster> zkClusters = autoKeeperClusterService.listAutoKeeperClusters();
    context.put("zkClusters", zkClusters);
    context.put("node", node);
    context.put("pageIndex", pageIndex);
    context.put("searchKey", searchKey);
}
Also used : 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