Class ConfigurationParserUtils


  • public class ConfigurationParserUtils
    extends Object
    Utility class to extract related parameters from Configuration and to sanity check them.
    • Constructor Detail

      • ConfigurationParserUtils

        public ConfigurationParserUtils()
    • Method Detail

      • getSlot

        public static int getSlot​(Configuration configuration)
        Parses the configuration to get the number of slots and validates the value.
        Parameters:
        configuration - configuration object
        Returns:
        the number of slots in task manager
      • checkConfigParameter

        public static void checkConfigParameter​(boolean condition,
                                                Object parameter,
                                                String name,
                                                String errorMessage)
                                         throws IllegalConfigurationException
        Validates a condition for a config parameter and displays a standard exception, if the condition does not hold.
        Parameters:
        condition - The condition that must hold. If the condition is false, an exception is thrown.
        parameter - The parameter value. Will be shown in the exception message.
        name - The name of the config parameter. Will be shown in the exception message.
        errorMessage - The optional custom error message to append to the exception message.
        Throws:
        IllegalConfigurationException - if the condition does not hold
      • getPageSize

        public static int getPageSize​(Configuration configuration)
        Parses the configuration to get the page size and validates the value.
        Parameters:
        configuration - configuration object
        Returns:
        size of memory segment
      • loadCommonConfiguration

        public static Configuration loadCommonConfiguration​(String[] args,
                                                            String cmdLineSyntax)
                                                     throws FlinkParseException
        Generate configuration from only the config file and dynamic properties.
        Parameters:
        args - the commandline arguments
        cmdLineSyntax - the syntax for this application
        Returns:
        generated configuration
        Throws:
        FlinkParseException - if the configuration cannot be generated