Interface VariableRegistry
public interface VariableRegistry
A Service for resolving variables to their values. Variables may be predefined by the
runtime, or be read from bootstrap.properties or the server.xml configuration.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The variable literal for obtaining the server install location.static final String
The variable literal for obtaining the server configuration directory.static final String
The variable literal for obtaining the server name.static final String
The variable literal for obtaining the server output directory.static final String
The variable literal for obtaining the shared applications directory.static final String
The variable literal for obtaining the shared configuration directory.static final String
The variable literal for obtaining the shared resources directory.static final String
The variable literal for obtaining the server user directory.static final String
The variable literal for obtaining the usr product extension directory. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addVariable
(String variable, String value) Add a variable to the registry with the specified value if it does not exist already.void
removeVariable
(String variable) Remove the specified variable from the registry.void
replaceVariable
(String variable, String value) Update the variable in the registry with the specified value.resolveRawString
(String string) Resolve the variables in the given string.resolveString
(String string) Resolve the variables in the given string.
-
Field Details
-
SERVER_NAME
The variable literal for obtaining the server name.- See Also:
-
INSTALL_DIR
The variable literal for obtaining the server install location.- See Also:
-
USER_DIR
The variable literal for obtaining the server user directory.- See Also:
-
USER_EXTENSION_DIR
The variable literal for obtaining the usr product extension directory.- See Also:
-
SERVER_CONFIG_DIR
The variable literal for obtaining the server configuration directory.- See Also:
-
SERVER_OUTPUT_DIR
The variable literal for obtaining the server output directory.- See Also:
-
SHARED_APPS_DIR
The variable literal for obtaining the shared applications directory.- See Also:
-
SHARED_CONFIG_DIR
The variable literal for obtaining the shared configuration directory.- See Also:
-
SHARED_RESC_DIR
The variable literal for obtaining the shared resources directory.- See Also:
-
-
Method Details
-
addVariable
Add a variable to the registry with the specified value if it does not exist already.- Parameters:
variable
- the name of the variable.value
- the value of the variable.- Returns:
- true if it was added, false otherwise.
-
replaceVariable
Update the variable in the registry with the specified value. If it does not exist already this will add the variable, if it already exists it will be overwritten.- Parameters:
variable
- the name of the variable.value
- the value of the variable.
-
resolveString
Resolve the variables in the given string. This can be used either to resolve a string that contains variables in it, such as The server is called ${wlp.server.name}. or to specifically discover the value of a variable by wrapping it in ${ and } for example ${wlp.server.name}. If the variable is not defined then the variable substitution will remain, so ${this.does.not.exist} would return ${this.does.not.exist}. During variable resolution the value of the variable will be path normalized by this call. If path normalization is not required use resolveRawString instead.- Parameters:
string
- the string to resolve.- Returns:
- the resolved string
-
resolveRawString
Resolve the variables in the given string. This can be used either to resolve a string that contains variables in it, such as The server is called ${wlp.server.name}. or to specifically discover the value of a variable by wrapping it in ${ and } for example ${wlp.server.name}. If the variable is not defined then the variable substitution will remain, so ${this.does.not.exist} would return ${this.does.not.exist}. If path normalization of variable values is required use resolveString instead.- Parameters:
string
- the string to resolve.- Returns:
- the resolved string
-
removeVariable
Remove the specified variable from the registry.- Parameters:
variable
-
-