org.eodisp.util.configuration
Interface Configuration

All Known Implementing Classes:
ConfigurationImpl, Log4JConfiguration

public interface Configuration

Defines the basic interface for all configuration used in the EODiSP. It is defined independent of any backend (persistence) or front-end (e.g: GUI, command-line) mechanism. Even though it is possible to specify the type of a configuration entry, no validation of values is done. This is left to the user of this class.

Version:
$Id: Configuration.java 3753 2006-09-26 16:11:53Z ibirrer $
Author:
ibirrer

Nested Class Summary
static interface Configuration.Entry
          This interface represents one entry (option) of a configuration.
 
Method Summary
 boolean containsEntry(java.lang.String key)
          Returns whether this configuration contains an entry with the given key.
 Configuration.Entry[] entries()
          Returns a safe array of all configuration entries of this configuration..
 java.lang.String getDescription()
          The description of this configuration.
 Configuration.Entry getEntry(java.lang.String key)
          Returns the entry with the given key.
 java.lang.String getId()
          The id is used as the registration key if the configuration is registered with and application.
 java.lang.String getName()
          Returns the name of the configuration.
 void load()
          Load the configuration from its stored location.
 boolean needsSave()
          Indicates if this configuration needs to be saved.
 void save()
          Saves the configuration to a persistent storage.
 

Method Detail

load

void load()
          throws java.io.IOException
Load the configuration from its stored location. Specific implementations of the Configuration class define how (e.g: database, file etc.) and from where (e.g: db table, file location etc..) the configuration is loaded. See the implementations of this interface for details.

Throws:
java.io.IOException - Indicates an error while loading.

getEntry

Configuration.Entry getEntry(java.lang.String key)
Returns the entry with the given key.

Parameters:
key - the key of the entry that shall be returned.
Returns:
the entry with the given key. Returns null if no entry with the given key exists.

containsEntry

boolean containsEntry(java.lang.String key)
Returns whether this configuration contains an entry with the given key. This test can be performed to distinguish between a null and a non-existing entry.

Parameters:
key - the key of the entry that shall be returned.
Returns:
True, if the entry exists, otherwise false.

save

void save()
          throws java.io.IOException
Saves the configuration to a persistent storage. Only entries are saved that for which Configuration.Entry.isSet() returns true.

Throws:
java.io.IOException - Indicates an error while saving.

entries

Configuration.Entry[] entries()
Returns a safe array of all configuration entries of this configuration..

Returns:
an array containing all entries of this configuration.

getName

java.lang.String getName()
Returns the name of the configuration. The name can be used in a GUI but needn't to be unique in a JVM.

Returns:
the name of this configuration

getId

java.lang.String getId()
The id is used as the registration key if the configuration is registered with and application. Must be unique.

Returns:
the unique id of this configuration

getDescription

java.lang.String getDescription()
The description of this configuration. Suitable to be shown to a human.

Returns:
the description of this configuration

needsSave

boolean needsSave()
Indicates if this configuration needs to be saved. This is true if the configuration in memory is different to the persisted configuration.

Returns:
true if this configuration is different from its persisted form.