com.ccg.values
Interface ValuesConfig

All Superinterfaces:
ValuesHolder
All Known Implementing Classes:
ValuesConfigBean, ValuesPropertiesAdapter

public interface ValuesConfig
extends ValuesHolder

Definition of a values holder which can save/load its set of values.

This interface extends the ValuesHolder definition in a manner such that the following features are provided:

The following UML diagram shows how this class fits into the ValuesHolder scheme of things:


ValuesConfig UML

Since:
1.0
Version:
$Revision: 1.1 $
Author:
$Author: pkb $

Field Summary
 
Fields inherited from interface com.ccg.values.ValuesHolder
HAS_FROM, HAS_TO, HAS_TO_FROM
 
Method Summary
 String[] getAvailable()
          Get list of available configurations.
 String getDefaultName()
          Get the default name for the ValuesConfig implementation.
 void load(String name)
          Attempts to load a configuration from the specified name.
 void remove(String name)
          Remove a configuration from existance.
 void save(String name)
          Saves the current configuration in a manner that it can be loaded in the future.
 
Methods inherited from interface com.ccg.values.ValuesHolder
fromObject, getCapabilities, getObjectClass, toObject
 

Method Detail

getDefaultName

String getDefaultName()
Get the default name for the ValuesConfig implementation.

Sometimes, one doesn't want to worry about choosing between available configurations for a object - they simply want to work with the 'default' configuration - or a application may only need one configuration. In these cases, one can simply use this method to retrieve the name for the 'default' configuration and then use this name with the save and load methods.

Please note that the name returned does NOT guarantee existance of the configuration (in other words a load of the default name might fail) - someone must save a configuration under the default name before it can be loaded.

Returns:
A 'default' name suitable as a parameter to the save and load methods.
Since:
1.0

getAvailable

String[] getAvailable()
Get list of available configurations.

This method returns the "simple" names of ALL of the currently available configuration files that are available for loading.

Returns:
Array of available configuration names - never returns null, but may return a zero length list.

save

void save(String name)
          throws IOException,
                 ConfigException
Saves the current configuration in a manner that it can be loaded in the future.

This method attempts to permanently save the state of the "values holder" in a manner that it can be loaded in the future.

Parameters:
name - Name or key which configuration is to be saved under (typically in a simple form like: "liveoak" - don't assume a file system). Must not be null.
Throws:
ConfigException - If there is a problem with the configuration
IOException - If there is a problem trying to write the configuration to its final location.
Since:
1.0
See Also:
load(java.lang.String)

load

void load(String name)
          throws IOException,
                 ConfigException
Attempts to load a configuration from the specified name.

This method attempts to load the values back from a configuration which had previously been saved.

Parameters:
name - Name or key which configuration is to be loaded (typically in a simple form like: "liveoak" - don't assume a file system). Must not be null.
Throws:
ConfigException - If there is a problem with the configuration
IOException - If there is a problem trying to read the configuration from the system/network.
Since:
1.0

remove

void remove(String name)
            throws IllegalArgumentException,
                   IOException
Remove a configuration from existance.

This method attempts to delete the configuration specified.

Parameters:
name - Name of the configuration to be removed - must not be null.
Throws:
IllegalArgumentException - If there is a problem removing the configuration (didn't exist, insufficient permissions, etc).
IOException - If there is a problem removing the configuration (didn't exist, insufficient permissions, etc).
Since:
1.0


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