All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.preferences.Configuration

java.lang.Object
   |
   +----semper.preferences.Configuration

public class Configuration
extends Object
The Configuration manager is a static class that manage the set of configuration field for a SEMPER application. This class is the main interface to configuration information and is very similar to the Preferences manager interface. This manager must be initialised before the Preferences manager.

Version:
$Revision: 1.14 $ $Date: 1997/09/26 16:29:23 $
Author:
Louis Salvail (CWI)
See Also:
Preferences

Variable Index

 o configFileName
 o configFilePath
 o defaultName
 o defaultPath

Constructor Index

 o Configuration()
This is a static class so everytime this constructor is called an exception is thrown.

Method Index

 o changeVal(String, String)
Allows to change the value of the given configuration field.
 o fieldsList()
Returns the list of all configuration fields.
 o get(String)
Get a configuration value from the actual configuration state.
 o getConfigFileName()
Returns the current filepath/filename for the configuration data.
 o init()
This method initialized Configuration by loading the default configuration file.
 o init(String, String)
This methods initialized Configuration by loading the given configuration file.
 o isEmpty()
Returns true iff no configuration fields are currently loaded.
 o isInitialised()
Returns true if configuration data have been initialised.
 o numberOfFields()
Gives the number of configuration fileds.
 o printConfig()
Print on the standard output the set of all configuration data.
 o put(String, String)
Put a new fieldname with the given value in the actual configuration state.
 o remove(String)
Remove a field from the actual state.
 o removeAll()
Removes all configuration fields.
 o save()
Save the internal configuration structure in the current configuration filename.
 o save(String, String)
Save the internal configuration structure in a file.
 o saveAsDefault()
Save as a new default configuration file.

Variables

 o defaultName
 public static final String defaultName
 o defaultPath
 public static final String defaultPath
 o configFileName
 protected static String configFileName
 o configFilePath
 protected static String configFilePath

Constructors

 o Configuration
 public Configuration() throws ConfigurationException
This is a static class so everytime this constructor is called an exception is thrown.

Throws: ConfigurationException
each a time this method is called.

Methods

 o init
 public static void init() throws ConfigurationException
This method initialized Configuration by loading the default configuration file.

Returns:
none.
Throws: ConfigurationException
when the file is not found.
 o init
 public static void init(String path,
                         String fileName) throws ConfigurationException
This methods initialized Configuration by loading the given configuration file.

Parameters:
path - is the path for the file to retrieve
fileName - is the filename to retrieve.
Returns:
none.
Throws: ConfigurationException
when the file is not found.
 o getConfigFileName
 public static String getConfigFileName()
Returns the current filepath/filename for the configuration data.

Returns:
the filepath/filename or null if not already defined.
 o isInitialised
 public static boolean isInitialised()
Returns true if configuration data have been initialised.

Returns:
true iff configuration has been initialised.
 o isEmpty
 public static boolean isEmpty()
Returns true iff no configuration fields are currently loaded.

Returns:
true iff no configuration data are loaded.
 o save
 public static void save(String path,
                         String fileName) throws ConfigurationException
Save the internal configuration structure in a file.

Parameters:
path - is the absolute path where to put the file.
fileName - of the configuration file.
Throws: ConfigurationException
when a problem happened.
See Also:
File
 o save
 public static void save() throws ConfigurationException
Save the internal configuration structure in the current configuration filename. Should be used only when Configuration has been initialised correctly.

Returns:
none.
Throws: ConfigurationException
when the current file and path are not well-defined or the configuration manager has not been initialised.
See Also:
File
 o saveAsDefault
 public static void saveAsDefault() throws ConfigurationException
Save as a new default configuration file.

Returns:
none.
Throws: ConfigurationException
when a problem occured.
 o get
 public static String get(String fieldName)
Get a configuration value from the actual configuration state.

Parameters:
fieldName - of the configuration value.
Returns:
the value or null if that field dos not exist.
 o put
 public static String put(String fieldName,
                          String fieldVal)
Put a new fieldname with the given value in the actual configuration state.

Parameters:
fieldName - is the field identity.
fieldValue - is the value to be put.
Returns:
the old value of the field, or null if it did not have one.
 o changeVal
 public static String changeVal(String fieldName,
                                String fieldVal)
Allows to change the value of the given configuration field. The operation is performed only if the field already exists.

Parameters:
fieldName - is the name of the field.
fieldVal - is the new value.
Returns:
the old value or null if the field did not exists before. No modification is done in that case.
 o remove
 public static String remove(String fieldName)
Remove a field from the actual state.

Parameters:
fieldName - to remove.
Returns:
the previous field value or null if no field has been found.
 o fieldsList
 public static Enumeration fieldsList()
Returns the list of all configuration fields.

Returns:
an enumeration of the fields.
 o printConfig
 public static void printConfig()
Print on the standard output the set of all configuration data.

 o numberOfFields
 public static int numberOfFields()
Gives the number of configuration fileds.

Returns:
s the number.
 o removeAll
 public static void removeAll()
Removes all configuration fields.

Returns:
none.

All Packages  Class Hierarchy  This Package  Previous  Next  Index