Coverage Report - org.mule.tools.visualizer.processor.ShortestNotationHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
ShortestNotationHandler
37%
11/30
25%
4/16
5
 
 1  
 /*
 2  
  * $Id: ShortestNotationHandler.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 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  
 }