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
Fields Modifier and Type Field Description static java.lang.String
INSTALL_DIR
The variable literal for obtaining the server install location.static java.lang.String
SERVER_CONFIG_DIR
The variable literal for obtaining the server configuration directory.static java.lang.String
SERVER_NAME
The variable literal for obtaining the server name.static java.lang.String
SERVER_OUTPUT_DIR
The variable literal for obtaining the server output directory.static java.lang.String
SHARED_APPS_DIR
The variable literal for obtaining the shared applications directory.static java.lang.String
SHARED_CONFIG_DIR
The variable literal for obtaining the shared configuration directory.static java.lang.String
SHARED_RESC_DIR
The variable literal for obtaining the shared resources directory.static java.lang.String
USER_DIR
The variable literal for obtaining the server user directory.static java.lang.String
USER_EXTENSION_DIR
The variable literal for obtaining the usr product extension directory.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addVariable(java.lang.String variable, java.lang.String value)
Add a variable to the registry with the specified value if it does not exist already.void
removeVariable(java.lang.String variable)
Remove the specified variable from the registry.void
replaceVariable(java.lang.String variable, java.lang.String value)
Update the variable in the registry with the specified value.java.lang.String
resolveRawString(java.lang.String string)
Resolve the variables in the given string.java.lang.String
resolveString(java.lang.String string)
Resolve the variables in the given string.
-
-
-
Field Detail
-
SERVER_NAME
static final java.lang.String SERVER_NAME
The variable literal for obtaining the server name.- See Also:
- Constant Field Values
-
INSTALL_DIR
static final java.lang.String INSTALL_DIR
The variable literal for obtaining the server install location.- See Also:
- Constant Field Values
-
USER_DIR
static final java.lang.String USER_DIR
The variable literal for obtaining the server user directory.- See Also:
- Constant Field Values
-
USER_EXTENSION_DIR
static final java.lang.String USER_EXTENSION_DIR
The variable literal for obtaining the usr product extension directory.- See Also:
- Constant Field Values
-
SERVER_CONFIG_DIR
static final java.lang.String SERVER_CONFIG_DIR
The variable literal for obtaining the server configuration directory.- See Also:
- Constant Field Values
-
SERVER_OUTPUT_DIR
static final java.lang.String SERVER_OUTPUT_DIR
The variable literal for obtaining the server output directory.- See Also:
- Constant Field Values
-
SHARED_APPS_DIR
static final java.lang.String SHARED_APPS_DIR
The variable literal for obtaining the shared applications directory.- See Also:
- Constant Field Values
-
SHARED_CONFIG_DIR
static final java.lang.String SHARED_CONFIG_DIR
The variable literal for obtaining the shared configuration directory.- See Also:
- Constant Field Values
-
SHARED_RESC_DIR
static final java.lang.String SHARED_RESC_DIR
The variable literal for obtaining the shared resources directory.- See Also:
- Constant Field Values
-
-
Method Detail
-
addVariable
boolean addVariable(java.lang.String variable, java.lang.String value)
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
void replaceVariable(java.lang.String variable, java.lang.String value)
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
java.lang.String resolveString(java.lang.String string)
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
java.lang.String resolveRawString(java.lang.String string)
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
void removeVariable(java.lang.String variable)
Remove the specified variable from the registry.- Parameters:
variable
-
-
-