Clover coverage report - Services for Dentaku - 0.6
Coverage timestamp: Wed Jun 30 2004 19:54:58 EDT
file stats: LOC: 58   Methods: 2
NCLOC: 27   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DentakuPlexusContainer.java 75% 100% 100% 92.9%
coverage coverage
 1   
 /*
 2   
  * DentakuPlexusContainer.java
 3   
  * Copyright 2002-2004 Bill2, Inc.
 4   
  *
 5   
  * Licensed under the Apache License, Version 2.0 (the "License");
 6   
  * you may not use this file except in compliance with the License.
 7   
  * You may obtain a copy of the License at
 8   
  *
 9   
  *     http://www.apache.org/licenses/LICENSE-2.0
 10   
  *
 11   
  * Unless required by applicable law or agreed to in writing, software
 12   
  * distributed under the License is distributed on an "AS IS" BASIS,
 13   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14   
  * See the License for the specific language governing permissions and
 15   
  * limitations under the License.
 16   
  */
 17   
 package org.dentaku.services.container;
 18   
 
 19   
 import org.codehaus.plexus.DefaultPlexusContainer;
 20   
 import org.codehaus.plexus.configuration.PlexusConfiguration;
 21   
 import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
 22   
 import org.codehaus.plexus.configuration.xml.xstream.PlexusTools;
 23   
 
 24   
 import java.io.InputStreamReader;
 25   
 import java.util.Iterator;
 26   
 import java.util.List;
 27   
 
 28   
 public class DentakuPlexusContainer extends DefaultPlexusContainer {
 29   
     private List configurationResources = null;
 30   
 
 31  9
     public void setConfigurationResources(List configurationResources) {
 32  9
         this.configurationResources = configurationResources;
 33   
     }
 34   
 
 35  9
     protected void initializeConfiguration() throws Exception {
 36  9
         super.initializeConfiguration();
 37   
 
 38   
         // this configuration is generated in the model and loaded from the classpath.  Since we can't load all configurations
 39   
         // in a certain class path, we need to have a single document that can point to all of the relevant documents that need
 40   
         // to be loaded.
 41   
         //InputStreamReader reader = new InputStreamReader(getClass().getConfigurationResource("/org/dentaku/conf/persistence/factory.xml"));
 42  9
         if (configurationResources != null) {
 43  9
             for (Iterator it = configurationResources.iterator(); it.hasNext();) {
 44  9
                 InputStreamReader config = (InputStreamReader) it.next();
 45  9
                 PlexusConfiguration conf =
 46   
                     PlexusTools.buildConfiguration( getInterpolationConfigurationReader( config ) );
 47   
 
 48  9
                 XmlPlexusConfiguration componentsConfiguration =
 49   
                     (XmlPlexusConfiguration) configuration.getChild( "components" );
 50   
 
 51  9
                 componentsConfiguration.addAllChildren( conf.getChild( "components" ) );
 52   
 
 53   
             }
 54   
         }
 55   
 
 56   
     }
 57   
 }
 58