Search in sources :

Example 56 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class ChannelCheck method execute.

public void execute(@Param("id") Long id) {
    try {
        Channel channel = channelService.findById(id);
        returnSuccess(channel.getStatus().toString());
    } catch (Exception e) {
        String errorMsg = String.format("error happens while [check status] channel with id [%d]", id);
        log.error(errorMsg, e);
        returnError(errorMsg);
    }
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel)

Example 57 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class ChannelInfo method execute.

public void execute(@Param("channelId") Long channelId, Context context) throws Exception {
    Channel channel = channelService.findById(channelId);
    context.put("channel", channel);
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel)

Example 58 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class ChannelList method execute.

public void execute(@Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @Param("channelStatus") String status, @Param("channelId") Long channelId, @Param("errorType") String errorType, Context context) throws Exception {
    @SuppressWarnings("unchecked") Map<String, Object> condition = new HashMap<String, Object>();
    if ("请输入关键字(目前支持Channel的ID、名字搜索)".equals(searchKey)) {
        searchKey = "";
    }
    condition.put("searchKey", searchKey);
    List<Long> theStatusPks = new ArrayList<Long>();
    if (null != status) {
        List<Long> allChannelPks = channelService.listAllChannelId();
        for (Long channelPk : allChannelPks) {
            ChannelStatus channelStatus = arbitrateManageService.channelEvent().status(channelPk);
            if (channelStatus.equals(ChannelStatus.valueOf(status))) {
                theStatusPks.add(channelPk);
            }
        }
    }
    int count = channelService.getCount(condition);
    Paginator paginator = new Paginator();
    paginator.setItems(count);
    paginator.setPage(pageIndex);
    condition.put("offset", paginator.getOffset());
    condition.put("length", paginator.getLength());
    List<Channel> channels = new ArrayList<Channel>();
    if ((null != channelId) && (channelId != 0l)) {
        channels.add(channelService.findById(channelId));
        paginator.setItems(1);
        paginator.setPage(0);
        // 定义为新的searchKey
        searchKey = String.valueOf(channelId);
    } else {
        channels = channelService.listByConditionWithoutColumn(condition);
    }
    List<SeniorChannel> seniorChannels = new ArrayList<SeniorChannel>();
    for (Channel channel : channels) {
        boolean processEmpty = false;
        List<Pipeline> pipelines = channel.getPipelines();
        for (Pipeline pipeline : pipelines) {
            if (processStatService.listRealtimeProcessStat(channel.getId(), pipeline.getId()).isEmpty()) {
                processEmpty = true;
            }
        }
        SeniorChannel seniorChannel = new SeniorChannel();
        seniorChannel.setId(channel.getId());
        seniorChannel.setName(channel.getName());
        seniorChannel.setParameters(channel.getParameters());
        seniorChannel.setPipelines(channel.getPipelines());
        seniorChannel.setStatus(channel.getStatus());
        seniorChannel.setDescription(channel.getDescription());
        seniorChannel.setGmtCreate(channel.getGmtCreate());
        seniorChannel.setGmtModified(channel.getGmtModified());
        seniorChannel.setProcessEmpty(processEmpty);
        seniorChannels.add(seniorChannel);
    }
    context.put("channels", seniorChannels);
    context.put("paginator", paginator);
    context.put("searchKey", searchKey);
    context.put("errorType", errorType);
}
Also used : HashMap(java.util.HashMap) SeniorChannel(com.alibaba.otter.manager.web.common.model.SeniorChannel) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) ArrayList(java.util.ArrayList) ChannelStatus(com.alibaba.otter.shared.common.model.config.channel.ChannelStatus) Paginator(com.alibaba.citrus.util.Paginator) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) SeniorChannel(com.alibaba.otter.manager.web.common.model.SeniorChannel)

Example 59 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class DataMediaPairInfo method execute.

public void execute(@Param("dataMediaPairId") Long dataMediaPairId, Context context) throws Exception {
    DataMediaPair dataMediaPair = dataMediaPairService.findById(dataMediaPairId);
    Channel channel = channelService.findByPipelineId(dataMediaPair.getPipelineId());
    List<ColumnPair> columnPairs = dataMediaPair.getColumnPairs();
    List<ColumnGroup> columnGroups = dataMediaPair.getColumnGroups();
    // 暂时策略,只拿出list的第一个Group
    ColumnGroup columnGroup = new ColumnGroup();
    if (!CollectionUtils.isEmpty(columnGroups)) {
        columnGroup = columnGroups.get(0);
    }
    context.put("dataMediaPair", dataMediaPair);
    context.put("columnGroup", columnGroup);
    context.put("columnPairs", columnPairs);
    context.put("channelId", channel.getId());
}
Also used : ColumnPair(com.alibaba.otter.shared.common.model.config.data.ColumnPair) DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) ColumnGroup(com.alibaba.otter.shared.common.model.config.data.ColumnGroup)

Example 60 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class EditChannel method execute.

/**
     * 找到单个Channel,用于编辑Channel信息界面加载信息
     * 
     * @param channelId
     * @param context
     * @throws WebxException
     */
public void execute(@Param("channelId") Long channelId, @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, Context context, Navigator nav) throws Exception {
    Channel channel = channelService.findById(channelId);
    if (channel.getStatus().isStart()) {
        nav.redirectTo(WebConstant.ERROR_FORBIDDEN_Link);
        return;
    }
    context.put("channel", channel);
    context.put("pageIndex", pageIndex);
    context.put("searchKey", searchKey);
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel)

Aggregations

Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)77 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)38 Mock (mockit.Mock)16 ArrayList (java.util.ArrayList)13 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)10 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)10 ChannelArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent)10 BeforeClass (org.testng.annotations.BeforeClass)10 PipelineArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.PipelineArbitrateEvent)9 InvalidConfigureException (com.alibaba.otter.manager.biz.common.exceptions.InvalidConfigureException)8 NodeArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent)8 Node (com.alibaba.otter.shared.common.model.config.node.Node)7 Event (com.alibaba.otter.shared.communication.core.model.Event)7 Test (org.testng.annotations.Test)7 ChannelStatus (com.alibaba.otter.shared.common.model.config.channel.ChannelStatus)6 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)6 HashMap (java.util.HashMap)6 ChannelDO (com.alibaba.otter.manager.biz.config.channel.dal.dataobject.ChannelDO)5 SystemParameter (com.alibaba.otter.shared.common.model.config.parameter.SystemParameter)5 Identity (com.alibaba.otter.shared.etl.model.Identity)5