org.apache.uima.util.impl

## Class Settings_impl

- java.lang.Object
- - org.apache.uima.util.impl.Settings_impl

- All Implemented Interfaces:
    Settings

      public class Settings_impl
      extends Object
      implements Settings

  Class that reads properties files containing external parameter overrides used by the ExternalOverrideSettings_impl class. Similar to java.util.Properties but: supports UTF-8 files reverses priority in that duplicate key values are ignored, i.e. values cannot be changed arrays are represented as strings, e.g. '[elem1,elem2]', and can span multiple lines '\' can be used to escape $ [ , ] and the line-end
  Author:
    burn

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `LOG_RESOURCE_BUNDLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Settings_impl()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<String>` | `getKeys()` Return a set of keys of all properties in the map
    `String` | `getSetting(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` | `loadSystemDefaults()` Load properties from the comma-separated list of resources specified in the system property UimaExternalOverrides Resource names may be specified with a prefix of "file:" or "path:".
    `String` | `lookUp(String name)` Look up the value for a property.
    `String` | `resolve(String value)` Replace variable references in a string.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LOG_RESOURCE_BUNDLE

          protected static final String LOG_RESOURCE_BUNDLE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Settings_impl

          public Settings_impl()

  - ### Method Detail

    - #### getKeys

          public Set<String> getKeys()

      Return a set of keys of all properties in the map
      Specified by:
        `getKeys` in interface `Settings`
      Returns:
        - set of strings

    - #### load

          public void load(InputStream in)
                    throws IOException

      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 \
      Specified by:
        `load` in interface `Settings`
      Parameters:
        `in` - - Stream holding properties
      Throws:
        `IOException` - if name characters illegal

    - #### loadSystemDefaults

          public void loadSystemDefaults()
                                  throws ResourceConfigurationException

      Load properties from the comma-separated list of resources specified in the system property UimaExternalOverrides Resource names may be specified with a prefix of "file:" or "path:". If the prefix is "path:" the name must use the Java-style dotted format, similar to an import by name. The name is converted to a URL with a suffix of ".settings" and is looked up in the datapath and classpath. If the prefix is "file:" or is omitted the filesystem is searched. Resources are loaded in list order. Duplicate properties are ignored so entries in a file override any in following files.
      Specified by:
        `loadSystemDefaults` in interface `Settings`
      Throws:
        `ResourceConfigurationException` - wraps IOException

    - #### lookUp

          public String lookUp(String name)
                        throws ResourceConfigurationException

      Look up the value for a property. Recursively evaluate the value replacing references ${key} with the value of the key. Nested references such as ${name-${suffix}} are supported. Exceptions are thrown for circular references and undefined references. To avoid evaluation and get ${key} in the output escape the $ or {, e.g. \${key} Arrays are returned as a comma-separated string, e.g. "[elem1,elem2]" Note: escape characters are not removed as they may affect array separators. Used by getSetting and getSettingArray
      Specified by:
        `lookUp` in interface `Settings`
      Parameters:
        `name` - - name to look up
      Returns:
        - value of property
      Throws:
        `ResourceConfigurationException` - if the value references an undefined property

    - #### resolve

          public String resolve(String value)
                         throws Exception

      Replace variable references in a string.
      Parameters:
        `value` - - String to scan for variable references
      Returns:
        - value with all references resolved and escapes processed
      Throws:
        `Exception` - -

    - #### getSetting

          public String getSetting(String name)
                            throws ResourceConfigurationException

      Description copied from interface: `Settings`
      Get the value of an external override setting.
      Specified by:
        `getSetting` in interface `Settings`
      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
      See Also:
        `Settings.getSetting(java.lang.String)`

    - #### getSettingArray

          public String[] getSettingArray(String name)
                                   throws ResourceConfigurationException

      Description copied from interface: `Settings`
      Get the array of values for an external override setting.
      Specified by:
        `getSettingArray` in interface `Settings`
      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
      See Also:
        `Settings.getSettingArray(java.lang.String)`

Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.