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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations