Package com.hcl.labs.domi.tools
Class DOMIUtils
- java.lang.Object
-
- com.hcl.labs.domi.tools.DOMIUtils
-
public class DOMIUtils extends Object
- Author:
- Paul Withers Generic utilities
-
-
Constructor Summary
Constructors Constructor Description DOMIUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 featuresstatic io.vertx.core.json.JsonArraygetEnvironmentParamsToRead()Names all parameters that can be overwritten / defined by environment variablesstatic io.vertx.core.json.JsonObjectgetJsonFromResource(String resourceName)static io.vertx.core.http.HttpServerOptionsgetServerOptions(String portType, int portDefault, io.vertx.core.json.JsonObject config)Constructing options for HTTP serverstatic StringgetStringFromResource(String resourceName)static voidincrementRequestCounter(String counterName, String providerName, String grantType)Increment metrics counter, creating the counter if required
-
-
-
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 incrementproviderName- OAuth provider for the requestgrantType- 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 configportDefault- default port, if nothing in configconfig- 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 forconfig- Vert.x config- Returns:
- Set of values that are enables
-
-