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