Class semper.preferences.Configuration
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.
- The only requirement is that semper.util.serial and
semper.util.log are intialised.
- Version:
- $Revision: 1.11 $ $Date: 1997/04/09 14:02:19 $
- Author:
- Louis Salvail (CWI)
- See Also:
- Preferences
-
configFileName
-
-
configFilePath
-
-
defaultName
-
-
defaultPath
-
-
Configuration()
- This is a static class so everytime this constructor
is called an exception is thrown.
-
changeVal(String, String)
- Allows to change the value of the given configuration field.
-
fieldsList()
- Returns the list of all configuration fields.
-
get(String)
- Get a configuration value from the actual configuration state.
-
getConfigFileName()
- Returns the current filepath/filename for the configuration data.
-
init()
- This method initialized Configuration by loading the default configuration file.
-
init(String, String)
- This methods initialized Configuration by loading the given configuration file.
-
isEmpty()
- Returns true iff no configuration fields are currently loaded.
-
isInitialised()
- Returns true if configuration data have been initialised.
-
numberOfFields()
- Gives the number of configuration fileds.
-
print()
- Print the configuration data as they appear in the Configuration
manager.
-
put(String, String)
- Put a new fieldname with the given value in the actual configuration state.
-
remove(String)
- Remove a field from the actual state.
-
removeAll()
- Removes all configuration fields.
-
save()
- Save the internal configuration structure in the current configuration filename.
-
save(String, String)
- Save the internal configuration structure in a file.
-
saveAsDefault()
- Save as a new default configuration file.
defaultName
public final static String defaultName
defaultPath
public final static String defaultPath
configFileName
protected static String configFileName
configFilePath
protected static String configFilePath
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.
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.
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.
getConfigFileName
public static String getConfigFileName()
- Returns the current filepath/filename for the configuration data.
- Returns:
- the filepath/filename or null if not already defined.
isInitialised
public static boolean isInitialised()
- Returns true if configuration data have been initialised.
- Returns:
- true iff configuration has been initialised.
isEmpty
public static boolean isEmpty()
- Returns true iff no configuration fields are currently loaded.
- Returns:
- true iff no configuration data are loaded.
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
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
saveAsDefault
public static void saveAsDefault() throws ConfigurationException
- Save as a new default configuration file.
- Returns:
- none.
- Throws: ConfigurationException
- when a problem occured.
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.
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.
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.
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.
fieldsList
public static Enumeration fieldsList()
- Returns the list of all configuration fields.
- Returns:
- an enumeration of the fields.
print
public static void print()
- Print the configuration data as they appear in the Configuration
manager.
numberOfFields
public static int numberOfFields()
- Gives the number of configuration fileds.
- Returns:
- s the number.
removeAll
public static void removeAll()
- Removes all configuration fields.
- Returns:
- none.
All Packages Class Hierarchy This Package Previous Next Index