|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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:
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 |
|---|
ConfigSource getConfigSource()
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.
ConfigSource object used to open/create
configuration files with.
void saveConfig(String name)
throws ConfigException
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.
name - Name to save the configuration under (or null if we are to use
the default).
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).loadConfig(java.lang.String)
void loadConfig(String name)
throws ConfigException
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.
name - Name to load the configuration from (or null if we are to use
the default).
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).saveConfig(java.lang.String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||