g-Eclipse
Release 1.0.0

eu.geclipse.core.config
Class Configuration

java.lang.Object
  extended by eu.geclipse.core.config.Configuration
All Implemented Interfaces:
IConfiguration

public class Configuration
extends java.lang.Object
implements IConfiguration

Concrete implementation of the IConfiguration interface. Configuration parameters are stored using a hashtable. This implementation provides a standard way of loading and saving a specific configuration from and to XML files.


Constructor Summary
Configuration()
          Standard constructor for an empty configuration.
Configuration(IConfiguration configuration)
          Copy constructor.
 
Method Summary
 java.util.Set<java.lang.String> getKeys()
          Get the keys of all currently registered parameters.
 java.lang.String getParameter(java.lang.String key)
          Get the parameter corresponding to the specified key.
 java.lang.String[] getParameters(java.lang.String key)
          Get the parameter corresponding to the specified key.
 void loadFromXML(IFileStore store)
          Load the configuration from the specified file store.
 void setParameter(java.lang.String key, java.lang.String value)
          Sets a single-value parameter.
 void setParameters(java.lang.String key, java.lang.String[] value)
          Sets a multi-value parameter.
 void storeToXML(IFileStore store)
          Save this configuration to the specified file store.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()
Standard constructor for an empty configuration.


Configuration

public Configuration(IConfiguration configuration)
Copy constructor.

Parameters:
configuration - The configuration to be copied.
Method Detail

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
Sets a single-value parameter.

Parameters:
key - The parameter's key.
value - The parameter's value.

setParameters

public void setParameters(java.lang.String key,
                          java.lang.String[] value)
Sets a multi-value parameter.

Parameters:
key - The parameter's key.
value - The parameter's value.

getKeys

public java.util.Set<java.lang.String> getKeys()
Description copied from interface: IConfiguration
Get the keys of all currently registered parameters.

Specified by:
getKeys in interface IConfiguration
Returns:
A Set of keys for all currently registered parameters.

getParameter

public java.lang.String getParameter(java.lang.String key)
Description copied from interface: IConfiguration
Get the parameter corresponding to the specified key. If no parameter with the specified key is found or if the parameter is a multi-string parameter null will be returned.

Specified by:
getParameter in interface IConfiguration
Parameters:
key - The key of the parameter to be returned.
Returns:
The single-string parameter or null if either the paremeter does not exist or if the specified key corresponds to a multi-string parameter.

getParameters

public java.lang.String[] getParameters(java.lang.String key)
Description copied from interface: IConfiguration
Get the parameter corresponding to the specified key. If no parameter with the specified key is found null will be returned. If the parameter corresponds to a single-string this string is wrapped into a one-element array before returning.

Specified by:
getParameters in interface IConfiguration
Parameters:
key - The key of the parameter to be returned.
Returns:
The multi-string parameter or null if no such parameter exists.

loadFromXML

public void loadFromXML(IFileStore store)
                 throws ProblemException
Description copied from interface: IConfiguration
Load the configuration from the specified file store.

Specified by:
loadFromXML in interface IConfiguration
Parameters:
store - The IFileStore from which to load the parameters.
Throws:
ProblemException - If the file store does not exists or an error occurs while reading the data from the file store.

storeToXML

public void storeToXML(IFileStore store)
                throws ProblemException
Description copied from interface: IConfiguration
Save this configuration to the specified file store.

Specified by:
storeToXML in interface IConfiguration
Parameters:
store - The IFileStore to which to save the configuration.
Throws:
ProblemException - If an error occurs while saving the configuration.

g-Eclipse
Release 1.0.0