1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.mule.tools.visualizer.processor; |
11 | |
|
12 | |
import org.mule.tools.visualizer.config.ColorRegistry; |
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 java.util.Iterator; |
20 | |
import java.util.List; |
21 | |
|
22 | |
import org.jdom.Element; |
23 | |
|
24 | |
public class DescriptorProcessor extends TagProcessor |
25 | |
{ |
26 | |
|
27 | |
private final ExceptionStrategyProcessor exceptionStrategyProcessor; |
28 | |
|
29 | |
private final ShortestNotationHandler shortestNotationHandler; |
30 | |
|
31 | |
private final InboundRoutersProcessor inboundRoutersProcessor; |
32 | |
|
33 | |
private final ResponseRouterProcessor responseRouterProcessor; |
34 | |
|
35 | |
private final OutBoundRoutersProcessor outBoundRoutersProcessor; |
36 | |
|
37 | |
public DescriptorProcessor(GraphEnvironment environment) |
38 | |
{ |
39 | 4 | super(environment); |
40 | 4 | this.shortestNotationHandler = new ShortestNotationHandler(environment); |
41 | 4 | this.inboundRoutersProcessor = new InboundRoutersProcessor(environment); |
42 | 4 | this.responseRouterProcessor = new ResponseRouterProcessor(environment); |
43 | 4 | exceptionStrategyProcessor = new ExceptionStrategyProcessor(environment); |
44 | |
|
45 | 4 | this.outBoundRoutersProcessor = new OutBoundRoutersProcessor(environment); |
46 | |
|
47 | 4 | } |
48 | |
|
49 | |
public void process(Graph graph, Element currentElement, GraphNode parent) |
50 | |
{ |
51 | 4 | if (currentElement == null) |
52 | |
{ |
53 | 0 | System.err.println("model is null"); |
54 | 0 | return; |
55 | |
} |
56 | |
|
57 | 4 | List descriptors = currentElement.getChildren(MuleTag.ELEMENT_MULE_DESCRIPTOR); |
58 | 4 | for (Iterator iter = descriptors.iterator(); iter.hasNext();) |
59 | |
{ |
60 | 6 | Element descriptor = (Element) iter.next(); |
61 | 6 | String name = descriptor.getAttributeValue(MuleTag.ATTRIBUTE_NAME); |
62 | 6 | GraphNode node = graph.addNode(); |
63 | 6 | node.getInfo().setHeader(name); |
64 | 6 | node.getInfo().setFillColor(ColorRegistry.COLOR_COMPONENT); |
65 | |
|
66 | 6 | StringBuffer caption = new StringBuffer(); |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | 6 | appendProfiles(descriptor, caption); |
74 | 6 | appendProperties(descriptor, caption); |
75 | 6 | appendDescription(descriptor, caption); |
76 | |
|
77 | 6 | node.getInfo().setCaption(caption.toString()); |
78 | |
|
79 | 6 | shortestNotationHandler.process(graph, descriptor, node); |
80 | |
|
81 | 6 | exceptionStrategyProcessor.process(graph, descriptor, node); |
82 | |
|
83 | 6 | inboundRoutersProcessor.process(graph, descriptor, node); |
84 | |
|
85 | 6 | outBoundRoutersProcessor.process(graph, descriptor, node); |
86 | |
|
87 | 6 | responseRouterProcessor.process(graph, descriptor, node); |
88 | |
|
89 | 6 | } |
90 | |
|
91 | 4 | } |
92 | |
|
93 | |
} |