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.GraphEnvironment; |
14 | |
import org.mule.tools.visualizer.util.MuleTag; |
15 | |
|
16 | |
import com.oy.shared.lm.graph.Graph; |
17 | |
import com.oy.shared.lm.graph.GraphNode; |
18 | |
|
19 | |
import org.jdom.Element; |
20 | |
|
21 | |
public class ShortestNotationHandler extends TagProcessor |
22 | |
{ |
23 | |
|
24 | |
public ShortestNotationHandler(GraphEnvironment environment) |
25 | |
{ |
26 | 4 | super(environment); |
27 | 4 | } |
28 | |
|
29 | |
public void process(Graph graph, Element currentElement, GraphNode parent) |
30 | |
{ |
31 | 6 | String inbound = currentElement.getAttributeValue(MuleTag.ATTRIBUTE_INBOUNDENDPOINT); |
32 | 6 | if (inbound != null) |
33 | |
{ |
34 | 0 | GraphNode in = getEnvironment().getEndpointRegistry().getEndpoint(inbound, |
35 | |
parent.getInfo().getHeader()); |
36 | 0 | if (in == null) |
37 | |
{ |
38 | 0 | in = graph.addNode(); |
39 | 0 | in.getInfo().setCaption(inbound); |
40 | 0 | getEnvironment().getEndpointRegistry().addEndpoint(inbound, in); |
41 | |
} |
42 | 0 | addEdge(graph, in, parent, "in", isTwoWay(null)); |
43 | |
} |
44 | 6 | String outbound = currentElement.getAttributeValue(MuleTag.ATTRIBUTE_OUTBOUNDENDPOINT); |
45 | 6 | if (outbound != null) |
46 | |
{ |
47 | 0 | GraphNode out = getEnvironment().getEndpointRegistry().getEndpoint(outbound, |
48 | |
parent.getInfo().getHeader()); |
49 | 0 | if (out == null) |
50 | |
{ |
51 | 0 | out = graph.addNode(); |
52 | 0 | out.getInfo().setCaption(outbound); |
53 | 0 | getEnvironment().getEndpointRegistry().addEndpoint(outbound, out); |
54 | |
} |
55 | 0 | addEdge(graph, parent, out, "out", isTwoWay(null)); |
56 | |
} |
57 | |
|
58 | 6 | String inboundTransformers = currentElement.getAttributeValue("inboundTransformer"); |
59 | 6 | if (inboundTransformers != null) |
60 | |
{ |
61 | 0 | String[] transformers = inboundTransformers.split(" "); |
62 | 0 | StringBuffer caption = new StringBuffer(); |
63 | 0 | for (int i = 0; i < transformers.length; i++) |
64 | |
{ |
65 | 0 | caption.append("transformer " + i + " : " + transformers[i] + "\n"); |
66 | |
} |
67 | 0 | parent.getInfo().setCaption(parent.getInfo().getCaption() + "\n" + caption.toString()); |
68 | |
} |
69 | |
|
70 | 6 | GraphNode[] virtual = getEnvironment().getEndpointRegistry().getVirtualEndpoint( |
71 | |
parent.getInfo().getHeader()); |
72 | 6 | if (virtual.length > 0) |
73 | |
{ |
74 | 0 | for (int i = 0; i < virtual.length; i++) |
75 | |
{ |
76 | 0 | addEdge(graph, parent, virtual[i], "out (dynamic)", false); |
77 | |
} |
78 | |
} |
79 | 6 | } |
80 | |
} |