Search in sources :

Example 6 with TopologyComponentBundle

use of com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle in project streamline by hortonworks.

the class StreamCatalogService method listTopologyComponentBundlesForTypeWithFilter.

public Collection<TopologyComponentBundle> listTopologyComponentBundlesForTypeWithFilter(TopologyComponentBundle.TopologyComponentType componentType, List<QueryParam> params) {
    List<TopologyComponentBundle> topologyComponentBundles = new ArrayList<>();
    String ns = TopologyComponentBundle.NAME_SPACE;
    Collection<TopologyComponentBundle> filtered = dao.find(ns, params);
    for (TopologyComponentBundle tcb : filtered) {
        if (tcb.getType().equals(componentType)) {
            topologyComponentBundles.add(tcb);
        }
    }
    return topologyComponentBundles;
}
Also used : ArrayList(java.util.ArrayList) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Example 7 with TopologyComponentBundle

use of com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle in project streamline by hortonworks.

the class TopologyComponentFactory method getTopologyComponentBundle.

private TopologyComponentBundle getTopologyComponentBundle(TopologyComponent topologyComponent) {
    TopologyComponentBundle topologyComponentBundle = catalogService.getTopologyComponentBundle(topologyComponent.getTopologyComponentBundleId());
    if (topologyComponentBundle == null) {
        String msg = "TopologyComponentBundle not found for topologyComponent " + topologyComponent;
        LOG.debug(msg);
        throw new RuntimeException(msg);
    }
    return topologyComponentBundle;
}
Also used : TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Example 8 with TopologyComponentBundle

use of com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle 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);
}
Also used : Rule(com.hortonworks.streamline.streams.layout.component.rule.Rule) TopologyBranchRule(com.hortonworks.streamline.streams.catalog.TopologyBranchRule) TopologyRule(com.hortonworks.streamline.streams.catalog.TopologyRule) TopologyProcessor(com.hortonworks.streamline.streams.catalog.TopologyProcessor) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Example 9 with TopologyComponentBundle

use of com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle in project streamline by hortonworks.

the class TopologyComponentFactory method getStreamlineComponent.

private <T extends StreamlineComponent> T getStreamlineComponent(Class<T> clazz, TopologyComponent topologyComponent) {
    if (topologyComponent.getReconfigure()) {
        throw new IllegalStateException("Topology component " + topologyComponent + " must be reconfigured");
    }
    TopologyComponentBundle topologyComponentBundle = getTopologyComponentBundle(topologyComponent);
    StreamlineComponent component = getProvider(clazz, topologyComponentBundle.getSubType()).create(topologyComponent);
    component.setId(topologyComponent.getId().toString());
    component.setName(topologyComponent.getName());
    component.setConfig(topologyComponent.getConfig());
    component.setTopologyComponentBundleId(topologyComponentBundle.getId().toString());
    component.setTransformationClass(topologyComponentBundle.getTransformationClass());
    return clazz.cast(component);
}
Also used : StreamlineComponent(com.hortonworks.streamline.streams.layout.component.StreamlineComponent) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Example 10 with TopologyComponentBundle

use of com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle in project streamline by hortonworks.

the class TopologyExportVisitor method storeBundleIdToType.

private void storeBundleIdToType(StreamlineComponent component) {
    TopologyComponentBundle bundle = streamCatalogService.getTopologyComponentBundle(Long.parseLong(component.getTopologyComponentBundleId()));
    Preconditions.checkNotNull(bundle, "No bundle with id: " + component.getTopologyComponentBundleId());
    topologyData.addBundleIdToType(component.getTopologyComponentBundleId(), bundle.getSubType());
}
Also used : TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Aggregations

TopologyComponentBundle (com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)23 ArrayList (java.util.ArrayList)9 IOException (java.io.IOException)8 QueryParam (com.hortonworks.registries.common.QueryParam)7 Timed (com.codahale.metrics.annotation.Timed)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 Path (javax.ws.rs.Path)6 WSUtils.buildEdgesFromQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam)5 WSUtils.buildEdgesToQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)5 WSUtils.currentVersionQueryParam (com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam)5 WSUtils.versionIdQueryParam (com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam)5 InputStream (java.io.InputStream)5 TopologyProcessor (com.hortonworks.streamline.streams.catalog.TopologyProcessor)4 ComponentUISpecification (com.hortonworks.streamline.common.ComponentUISpecification)3 File (java.io.File)3 HashMap (java.util.HashMap)3 ImmutableList (com.google.common.collect.ImmutableList)2 StorageException (com.hortonworks.registries.storage.exception.StorageException)2 BaseTopologyRule (com.hortonworks.streamline.streams.catalog.BaseTopologyRule)2 CustomProcessorInfo (com.hortonworks.streamline.streams.catalog.processor.CustomProcessorInfo)2