Coverage Report - org.mule.tools.visualizer.processor.DescriptorProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
DescriptorProcessor
93%
27/29
75%
3/4
2.5
 
 1  
 /*
 2  
  * $Id: DescriptorProcessor.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  
 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  
              * caption.append("implementation :
 70  
              * "+descriptor.getAttributeValue("implementation") + "\n");
 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  
 }