use of com.hortonworks.streamline.streams.catalog.TopologyProcessor in project streamline by hortonworks.
the class TopologyComponentFactory method getInputComponent.
private InputComponent getInputComponent(TopologyEdge topologyEdge) {
TopologySink topologySink;
TopologyProcessor topologyProcessor;
if ((topologySink = catalogService.getTopologySink(topologyEdge.getTopologyId(), topologyEdge.getToId(), topologyEdge.getVersionId())) != null) {
return getStreamlineSink(topologySink);
} else if ((topologyProcessor = catalogService.getTopologyProcessor(topologyEdge.getTopologyId(), topologyEdge.getToId(), topologyEdge.getVersionId())) != null) {
return getStreamlineProcessor(topologyProcessor);
} else {
throw new IllegalArgumentException("Invalid to id for edge " + topologyEdge);
}
}
use of com.hortonworks.streamline.streams.catalog.TopologyProcessor in project streamline by hortonworks.
the class TopologyExportVisitor method visit.
public void visit(RulesProcessor rulesProcessor) {
try {
TopologyComponentBundle componentBundle = streamCatalogService.getTopologyComponentBundle(Long.parseLong(rulesProcessor.getTopologyComponentBundleId()));
String subType = componentBundle.getSubType();
RulesHandler rulesHandler = rulesHandlerMap.get(subType);
for (Rule rule : rulesProcessor.getRules()) {
rulesHandler.handle(rule);
}
} catch (Exception e) {
throw new RuntimeException(String.format("Unexpected exception thrown while trying to add the rule %s", rulesProcessor.getId()), e);
}
TopologyProcessor topologyProcessor = streamCatalogService.getTopologyProcessor(topologyId, Long.parseLong(rulesProcessor.getId()));
topologyData.addProcessor(topologyProcessor);
storeBundleIdToType(rulesProcessor);
}
use of com.hortonworks.streamline.streams.catalog.TopologyProcessor in project streamline by hortonworks.
the class TopologyProcessorCatalogResource method getTopologyProcessorByIdAndVersion.
@GET
@Path("/topologies/{topologyId}/versions/{versionId}/processors/{id}")
@Timed
public Response getTopologyProcessorByIdAndVersion(@PathParam("topologyId") Long topologyId, @PathParam("id") Long processorId, @PathParam("versionId") Long versionId, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ);
TopologyProcessor processor = catalogService.getTopologyProcessor(topologyId, processorId, versionId);
if (processor != null) {
return WSUtils.respondEntity(processor, OK);
}
throw EntityNotFoundException.byVersion(buildMessageForCompositeId(topologyId, processorId), versionId.toString());
}
use of com.hortonworks.streamline.streams.catalog.TopologyProcessor in project streamline by hortonworks.
the class TopologyProcessorCatalogResource method removeTopologyProcessor.
/**
* <p>
* Removes a topology processor.
* </p>
* <b>DELETE /api/v1/catalog/topologies/:TOPOLOGY_ID/processors/:PROCESSOR_ID</b>
* <pre>
* {
* "responseCode": 1000,
* "responseMessage": "Success",
* "entity": {
* "id": 1,
* "topologyId": 1,
* "name": "ParserProcessor",
* "config": {
* "properties": {
* "parallelism": 5
* }
* },
* "type": "PARSER",
* "outputStreamIds": [1]
* }
* }
* </pre>
*/
@DELETE
@Path("/topologies/{topologyId}/processors/{id}")
@Timed
public Response removeTopologyProcessor(@PathParam("topologyId") Long topologyId, @PathParam("id") Long processorId, @javax.ws.rs.QueryParam("removeEdges") boolean removeEdges, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, WRITE);
TopologyProcessor topologyProcessor = catalogService.removeTopologyProcessor(topologyId, processorId, removeEdges);
if (topologyProcessor != null) {
return WSUtils.respondEntity(topologyProcessor, OK);
}
throw EntityNotFoundException.byId(processorId.toString());
}
use of com.hortonworks.streamline.streams.catalog.TopologyProcessor in project streamline by hortonworks.
the class TopologyProcessorCatalogResource method addOrUpdateTopologyProcessor.
/**
* <p>Updates a topology processor.</p>
* <p>
* <b>PUT /api/v1/catalog/topologies/:TOPOLOGY_ID/processors/:PROCESSOR_ID</b>
* <pre>
* {
* "name": "ParserProcessor",
* "config": {
* "properties": {
* "parallelism": 5
* }
* },
* "type": "PARSER",
* "outputStreamIds": [1]
* }
* </pre>
* <i>Sample success response: </i>
* <pre>
* {
* "responseCode": 1000,
* "responseMessage": "Success",
* "entity": {
* "id": 1,
* "topologyId": 1,
* "name": "ParserProcessor",
* "config": {
* "properties": {
* "parallelism": 5
* }
* },
* "type": "PARSER",
* "outputStreamIds": [1]
* }
* }
* </pre>
*/
@PUT
@Path("/topologies/{topologyId}/processors/{id}")
@Timed
public Response addOrUpdateTopologyProcessor(@PathParam("topologyId") Long topologyId, @PathParam("id") Long processorId, TopologyProcessor topologyProcessor, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, WRITE);
TopologyProcessor createdTopologyProcessor = catalogService.addOrUpdateTopologyProcessor(topologyId, processorId, topologyProcessor);
return WSUtils.respondEntity(createdTopologyProcessor, CREATED);
}
Aggregations