Package org.apache.uima.util
Interface Settings
- All Known Implementing Classes:
Settings_impl
public interface Settings
A
Settings
object holds the properties used for external parameter overrides.
Similar to java.util.Properties but:
- supports UTF-8 (so \\uXXXX escapes are not needed or supported)
- keys must be valid Java identifiers (actually must not contain '=' ':' '}' or white-space)
- reverses priority in that duplicate entries are ignored, i.e. once set values cannot be changed
- multiple files can be loaded
- values can contain references to other values, e.g. name = .... ${key} ....
- arrays are represented as strings, e.g. '[elem1,elem2]', and can span multiple lines
- '\' can be used in values to escape '$' '{' '[' ',' ']'- Author:
- burn
-
Method Summary
Modifier and TypeMethodDescriptiongetKeys()
Return a set of keys of all properties loadedgetSetting
(String name) Get the value of an external override setting.String[]
getSettingArray
(String name) Get the array of values for an external override setting.void
load
(InputStream in) Load properties from an input stream.void
Load properties from the comma-separated list of files specified in the system property UimaExternalOverrides Files are loaded in order --- so in descending priority.Look up the value for a property.
-
Method Details
-
load
Load properties from an input stream. Existing properties are not changed and a warning is logged if the new value is different. May be called multiple times, so effective search is in load order. Arrays are enclosed in [] and the elements may be separated by,
or new-line, so can span multiple lines without using a final \- Parameters:
in
- - Stream holding properties- Throws:
IOException
- if name characters illegal
-
loadSystemDefaults
Load properties from the comma-separated list of files specified in the system property UimaExternalOverrides Files are loaded in order --- so in descending priority.- Throws:
ResourceConfigurationException
- wraps IOException
-
lookUp
Look up the value for a property. Perform one substitution pass on ${key} substrings replacing them with the value for key. Recursively evaluate the value to be substituted. NOTE: infinite loops not detected! If the key variable has not been defined, an exception is thrown. To avoid evaluation and get ${key} in the output escape the $ or { Arrays are returned as a comma-separated string, e.g. "[elem1,elem2]" Note: escape characters are not removed as they may affect array separators.- Parameters:
name
- - name to look up- Returns:
- - value of property
- Throws:
ResourceConfigurationException
- if the value references an undefined property
-
getKeys
Return a set of keys of all properties loaded- Returns:
- - set of strings
-
getSetting
Get the value of an external override setting.- Parameters:
name
- - the name of the parameter- Returns:
- - the value found in the settings file(s), or null if missing.
- Throws:
ResourceConfigurationException
- if the value references an undefined property, or the value is an array
-
getSettingArray
Get the array of values for an external override setting.- Parameters:
name
- - the name of the parameter- Returns:
- - an array of values found in the settings file(s), or null if missing.
- Throws:
ResourceConfigurationException
- if the value references an undefined property, or the value is not an array
-