Package org.glassfish.config.support
Class TranslatedConfigView
java.lang.Object
org.glassfish.config.support.TranslatedConfigView
- All Implemented Interfaces:
InvocationHandler,org.jvnet.hk2.config.ConfigView
View that translate configured attributes containing properties like
${foo.bar} into system properties values.
- Author:
- Jerome Dochez
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringexpandValue(String value) static Stringcheck if a given property name matches AS alias pattern ${ALIAS=aliasname}. if so, return the aliasname, otherwise return null.org.jvnet.hk2.config.ConfigViewstatic StringgetProperty(String propertyName) <T extends org.jvnet.hk2.config.ConfigBeanProxy>
T<T extends org.jvnet.hk2.config.ConfigBeanProxy>
Class<T> static Stringstatic ObjectgetTranslatedValue(Object value) Evaluates expression against aliases, system properties and environment variables.static booleanisPropertyTrue(String propertyName) static voidsetHabitat(org.glassfish.hk2.api.ServiceLocator h) voidsetMasterView(org.jvnet.hk2.config.ConfigView view)
-
Method Details
-
expandValue
-
getProperty
-
isPropertyTrue
-
getTranslatedValue
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:
- System property, if exists
- Environment variable with that name, if exists
- Environment variable with characters that are neither alphanumeric nor _ replaced by _, if exists
- Environment variable as in previous case but upper case, if exists
- null
"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
- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
getMasterView
public org.jvnet.hk2.config.ConfigView getMasterView()- Specified by:
getMasterViewin interfaceorg.jvnet.hk2.config.ConfigView
-
setMasterView
public void setMasterView(org.jvnet.hk2.config.ConfigView view) - Specified by:
setMasterViewin interfaceorg.jvnet.hk2.config.ConfigView
-
getProxyType
- Specified by:
getProxyTypein interfaceorg.jvnet.hk2.config.ConfigView
-
getProxy
- Specified by:
getProxyin interfaceorg.jvnet.hk2.config.ConfigView
-
setHabitat
public static void setHabitat(org.glassfish.hk2.api.ServiceLocator h) -
getAlias
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
public static String getRealPasswordFromAlias(String at) throws KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException
-