Resource location symbols
Liberty user configuration is made more portable through the use of variables that represent symbolic locations. Use of these variables helps to prevent the coding of absolute paths that would make the user configuration brittle and less portable. Feature code that receives configuration properties might have to deal with values that contain such variables.
The location service of Liberty can be
used to resolve symbolic locations to physical resources. For example, the symbolic location
${wlp.install.dir}/myFile
can be mapped to the local file
myFile in the installation directory of Liberty. Most methods return a
WsResource
object that wraps the physical resource, but you can also use the
resolveString
method to transform the symbolic location into a
String
that can be used to obtain a File
object.
The name of the location service is
com.ibm.wsspi.kernel.service.location.WsLocationAdmin
and it is provided by the Liberty kernel, so you do not have to specify a
feature in your server.xml file to make it available. The Java™ API documentation for each Liberty SPI is detailed in the Programming interfaces (Javadoc) section of the information center, and is also available as a separate .zip file in one of the javadoc subdirectories of the ${wlp.install.dir}/dev directory.
Symbols
com.ibm.wsspi.kernel.service.location.WsLocationConstants
class
defines symbols that refer to directory locations:/
server.config.dir
server.output.dir
server.workarea.dir
shared.app.dir
shared.config.dir
shared.resource.dir
wlp.install.dir
wlp.server.name
wlp.user.dir
usr.extension.dir
For the meaning of each symbol, see Directory locations and properties.