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 we can also use the resolveString method to transform the symbolic location into a String 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 SPI is available in 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 and properties.