Class TranslatedConfigView

java.lang.Object
org.glassfish.config.support.TranslatedConfigView
All Implemented Interfaces:
InvocationHandler, org.jvnet.hk2.config.ConfigView

public class TranslatedConfigView extends Object implements org.jvnet.hk2.config.ConfigView
View that translate configured attributes containing properties like ${foo.bar} into system properties values.
Author:
Jerome Dochez
  • Method Details

    • expandValue

      public static String expandValue(String value)
    • getProperty

      public static String getProperty(String propertyName)
    • isPropertyTrue

      public static boolean isPropertyTrue(String propertyName)
    • getTranslatedValue

      public static Object getTranslatedValue(Object value)
      Evaluates expression against aliases, system properties and environment variables. Variable references are enclosed in ${name}. Aliases are enclosed in ${ALIAS=name}.

      Follows the MicroProfile Config convention - replaces variable references with the following values:

      1. System property, if exists
      2. Environment variable with that name, if exists
      3. Environment variable with characters that are neither alphanumeric nor _ replaced by _, if exists
      4. Environment variable as in previous case but upper case, if exists
      5. null
      Environment variables are not considered if the system property "org.glassfish.propertyexpansion.envvars.disabled" is set to "true".

      Environment variables take preference over system properties if the system property "org.glassfish.variableexpansion.envvars.preferred" is set to "true".

      Also replaces nested expressions in names of variable references. For example, for a variable "key" with value "name" and variable "servername" with value "GlassFish", the expression "${server${key}}" will expand to "GlassFish"

      Parameters:
      variableName -
      Returns:
      Value or null
    • invoke

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      Specified by:
      invoke in interface InvocationHandler
      Throws:
      Throwable
    • getMasterView

      public org.jvnet.hk2.config.ConfigView getMasterView()
      Specified by:
      getMasterView in interface org.jvnet.hk2.config.ConfigView
    • setMasterView

      public void setMasterView(org.jvnet.hk2.config.ConfigView view)
      Specified by:
      setMasterView in interface org.jvnet.hk2.config.ConfigView
    • getProxyType

      public <T extends org.jvnet.hk2.config.ConfigBeanProxy> Class<T> getProxyType()
      Specified by:
      getProxyType in interface org.jvnet.hk2.config.ConfigView
    • getProxy

      public <T extends org.jvnet.hk2.config.ConfigBeanProxy> T getProxy(Class<T> proxyType)
      Specified by:
      getProxy in interface org.jvnet.hk2.config.ConfigView
    • setHabitat

      public static void setHabitat(org.glassfish.hk2.api.ServiceLocator h)
    • getAlias

      public static String getAlias(String propName)
      check if a given property name matches AS alias pattern ${ALIAS=aliasname}. if so, return the aliasname, otherwise return null.
      Parameters:
      propName - The property name to resolve. ex. ${ALIAS=aliasname}.
      Returns:
      The aliasname or null.
    • getRealPasswordFromAlias

      Throws:
      KeyStoreException
      CertificateException
      IOException
      NoSuchAlgorithmException
      UnrecoverableKeyException