DotGraph.Cluster cluster = (DotGraph.Cluster) digraph.addCluster(String.format("topology_%s", subtopology.id())) .setLabel(String.format("Sub-Topology: %s", subtopology.id())); cluster.addNode(processorId) .setLabel(String.format("Source: %s", node.name())); .forEach(topic -> { String topicId = String.format("topic-%s", topic); cluster.addNode(topicId) .setLabel(String.format("Topic: %s", topic)) .addAssociation(topicId, processorId); } else if (node instanceof TopologyDescription.Processor) { String processorId = String.format("node-%s", node.name()); DotGraph.AbstractNode processorNode = cluster.addNode(processorId) .setLabel(String.format("Processor: %s", node.name())); String processorId = String.format("node-%s", node.name()); DotGraph.AbstractNode sinkNode = cluster.addNode(processorId).setLabel(String.format("Sink: %s", node.name()));
public String render() { final StringBuffer out = new StringBuffer(); final List<String> cells = new ArrayList<String>(); if (label != null) { cells.add(label); } cells.addAll(stereotypes); final String content = DotRenderer.toLines(cells); out.append(DotRenderer.openCluster(CLUSTER_PREFIX + id)); out.append(DotRenderer.cluster(content)); renderNodes(out); renderAssociations(out); out.append(DotRenderer.closeCluster()); return out.toString(); }
public Cluster addCluster(Object id) { final String uid = registry.nodeUniqueId(id); Cluster node = (Cluster) nodes.get(uid); if (node == null) { node = new Cluster(registry, uid); nodes.put(uid, node); } return node; }