public final class ResourceConfig extends ObjectProvides access to configuration files.
A standard approach to configuration is provided by this class. Any configuration information provided by this library can be overridden or added to by applications.
By default, there are three groups of recognized configuration directories:
Each group consists of ten directories using a numeric suffix:
The search strategy looks for the same file name in each of the thirty directories. All the files that are found are then merged, with directories lower down the list taking priorty. Thus, any configuration file in the 'application9' directory will override the same file in the 'appication1' directory, which will override the same file in the 'library' group, which will further override the same file in the 'base' group.
The 'base' group is reserved for Strata. The 'library' group is reserved for libraries built directly on Strata.
The set of configuration directories can be changed using the system property 'com.opengamma.strata.config.directories'. This must be a comma separated list, such as 'base,base1,base2,override,application'.
In general, the configuration managed by this class will be in INI format. The
combinedIniFile(String)method is the main entry point, returning a single INI file merged from all available configuration files.
All Methods Static Methods Concrete Methods Modifier and Type Method Description
combinedIniFile(String resourceName)Returns a combined INI file formed by merging INI files with the specified name.
combinedIniFile(List<ResourceLocator> resources)Returns a combined INI file formed by merging the specified INI files.
orderedResources(String resourceName)Obtains an ordered list of resource locators.
combinedIniFileReturns a combined INI file formed by merging INI files with the specified name.
This finds the all files with the specified name in the configuration directories. Each file is loaded, with the result being formed by merging the files into one. See
combinedIniFile(List)for more details on the merge process.
public static IniFile combinedIniFile(List<ResourceLocator> resources)Returns a combined INI file formed by merging the specified INI files.
The result of this method is formed by merging the specified files together. The files are combined in order forming a chain. The first file in the list has the lowest priority. The last file in the list has the highest priority.
The algorithm starts with all the sections and properties from the highest priority file. It then adds any sections or properties from subsequent files that are not already present.
The algorithm can be controlled by providing a '[chain]' section. Within the 'chain' section, if 'chainNextFile' is 'false', then processing stops, and lower priority files are ignored. If the 'chainRemoveSections' property is specified, the listed sections are ignored from the files lower in the chain.
public static List<ResourceLocator> orderedResources(String resourceName)Obtains an ordered list of resource locators.
This finds the all files with the specified name in the configuration directories. The result is ordered from the lowest priority (base) file to the highest priority (application) file. The result will always contain at least one file, but it may contain more than one.