Coverage Report - org.apache.any23.configuration.Configuration
 
Classes in this File Line Coverage Branch Coverage Complexity
Configuration
N/A
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  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  
 
 18  
 package org.apache.any23.configuration;
 19  
 
 20  
 /**
 21  
  * Defines the main <i>Any23</code> configuration.
 22  
  */
 23  
 public interface Configuration {
 24  
 
 25  
     /**
 26  
      * Returns all the defined configuration properties.
 27  
      *
 28  
      * @return list of defined properties.
 29  
      */
 30  
     String[] getProperties();
 31  
 
 32  
     /**
 33  
      * Checks whether a property is defined or not in configuration.
 34  
      *
 35  
      * @param propertyName name of property to check.
 36  
      * @return <code>true</code> if defined, </code>false</code> otherwise.
 37  
      */
 38  
     boolean defineProperty(String propertyName);
 39  
 
 40  
     /**
 41  
      * Returns the value of a specified property, of the default value if property is not defined.
 42  
      *
 43  
      * @param propertyName name of property
 44  
      * @param defaultValue default value if not found.
 45  
      * @return the value associated to <i>propertyName</i>.
 46  
      */
 47  
     String getProperty(String propertyName, String defaultValue);
 48  
 
 49  
     /**
 50  
      * Returns the value of the specified <code>propertyName</code> or raises an exception
 51  
      * if <code>propertyName</code> is not defined.
 52  
      *
 53  
      * @param propertyName name of property to be returned.
 54  
      * @return property value.
 55  
      * @throws IllegalArgumentException if the property name is not defined
 56  
      *                                  or the found property value is blank or empty.
 57  
      */
 58  
     String getPropertyOrFail(String propertyName);
 59  
 
 60  
     /**
 61  
      * Returns the {@link Integer} value of the specified <code>propertyName</code> or raises an exception
 62  
      * if <code>propertyName</code> is not defined.
 63  
      *
 64  
      * @param propertyName name of property to be returned.
 65  
      * @return property value.
 66  
      * @throws NullPointerException if the property name is not defined.
 67  
      * @throws IllegalArgumentException if the found property value is blank or empty.
 68  
      * @throws NumberFormatException if the found property value is not a valid {@link Integer}.
 69  
      */
 70  
     int getPropertyIntOrFail(String propertyName);
 71  
 
 72  
     /**
 73  
      * Returns the value of a <i> flag property</i>. Such properties can assume only two values:
 74  
      * <ul>
 75  
      *     <li><code>on</code>  if flag is active   (<code>true</code> is returned).
 76  
      *     <li><code>off</code> if flag is inactive (<code>false</code> is returned).
 77  
      * </ul>
 78  
      *
 79  
      * @param propertyName name of property flag.
 80  
      * @return <code>true</code> for <code>on</code>, <code>false</code> for <code>off</code>.
 81  
      * @throws IllegalArgumentException if the <code>propertyName</code> is not declared.
 82  
      */
 83  
     boolean getFlagProperty(final String propertyName);
 84  
 
 85  
     /**
 86  
      * Returns a human readable string containing the configuration dump.
 87  
      *
 88  
      * @return a string describing the configuration options.
 89  
      */
 90  
     String getConfigurationDump();
 91  
 
 92  
 }