Modifying configuration objects using the wsadmin scripting tool

Modifying configuration objects using scripting and the wsadmin tool.

Before you begin

Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client topic for more information.

About this task

When using the modify command for the AdminConfig object, use the configuration object ID to modify the attribute you want to change. If you use the parent object ID to modify the attribute, the command resets all other attributes that are not specified to the default values. For example, you use the modify command to change the monitoring policy settings through its parent object, the process definition object. All attributes for the process definition object that were not modified with the command, such as the pingInterval and pingTimeout attributes, are reset to their default values.

Perform the following steps to modify a configuration object:

Procedure

  1. Retrieve the configuration ID of the objects that you want to modify, for example:
    • Using Jacl:

      set jdbcProvider1 [$AdminConfig getid /JDBCProvider:myJdbcProvider/]
      
    • Using Jython:
      jdbcProvider1 = AdminConfig.getid('/JDBCProvider:myJdbcProvider/')
    Table 1. AdminConfig getid command description . Invoke a command from a wsadmin command line.
    Element Description
    set is a Jacl command
    jdbcProvider1 is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object that represents the product configuration
    getid is an AdminConfig command
    /JDBCProvider:myJdbcProvider/ is the hierarchical containment path of the configuration object
    JDBCProvider is the object type
    myJdbcProvider is the optional name of the object
  2. Show the current attribute values of the configuration object with the show command, for example:
    • Using Jacl:

      $AdminConfig show $jdbcProvider1
    • Using Jython:
      AdminConfig.show(jdbcProvider1)
    Table 2. AdminConfig show command description . Invoke a command from a wsadmin command line.
    Element Description
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object that represents the product configuration
    show is an AdminConfig command
    jdbcProvider1 evaluates to the ID of the host node that is specified in step number 1
  3. Modify the attributes of the configuration object.

    Examples:

    • Using Jacl:

      $AdminConfig modify $jdbcProvider1 {{description "This is my new description"}}
      $AdminConfig modify $outPort {{retargettedURI "endpoint address"}}   
    • Using Jython list:
      AdminConfig.modify(jdbcProvider1, [['description', "This is my new description"]])
      AdminConfig.modify(outPort, [['retargettedURI', "endpoint address"]])
    • Using Jython string:
      AdminConfig.modify(jdbcProvider1, '[[description "This is my new description"]]')
      AdminConfig.modify(outPort, '[[retargettedURI "endpoint address"]]')
    where:
    Table 3. AdminConfig modify command description . Invoke a command from a wsadmin command line.
    Element Description
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object that represents the product configuration
    modify is an AdminConfig command
    jdbcProvider1 evaluates to the ID of the host node that is specified in step number 1
    description is an attribute of server objects
    This is my new description is the value of the description attribute
    outPort is the name of the SIBWSOutboundPort created using the addSIBWSOutboundPort command. The AdminConfig command can also be used to modify the other SIBWSOutboundPort command attributes.
    retargettedURI is the attribute of outport objects. This particular attribute is equivalent to changing the value specified for the endpoint address property on the administrative console.
    endpoint address is the value of the retargettedURI attribute
    You can also modify several attributes at the same time. For example:
    • Using Jacl:

      {{name1 val1} {name2 val2} {name3 val3}}
    • Using Jython list:
      [['name1', 'val1'], ['name2', 'val2'], ['name3', 'val3']]
    • Using Jython string:
      '[[name1 val1] [name2 val2] [name3 val3]]'
  4. List all of the attributes that can be modified:
    • Using Jacl:

      $AdminConfig attributes JDBCProvider
    • Using Jython:
      print AdminConfig.attributes('JDBCProvider')
    Example output:
    $AdminConfig attributes JDBCProvider
    "classpath String*"
    "description String"
    "implementationClassName String"
    "name String"
    "nativepath String*"
    "propertySet J2EEResourcePropertySet"
    "providerType String"
    "xa boolean"
  5. Modify an attribute that has a type of list and collection.

    By default, if you try to modify an attribute that has a type of list and collection, and the attribute has an existing value in the list, it will append the new value to the existing values. An attribute that has a type of list and collection will have a star (*). In the following example, the attribute classpath has an type of list and collection and the value is String. If you want to replace the existing value, you must change the classpath to be an empty list before you modify the new value. For example:

    • Using Jacl:

      [AIX Solaris HP-UX Linux Windows]
      $AdminConfig modify $jdbcProvider1 {{classpath {}}}
      
      $AdminConfig modify $jdbcProvider1 [list [list classpath c:/temp/db2j.jar]]
      [z/OS][IBM i]
      $AdminConfig modify $jdbcProvider1 {{classpath {}}}
      
      $AdminConfig modify $jdbcProvider1 [list [list classpath /temp/db2j.jar]]
    • Using Jython list:

      [AIX Solaris HP-UX Linux Windows]
      AdminConfig.modify(jdbcProvider1, [['description', []]])
      
      AdminConfig.modify(jdbcProvider1, [['description', 'c:/temp/db2j.jar']]
      [z/OS][IBM i]
      AdminConfig.modify(jdbcProvider1, [['description', []]])
      
      AdminConfig.modify(jdbcProvider1, [['description', '/temp/db2j.jar']]
    • Using Jython string:

      [AIX Solaris HP-UX Linux Windows]
      AdminConfig.modify(jdbcProvider1, '[]')
      
      AdminConfig.modify(jdbcProvider1, '[[description c:/temp/db2j.jar]]')
      [z/OS][IBM i]
      AdminConfig.modify(jdbcProvider1, '[]')
      
      AdminConfig.modify(jdbcProvider1, '[[description /temp/db2j.jar]]')
  6. Save the configuration changes.
    Use the following command example to save your configuration changes:
    AdminConfig.save()
  7. In a network deployment environment only, synchronize the node.
    Use the syncActiveNode or syncNode scripts in the AdminNodeManagement script library to propagate the configuration changes to node or nodes.
    • Use the syncActiveNodes script to propagate the changes to each node in the cell, as the following example demonstrates:
      AdminNodeManagement.syncActiveNodes()
    • Use the syncNode script to propagate the changes to a specific node, as the following example demonstrates:
      AdminNodeManagement.syncNode("myNode")