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

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


  private static final String PROJECT = GraphConstrant.PROJECT;

  private static final String CACHE = GraphConstrant.CACHE;

  public TopologyEdge buildEdge(String domain, Dependency dependency) {
    TopologyEdge edge = new TopologyEdge();

    edge.setType(dependency.getType());
    edge.setKey(dependency.getType() + ':' + domain + ':' + dependency.getTarget());
    edge.setSelf(domain);
    edge.setTarget(dependency.getTarget());
    edge.setOpposite(false);
    edge.setWeight(1);

    Pair<Integer, String> state = m_graphConfigManager.buildEdgeState(domain, dependency);

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


  private Date m_date;

  private Set<String> m_pigeonServices = new HashSet<String>(Arrays.asList("Service", "PigeonService", "PigeonServer"));

  public TopologyEdge cloneEdge(TopologyEdge edge) {
    TopologyEdge result = new TopologyEdge();

    result.setDes(edge.getDes());
    result.setKey(edge.getKey());
    result.setLink(edge.getLink());
    result.setOpposite(edge.getOpposite());
    result.setSelf(edge.getSelf());
    result.setStatus(edge.getStatus());
    result.setTarget(edge.getTarget());
    result.setType(edge.getType());
    result.setWeight(edge.getWeight());
    return result;
  }
View Full Code Here

  @Override
  public void visitDependency(Dependency dependency) {
    String type = dependency.getType();
   
    if (!m_pigeonServices.contains(type)) {
      TopologyEdge edge = m_itemBuilder.buildEdge(m_domain, dependency);
      TopologyGraph graph = findOrCreateGraph();
      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);
View Full Code Here

      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));
          }
          cloneEdge.setTarget(edge.getSelf());
          cloneEdge.setSelf(edge.getTarget());
          cloneEdge.setOpposite(true);
          topylogyGraph.addTopologyEdge(cloneEdge);
        }
      }
    }
    return topylogyGraph;
View Full Code Here

TOP

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

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.