net.ggtools.grand
Class Configuration

java.lang.Object
  extended by net.ggtools.grand.Configuration

public class Configuration
extends java.lang.Object

A singleton class for configuration.

Author:
Christophe Labouisse

Constructor Summary
protected Configuration(java.util.Properties override)
          Creates a new configuration.
 
Method Summary
 java.lang.String get(java.lang.String key)
          Get a parameter as a String.
 java.util.Properties getBuildProperties()
           
static Configuration getConfiguration()
          Get a configuration with the default values.
static Configuration getConfiguration(java.io.File propFile)
          Returns an new configuration overriding some parameters from a file.
static Configuration getConfiguration(java.util.Properties override)
          Returns a new configuration overriding some parameters.
 java.lang.String getVersionString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

protected Configuration(java.util.Properties override)
                 throws java.io.IOException
Creates a new configuration. The new object's get methods will return values from the supplied properties if the demanded key exists or from the default properties in other case.

Parameters:
override - properties to override in the default configuration.
Throws:
java.io.IOException
Method Detail

getConfiguration

public static Configuration getConfiguration()
                                      throws java.io.IOException
Get a configuration with the default values.

Returns:
new configuration
Throws:
java.io.IOException - if the default properties were not loadable.

getConfiguration

public static Configuration getConfiguration(java.io.File propFile)
                                      throws java.io.IOException
Returns an new configuration overriding some parameters from a file.

Parameters:
propFile - override file
Returns:
new configuration
Throws:
java.io.IOException - if the default properties were not loadable.

getConfiguration

public static Configuration getConfiguration(java.util.Properties override)
                                      throws java.io.IOException
Returns a new configuration overriding some parameters.

Parameters:
override - the properties to override.
Returns:
new configuration
Throws:
java.io.IOException - if the default properties were not loadable.

get

public final java.lang.String get(java.lang.String key)
Get a parameter as a String.

Parameters:
key - parameter to look for.
Returns:
parameter value.

getBuildProperties

public final java.util.Properties getBuildProperties()
Returns:
Returns the buildProperties.

getVersionString

public final java.lang.String getVersionString()
Returns:
Returns the versionString.


Copyright © 2004-2005 ggTools. All Rights Reserved.