static Set<Node> from(CubeDockerConfiguration config) { Map<String, Node> nodes = new HashMap<>(); AutoStartParser autoStartParser = config.getAutoStartContainers(); if (autoStartParser != null) { nodes.putAll(autoStartParser.parse()); } // add all children links Map<String, Node> autoStartNodes = new HashMap<>(nodes); for (Map.Entry<String, Node> node : autoStartNodes.entrySet()) { addAll(nodes, config, node.getKey()); } return new HashSet<>(nodes.values()); }
static Set<Node> from(CubeDockerConfiguration config) { Map<String, Node> nodes = new HashMap<>(); AutoStartParser autoStartParser = config.getAutoStartContainers(); if (autoStartParser != null) { nodes.putAll(autoStartParser.parse()); } // add all children links Map<String, Node> autoStartNodes = new HashMap<>(nodes); for (Map.Entry<String, Node> node : autoStartNodes.entrySet()) { addAll(nodes, config, node.getKey()); } return new HashSet<>(nodes.values()); }
private static void addAll(Map<String, Node> nodes, CubeDockerConfiguration config, String id) { CubeContainer content = config.getDockerContainersContent().get(id); if (content == null) { return; } Node parent = nodes.get(id); Collection<String> dependencies = content.getDependingContainers(); for (String name : dependencies) { if (config.getDockerContainersContent().get(name) != null) { Node child = nodes.get(name); if (child == null) { child = Node.from(name); nodes.put(name, child); } // Only continue recursively if this was a new found child if (child.addAsChildOf(parent)) { addAll(nodes, config, name); } } } }
private static void addAll(Map<String, Node> nodes, CubeDockerConfiguration config, String id) { CubeContainer content = config.getDockerContainersContent().get(id); if (content == null) { return; } Node parent = nodes.get(id); Collection<String> dependencies = content.getDependingContainers(); for (String name : dependencies) { if (config.getDockerContainersContent().get(name) != null) { Node child = nodes.get(name); if (child == null) { child = Node.from(name); nodes.put(name, child); } // Only continue recursively if this was a new found child if (child.addAsChildOf(parent)) { addAll(nodes, config, name); } } } }