use of com.hortonworks.streamline.streams.catalog.TopologyComponent in project streamline by hortonworks.
the class StreamCatalogService method getNextTopologyComponentId.
/**
* Generate id from the {@link TopologyComponent} namespace
* so that its unique across source, sink and processors.
* Similar to Table per concrete class hibernate strategy.
*/
private Long getNextTopologyComponentId() {
TopologyComponent component = new TopologyComponent();
Long id = dao.nextId(TOPOLOGY_COMPONENT_NAMESPACE);
component.setId(id);
dao.add(component);
dao.remove(component.getStorableKey());
return component.getId();
}
use of com.hortonworks.streamline.streams.catalog.TopologyComponent in project streamline by hortonworks.
the class StreamCatalogService method setReconfigureOnAllComponentsInTopology.
public void setReconfigureOnAllComponentsInTopology(Topology topology) {
List<TopologyComponent> topologyComponents = new ArrayList<>();
List<com.hortonworks.registries.common.QueryParam> queryParams = new ArrayList<>();
queryParams.add(new com.hortonworks.registries.common.QueryParam("topologyId", String.valueOf(topology.getId())));
queryParams.add(new com.hortonworks.registries.common.QueryParam("versionId", String.valueOf(topology.getVersionId())));
topologyComponents.addAll(listTopologySources(queryParams));
topologyComponents.addAll(listTopologyProcessors(queryParams));
topologyComponents.addAll(listTopologySinks(queryParams));
for (TopologyComponent topologyComponent : topologyComponents) {
setReconfigureOnTopologyComponent(topologyComponent);
}
}
use of com.hortonworks.streamline.streams.catalog.TopologyComponent in project streamline by hortonworks.
the class TopologyEventSamplingResource method disableSampling.
@POST
@Path("/topologies/{topologyId}/component/{componentId}/sampling/disable")
@Timed
public Response disableSampling(@PathParam("topologyId") Long topologyId, @PathParam("componentId") Long componentId, @Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, READ, EXECUTE);
Topology topology = catalogService.getTopology(topologyId);
TopologyComponent topologyComponent = catalogService.getTopologyComponent(topologyId, componentId);
if (topology != null && topologyComponent != null) {
String asUser = WSUtils.getUserFromSecurityContext(securityContext);
boolean success = samplingService.disableSampling(topology, topologyComponent, asUser);
return WSUtils.respondEntity(SamplingResponse.of(topologyId).componentId(componentId).success(success).build(), OK);
}
throw EntityNotFoundException.byId(buildTopologyComponentId(topologyId, componentId));
}
Aggregations