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 java.util.Iterator; |
21 | |
import java.util.List; |
22 | |
|
23 | |
import org.jdom.Element; |
24 | |
|
25 | |
public class ConnectorProcessor extends TagProcessor |
26 | |
{ |
27 | |
|
28 | |
public ConnectorProcessor(GraphEnvironment environment) |
29 | |
{ |
30 | 4 | super(environment); |
31 | 4 | } |
32 | |
|
33 | |
public void process(Graph graph, Element currentElement, GraphNode parent) |
34 | |
{ |
35 | 4 | if (!getEnvironment().getConfig().isShowConnectors()) |
36 | |
{ |
37 | 4 | return; |
38 | |
} |
39 | |
|
40 | 0 | List connectorsElement = currentElement.getChildren(MuleTag.ELEMENT_CONNECTOR); |
41 | 0 | for (Iterator iter = connectorsElement.iterator(); iter.hasNext();) |
42 | |
{ |
43 | 0 | Element connector = (Element) iter.next(); |
44 | 0 | GraphNode connectorNode = graph.addNode(); |
45 | 0 | connectorNode.getInfo().setFillColor(ColorRegistry.COLOR_CONNECTOR); |
46 | 0 | String name = connector.getAttributeValue(MuleTag.ATTRIBUTE_NAME); |
47 | 0 | connectorNode.getInfo().setHeader(name); |
48 | |
|
49 | 0 | StringBuffer caption = new StringBuffer(); |
50 | |
|
51 | 0 | String className = connector.getAttributeValue(MuleTag.ATTRIBUTE_CLASS_NAME); |
52 | 0 | caption.append(MuleTag.ATTRIBUTE_CLASS_NAME + " :" + className + "\n"); |
53 | |
|
54 | 0 | appendProfiles(connector, caption); |
55 | 0 | appendProperties(connector, caption); |
56 | 0 | appendDescription(connector, caption); |
57 | 0 | connectorNode.getInfo().setCaption(caption.toString()); |
58 | |
|
59 | |
|
60 | 0 | ConnectionStrategyProcessor connectionStrategyProcessor = new ConnectionStrategyProcessor( |
61 | |
getEnvironment()); |
62 | 0 | connectionStrategyProcessor.process(graph, connector, connectorNode); |
63 | 0 | } |
64 | 0 | } |
65 | |
} |