Coverage Report - org.codehaus.plexus.configuration.source.ChainedConfigurationSource
 
Classes in this File Line Coverage Branch Coverage Complexity
ChainedConfigurationSource
36 %
4/11
0 %
0/4
2
 
 1  
 package org.codehaus.plexus.configuration.source;
 2  
 
 3  
 import java.util.Iterator;
 4  
 import java.util.List;
 5  
 
 6  
 import org.codehaus.plexus.component.repository.ComponentDescriptor;
 7  
 import org.codehaus.plexus.configuration.PlexusConfiguration;
 8  
 
 9  
 /**
 10  
  * A configuration source that delegates to any number of underlying configuration sources. If you are an application
 11  
  * author and want to create a custom source of configuration for the components in your application then you would most
 12  
  * likely want to create a chained configuration source where you can decide the order of processing, but still have the
 13  
  * container perform its default behavior.
 14  
  * 
 15  
  * @author Jason van Zyl
 16  
  */
 17  
 public class ChainedConfigurationSource
 18  
     implements ConfigurationSource
 19  
 {
 20  
     private List configurationSources;
 21  
 
 22  
     public ChainedConfigurationSource( List configurationSources )
 23  1
     {
 24  1
         this.configurationSources = configurationSources;
 25  1
     }
 26  
 
 27  
     public PlexusConfiguration getConfiguration( ComponentDescriptor componentDescriptor )
 28  
     {
 29  0
         for (Object configurationSource1 : configurationSources) {
 30  0
             ConfigurationSource configurationSource = (ConfigurationSource) configurationSource1;
 31  
 
 32  0
             PlexusConfiguration configuration = configurationSource.getConfiguration(componentDescriptor);
 33  
 
 34  0
             if (configuration != null) {
 35  0
                 return configuration;
 36  
             }
 37  0
         }
 38  
 
 39  0
         return null;
 40  
     }
 41  
 
 42  
     public List getConfigurationSources()
 43  
     {
 44  2
         return configurationSources;
 45  
     }
 46  
 }