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 | 4 | super(environment); |
29 | 4 | } |
30 | |
|
31 | |
public void process(Graph graph, Element currentElement, GraphNode parent) |
32 | |
{ |
33 | 4 | Element globalEndpoints = currentElement.getChild("global-endpoints"); |
34 | |
|
35 | 4 | if (globalEndpoints == null) |
36 | |
{ |
37 | 4 | getEnvironment().log("no global-endpoints"); |
38 | 4 | return; |
39 | |
} |
40 | |
|
41 | 0 | List namedChildren = globalEndpoints.getChildren("endpoint"); |
42 | |
|
43 | 0 | for (Iterator iter = namedChildren.iterator(); iter.hasNext();) |
44 | |
{ |
45 | 0 | Element endpoint = (Element) iter.next(); |
46 | 0 | GraphNode node = graph.addNode(); |
47 | 0 | node.getInfo().setFillColor(ColorRegistry.COLOR_DEFINED_ENDPOINTS); |
48 | 0 | String name = endpoint.getAttributeValue("name"); |
49 | |
|
50 | 0 | node.getInfo().setHeader(endpoint.getAttributeValue("address") + " (" + name + ")"); |
51 | 0 | StringBuffer caption = new StringBuffer(); |
52 | 0 | TagProcessor.appendProperties(endpoint, caption); |
53 | 0 | node.getInfo().setCaption(caption.toString()); |
54 | 0 | getEnvironment().getEndpointRegistry().addEndpoint(name, node); |
55 | 0 | } |
56 | 0 | } |
57 | |
} |