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;
}
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;
}
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);
}
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);
}
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());
}
Aggregations