WAS v8.5 > Script the application serving environment (wsadmin) > Use properties files to manage system configuration > Manage environment configurations with properties files using wsadmin.sh

Create, modify, and delete configuration objects using one properties file

We can specify to create, modify, and delete objects in one properties file. You run the applyConfigProperties command to apply the configuration changes.

Determine the changes to make to configuration objects. Using the PropertiesBasedConfiguration command group for AdminTask, we can use properties files to create, modify, and delete configuration objects from the environment.

We 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 the applyConfigProperties command to apply the properties file. With this approach, we do not need to run the deleteConfigProperties command to delete an object.

We cannot apply a z/OS operating system properties file directly to a distributed operating system. Similarly, we 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.

  1. Start the wsadmin scripting tool.
  2. Extract a properties file for the subtype of interest from your 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)
  3. 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

  4. Run the applyConfigProperties command to apply the properties file and change your 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 your configuration.

    If you run the applyConfigProperties command 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.

Save the changes to your configuration.


Related


Applying portable properties files across multiple environments
Extracting properties files using wsadmin.sh
Applying properties files using wsadmin.sh
Validating 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
Extracting properties files to troubleshoot the environment using wsadmin.sh
Use properties files to manage system configuration


Reference:

PropertiesBasedConfiguration command group for AdminTask using wsadmin.sh
Properties file syntax


+

Search Tips   |   Advanced Search