use of com.hortonworks.streamline.streams.catalog.TopologyStream in project streamline by hortonworks.
the class TopologyStreamCatalogResource method removeStreamInfo.
/**
* <p>
* Removes a stream resource.
* </p>
* <b>DELETE /api/v1/catalog/topologies/:TOPOLOGY_ID/streams/:STREAM_ID</b>
* <pre>
* {
* "responseCode": 1000,
* "responseMessage": "Success",
* "entity": {
* "id": 1,
* "streamId": "default",
* "topologyId": 1,
* "fields": [
* {
* "name": "f1",
* "type": "STRING",
* "optional": false
* },
* {
* "name": "f2",
* "type": "LONG",
* "optional": false
* }
* ],
* "timestamp": 1463238609751
* }
* }
* </pre>
*/
@DELETE
@Path("/topologies/{topologyId}/streams/{id}")
@Timed
public Response removeStreamInfo(@PathParam("topologyId") Long topologyId, @PathParam("id") Long id, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, WRITE);
TopologyStream removedStream = catalogService.removeStreamInfo(topologyId, id);
if (removedStream != null) {
return WSUtils.respondEntity(removedStream, OK);
}
throw EntityNotFoundException.byId(buildMessageForCompositeId(topologyId, id));
}
use of com.hortonworks.streamline.streams.catalog.TopologyStream in project streamline by hortonworks.
the class TopologyComponentFactory method updateWithSchemas.
private void updateWithSchemas(Long topologyId, Long versionId, Map<String, NormalizationConfig> normalizationConfigRead) {
for (Map.Entry<String, NormalizationConfig> entry : normalizationConfigRead.entrySet()) {
NormalizationConfig normalizationConfig = entry.getValue();
TopologyStream topologyStream = catalogService.getStreamInfoByName(topologyId, entry.getKey(), versionId);
if (topologyStream != null) {
normalizationConfig.setInputSchema(topologyStream.getSchema());
}
}
}
use of com.hortonworks.streamline.streams.catalog.TopologyStream 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()));
}
}
use of com.hortonworks.streamline.streams.catalog.TopologyStream in project streamline by hortonworks.
the class StreamCatalogService method fillProcessorStreams.
private Collection<TopologyProcessor> fillProcessorStreams(Collection<TopologyProcessor> processors) {
if (processors != null) {
for (TopologyProcessor processor : processors) {
List<TopologyStream> topologyStreams = getOutputStreams(processor);
processor.setOutputStreams(topologyStreams);
processor.setOutputStreamIds(new ArrayList<>(Collections2.transform(topologyStreams, new Function<TopologyStream, Long>() {
@Nullable
@Override
public Long apply(@Nullable TopologyStream input) {
return input.getId();
}
})));
}
}
return processors;
}
use of com.hortonworks.streamline.streams.catalog.TopologyStream in project streamline by hortonworks.
the class StreamCatalogService method addOrUpdateStreamInfo.
public TopologyStream addOrUpdateStreamInfo(Long topologyId, Long id, TopologyStream stream) {
stream.setId(id);
Long currentVersionId = getCurrentVersionId(topologyId);
stream.setVersionId(currentVersionId);
stream.setTopologyId(topologyId);
long timestamp = System.currentTimeMillis();
stream.setVersionTimestamp(timestamp);
validateStreamInfo(stream);
TopologyStream curStream = getStreamInfo(topologyId, stream.getId());
if (!curStream.getFields().equals(stream.getFields())) {
setReconfigureTarget(stream);
}
dao.addOrUpdate(stream);
updateVersionTimestamp(currentVersionId, timestamp);
return stream;
}
Aggregations