@Override public StreamlineProcessor create(TopologyComponent component) { Config config = component.getConfig(); Object typeObj = config.getAny(NormalizationProcessor.CONFIG_KEY_TYPE); Object normConfObj = config.getAny(NormalizationProcessor.CONFIG_KEY_NORMALIZATION); ObjectMapper objectMapper = new ObjectMapper(); NormalizationProcessor.Type type = objectMapper.convertValue(typeObj, NormalizationProcessor.Type.class); Map<String, NormalizationConfig> normConfig = objectMapper.convertValue(normConfObj, new TypeReference<Map<String, NormalizationConfig>>() { }); updateWithSchemas(component.getTopologyId(), component.getVersionId(), normConfig); Set<Stream> outputStreams; if (component instanceof TopologyOutputComponent) { outputStreams = createOutputStreams((TopologyOutputComponent) component); } else { throw new IllegalArgumentException("Component " + component + " must be an instance of TopologyOutputComponent"); } if (outputStreams.size() != 1) { throw new IllegalArgumentException("Normalization component [" + component + "] must have only one output stream"); } return new NormalizationProcessor(normConfig, outputStreams.iterator().next(), type); } };
private void removeAllEdges(TopologyComponent c) { removeTopologyEdge(buildEdgesFromQueryParam(c.getTopologyId(), c.getVersionId(), c.getId())); removeTopologyEdge(buildEdgesToQueryParam(c.getTopologyId(), c.getVersionId(), c.getId())); }
if ((to == null || !to.getTopologyId().equals(edge.getTopologyId()))) { throw new IllegalArgumentException("Invalid destination for edge " + edge);
@Override public StreamlineProcessor create(TopologyComponent component) { RulesProcessor processor = new RulesProcessor(); ObjectMapper objectMapper = new ObjectMapper(); if (component instanceof TopologyOutputComponent) { Set<Stream> outputStreams = createOutputStreams((TopologyOutputComponent) component); processor.addOutputStreams(outputStreams); } else { throw new IllegalArgumentException("Component " + component + " must be an instance of TopologyOutputComponent"); } boolean processAll = component.getConfig().getBoolean(RulesProcessor.CONFIG_PROCESS_ALL, true); processor.setProcessAll(processAll); Object ruleList = component.getConfig().getAny(RulesProcessor.CONFIG_KEY_RULES); List<Long> ruleIds = objectMapper.convertValue(ruleList, new TypeReference<List<Long>>() { }); try { List<Rule> rules = new ArrayList<>(); for (Long ruleId : ruleIds) { rules.add(ruleExtractor.getRule(component.getTopologyId(), ruleId, component.getVersionId())); } processor.setRules(rules); } catch (Exception ex) { throw new RuntimeException(ex); } return processor; } };
public TopologyComponent(TopologyComponent other) { if (other != null) { setId(other.getId()); setTopologyId(other.getTopologyId()); setTopologyComponentBundleId(other.getTopologyComponentBundleId()); setVersionId(other.getVersionId()); setName(other.getName()); setDescription(other.getDescription()); setConfig(new Config(other.getConfig())); setVersionTimestamp(other.getVersionTimestamp()); } }