Coverage Report - org.apache.onami.autobind.configuration.ConfigurationModule
 
Classes in this File Line Coverage Branch Coverage Complexity
ConfigurationModule
0%
0/18
0%
0/6
2
 
 1  
 package org.apache.onami.autobind.configuration;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 5  
  * contributor license agreements.  See the NOTICE file distributed with
 6  
  * this work for additional information regarding copyright ownership.
 7  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 8  
  * (the "License"); you may not use this file except in compliance with
 9  
  * the License.  You may obtain a copy of the License at
 10  
  *
 11  
  *  http://www.apache.org/licenses/LICENSE-2.0
 12  
  *
 13  
  * Unless required by applicable law or agreed to in writing, software
 14  
  * distributed under the License is distributed on an "AS IS" BASIS,
 15  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 16  
  * See the License for the specific language governing permissions and
 17  
  * limitations under the License.
 18  
  */
 19  
 
 20  
 import java.util.ArrayList;
 21  
 import java.util.List;
 22  
 
 23  
 import javax.inject.Singleton;
 24  
 
 25  
 import org.apache.onami.autobind.annotations.GuiceModule;
 26  
 import org.apache.onami.configuration.PropertiesURLReader;
 27  
 
 28  
 @Singleton
 29  
 @GuiceModule
 30  0
 public class ConfigurationModule
 31  
     extends org.apache.onami.configuration.ConfigurationModule
 32  
 {
 33  
         
 34  0
         protected List<PropertiesURLReader> readers = new ArrayList<PropertiesURLReader>();
 35  
         
 36  
         protected boolean bindSystemProperties;
 37  
 
 38  
         protected boolean bindEnvironment;
 39  
 
 40  
 
 41  
     @Override
 42  
     protected void bindConfigurations()
 43  
     {
 44  
         // TODO what was the default implementation in rocoto 4.x?
 45  0
             for(PropertiesURLReader reader : readers){
 46  
                      try
 47  
              {
 48  0
                  bindProperties( reader.readConfiguration() );
 49  
              }
 50  0
              catch ( Exception e )
 51  
              {
 52  0
                  addError( "An error occurred while reading properties from '%s': %s", reader.getUrl(),
 53  
                            e.getMessage() );
 54  0
              }
 55  
             }
 56  
             
 57  0
             if(bindEnvironment){
 58  0
                     super.bindEnvironmentVariables();        
 59  
             }
 60  0
             if(bindSystemProperties){
 61  0
                     super.bindSystemProperties();        
 62  
             }
 63  0
     }
 64  
     
 65  
     @Override
 66  
     protected void bindEnvironmentVariables() {
 67  0
             bindEnvironment = true;
 68  0
     }
 69  
     
 70  
     @Override
 71  
     protected void bindSystemProperties() {
 72  0
             bindSystemProperties = true;
 73  0
     }
 74  
     
 75  
     public void addConfigurationReader(PropertiesURLReader reader){
 76  0
             this.readers.add(reader);
 77  0
     }
 78  
 
 79  
 }