public class FlatFileResolver extends Object implements PropertyResolver
PropertyResolver
in which each property is stored in its own file in some directory. The entire contents
of the file (as UTF-8) is returned as the value of the property. For efficiency and consistency with the other
property resolvers, the contents of files are cached in-memory. A maximum size of 2MB is imposed on files, and any
file larger than this will be ignored.Constructor and Description |
---|
FlatFileResolver(Path rootDirectory)
Initializes the resolver with the given root directory and an empty suffix.
|
FlatFileResolver(Path rootDirectory,
String suffix)
Initializes the resolver with the given root directory.
|
Modifier and Type | Method and Description |
---|---|
Optional<String> |
getProperty(String key)
Returns the value of the specified property.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProperty
public FlatFileResolver(Path rootDirectory, String suffix)
rootDirectory
- the root directory to resolve files relative to.suffix
- a suffix to append to property names such as a file extension, for instance ".txt" (note:
include the dot in this case).public FlatFileResolver(Path rootDirectory)
rootDirectory
- the root directory to resolve files relative to.public Optional<String> getProperty(String key)
PropertyResolver
Optional
if the property is not
found.getProperty
in interface PropertyResolver
key
- The name of the requested property. The key can't be null.Optional
string that contains the value of the requested property, or empty Optional
if property is undefined.Copyright © 2010-2018, ForgeRock All Rights Reserved.