servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r468169 - in /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view: DotViewEndpointListener.java DotViewFlowListener.java
Date Thu, 26 Oct 2006 22:07:41 GMT
Author: gnodet
Date: Thu Oct 26 15:07:41 2006
New Revision: 468169

URL: http://svn.apache.org/viewvc?view=rev&rev=468169
Log:
Use different colors per endpoint types (internal / external), use small font

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewFlowListener.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java?view=diff&rev=468169&r1=468168&r2=468169
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java
Thu Oct 26 15:07:41 2006
@@ -83,11 +83,9 @@
     protected void generateFile(PrintWriter writer) throws Exception {
         writer.println("digraph \"Apache ServiceMix\" {");
         writer.println();
-        writer.println("node [style = \"rounded,filled\", fillcolor = yellow, fontname=\"Helvetica-Oblique\"];");
+        writer.println("node [ shape = box, style = \"rounded,filled\", fontname = \"Helvetica-Oblique\",
fontsize = 8 ];");
         writer.println();
-        writer.println("jbi [label=\"Apache ServiceMix: " + container.getName() + "\"];");
-        writer.println();
-        writer.println("node [fillcolor = green];");
+        writer.println("jbi [ fillcolor = \"#FFFF99\", label=\"Apache ServiceMix: " + container.getName()
+ "\" ];");
         writer.println();
 
         List brokerLinks = new ArrayList();
@@ -99,7 +97,7 @@
             String id = encode(name);
 
             writer.print(id);
-            writer.print(" [ label=\"");
+            writer.print(" [ fillcolor = gray, label = \"");
             writer.print(name);
             writer.println("\" ];");
 
@@ -108,7 +106,6 @@
         writer.println();
         generateLinks(writer, brokerLinks);
 
-        writer.println("node [fillcolor = red];");
         writer.println();
 
         List componentEndpointLinks = new ArrayList();
@@ -122,8 +119,25 @@
             String componentName = encode(endpoint.getComponentName());
             String id = encode(key);
             writer.print(id);
-            writer.print(" [ label=\"");
-            writer.print(formatEndpoint(key));
+            String epname = formatEndpoint(key);
+            String color = "lightgray";
+            if (epname.startsWith("internal")) {
+                epname = epname.substring(10);
+                color = "#6699ff";
+            } else if (epname.startsWith("external")) {
+                epname = epname.substring(10);
+                color = "#66ccff";
+            } else if (epname.startsWith("dynamic")) {
+                epname = epname.substring(9);
+                color = "#6666ff";
+            } else if (epname.startsWith("linked")) {
+                epname = epname.substring(8);
+                color = "#66ffff";
+            } else {
+                color = "#f3f3f3";
+            }
+            writer.print(" [ fillcolor = \"" + color + "\", label = \"");
+            writer.print(epname);
             writer.println("\" ];");
             
             componentEndpointLinks.add(componentName + " -> " + id);

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewFlowListener.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewFlowListener.java?view=diff&rev=468169&r1=468168&r2=468169
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewFlowListener.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewFlowListener.java
Thu Oct 26 15:07:41 2006
@@ -55,12 +55,16 @@
 
     private Map flow;
     private Set flowLinks;
-    private boolean displayComponents;
+    private Set usedComponents;
+    private Set componentsAsConsumer;
+    private boolean displayComponents = true;
     
     public DotViewFlowListener() {
         setFile("ServiceMixFlow.dot");
         flow = new ConcurrentHashMap();
         flowLinks = new CopyOnWriteArraySet();
+        usedComponents = new CopyOnWriteArraySet();
+        componentsAsConsumer = new CopyOnWriteArraySet();
     }
 
     // Implementation methods
@@ -70,7 +74,7 @@
         writer.println("digraph \"Apache ServiceMix\" {");
         writer.println();
         writer.println("label = \"Apache ServiceMix flow\";");
-        writer.println("node [style = \"rounded,filled\", fillcolor = yellow, fontname=\"Helvetica-Oblique\"];");
+        writer.println("node [ shape = box, style = \"rounded,filled\", fontname = \"Helvetica-Oblique\",
fontsize = 8 ];");
         writer.println();
 
         List brokerLinks = new ArrayList();
@@ -80,6 +84,9 @@
             ComponentMBeanImpl component = (ComponentMBeanImpl) iter.next();
             ServiceEndpoint[] ses = registry.getEndpointRegistry().getAllEndpointsForComponent(component.getComponentNameSpace());
             String name = component.getName();
+            if (!usedComponents.contains(name)) {
+                continue;
+            }
             // If we want to display components, create
             // a sub graph, grouping all the components
             // endpoints
@@ -87,9 +94,9 @@
                 String id = encode(name);
                 writer.println("subgraph cluster_" + id + " {");
                 writer.println("  label=\"" + name + "\";");
-                writer.println("  node [fillcolor = green];");
-                writer.println("  " + id + " [label=\"" + name + "\"];");
-                writer.println("  node [fillcolor = red];");
+                if (componentsAsConsumer.contains(name)) {
+                    writer.println("  " + id + " [ fillcolor = gray, label = \"" + name +
"\" ];");
+                }
             }
             for (int i = 0; i < ses.length; i++) {
                 String key = EndpointSupport.getUniqueKey(ses[i]);
@@ -97,8 +104,24 @@
                 if (!isDisplayComponents()) {
                     epname += "\\n" + name;
                 }
+                String color = "lightgray";
+                if (epname.startsWith("internal")) {
+                    epname = epname.substring(10);
+                    color = "#6699ff";
+                } else if (epname.startsWith("external")) {
+                    epname = epname.substring(10);
+                    color = "#66ccff";
+                } else if (epname.startsWith("dynamic")) {
+                    epname = epname.substring(9);
+                    color = "#6666ff";
+                } else if (epname.startsWith("linked")) {
+                    epname = epname.substring(8);
+                    color = "#66ffff";
+                } else {
+                    color = "#f3f3f3";
+                }
                 String epid = encode(key);
-                writer.println("  " + epid + " [label=\"" + epname + "\"];");
+                writer.println("  " + epid + " [fillcolor = \"" + color + "\", label=\""
+ epname + "\"];");
             }
             if (isDisplayComponents()) {
                 writer.println("}");
@@ -122,6 +145,7 @@
             String source = (String) me.getProperty(JbiConstants.SENDER_ENDPOINT);
             if (source == null) {
                 source = mei.getSourceId().getName();
+                componentsAsConsumer.add(source);
             } else {
                 ServiceEndpoint[] ses = getContainer().getRegistry().getEndpointRegistry().getAllEndpointsForComponent(mei.getSourceId());
                 for (int i = 0; i < ses.length; i++) {
@@ -131,6 +155,8 @@
                     }
                 }
             }
+            usedComponents.add(mei.getSourceId().getName());
+            usedComponents.add(mei.getDestinationId().getName());
             String dest = EndpointSupport.getUniqueKey(mei.getEndpoint());
             Map componentFlow = createSource(source);
             if (componentFlow.put(dest, Boolean.TRUE) == null) {



Mime
View raw message