public class DirectoryConfigProvider extends Object implements ConfigProvider
ConfigProvider
based on a directory of files.
Property keys correspond to the names of the regular (i.e. non-directory)
files in a directory given by the path parameter.
Property values are taken from the file contents corresponding to each key.Modifier and Type | Field and Description |
---|---|
static String |
ALLOWED_PATHS_CONFIG |
static String |
ALLOWED_PATHS_DOC |
Constructor and Description |
---|
DirectoryConfigProvider() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
configure(Map<String,?> configs)
Configure this class with the given key-value pairs
|
ConfigData |
get(String path)
Retrieves the data contained in regular files in the directory given by
path . |
ConfigData |
get(String path,
Set<String> keys)
Retrieves the data contained in the regular files named by
keys in the directory given by path . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
subscribe, unsubscribe, unsubscribeAll
public static final String ALLOWED_PATHS_CONFIG
public static final String ALLOWED_PATHS_DOC
public void configure(Map<String,?> configs)
Configurable
configure
in interface Configurable
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public ConfigData get(String path)
path
.
Non-regular files (such as directories) in the given directory are silently ignored.get
in interface ConfigProvider
path
- the directory where data files reside.public ConfigData get(String path, Set<String> keys)
keys
in the directory given by path
.
Non-regular files (such as directories) in the given directory are silently ignored.get
in interface ConfigProvider
path
- the directory where data files reside.keys
- the keys whose values will be retrieved.