use of com.hortonworks.streamline.streams.catalog.TopologyStream in project streamline by hortonworks.
the class StreamCatalogService method importOutputStreams.
private List<Long> importOutputStreams(Long newTopologyId, Map<Long, Long> oldToNewStreamIds, List<TopologyStream> streams) {
List<Long> importedOutputStreamIds = new ArrayList<>();
for (TopologyStream stream : streams) {
Long oldId = stream.getId();
Long newId = oldToNewStreamIds.get(oldId);
if (newId == null) {
stream.setId(null);
TopologyStream addedTopologyStream = addStreamInfo(newTopologyId, stream);
newId = addedTopologyStream.getId();
oldToNewStreamIds.put(oldId, newId);
}
importedOutputStreamIds.add(newId);
}
return importedOutputStreamIds;
}
use of com.hortonworks.streamline.streams.catalog.TopologyStream 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;
}
use of com.hortonworks.streamline.streams.catalog.TopologyStream in project streamline by hortonworks.
the class StreamCatalogService method getOutputStreams.
private List<TopologyStream> getOutputStreams(TopologySource topologySource) {
List<TopologyStream> streams = new ArrayList<>();
if (topologySource != null) {
QueryParam qp1 = new QueryParam(TopologySourceStreamMap.FIELD_SOURCE_ID, String.valueOf(topologySource.getId()));
QueryParam qp2 = new QueryParam(TopologySourceStreamMap.FIELD_VERSION_ID, String.valueOf(topologySource.getVersionId()));
for (TopologySourceStreamMap mapping : listTopologySourceStreamMapping(ImmutableList.of(qp1, qp2))) {
TopologyStream topologyStream = getStreamInfo(topologySource.getTopologyId(), mapping.getStreamId(), topologySource.getVersionId());
if (topologyStream != null) {
streams.add(topologyStream);
}
}
}
return streams;
}
use of com.hortonworks.streamline.streams.catalog.TopologyStream in project streamline by hortonworks.
the class StreamCatalogService method updateOutputStreams.
private List<Long> updateOutputStreams(TopologyOutputComponent outputComponent) {
List<Long> newStreamIds = new ArrayList<>();
for (TopologyStream topologyStream : outputComponent.getOutputStreams()) {
if (topologyStream.getId() != null && getStreamInfo(outputComponent.getTopologyId(), topologyStream.getId()) != null) {
addOrUpdateStreamInfo(outputComponent.getTopologyId(), topologyStream.getId(), topologyStream);
newStreamIds.add(topologyStream.getId());
} else {
newStreamIds.add(addStreamInfo(outputComponent.getTopologyId(), topologyStream).getId());
}
}
return newStreamIds;
}
use of com.hortonworks.streamline.streams.catalog.TopologyStream in project streamline by hortonworks.
the class StreamCatalogService method setReconfigureTarget.
private void setReconfigureTarget(TopologyEdge edge, TopologyStream stream) {
TopologyComponent component = getTo(edge);
component.setReconfigure(true);
dao.addOrUpdate(component);
// if component is a processor, update any rules in that processor that uses any of the streams
if (component instanceof TopologyProcessor) {
setReconfigureRules(Collections.singletonList((TopologyProcessor) component), edge.getStreamGroupings().stream().map(StreamGrouping::getStreamId).map(sid -> getStreamInfo(edge.getTopologyId(), sid, edge.getVersionId())).filter(curStream -> stream == null || curStream.getId().equals(stream.getId())).collect(Collectors.toList()));
}
}
Aggregations