com.emarsys.ecommon.prefs.config
Interface ConfigurationBackend

All Known Implementing Classes:
Configuration, DefaultsConfigurationBackend, FallbackConfigurationBackend, FallbackDefaultConfigurationBackend, ImmutableConfigurationBackend, ModeSettingConfigurationBackend, NamedConfigurationBackend, NullConfigurationBackend, PropertiesConfigurationBackend, SnapshotPropertiesConfigurationBackend

public interface ConfigurationBackend

A ConfigurationBackend encapsulates a generic backend that provides access to ISettings.

ConfigurationBackend implementations could delegate to a Properties or Preferences object or query a DB or some other storage mechanism.

TODO ConfigurationBackend.class

Author:
Michael "kULO" Kulovits

Method Summary
 ISetting get(java.lang.String name)
          Retrieves the ISetting with the passed name.
 java.util.List<ISetting> getSettings()
           Retrieves all ISettings from this backend.
 void set(ISetting setting)
          Sets the passed setting which must not be null in this configuration backend, if a setting with the given name is already present it will be overridden.
 

Method Detail

get

ISetting get(java.lang.String name)
             throws java.lang.IllegalArgumentException
Retrieves the ISetting with the passed name.

Returns:
the ISetting with the passed name or null if not present.
Throws:
java.lang.IllegalArgumentException - - if the passed name is null.

set

void set(ISetting setting)
         throws java.lang.IllegalArgumentException
Sets the passed setting which must not be null in this configuration backend, if a setting with the given name is already present it will be overridden. The next call to get(String) with the passed setting's name will return the passed setting.

Parameters:
setting -
Throws:
java.lang.IllegalArgumentException - - if the passed setting, its name or value is null.

getSettings

java.util.List<ISetting> getSettings()

Retrieves all ISettings from this backend.

What exactly "all" means in the context of the concrete ConfigurationBackend is up to the implementation. For instance the List may or may not contain default values or fallbacked ISettings or might even return a cached list.

The only requirement for this method is to be logically in synch with get(String) and set(ISetting). Thus if a Setting is inserted/updated/deleted and nothing is changed in the meantime the next call to getSettings() has to reflect the changes made.

Returns:
always a valid List of ISettings, never null.


Copyright © 2010 emarsys AG. All Rights Reserved.