+

Search Tips   |   Advanced Search

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.

Use the PropertiesBasedConfiguration command group for the AdminTask object, we can use properties files to create, modify, and delete configuration objects from the environment.

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.


Tasks

  1. Start the wsadmin scripting tool.

  2. 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)
    

  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 the 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=DefaultApp 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=DefaultApp Datasource #required
      jndiName=DefaultDatasource
      

  4. Run the applyConfigProperties command 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 we run the applyConfigProperties command before we 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.

The administrative command runs and applies the properties file.


What to do next

Save the changes to the configuration.

  • Applying portable properties files across multiple environments
  • Extracting properties files
  • Applying properties files
  • Validate properties files
  • Create server, cluster, application, or authorization group objects using properties files and wsadmin scripting
  • Deleting server, cluster, application, or authorization group objects using properties files
  • Extracting properties files to troubleshoot the environment
  • Use properties files to manage system configuration
  • PropertiesBasedConfiguration .
  • Properties file syntax