WAS v8.5 > Script the application serving environment (wsadmin) > Use properties files to manage system configuration > Manage specific configuration objects using properties filesWork 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 your variable map.
Start the wsadmin scripting tool. To start wsadmin using the Jython language, run the wsadmin -lang jython command from the bin directory of the server profile. 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 your configuration.
Actions for variable map properties. We can create, modify, and delete properties and values in variable maps.
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 your 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 manage the variable map properties.
Save the changes to your configuration.
Related
Extracting properties files using wsadmin.sh
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
Reference:
PropertiesBasedConfiguration command group for AdminTask using wsadmin.sh