File Systems
In its default mode of operation Commons Configuration supports retrieving and storing
configuration files either on a local file system or via http. However, Commons
Configuration provides support for allowing other File System adapters. All file
access is accomplished through the Commons Configuration also provides a second FileSystem which allows retrieval using Apache Commons VFS. As of this writing Commons VFS supports 18 protocols for manipulating files. ConfigurationThe FileSystem used by Commons Configuration can be set in one of several ways:
The example that follows shows how to add <configuration> <header> <result delimiterParsingDisabled="true" forceReloadCheck="true"> <expressionEngine config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/> </result> <fileSystem config-class="org.apache.commons.configuration.VFSFileSystem"/> </header> <override> <xml fileName="settings.xml" config-name="xml"> <fileSystem config-class="org.apache.commons.configuration.DefaultFileSystem"/> </xml> </override> </configuration> File Options Provider
Commons VFS allows options to the underlying file systems being used. Commons Configuration
allows applications to provide these by implementing the File Reloading Strategy
The <configuration> <header> <result delimiterParsingDisabled="true" forceReloadCheck="true"> <expressionEngine config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/> </result> <fileSystem config-class="org.apache.commons.configuration.VFSFileSystem"/> </header> <override> <properties fileName="test.properties" throwExceptionOnMissing="true"> <reloadingStrategy refreshDelay="60000" config-class="org.apache.commons.configuration.reloading.VFSFileChangedReloadingStrategy"/> </properties> <xml fileName="settings.xml" config-name="xml"> <reloadingStrategy refreshDelay="60000" config-class="org.apache.commons.configuration.reloading.VFSFileChangedReloadingStrategy"/> </xml> </override> </configuration> |