Package com.puppetlabs.graph.elements

Examples of com.puppetlabs.graph.elements.Vertex


  private void edgesForCatalogEdges(Iterable<CatalogEdge> catalogEdges, //
      Map<String, Vertex> vertexMap, //
      Map<String, Edge> edgeMap, //
      Set<String> edges) {
    for(CatalogEdge e : catalogEdges) {
      Vertex source = vertexMap.get(e.getSource().toLowerCase());
      Vertex target = vertexMap.get(e.getTarget().toLowerCase());
      Edge edge = new Edge("", STYLE_ResourceEdge, source, target);
      final String key = keyOf(e);
      edgeMap.put(key, edge);
      edges.add(key);
    }
View Full Code Here


      Map<String, Vertex> vertexMap, //
      Map<String, Edge> edgeMap, //
      Set<String> edges) {
    for(CatalogResource r : resources) {
      final String sourceKey = keyOf(r);
      final Vertex source = vertexMap.get(sourceKey);
      for(CatalogResourceParameter p : Iterables.filter(
        getParameterIterable(r), Predicates.not(regularParameterPredicate))) {
        String aName = p.getName();
        String style = null;
        if("subscribe".equals(aName))
          style = CatalogGraphStyles.STYLE_SubscribeEdge;
        else if("before".equals(aName))
          style = CatalogGraphStyles.STYLE_BeforeEdge;
        else if("notify".equals(aName))
          style = CatalogGraphStyles.STYLE_NotifyEdge;
        else
          style = CatalogGraphStyles.STYLE_RequireEdge;
        for(String targetRef : p.getValue()) {
          final String targetKey = targetRef.toLowerCase();
          Vertex target = vertexMap.get(targetKey);
          if(target == null) {
            target = createVertexForMissingResource(targetRef);
            vertexMap.put(targetKey, target); // keep it if there are more references
            g.addVertex(target);
          }
View Full Code Here

    SetView<String> removedInNew = Sets.difference(oldKeys, newKeys);
    SetView<String> addedInNew = Sets.difference(newKeys, oldKeys);
    Map<String, Vertex> resultingVertexMap = Maps.newHashMap();

    for(String s : removedInNew) {
      Vertex v = oldVertexMap.get(s);
      v.addStyleClass(STYLE_Removed);
      v.setStyles(labelStyleForResource(catalogMap.get(v), oldRoot, null, null, new String[1]));
      resultingVertexMap.put(s, v);
      g.addVertex(v);
    }
    for(String s : addedInNew) {
      Vertex v = newVertexMap.get(s);
      v.addStyleClass(STYLE_Added);
      v.setStyles(labelStyleForResource(null, null, catalogMap.get(v), newRoot, new String[1]));
      resultingVertexMap.put(s, v);
      g.addVertex(v);
    }
    for(String s : inBoth) {
      Vertex vOld = oldVertexMap.get(s);
      Vertex vNew = newVertexMap.get(s);

      Vertex v = new Vertex("", STYLE_Resource);
      String computedStyle[] = new String[1];
      v.setStyles(labelStyleForResource(
        catalogMap.get(vOld), oldRoot, catalogMap.get(vNew), newRoot, computedStyle));
      v.addStyleClass(computedStyle[0]);
      resultingVertexMap.put(s, v);
      g.addVertex(v);
    }

    // Process Edges
View Full Code Here

TOP

Related Classes of com.puppetlabs.graph.elements.Vertex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.