com.ccg.io
Interface Configurable


public interface Configurable

What must be implemented by "configurable" objects.

For an general overview of configuration issues (and how this class fits in to the scheme), refer to the Configuration Files document.

This class defines the methods which MUST be implemented by a configurable object. Classes which implement this interface must be able to indicate the ConfigSource object they use for loading and saving configuration files, in addition, they must provide a means in which configuration information can be saved and loaded.

If things work out well, if your class provides these methods, then "gluing" it to a application should become a generic task. The following should then be able to your class:

Since:
1.0
Version:
$Revision: 1.1.1.1 $
Author:
$Author: pkb $
See Also:
ConfigSource, ConfigAttributes

Method Summary
 ConfigSource getConfigSource()
          Get the ConfigSource to open/create files with.
 void loadConfig(String name)
          The method to use when the configuration should be loaded from disk.
 void saveConfig(String name)
          The method to use when the configuration should be saved to disk.
 

Method Detail

getConfigSource

ConfigSource getConfigSource()
Get the ConfigSource to open/create files with.

This method returns the ConfigSource object to be used for the purpose of opening and closing configuration files. It is of most interest to GUI panels which want to provide a choice of configuration files to be loaded to the user.

Returns:
The ConfigSource object used to open/create configuration files with.
Since:
1.0

saveConfig

void saveConfig(String name)
                throws ConfigException
The method to use when the configuration should be saved to disk.

This method is called when the configuration will be saved to disk. The method will be passed 'null' if the configuration should be save to the default location. Otherwise, it will be passed either a full file name (in which case the full file name should be honored), or a simple name (like "myconfig") in which the default path and extension should be applied.

This method should then use its ConfigSource object to create the file to write the configuration information to. This method should make certain that any opened files are closed prior to exit.

Parameters:
name - Name to save the configuration under (or null if we are to use the default).
Throws:
ConfigException - If there is a problem saving the configuration. The underlying problem of the ConfigException should be of a IOException if the problem was a file system related problem (such as file not found).
Since:
1.0
See Also:
loadConfig(java.lang.String)

loadConfig

void loadConfig(String name)
                throws ConfigException
The method to use when the configuration should be loaded from disk.

This method is called when the configuration will be loaded from disk. The method will be passed 'null' if the configuration should be loaded from the default location. Otherwise, it will be passed either a full file name (in which case the full file name should be honored), or a simple name (like "myconfig") in which the default path and extension should be applied.

This method should then use its ConfigSource object to open and read the configuration information. This method should make certain that any opened files are closed prior to exit.

Parameters:
name - Name to load the configuration from (or null if we are to use the default).
Throws:
ConfigException - If there is a problem loading the configuration. The underlying problem of the ConfigException should be of a IOException if the problem was a file system related problem (such as file not found).
Since:
1.0
See Also:
saveConfig(java.lang.String)


Copyright 1998-1998-2006 null. All Rights Reserved.