Search in sources :

Example 1 with TopologyProcessorStreamMap

use of com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap in project streamline by hortonworks.

the class StreamCatalogService method removeProcessorStreamMapping.

private void removeProcessorStreamMapping(TopologyProcessor topologyProcessor, List<Long> streamIds) {
    if (topologyProcessor != null) {
        for (Long outputStreamId : streamIds) {
            TopologyProcessorStreamMap mapping = new TopologyProcessorStreamMap(topologyProcessor.getId(), topologyProcessor.getVersionId(), outputStreamId);
            dao.<TopologyProcessorStreamMap>remove(mapping.getStorableKey());
        }
    }
}
Also used : TopologyProcessorStreamMap(com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap)

Example 2 with TopologyProcessorStreamMap

use of com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap in project streamline by hortonworks.

the class StreamCatalogService method getOutputStreams.

private List<TopologyStream> getOutputStreams(TopologyProcessor topologyProcessor) {
    List<TopologyStream> streams = new ArrayList<>();
    if (topologyProcessor != null) {
        QueryParam qp1 = new QueryParam(TopologyProcessorStreamMap.FIELD_PROCESSOR_ID, String.valueOf(topologyProcessor.getId()));
        QueryParam qp2 = new QueryParam(TopologyProcessorStreamMap.FIELD_VERSION_ID, String.valueOf(topologyProcessor.getVersionId()));
        for (TopologyProcessorStreamMap mapping : listTopologyProcessorStreamMapping(ImmutableList.of(qp1, qp2))) {
            TopologyStream topologyStream = getStreamInfo(topologyProcessor.getTopologyId(), mapping.getStreamId(), topologyProcessor.getVersionId());
            if (topologyStream != null) {
                streams.add(topologyStream);
            }
        }
    }
    return streams;
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList) TopologyProcessorStreamMap(com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap) TopologyStream(com.hortonworks.streamline.streams.catalog.TopologyStream)

Example 3 with TopologyProcessorStreamMap

use of com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap in project streamline by hortonworks.

the class StreamCatalogService method createProcessorStreamMapping.

private void createProcessorStreamMapping(TopologyProcessor topologyProcessor, List<TopologyStream> streams) {
    for (TopologyStream outputStream : streams) {
        TopologyStream addedStream = addStreamInfo(topologyProcessor.getTopologyId(), outputStream);
        dao.<TopologyProcessorStreamMap>add(new TopologyProcessorStreamMap(topologyProcessor.getId(), topologyProcessor.getVersionId(), addedStream.getId()));
    }
}
Also used : TopologyProcessorStreamMap(com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap) TopologyStream(com.hortonworks.streamline.streams.catalog.TopologyStream)

Example 4 with TopologyProcessorStreamMap

use of com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap in project streamline by hortonworks.

the class StreamCatalogService method getOutputStreamIds.

private List<Long> getOutputStreamIds(TopologyProcessor topologyProcessor) {
    List<Long> streamIds = new ArrayList<>();
    if (topologyProcessor != null) {
        QueryParam qp1 = new QueryParam(TopologyProcessorStreamMap.FIELD_PROCESSOR_ID, String.valueOf(topologyProcessor.getId()));
        QueryParam qp2 = new QueryParam(TopologyProcessorStreamMap.FIELD_VERSION_ID, String.valueOf(topologyProcessor.getVersionId()));
        for (TopologyProcessorStreamMap mapping : listTopologyProcessorStreamMapping(ImmutableList.of(qp1, qp2))) {
            streamIds.add(mapping.getStreamId());
        }
    }
    return streamIds;
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList) TopologyProcessorStreamMap(com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap)

Aggregations

TopologyProcessorStreamMap (com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap)4 QueryParam (com.hortonworks.registries.common.QueryParam)2 WSUtils.buildEdgesFromQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam)2 WSUtils.buildEdgesToQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)2 WSUtils.currentVersionQueryParam (com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam)2 WSUtils.versionIdQueryParam (com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam)2 TopologyStream (com.hortonworks.streamline.streams.catalog.TopologyStream)2 ArrayList (java.util.ArrayList)2