private static Graph<String, DefaultEdge> generateGraph(Map<String, ComponentMetadata> commands) { Graph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); commands.keySet().stream().forEach( c -> graph.addVertex(c) ); commands.entrySet().stream().forEach(entry -> { String key = entry.getKey(); entry.getValue().getDependencies().stream().forEach(dependency -> { try { graph.addEdge(key, dependency); } catch (IllegalArgumentException e) { //ignore it : if a dependency is declared in metadata but is not present on runtime LOGGER.warn("{} is not declared into the component's dependencies {}", key, dependency); } }); } ); return graph; }
Graph<String, DefaultEdge> generateGraph(Map<String, Bootstrap> commands) { Graph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); commands.keySet().stream().forEach( c -> graph.addVertex(c) ); commands.entrySet().stream().forEach(entry -> { String key = entry.getKey(); entry.getValue().getMetadata().getDependencies().stream().forEach(dependency -> { try { graph.addEdge(key, dependency); } catch (IllegalArgumentException e) { //ignore it : if a dependency is declared in metadata but is not present on runtime LOGGER.warn("{} is not declared into the component's dependencies {}", key, dependency); } }); } ); return graph; }
Graph<String, DefaultEdge> generateGraph(Map<String, Bootstrap> commands) { Graph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); commands.keySet().stream().forEach( c -> graph.addVertex(c) ); commands.entrySet().stream().forEach(entry -> { String key = entry.getKey(); entry.getValue().getMetadata().getDependencies().stream().forEach(dependency -> { try { graph.addEdge(key, dependency); } catch (IllegalArgumentException e) { //ignore it : if a dependency is declared in metadata but is not present on runtime LOGGER.warn("{} is not declared into the component's dependencies {}", key, dependency); } }); } ); return graph; }