org.jfree.report.modules.preferences.base

Class ConfigFactory


public final class ConfigFactory
extends java.lang.Object

The config factory is used to access the currently active config storage implementation. The implementation itself allows to read or store a set of properties stored under a certain path.
Author:
Thomas Morgner

Field Summary

static String
CONFIG_TARGET_KEY
The selector configuration key that defines the active config storage implementation.

Method Summary

void
defineSystemStorage(ConfigStorage storage)
Defines the system storage implementation that should be used.
void
defineUserStorage(ConfigStorage storage)
Defines the user storage implementation that should be used.
static String
encodePath(String path)
Encodes the given configuration path.
static ConfigFactory
getInstance()
Returns the singleton instance of the config factory.
ConfigStorage
getSystemStorage()
Returns the system settings storage implementation used in the config subsystem.
ConfigStorage
getUserStorage()
Returns the user settings storage implementation used in the config subsystem.
static boolean
isValidPath(String path)
Checks, whether the given string denotes a valid config storage path.

Field Details

CONFIG_TARGET_KEY

public static final String CONFIG_TARGET_KEY
The selector configuration key that defines the active config storage implementation.

Method Details

defineSystemStorage

public void defineSystemStorage(ConfigStorage storage)
Defines the system storage implementation that should be used. This method should only be called by the module initialization methods.
Parameters:
storage - the system settings storage implementation.

defineUserStorage

public void defineUserStorage(ConfigStorage storage)
Defines the user storage implementation that should be used. This method should only be called by the module initialization methods.
Parameters:
storage - the user settings storage implementation.

encodePath

public static String encodePath(String path)
Encodes the given configuration path. All non-ascii characters get replaced by an escape sequence.
Parameters:
path - the path.
Returns:
the translated path.

getInstance

public static ConfigFactory getInstance()
Returns the singleton instance of the config factory.
Returns:
the config factory

getSystemStorage

public ConfigStorage getSystemStorage()
Returns the system settings storage implementation used in the config subsystem.
Returns:
the system settings storage provider.

getUserStorage

public ConfigStorage getUserStorage()
Returns the user settings storage implementation used in the config subsystem.
Returns:
the user settingsstorage provider.

isValidPath

public static boolean isValidPath(String path)
Checks, whether the given string denotes a valid config storage path. Such an path must not contain whitespaces or non-alphanumeric characters.
Parameters:
path - the path that should be tested.
Returns:
true, if the path is valid, false otherwise.