Class PropertyProvider

  • Direct Known Subclasses:
    ConfigurationPropertyProvider

    public abstract class PropertyProvider
    extends Object
    This class provides global properties that are needed for the whole AristaFlow-platform. These properties are needed for initialising the configuration framework which is why they are parsed very early when bootstrapping. This also includes global properties (starting with arflow.confVar) which will be injected into the configuration framework allowing to reference this properties in service configurations.
    This interface encapsulates the concrete representation of the global properties. For instance, these may stem from the system properties or from a servlet context, depending on the execution context of the AristaFlow-platform.

    This class may be extended to reflect specific requirements (that is specific global properties) needed by a configuration manager.

    This class parses the following properties from the designated map (in parentheses the default value that will apply if the property is not set):

    • arflow.logdir (default: ./logs)
    • arflow.datadir (default: ./examples)
    • arflow.libdir (default: ./lib)
    • arflow.useSunSecProvider (default: false)
    • arflow.usePre300Security (default: false)
    • arflow.totalMemPerthousandStreamThreshold (default: 40)
    • arflow.skipClosing (default: false)
    • arflow.confVar.*
    • Field Detail

      • logger

        protected final Logger logger
        The logger for property providers. It is protected for extensibility.
    • Constructor Detail

      • PropertyProvider

        protected PropertyProvider​(Map<String,​String> properties)
                            throws ConfigurationException
        Creates a new PropertyProvider and parses all corresponding global properties from the designated map and/or sets the properties appropriately.
        Parameters:
        properties - A map providing all required global properties and values for substituted variables.
        Throws:
        ConfigurationException - If there are problems retrieving a required global property or a substituted variables from the designated map, a ConfigurationException will be thrown.
    • Method Detail

      • getSubstitutedVariables

        public Map<String,​String> getSubstitutedVariables()
        Gets an unmodifiable map containing all substitutions (interpolation) that need to be applied to all configurations. If a key of this map is found in a configuration, it will be replaced with the corresponding value from the map. The key needs to have the appropriate prefix in the configuration, for instance, ${arflow:key} will be replaced by value.
        Returns:
        An unmodifiable map containing the keys which will be replaced by the corresponding values from the map if they are found in a configuration.
      • getUseSunSecurityProviders

        public boolean getUseSunSecurityProviders()
        Gets whether the Sun providers should be used for the security API. This prevents using other registered security providers like from Apache or Bouncy Castle.
        Returns:
        Whether the Sun providers should be used for the security API. This prevents using other registered security providers like from Apache or Bouncy Castle.
      • getUsePre300Security

        public boolean getUsePre300Security()
        Gets whether to use the security settings from before 3.0.0. This may be insecure but it allows communication between server and clients from before and after 3.0.0.
        Returns:
        Whether to use the security settings from before 3.0.0.
      • getTotalMemPerthousandStreamThreshold

        public int getTotalMemPerthousandStreamThreshold()
        Gets the portion (per thousand) of the total memory available for the JVM that is used as threshold to switch between holding (temporary) data in a stream in main memory or storing it in a file. Data with a size below this threshold is kept in memory, bigger data will be stored in a temporary file.
        Returns:
        The portion (per thousand) of the total memory available for the JVM used as threshold to switch between holding stream data in memory or file storage.
      • getSkipClosing

        @Deprecated(since="15.0.0",
                    forRemoval=true)
        public boolean getSkipClosing()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Do only use if absolutely required. This will be removed as soon as closing works reliable.
        Gets whether to skip closing introduced with 15.0.0. This helps in case of buggy closing, e. early or inappropriate closing.
        Returns:
        Whether to skip closing introduced with 15.0.0.
      • initialiseProperties

        protected void initialiseProperties​(Map<String,​String> properties)
                                     throws ConfigurationException
        Initialises, checks and sets the values of the global properties as well as the substituted variables. The following properties are parsed from the designated map (with a default value where appropriate):
        • arflow.logdir (default: ./logs)
        • arflow.datadir (default: ./examples)
        • arflow.libdir (default: ./lib)
        • arflow.useSunSecProvider (default: false)
        • arflow.totalMemPerthousandStreamThreshold (default: 40)
        • arflow.skipClosing (default: false)
        • arflow.confVar.*
        The substituted variables will contain:
        • arflow.logdir (default: ./logs)
        • arflow.datadir (default: ./examples)
        • arflow.libdir (default: ./lib)
        • arflow.confVar.*
        Parameters:
        properties - The properties which to parse.
        Throws:
        ConfigurationException - If the user dir for the log dir is not a valid directory or the default data directory could not be created, a ConfigurationException will be thrown.