org.apache.commons.configuration
public abstract class AbstractHierarchicalFileConfiguration extends HierarchicalConfiguration implements FileConfiguration, ConfigurationListener
Base class for implementing file based hierarchical configurations.
This class serves an analogous purpose as the
AbstractFileConfiguration
class for non hierarchical
configurations. It behaves in exactly the same way, so please refer to the
documentation of AbstractFileConfiguration
for further details.
Since: 1.2
Version: $Revision: 492216 $, $Date: 2007-01-03 17:51:24 +0100 (Mi, 03 Jan 2007) $
Nested Class Summary | |
---|---|
protected class | AbstractHierarchicalFileConfiguration.FileConfigurationDelegate
A special implementation of the FileConfiguration interface that is
used internally to implement the FileConfiguration methods
for hierarchical configurations. |
Field Summary | |
---|---|
AbstractHierarchicalFileConfiguration.FileConfigurationDelegate | delegate Stores the delegate used for implementing functionality related to the
FileConfiguration interface. |
Constructor Summary | |
---|---|
protected | AbstractHierarchicalFileConfiguration()
Creates a new instance of
AbstractHierarchicalFileConfiguration . |
protected | AbstractHierarchicalFileConfiguration(HierarchicalConfiguration c)
Creates a new instance of
AbstractHierarchicalFileConfiguration and copies the
content of the specified configuration into this object.
|
AbstractHierarchicalFileConfiguration(String fileName)
Creates and loads the configuration from the specified file.
| |
AbstractHierarchicalFileConfiguration(File file)
Creates and loads the configuration from the specified file.
| |
AbstractHierarchicalFileConfiguration(URL url)
Creates and loads the configuration from the specified URL.
|
Method Summary | |
---|---|
protected void | addPropertyDirect(String key, Object obj) |
void | clearProperty(String key) |
void | clearTree(String key) |
void | configurationChanged(ConfigurationEvent event)
Reacts on configuration change events triggered by the delegate. |
boolean | containsKey(String key) |
protected AbstractHierarchicalFileConfiguration.FileConfigurationDelegate | createDelegate()
Creates the file configuration delegate, i.e. the object that implements
functionality required by the FileConfiguration interface.
|
protected List | fetchNodeList(String key)
Fetches a list of nodes, which are selected by the specified key. |
String | getBasePath() |
protected AbstractHierarchicalFileConfiguration.FileConfigurationDelegate | getDelegate()
Returns the file configuration delegate.
|
String | getEncoding() |
File | getFile() |
String | getFileName() |
Iterator | getKeys(String prefix) |
Object | getProperty(String key) |
ReloadingStrategy | getReloadingStrategy() |
URL | getURL() |
void | initDelegate(AbstractHierarchicalFileConfiguration.FileConfigurationDelegate del)
Helper method for initializing the file configuration delegate.
|
void | initialize()
Initializes this instance, mainly the internally used delegate object. |
boolean | isAutoSave() |
boolean | isEmpty() |
void | load() |
void | load(String fileName) |
void | load(File file) |
void | load(URL url) |
void | load(InputStream in) |
void | load(InputStream in, String encoding) |
void | reload() |
void | save() |
void | save(String fileName) |
void | save(File file) |
void | save(URL url) |
void | save(OutputStream out) |
void | save(OutputStream out, String encoding) |
void | setAutoSave(boolean autoSave) |
void | setBasePath(String basePath) |
protected void | setDelegate(AbstractHierarchicalFileConfiguration.FileConfigurationDelegate delegate)
Allows to set the file configuration delegate. |
void | setEncoding(String encoding) |
void | setFile(File file) |
void | setFileName(String fileName) |
void | setProperty(String key, Object value) |
void | setReloadingStrategy(ReloadingStrategy strategy) |
void | setURL(URL url) |
FileConfiguration
interface.AbstractHierarchicalFileConfiguration
.AbstractHierarchicalFileConfiguration
and copies the
content of the specified configuration into this object.
Parameters: c the configuration to copy
Since: 1.4
Parameters: fileName The name of the plist file to load.
Throws: ConfigurationException Error while loading the file
Parameters: file The configuration file to load.
Throws: ConfigurationException Error while loading the file
Parameters: url The location of the configuration file to load.
Throws: ConfigurationException Error while loading the file
Parameters: event the triggered event
Since: 1.3
FileConfiguration
interface.
This base implementation will return an instance of the
FileConfigurationDelegate
class. Derived classes may
override it to create a different delegate object.
Returns: the file configuration delegate
Parameters: key the key
Returns: a list with the selected nodes
Returns: the delegate
Parameters: del the delegate
Parameters: delegate the new delegate