- java.lang.Object
-
- com.pervasive.datarush.io.configuration.FileMetaConfiguration
-
public final class FileMetaConfiguration extends Object
A FileMetaConfiguration is a grouping of all file configurations related to the client. FileMetaConfiguration consist of a list ofentries
which each entry is a pair of path prefix to those that are to be used for paths starting with the given prefix. The list of entries are searched in the order until a match is found.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileMetaConfiguration.Entry
An entry in the meta-configuration consisting of a path prefix and those configurations that are to be used for paths starting with the given prefix.
-
Field Summary
Fields Modifier and Type Field Description static FileMetaConfiguration
DEFAULT_CONFIGURATION
An empty configuration that only has default configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FileMetaConfiguration
configuration(FileMetaConfiguration.Entry... entries)
Creates a new meta-configuration consisting of the given entries.static FileMetaConfiguration
configuration(List<FileMetaConfiguration.Entry> entries)
Creates a new meta-configuration consisting of the given entries.static FileMetaConfiguration.Entry
entry(Path prefix, FileConfiguration configuration)
Creates a new entrystatic FileMetaConfiguration
exactConfiguration(FileMetaConfiguration.Entry... entries)
Creates a new configuration consisting of onlythe given entries; no default configuration is acquired.static FileMetaConfiguration
exactConfiguration(List<FileMetaConfiguration.Entry> entries)
Creates a new configuration consisting of onlythe given entries; no default configuration is acquired.FileMetaConfiguration.Entry
findEntry(Path path)
Returns the first entry whose prefix is a prefix of the given pathFileConfiguration
getConfiguration(Path path)
Returns the configuration to be used for the given path orFileConfiguration.EMPTY_CONFIGURATION
if none found.List<FileMetaConfiguration.Entry>
getEntries()
Returns the list of entries contained by this configurationFileMetaConfiguration
removeDefaultConfiguration()
Gets a new meta-configuration with all default configuration removed.FileMetaConfiguration
resetDefaultConfiguration()
Gets a new meta-configuration with the default configuration replaced with those from the current environment.
-
-
-
Field Detail
-
DEFAULT_CONFIGURATION
public static FileMetaConfiguration DEFAULT_CONFIGURATION
An empty configuration that only has default configuration.
-
-
Method Detail
-
entry
public static FileMetaConfiguration.Entry entry(Path prefix, FileConfiguration configuration)
Creates a new entry- Parameters:
prefix
- the path prefixconfiguration
- the configuration to use for paths that start with the given prefix- Returns:
- a new entry
-
configuration
public static FileMetaConfiguration configuration(FileMetaConfiguration.Entry... entries)
Creates a new meta-configuration consisting of the given entries. The resulting meta-configuration will also acquire any default configuration from the execution environment.- Parameters:
entries
- the entries- Returns:
- the configuration
-
configuration
public static FileMetaConfiguration configuration(List<FileMetaConfiguration.Entry> entries)
Creates a new meta-configuration consisting of the given entries. The resulting configuration will also acquire any default configuration from the execution environment.- Parameters:
entries
- the entries- Returns:
- the configuration
-
exactConfiguration
public static FileMetaConfiguration exactConfiguration(FileMetaConfiguration.Entry... entries)
Creates a new configuration consisting of onlythe given entries; no default configuration is acquired.- Parameters:
entries
- the entries- Returns:
- the configuration
-
exactConfiguration
public static FileMetaConfiguration exactConfiguration(List<FileMetaConfiguration.Entry> entries)
Creates a new configuration consisting of onlythe given entries; no default configuration is acquired.- Parameters:
entries
- the entries- Returns:
- the configuration
-
getEntries
public List<FileMetaConfiguration.Entry> getEntries()
Returns the list of entries contained by this configuration- Returns:
- the entries
-
resetDefaultConfiguration
public FileMetaConfiguration resetDefaultConfiguration()
Gets a new meta-configuration with the default configuration replaced with those from the current environment.This is equivalent to calling
FileMetaConfiguration.exactConfiguration(this.getEntries())
.- Returns:
- a new configuration inheriting default configuration from the current environment
-
removeDefaultConfiguration
public FileMetaConfiguration removeDefaultConfiguration()
Gets a new meta-configuration with all default configuration removed. This strips all configuration inherited from the execution environment from the resulting configuration.This is equivalent to calling
FileMetaConfiguration.exactConfiguration(this.getEntries())
.- Returns:
- a new configuration without default configuration
-
getConfiguration
public FileConfiguration getConfiguration(Path path)
Returns the configuration to be used for the given path orFileConfiguration.EMPTY_CONFIGURATION
if none found.- Parameters:
path
- the path- Returns:
- the configuration
-
findEntry
public FileMetaConfiguration.Entry findEntry(Path path)
Returns the first entry whose prefix is a prefix of the given path- Parameters:
path
- the path- Returns:
- the matching entry or null if no matches found
-
-