org.naftulin.configmgr
Class ConfigurationManagementImpl

java.lang.Object
  extended by org.naftulin.configmgr.ConfigurationManagementImpl
All Implemented Interfaces:
ConfigurationManagement

public class ConfigurationManagementImpl
extends java.lang.Object
implements ConfigurationManagement

Configuration Management provides a convinient way to manage configuration for your programs. Alows to load and reload configurations, add configuration, list all the configurations and returns configuration manager interface. Configuration manager interface returns configuration based on the key.

Since:
1.0
Author:
Henry Naftulin

Method Summary
 void addConfigurationManagmentEntry(ConfigurationManagementEntry entry)
          Adds a configuration entry to the configuration manager.
 ConfigurationManager getConfigurationManager()
          Returns configuration manager created by the configuration management engine.
 java.util.List<ConfigurationManagementEntry> getConfigurationManagmentEntries()
          Returns a list of configuration management entries managed by this configuration managment engine.
 ConfigurationManagementEntry getConfigurationManagmentEntry(java.lang.String key)
          Returns configuration management entry based on the key passed.
 boolean isInitialized()
          Returns true if configuration Management has loaded configurations.
 void reload()
          Reloades configurations stored in the configuration management engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reload

public void reload()
            throws ConfigurationManagerException
Reloades configurations stored in the configuration management engine. The configurations are read again, parsed and stored.

Specified by:
reload in interface ConfigurationManagement
Throws:
ConfigurationManagerException - if a problem occurs while reading or parsing the configurations.

getConfigurationManagmentEntry

public ConfigurationManagementEntry getConfigurationManagmentEntry(java.lang.String key)
                                                            throws ConfigurationManagerException
Returns configuration management entry based on the key passed.

Specified by:
getConfigurationManagmentEntry in interface ConfigurationManagement
Parameters:
key - key the entry is stored under
Returns:
configuration management entry based on the key passed
Throws:
ConfigurationManagerException - if the entry is not found.

getConfigurationManagmentEntries

public java.util.List<ConfigurationManagementEntry> getConfigurationManagmentEntries()
Returns a list of configuration management entries managed by this configuration managment engine.

Specified by:
getConfigurationManagmentEntries in interface ConfigurationManagement
Returns:
a list of configuration management entries managed by this configuration managment engine.

isInitialized

public boolean isInitialized()
Returns true if configuration Management has loaded configurations. Returns false before that point. After instantiation, we can confgure where configuration master record is read from. Once the master record is configured, we will be able to reload configuration manager. Reloading configuration manager will load all configurations, and the flag will switch to initialized.

Specified by:
isInitialized in interface ConfigurationManagement
Returns:
true if configuration Management has loaded configurations.

getConfigurationManager

public ConfigurationManager getConfigurationManager()
Returns configuration manager created by the configuration management engine.

Specified by:
getConfigurationManager in interface ConfigurationManagement
Returns:
configuration manager.

addConfigurationManagmentEntry

public void addConfigurationManagmentEntry(ConfigurationManagementEntry entry)
                                    throws EntryInErrorException
Adds a configuration entry to the configuration manager. Needed to add ad-hoc configurations to the configuration manager. when adding a new configuration with the same key old configuration should be replaced. Is overwritten flag for the new configuration should be set. Delegates to private method that takes a map to which the configuration is added.

Specified by:
addConfigurationManagmentEntry in interface ConfigurationManagement
Parameters:
entry - configuration entry
Throws:
if - the entry is in error
EntryInErrorException - if the entry is not configured properly, for example if the key is not supplied.


Copyright © 2009. All Rights Reserved.