Package org.forgerock.config.resolvers
Class FlatFileResolver
- java.lang.Object
-
- org.forgerock.config.resolvers.FlatFileResolver
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,PropertyResolver
@Deprecated public class FlatFileResolver extends Object implements PropertyResolver, Closeable
Deprecated.This class is currently only used in conjunction with the PropertyResolverSecretStore and this pairing is deprecated. Instead, use the FileSystemSecretStore.APropertyResolver
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. Use theFlatFileResolver(Path, String, DirectoryWatcher)
constructor to enable the cache to be updated when files change, otherwise files are cached permanently. A maximum size of 2MB is imposed on files, and any file larger than this will be ignored.
-
-
Constructor Summary
Constructors Constructor Description FlatFileResolver(Path rootDirectory)
Deprecated.Initializes the resolver with the given root directory and an empty suffix.FlatFileResolver(Path rootDirectory, String suffix)
Deprecated.Initializes the resolver with the given root directory.FlatFileResolver(Path rootDirectory, String suffix, DirectoryWatcher directoryWatcher)
Deprecated.Initializes the resolver with the given root directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
Deprecated.If this resolver was registered with a directory watcher, then calling this method will cancel the directory watching.Optional<String>
getProperty(String key, boolean sensitive)
Deprecated.Returns the value of the specified property.String
toString()
Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.forgerock.config.resolvers.PropertyResolver
getProperty, getProperty, getProperty
-
-
-
-
Constructor Detail
-
FlatFileResolver
public FlatFileResolver(Path rootDirectory, String suffix)
Deprecated.Initializes the resolver with the given root directory. Files are cached permanently after first access.- Parameters:
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).
-
FlatFileResolver
public FlatFileResolver(Path rootDirectory)
Deprecated.Initializes the resolver with the given root directory and an empty suffix. Files are cached permanently after first access.- Parameters:
rootDirectory
- the root directory to resolve files relative to.
-
FlatFileResolver
public FlatFileResolver(Path rootDirectory, String suffix, DirectoryWatcher directoryWatcher)
Deprecated.Initializes the resolver with the given root directory.- Parameters:
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).directoryWatcher
- if non-null then the resolver will use this watcher to update the cache when files change in the root directory.
-
-
Method Detail
-
getProperty
public Optional<String> getProperty(String key, boolean sensitive)
Deprecated.Description copied from interface:PropertyResolver
Returns the value of the specified property. The method returns an emptyOptional
if the property is not found. The resolved property has to be considered sensitive ifsensitive
istrue
and implementations are required to handle it with special attention (no logs, ...).- Specified by:
getProperty
in interfacePropertyResolver
- Parameters:
key
- The name of the requested property. The key can't be null.sensitive
-true
is the property value has to be considered a sensitive value (such as a password).- Returns:
- An
Optional
string that contains the value of the requested property, or emptyOptional
if property is undefined.
-
close
public void close()
Deprecated.If this resolver was registered with a directory watcher, then calling this method will cancel the directory watching. All accessed files will be cached permanently after calling this method.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-