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 EndpointIdentifiersProcessor extends TagProcessor
25 {
26 public EndpointIdentifiersProcessor(GraphEnvironment environment)
27 {
28 super(environment);
29 }
30
31 public void process(Graph graph, Element currentElement, GraphNode parent)
32 {
33 Element endpointIdentifiers = currentElement.getChild("endpoint-identifiers");
34
35 if (endpointIdentifiers == null)
36 {
37 getEnvironment().log("no endpoint-identifiers tag");
38 return;
39 }
40
41 List namedChildren = endpointIdentifiers.getChildren("endpoint-identifier");
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 String value = lookupPropertyTemplate(endpoint.getAttributeValue("value"));
51 node.getInfo().setHeader(name);
52 node.getInfo().setCaption(value);
53 getEnvironment().getEndpointRegistry().addEndpoint(name, node);
54 getEnvironment().getProperties().setProperty(name, value);
55
56 }
57 }
58 }