org.dbmaintain.config
Class DbMaintainConfigurationLoader

java.lang.Object
  extended by org.dbmaintain.config.DbMaintainConfigurationLoader

public class DbMaintainConfigurationLoader
extends Object

Utility that loads the configuration of DbMaintain.

Author:
Tim Ducheyne, Filip Neven

Field Summary
static String DEFAULT_PROPERTIES_FILE_NAME
          Name of the fixed configuration file that contains all defaults
 
Constructor Summary
DbMaintainConfigurationLoader()
           
 
Method Summary
 Properties loadConfiguration()
          Loads all properties as defined by the default configuration.
 Properties loadConfiguration(File customConfigurationFile)
          Loads all properties as defined by the default configuration.
 Properties loadConfiguration(Properties customConfiguration)
          Loads all properties as defined by the default configuration.
 Properties loadConfiguration(URL customConfigurationUrl)
          Loads all properties as defined by the default configuration.
 Properties loadDefaultConfiguration()
          Creates and loads the default configuration settings from the DEFAULT_PROPERTIES_FILE_NAME file.
protected  Properties loadPropertiesFromClasspath(String propertiesFileName)
           
protected  Properties loadPropertiesFromFile(File propertiesFile)
           
protected  Properties loadPropertiesFromStream(InputStream inputStream)
           
protected  Properties loadPropertiesFromURL(URL propertiesFileUrl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROPERTIES_FILE_NAME

public static final String DEFAULT_PROPERTIES_FILE_NAME
Name of the fixed configuration file that contains all defaults

See Also:
Constant Field Values
Constructor Detail

DbMaintainConfigurationLoader

public DbMaintainConfigurationLoader()
Method Detail

loadConfiguration

public Properties loadConfiguration()
Loads all properties as defined by the default configuration.

Returns:
the settings, not null

loadConfiguration

public Properties loadConfiguration(URL customConfigurationUrl)
Loads all properties as defined by the default configuration. Properties defined by the properties file to which the given URL points override the default properties.

Parameters:
customConfigurationUrl - URL that points to the custom configuration, may be null if there is no custom config
Returns:
the settings, not null

loadConfiguration

public Properties loadConfiguration(File customConfigurationFile)
Loads all properties as defined by the default configuration. Properties defined by the properties file to which the given URL points override the default properties.

Parameters:
customConfigurationFile - The custom configuration, may be null if there is no custom config
Returns:
the settings, not null

loadConfiguration

public Properties loadConfiguration(Properties customConfiguration)
Loads all properties as defined by the default configuration. Properties from the given properties object override the default properties.

Parameters:
customConfiguration - custom configuration, may be null if there is no custom config
Returns:
the settings, not null

loadDefaultConfiguration

public Properties loadDefaultConfiguration()
Creates and loads the default configuration settings from the DEFAULT_PROPERTIES_FILE_NAME file.

Returns:
the defaults, not null
Throws:
RuntimeException - if the file cannot be found or loaded

loadPropertiesFromClasspath

protected Properties loadPropertiesFromClasspath(String propertiesFileName)

loadPropertiesFromURL

protected Properties loadPropertiesFromURL(URL propertiesFileUrl)

loadPropertiesFromFile

protected Properties loadPropertiesFromFile(File propertiesFile)

loadPropertiesFromStream

protected Properties loadPropertiesFromStream(InputStream inputStream)
                                       throws IOException
Throws:
IOException


Copyright © 2011. All Rights Reserved.