Search in sources :

Example 11 with TopologyComponent

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();
}
Also used : TopologyComponent(com.hortonworks.streamline.streams.catalog.TopologyComponent)

Example 12 with TopologyComponent

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);
    }
}
Also used : TopologyComponent(com.hortonworks.streamline.streams.catalog.TopologyComponent) 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) QueryParam(com.hortonworks.registries.common.QueryParam)

Example 13 with 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));
}
Also used : TopologyComponent(com.hortonworks.streamline.streams.catalog.TopologyComponent) Topology(com.hortonworks.streamline.streams.catalog.Topology) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

TopologyComponent (com.hortonworks.streamline.streams.catalog.TopologyComponent)13 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 Topology (com.hortonworks.streamline.streams.catalog.Topology)5 TopologyOutputComponent (com.hortonworks.streamline.streams.catalog.TopologyOutputComponent)5 Timed (com.codahale.metrics.annotation.Timed)4 TopologyStream (com.hortonworks.streamline.streams.catalog.TopologyStream)4 StreamlineProcessor (com.hortonworks.streamline.streams.layout.component.StreamlineProcessor)4 SimpleImmutableEntry (java.util.AbstractMap.SimpleImmutableEntry)4 ArrayList (java.util.ArrayList)4 Path (javax.ws.rs.Path)4 Stream (com.hortonworks.streamline.streams.layout.component.Stream)3 Map (java.util.Map)3 GET (javax.ws.rs.GET)3 QueryParam (com.hortonworks.registries.common.QueryParam)2 TopologyBranchRule (com.hortonworks.streamline.streams.catalog.TopologyBranchRule)2 StreamGrouping (com.hortonworks.streamline.streams.catalog.TopologyEdge.StreamGrouping)2 TopologyRule (com.hortonworks.streamline.streams.catalog.TopologyRule)2 RulesProcessor (com.hortonworks.streamline.streams.layout.component.impl.RulesProcessor)2 Rule (com.hortonworks.streamline.streams.layout.component.rule.Rule)2 IOException (java.io.IOException)2