1
2
3
4
5
6
7
8
9
10
11 package org.mule.tools.visualizer.processor;
12
13 import org.mule.tools.visualizer.config.ColorRegistry;
14 import org.mule.tools.visualizer.config.GraphEnvironment;
15
16 import com.oy.shared.lm.graph.Graph;
17 import com.oy.shared.lm.graph.GraphNode;
18
19 import java.util.Iterator;
20 import java.util.List;
21
22 import org.jdom.Element;
23
24 public class EndpointsProcessor extends TagProcessor
25 {
26 public EndpointsProcessor(GraphEnvironment environment)
27 {
28 super(environment);
29 }
30
31 public void process(Graph graph, Element currentElement, GraphNode parent)
32 {
33 Element globalEndpoints = currentElement.getChild("global-endpoints");
34
35 if (globalEndpoints == null)
36 {
37 getEnvironment().log("no global-endpoints");
38 return;
39 }
40
41 List namedChildren = globalEndpoints.getChildren("endpoint");
42
43 for (Iterator iter = namedChildren.iterator(); iter.hasNext();)
44 {
45 Element endpoint = (Element) iter.next();
46 GraphNode node = graph.addNode();
47 node.getInfo().setFillColor(ColorRegistry.COLOR_DEFINED_ENDPOINTS);
48 String name = endpoint.getAttributeValue("name");
49
50 node.getInfo().setHeader(endpoint.getAttributeValue("address") + " (" + name + ")");
51 StringBuffer caption = new StringBuffer();
52 TagProcessor.appendProperties(endpoint, caption);
53 node.getInfo().setCaption(caption.toString());
54 getEnvironment().getEndpointRegistry().addEndpoint(name, node);
55 }
56 }
57 }