Poco::Util

class FilesystemConfiguration

Library: Util
Package: Configuration
Header: Poco/Util/FilesystemConfiguration.h

Description

An implementation of AbstractConfiguration that stores configuration data in a directory hierarchy in the filesystem.

Every period-separated part of a property name is represented as a directory in the filesystem, relative to the base directory. Values are stored in files named "data".

All changes to properties are immediately persisted in the filesystem.

For example, a configuration consisting of the properties

logging.loggers.root.channel.class = ConsoleChannel
logging.loggers.app.name = Application
logging.loggers.app.channel = c1
logging.formatters.f1.class = PatternFormatter
logging.formatters.f1.pattern = [%p] %t

is stored in the filesystem as follows:

logging/
        loggers/
                root/
                     channel/
                             class/
                                   data ("ConsoleChannel")
                app/
                    name/
                         data ("Application")
                    channel/
                            data ("c1")
        formatters/
                   f1/
                      class/
                            data ("PatternFormatter")
                      pattern/
                              data ("[%p] %t")                      

Inheritance

Direct Base Classes: AbstractConfiguration

All Base Classes: Poco::RefCountedObject, AbstractConfiguration

Member Summary

Member Functions: clear, enumerate, getRaw, keyToPath, removeRaw, setRaw

Inherited Functions: createView, duplicate, enableEvents, enumerate, eventsEnabled, expand, getBool, getDouble, getInt, getInt64, getRaw, getRawString, getString, getUInt, getUInt64, has, hasOption, hasProperty, keys, parseBool, parseInt, parseInt64, parseUInt, parseUInt64, referenceCount, release, remove, removeRaw, setBool, setDouble, setInt, setInt64, setRaw, setRawWithEvent, setString, setUInt, setUInt64

Constructors

FilesystemConfiguration

FilesystemConfiguration(
    const std::string & path
);

Creates a FilesystemConfiguration using the given path. All directories are created as necessary.

Destructor

~FilesystemConfiguration protected virtual

~FilesystemConfiguration();

Member Functions

clear

void clear();

Clears the configuration by erasing the configuration directory and all its subdirectories and files.

enumerate protected virtual

void enumerate(
    const std::string & key,
    Keys & range
) const;

getRaw protected virtual

bool getRaw(
    const std::string & key,
    std::string & value
) const;

keyToPath protected

Poco::Path keyToPath(
    const std::string & key
) const;

removeRaw protected virtual

void removeRaw(
    const std::string & key
);

setRaw protected virtual

void setRaw(
    const std::string & key,
    const std::string & value
);