Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.any23.configuration
Class DefaultConfiguration

    java.lang.Object
      org.apache.any23.configuration.DefaultConfiguration

All Implemented Interfaces:
  Configuration

Direct Known Subclasses:
  DefaultModifiableConfiguration

    public class DefaultConfiguration

extends Object
implements Configuration

Default implementation of `Configuration`. The default property values are read from the /default-configuration.properties properties file in classpath.

Author:
  Michele Mostarda (michele.mostarda@gmail.com)

Field Summary
`static String` | `DEFAULT_CONFIG_FILE` Default configuration file.
`static String` | `FLAG_PROPERTY_OFF`
`static String` | `FLAG_PROPERTY_ON`
`protected static org.slf4j.Logger` | `logger`
`protected Properties` | `properties`
`protected static DefaultConfiguration` | `singleton`

Constructor Summary
`protected` | `DefaultConfiguration(Properties properties)`

Method Summary
`static ModifiableConfiguration` | `copy()`
`boolean` | `defineProperty(String propertyName)` Checks whether a property is defined or not in configuration.
`String` | `getConfigurationDump()` Returns a human readable string containing the configuration dump.
`boolean` | `getFlagProperty(String propertyName)` Returns the value of a flag property.
`String[]` | `getProperties()` Returns all the defined configuration properties.
`String` | `getProperty(String propertyName, String defaultValue)` Returns the value of a specified property, of the default value if property is not defined.
`int` | `getPropertyIntOrFail(String propertyName)` Returns the `Integer` value of the specified `propertyName` or raises an exception if `propertyName` is not defined.
`String` | `getPropertyOrFail(String propertyName)` Returns the value of the specified `propertyName` or raises an exception if `propertyName` is not defined.
`static DefaultConfiguration` | `singleton()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_CONFIG_FILE

    public static final String DEFAULT_CONFIG_FILE

  Default configuration file.

  See Also:
    Constant Field Values

### FLAG_PROPERTY_ON

    public static final String FLAG_PROPERTY_ON

See Also:
  Constant Field Values

### FLAG_PROPERTY_OFF

    public static final String FLAG_PROPERTY_OFF

See Also:
  Constant Field Values

### logger

    protected static final org.slf4j.Logger logger

### singleton

    protected static final DefaultConfiguration singleton

### properties

    protected final Properties properties

Constructor Detail

### DefaultConfiguration

    protected DefaultConfiguration(Properties properties)

Method Detail

### singleton

    public static DefaultConfiguration singleton()

  Returns:
    the singleton configuration instance. Such instance is unmodifiable.

### copy

    public static ModifiableConfiguration copy()

  Returns:
    a copy of the singleton instance. such instance is modifiable.

### getProperties

    public String[] getProperties()

  Description copied from interface: `Configuration`
  Returns all the defined configuration properties.

  Specified by:
    `getProperties` in interface `Configuration`
  Returns:
    list of defined properties.

### defineProperty

    public boolean defineProperty(String propertyName)

  Description copied from interface: `Configuration`
  Checks whether a property is defined or not in configuration.

  Specified by:
    `defineProperty` in interface `Configuration`
  Parameters:
    `propertyName` - name of property to check.
  Returns:
    `true` if defined, false otherwise.

### getProperty

    public String getProperty(String propertyName,
                              String defaultValue)

  Description copied from interface: `Configuration`
  Returns the value of a specified property, of the default value if property is not defined.

  Specified by:
    `getProperty` in interface `Configuration`
  Parameters:
    `propertyName` - name of property
    `defaultValue` - default value if not found.
  Returns:
    the value associated to propertyName.

### getPropertyOrFail

    public String getPropertyOrFail(String propertyName)

  Description copied from interface: `Configuration`
  Returns the value of the specified `propertyName` or raises an exception if `propertyName` is not defined.

  Specified by:
    `getPropertyOrFail` in interface `Configuration`
  Parameters:
    `propertyName` - name of property to be returned.
  Returns:
    property value.

### getPropertyIntOrFail

    public int getPropertyIntOrFail(String propertyName)

  Description copied from interface: `Configuration`
  Returns the `Integer` value of the specified `propertyName` or raises an exception if `propertyName` is not defined.

  Specified by:
    `getPropertyIntOrFail` in interface `Configuration`
  Parameters:
    `propertyName` - name of property to be returned.
  Returns:
    property value.

### getFlagProperty

    public boolean getFlagProperty(String propertyName)

  Description copied from interface: `Configuration`
  Returns the value of a flag property. Such properties can assume only two values:
  - `on` if flag is active (`true` is returned).
  - `off` if flag is inactive (`false` is returned).

  Specified by:
    `getFlagProperty` in interface `Configuration`
  Parameters:
    `propertyName` - name of property flag.
  Returns:
    `true` for `on`, `false` for `off`.

### getConfigurationDump

    public String getConfigurationDump()

  Description copied from interface: `Configuration`
  Returns a human readable string containing the configuration dump.

  Specified by:
    `getConfigurationDump` in interface `Configuration`
  Returns:
    a string describing the configuration options.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.