Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Use properties files to manage system configuration > Manage environment configurations with properties files using wsadmin.sh
Create, modifying, and deleting configuration objects using one properties file
We can specify to create, modify, and delete objects in one properties file. You run applyConfigProperties to apply the configuration changes.
Determine the changes to make to configuration objects.
Use the PropertiesBasedConfiguration command group for the AdminTask object, you can use properties files to create, modify, and delete configuration objects from the environment.
You can create, delete, and modify objects using one properties file. Specify in the header of the properties section DELETE=true to delete an entire object or DELTEPROP=true to delete an object property and then run applyConfigProperties to apply the properties file. With this approach, you do not need to run deleteConfigProperties to delete an object. We cannot apply a z/OS operating system properties file directly to a distributed operating system. Similarly, you cannot apply a distributed operating system properties file directly to a z/OS operating system. See the topic on applying portable properties files across multiple environments.
Procedure
- Start wsadmin.sh.
- Extract a properties file for the subtype of interest from the configuration.
Use the extractConfigProperties command to extract the properties file for the resource of interest. The following example extracts the properties for the JDBCProvider resource to the derby.props file:
AdminTask.extractConfigProperties('[-propertiesFileName derby.props -configData Server=server1 -filterMechanism SELECTED_SUBTYPES -selectedSubTypes [JDBCProvider]]')The command generates a template file similar to the following sample template:
# # SubSection 1.0 # JDBCProvider attributes # ResourceType=JDBCProvider ImplementingResourceType=JDBCProvider ResourceId=Cell=!{cellName}:ServerCluster=!{clusterName}:JDBCProvider=Derby JDBC Provider (XA) # # #Properties # classpath={${DERBY_JDBC_DRIVER_PATH}/derby.jar} name=Derby JDBC Provider (XA) #required implementationClassName=org.apache.derby.jdbc.EmbeddedXADataSource #required isolatedClassLoader=false #boolean,default(false) nativepath={} description=Built-in Derby JDBC Provider (XA) providerType=Derby JDBC Provider (XA) #readonly xa=true #boolean,default(false)- Edit the extracted properties file to specify that it create, modify, or delete configuration objects.
To create a new object or modify or delete an existing object, edit the extracted properties file. We can specify one or more create, modify, and delete operations in the same properties file.
- To create a new object, specify unique properties for an object. Set the ResourceId attribute to a value that does not exist in your configuration.
The following example creates a new DataSource object, DefaultDatasource_1, which does not exist in the configuration:
# # Create a new object # ResourceType=DataSource ImplementingResourceType=GenericType ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=Derby JDBC Provider:DataSource=jndiName#DefaultDatasource_1 # # #Properties # name=Default Datasource1 #required jndiName=DefaultDatasource_1 manageCachedHandles=false #boolean,default(false) provider=Derby JDBC Provider #ObjectName(JDBCProvider),readonly description=Datasource for the WebSphere Default Application logMissingTransactionContext=true #boolean,default(true)
- To modify an existing object, change one or more object properties.
The following example changes the description property of the DefaultDatasource_1 object by adding _1 to the end of the description:
# # Modify a property # ResourceType=DataSource ImplementingResourceType=GenericType ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=Derby JDBC Provider:DataSource=jndiName#DefaultDatasource_1 # # #Properties # description=Datasource for the WebSphere Default Application_1
- To delete an existing object property, specify DELETEPROP=true in the header of the properties file.
The following example deletes the description property:
# # Delete a property # ResourceType=DataSource ImplementingResourceType=GenericType ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=Derby JDBC Provider:DataSource=jndiName#DefaultDatasource_1 DELETEPROP=true # # #Properties # description=Datasource for the WebSphere Default Application_1
- To delete an existing object, specify DELETE=true in the header of the properties file.
The following example deletes the DefaultDatasource object:
# # Delete an existing object # ResourceType=DataSource ImplementingResourceType=GenericType ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=Derby JDBC Provider:DataSource=jndiName#DefaultDatasource DELETE=true # # #Properties # name=Default Datasource #required jndiName=DefaultDatasource
- Run applyConfigProperties to apply the properties file and change the configuration.
The following example command applies the derby.props properties file:
AdminTask.applyConfigProperties('[-propertiesFileName derby.props]')The command automatically validates the properties file, then applies the changes to the configuration. If you run applyConfigProperties before you add the DELETE=true attribute and value to the properties file, the command resets each property to the default value. The system completely removes properties that do not have default values.
Results
The administrative command runs and applies the properties file.
What to do next
Save the changes to the configuration.
Apply portable properties files across multiple environments
Extract properties files using wsadmin.sh
Apply properties files using wsadmin.sh
Validate 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
Extract properties files to troubleshoot the environment using wsadmin.sh
Use properties files to manage system configuration
Related
PropertiesBasedConfiguration command group using wsadmin.sh
Properties file syntax