Coverage Report - org.mule.config.spring.editors.ConnectorPropertyEditor
 
Classes in this File Line Coverage Branch Coverage Complexity
ConnectorPropertyEditor
0%
0/8
0%
0/2
2
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.config.spring.editors;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.transport.Connector;
 11  
 import org.mule.config.i18n.CoreMessages;
 12  
 
 13  
 import java.beans.PropertyEditorSupport;
 14  
 
 15  
 /**
 16  
  * Translates a connector name property into the corresponding {@link org.mule.api.transport.Connector}
 17  
  * instance.
 18  
  *
 19  
  * TODO - Why isn't this simply a reference?
 20  
  */
 21  
 public class ConnectorPropertyEditor extends PropertyEditorSupport
 22  
 {
 23  
     private MuleContext muleContext;
 24  
 
 25  
     public ConnectorPropertyEditor(MuleContext muleContext)
 26  0
     {
 27  0
         this.muleContext = muleContext;
 28  0
     }
 29  
 
 30  
     public void setAsText(String text)
 31  
     {
 32  
 
 33  0
         Connector connector = muleContext.getRegistry().lookupConnector(text);
 34  
 
 35  0
         if (connector == null)
 36  
         {
 37  0
             throw new IllegalArgumentException(CoreMessages.objectNotRegistered("Connector", text).getMessage());
 38  
         }
 39  0
         setValue(connector);
 40  0
     }
 41  
 }