Work with variable map properties files
We can use properties files to create, modify, or delete property-value pairs in variable maps.
Determine the changes to make to the variable map.
From the server profile bin directory, run wsadmin -lang jython
Using a properties file, we can create, modify, or delete one or more variable substitution entries in a variable map.
Run administrative commands using wsadmin to create or change a properties file for a variable map, validate the variable substitution entries, and apply them to the configuration.
Action Procedure create Not applicable modify Edit property values in the variable map properties file and then run the applyConfigProperties command to modify the values of existing variables. delete Not applicable create Property Edit the variable map properties file and then run the applyConfigProperties command to create a variable substitution entry. delete Property Run the deleteConfigProperties command to delete an existing variable substitution entry. The properties file must contain only the properties to be deleted. Optionally, we can use interactive mode with the commands:
AdminTask.command_name('-interactive')
- Modify an existing properties file.
- Obtain a properties file for the variable map to change.
We can extract a properties file for a VariableMap object using the extractConfigProperties command.
- Open the properties file in an editor and change the properties as needed.
Modify the Environment Variables section to match the system and set any property value that needs to be changed. To specify a variable substitution entry, edit the AttributeInfo value and properties values. An example VariableMap properties file follows:
# # Header # ResourceType=VariableMap ImplementingResourceType=VariableMap ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:VariableMap= AttributeInfo=entries(symbolicName,value) # #Properties # SERVER_LOG_ROOT=${LOG_ROOT}/!{serverName} WAS_SERVER_NAME=!{serverName} # EnvironmentVariablesSection # #Environment Variables cellName=myCell04 nodeName=myNode serverName=myServer
- Run the applyConfigProperties command to create or change a VariableMap configuration.
Running the applyConfigProperties command applies the properties file to the configuration. In this Jython example, the optional -reportFileName parameter produces a report named report.txt:
AdminTask.applyConfigProperties(['-propertiesFileName myObjectType.props -reportFileName report.txt'])
- If we no longer need a variable substitution entry, we can delete the entry.
To delete a variable substitution entry, specify only the entry to be deleted in the properties file and then run the deleteConfigProperties command; for example:
AdminTask.deleteConfigProperties('[-propertiesFileName myObjectType.props -reportFileName report.txt]')
Results
We can use the properties file to configure and manage the variable map properties.
What to do next
Save the changes to the configuration.
Related tasks
Extracting properties files Create server, cluster, application, or authorization group objects using properties files and wsadmin scripting Delete server, cluster, application, or authorization group objects using properties files
PropertiesBasedConfiguration (AdminTask)