Package com.dianping.cat.home.dependency.graph.entity

Examples of com.dianping.cat.home.dependency.graph.entity.TopologyNode


        if (isDashboard) {
          Map<String, Domain> domains = entry.getValue().getDomains();
          for (Domain domain : domains.values()) {
            String nodeName = domain.getId();
            TopologyNode node = topologyGraph.findTopologyNode(nodeName);

            allDomains.add(nodeName);
            if (node != null) {
              dashboardGraph.addNode(realName, m_graphBuilder.cloneNode(node));
            }
View Full Code Here


    topylogyGraph.setId(domain);
    topylogyGraph.setType(GraphConstrant.PROJECT);
    topylogyGraph.setStatus(GraphConstrant.OK);

    if (all != null) {
      TopologyNode node = all.findTopologyNode(domain);

      if (node != null) {
        topylogyGraph.setDes(node.getDes());
        topylogyGraph.setStatus(node.getStatus());
        topylogyGraph.setType(node.getType());
      }
      Collection<TopologyEdge> edges = all.getEdges().values();

      for (TopologyEdge edge : edges) {
        String self = edge.getSelf();
        String target = edge.getTarget();
        TopologyEdge cloneEdge = m_graphBuilder.cloneEdge(edge);

        if (self.equals(domain)) {
          TopologyNode other = all.findTopologyNode(target);

          if (other != null) {
            topylogyGraph.addTopologyNode(m_graphBuilder.cloneNode(other));
          } else {
            topylogyGraph.addTopologyNode(m_graphBuilder.createNode(target));
          }
          edge.setOpposite(false);
          topylogyGraph.addTopologyEdge(cloneEdge);
        } else if (target.equals(domain)) {
          TopologyNode other = all.findTopologyNode(self);

          if (other != null) {
            topylogyGraph.addTopologyNode(m_graphBuilder.cloneNode(other));
          } else {
            topylogyGraph.addTopologyNode(m_graphBuilder.createNode(target));
View Full Code Here

    edge.setDes(state.getValue());
    return edge;
  }

  public TopologyNode buildNode(String domain, Index index) {
    TopologyNode node = new TopologyNode(domain);

    node.setType(PROJECT);
    node.setWeight(1);

    Pair<Integer, String> state = m_graphConfigManager.buildNodeState(domain, index);

    node.setStatus(state.getKey());
    node.setDes(state.getValue());
    return node;
  }
View Full Code Here

    node.setDes(state.getValue());
    return node;
  }

  public TopologyNode createCacheNode(String cache) {
    TopologyNode node = new TopologyNode(cache);

    node.setStatus(OK);
    node.setType(CACHE);
    node.setWeight(1);
    return node;
  }
View Full Code Here

    node.setWeight(1);
    return node;
  }

  public TopologyNode createDatabaseNode(String database) {
    TopologyNode node = new TopologyNode(database);

    node.setStatus(OK);
    node.setType(DATABASE);
    node.setWeight(1);
    return node;
  }
View Full Code Here

    node.setWeight(1);
    return node;
  }

  public TopologyNode createNode(String domain) {
    TopologyNode node = new TopologyNode(domain);

    node.setStatus(OK);
    node.setType(PROJECT);
    node.setWeight(1);
    return node;
  }
View Full Code Here

    result.setWeight(edge.getWeight());
    return result;
  }

  public TopologyNode cloneNode(TopologyNode node) {
    TopologyNode result = new TopologyNode();

    result.setDes(node.getDes());
    result.setId(node.getId());
    result.setLink(node.getLink());
    result.setStatus(node.getStatus());
    result.setType(node.getType());
    result.setWeight(node.getWeight());
    return result;
  }
View Full Code Here

      TopologyEdge old = graph.findTopologyEdge(edge.getKey());

      graph.getEdges().put(edge.getKey(), mergeEdge(old, edge));
      if ("Database".equals(type)) {
        String target = dependency.getTarget();
        TopologyNode nodeOld = graph.findTopologyNode(target);

        graph.getNodes().put(target, mergeNode(nodeOld, m_itemBuilder.createDatabaseNode(target)));
      } else if ("Cache".equals(type)) {
        String target = dependency.getTarget();
        TopologyNode nodeOld = graph.findTopologyNode(target);

        graph.getNodes().put(target, mergeNode(nodeOld, m_itemBuilder.createCacheNode(target)));
      }
    }
  }
View Full Code Here

  }

  @Override
  public void visitIndex(Index index) {
    TopologyGraph graph = findOrCreateGraph();
    TopologyNode node = m_itemBuilder.buildNode(m_domain, index);
    TopologyNode old = graph.findTopologyNode(node.getId());

    graph.getNodes().put(node.getId(), mergeNode(old, node));
  }
View Full Code Here

    Set<String> nodes = new HashSet<String>();
    for (Entry<String, List<Event>> entry : events.entrySet()) {
      List<Event> eventList = entry.getValue();

      for (Event event : eventList) {
        TopologyNode node = graph.findTopologyNode(event.getDomain());

        if (node != null) {
          if (!nodes.contains(node.getId())) {
            node.setDes(node.getDes() + zabbixHeader);
            nodes.add(node.getId());
          }
          if (node.getStatus() == GraphConstrant.OK) {
            node.setStatus(GraphConstrant.OP_ERROR);
          }
          String des = node.getDes();

          des = des + m_sdf.format(event.getDate()) + " " + event.getSubject() + GraphConstrant.ENTER;
          node.setDes(des);
        } else if (event.getDomain().equals(graph.getId())) {
          if (!nodes.contains(graph.getId())) {
            graph.setDes(graph.getDes() + zabbixHeader);
            nodes.add(graph.getId());
          }
View Full Code Here

TOP

Related Classes of com.dianping.cat.home.dependency.graph.entity.TopologyNode

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.