View Javadoc

1   /*
2    * $Id: ExternalSystemPostProcessor.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.tools.visualizer.postprocessors;
12  
13  import org.mule.tools.visualizer.components.PostProcessor;
14  import org.mule.tools.visualizer.config.ColorRegistry;
15  import org.mule.tools.visualizer.config.GraphEnvironment;
16  import org.mule.tools.visualizer.processor.TagProcessor;
17  
18  import com.oy.shared.lm.graph.Graph;
19  import com.oy.shared.lm.graph.GraphNode;
20  
21  public class ExternalSystemPostProcessor implements PostProcessor
22  {
23  
24      public void postProcess(Graph graph, GraphEnvironment env)
25      {
26          if (env.getConfig().getMappings().size() > 0)
27          {
28              GraphNode[] nodes = graph.getNodes();
29              for (int i = 0; i < nodes.length; i++)
30              {
31                  GraphNode node = nodes[i];
32                  String ext = env.getConfig().getMappings().getProperty(
33                      node.getInfo().getHeader() + ".external", null);
34                  if (ext != null)
35                  {
36                      env.log("Adding External system '" + ext + "'");
37  
38                      String type = env.getConfig().getMappings().getProperty(
39                          node.getInfo().getHeader() + ".external.type", null);
40                      GraphNode n = graph.addNode();
41                      n.getInfo().setShapeEllipse();
42                      n.getInfo().setCaption(ext);
43                      n.getInfo().setFillColor(ColorRegistry.COLOR_EXTERNAL);
44                      if ("server".equalsIgnoreCase(type))
45                      {
46                          TagProcessor.addEdge(graph, node, n, null, true);
47                      }
48                      else
49                      {
50                          TagProcessor.addEdge(graph, n, node, null, true);
51                      }
52                  }
53              }
54          }
55      }
56  
57  }