+

Search Tips   |   Advanced Search

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 containing such variables.

The location service of the Liberty profile 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 the Liberty profile. Most methods return a WsResource object that wraps the physical resource, but we 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 we do not have to specify a feature in server.xml to make it available. The Java API documentation for each Liberty profile SPI is detailed in the Programming Interfaces (APIs) 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

The com.ibm.wsspi.kernel.service.location.WsLocationConstants class defines symbols that refer to directory locations:

For the meaning of each symbol, see Directory locations.


Parent topic: Liberty SPI utilities