Class DOMIUtils


  • public class DOMIUtils
    extends Object
    Author:
    Paul Withers Generic utilities
    • Constructor Detail

      • DOMIUtils

        public DOMIUtils()
    • Method Detail

      • getEnvironmentParamsToRead

        public static io.vertx.core.json.JsonArray getEnvironmentParamsToRead()
        Names all parameters that can be overwritten / defined by environment variables
        Returns:
        JsonArray
      • getJsonFromResource

        public static io.vertx.core.json.JsonObject getJsonFromResource​(String resourceName)
        Parameters:
        resourceName - to load as a JsonObject
        Returns:
        a JsonObject or an empty JsonObject if no resource found
      • getStringFromResource

        public static String getStringFromResource​(String resourceName)
        Parameters:
        resourceName - to load as a string
        Returns:
        a String containing the text in the resource
      • incrementRequestCounter

        public static void incrementRequestCounter​(String counterName,
                                                   String providerName,
                                                   String grantType)
        Increment metrics counter, creating the counter if required
        Parameters:
        counterName - name of the counter to increment
        providerName - OAuth provider for the request
        grantType - whether the request was for an authorization code or refresh token
      • getServerOptions

        public static io.vertx.core.http.HttpServerOptions getServerOptions​(String portType,
                                                                            int portDefault,
                                                                            io.vertx.core.json.JsonObject config)
        Constructing options for HTTP server
        Parameters:
        portType - which port constant to use to retrieve from config
        portDefault - default port, if nothing in config
        config - config from which to retrieve the port
        Returns:
        HttpServerOptions to apply to server
      • getEnabledValuesFromConfig

        public static Set<String> getEnabledValuesFromConfig​(String key,
                                                             io.vertx.core.json.JsonObject config)
        Returns all keys where the value is "true" - used to switch on/off features
        Parameters:
        key - - value to look for
        config - Vert.x config
        Returns:
        Set of values that are enables