Coverage Report - org.mule.tools.visualizer.processor.EndpointIdentifiersProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
EndpointIdentifiersProcessor
32%
6/19
25%
1/4
2.5
 
 1  
 /*
 2  
  * $Id: EndpointIdentifiersProcessor.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.ColorRegistry;
 14  
 import org.mule.tools.visualizer.config.GraphEnvironment;
 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 EndpointIdentifiersProcessor extends TagProcessor
 25  
 {
 26  
     public EndpointIdentifiersProcessor(GraphEnvironment environment)
 27  
     {
 28  4
         super(environment);
 29  4
     }
 30  
 
 31  
     public void process(Graph graph, Element currentElement, GraphNode parent)
 32  
     {
 33  4
         Element endpointIdentifiers = currentElement.getChild("endpoint-identifiers");
 34  
 
 35  4
         if (endpointIdentifiers == null)
 36  
         {
 37  4
             getEnvironment().log("no endpoint-identifiers tag");
 38  4
             return;
 39  
         }
 40  
 
 41  0
         List namedChildren = endpointIdentifiers.getChildren("endpoint-identifier");
 42  
 
 43  0
         for (Iterator iter = namedChildren.iterator(); iter.hasNext();)
 44  
         {
 45  0
             Element endpoint = (Element) iter.next();
 46  0
             GraphNode node = graph.addNode();
 47  0
             node.getInfo().setFillColor(ColorRegistry.COLOR_DEFINED_ENDPOINTS);
 48  0
             String name = endpoint.getAttributeValue("name");
 49  
 
 50  0
             String value = lookupPropertyTemplate(endpoint.getAttributeValue("value"));
 51  0
             node.getInfo().setHeader(name);
 52  0
             node.getInfo().setCaption(value);
 53  0
             getEnvironment().getEndpointRegistry().addEndpoint(name, node);
 54  0
             getEnvironment().getProperties().setProperty(name, value);
 55  
 
 56  0
         }
 57  0
     }
 58  
 }