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 | |
import org.mule.tools.visualizer.util.MuleTag; |
16 | |
|
17 | |
import com.oy.shared.lm.graph.Graph; |
18 | |
import com.oy.shared.lm.graph.GraphNode; |
19 | |
|
20 | |
import org.jdom.Element; |
21 | |
|
22 | |
public class ExceptionStrategyProcessor extends TagProcessor |
23 | |
{ |
24 | |
|
25 | |
public ExceptionStrategyProcessor(GraphEnvironment environment) |
26 | |
{ |
27 | 10 | super(environment); |
28 | 10 | } |
29 | |
|
30 | |
public void process(Graph graph, Element currentElement, GraphNode parent) |
31 | |
{ |
32 | 12 | String edgeCaption = MuleTag.ELEMENT_CATCH_ALL_STRATEGY; |
33 | 12 | Element exceptionStrategy = currentElement.getChild(edgeCaption); |
34 | 12 | if (exceptionStrategy == null) |
35 | |
{ |
36 | 12 | edgeCaption = MuleTag.ELEMENT_EXCEPTION_STRATEGY; |
37 | 12 | exceptionStrategy = currentElement.getChild(edgeCaption); |
38 | |
|
39 | |
} |
40 | |
|
41 | 12 | if (exceptionStrategy != null) |
42 | |
{ |
43 | 0 | String className = exceptionStrategy.getAttributeValue(MuleTag.ATTRIBUTE_CLASS_NAME); |
44 | 0 | GraphNode exceptionNode = graph.addNode(); |
45 | 0 | exceptionNode.getInfo().setHeader(className); |
46 | 0 | exceptionNode.getInfo().setFillColor(ColorRegistry.COLOR_EXCEPTION_STRATEGY); |
47 | |
|
48 | 0 | addEdge(graph, parent, exceptionNode, edgeCaption, false); |
49 | 0 | Element endpoint = exceptionStrategy.getChild(MuleTag.ELEMENT_ENDPOINT); |
50 | 0 | if (endpoint == null) |
51 | |
{ |
52 | 0 | endpoint = exceptionStrategy.getChild(MuleTag.ELEMENT_GLOBAL_ENDPOINT); |
53 | |
} |
54 | 0 | if (endpoint != null) |
55 | |
{ |
56 | 0 | String url = endpoint.getAttributeValue(MuleTag.ATTRIBUTE_ADDRESS); |
57 | 0 | if (url == null) |
58 | |
{ |
59 | 0 | url = endpoint.getAttributeValue(MuleTag.ATTRIBUTE_NAME); |
60 | |
} |
61 | 0 | if (url != null) |
62 | |
{ |
63 | 0 | GraphNode out = getEnvironment().getEndpointRegistry().getEndpoint(url, |
64 | |
parent.getInfo().getHeader()); |
65 | 0 | if (out == null) |
66 | |
{ |
67 | 0 | out = graph.addNode(); |
68 | 0 | out.getInfo().setCaption(url); |
69 | 0 | getEnvironment().getEndpointRegistry().addEndpoint(url, out); |
70 | |
} |
71 | 0 | addEdge(graph, exceptionNode, out, "out", false); |
72 | |
} |
73 | |
} |
74 | |
} |
75 | |
|
76 | 12 | } |
77 | |
} |