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 '$' '{' '[' ',' ']'
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Set<java.lang.String> getKeys()
      Return a set of keys of all properties loaded
      java.lang.String getSetting​(java.lang.String name)
      Get the value of an external override setting.
      java.lang.String[] getSettingArray​(java.lang.String name)
      Get the array of values for an external override setting.
      void load​(java.io.InputStream in)
      Load properties from an input stream.
      void 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.
      java.lang.String lookUp​(java.lang.String name)
      Look up the value for a property.
    • Method Detail

      • load

        void load​(java.io.InputStream in)
           throws java.io.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 \
        Parameters:
        in - - Stream holding properties
        Throws:
        java.io.IOException - if name characters illegal
      • loadSystemDefaults

        void loadSystemDefaults()
                         throws ResourceConfigurationException
        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

        java.lang.String lookUp​(java.lang.String name)
                         throws ResourceConfigurationException
        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

        java.util.Set<java.lang.String> getKeys()
        Return a set of keys of all properties loaded
        Returns:
        - set of strings
      • getSetting

        java.lang.String getSetting​(java.lang.String name)
                             throws ResourceConfigurationException
        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

        java.lang.String[] getSettingArray​(java.lang.String name)
                                    throws ResourceConfigurationException
        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