WAS v8.5 > Script the application serving environment (wsadmin) > Use the wsadmin scripting AdminConfig object for scripted administration

Modify configuration objects using wsadmin.sh

Modifying configuration objects using scripting and wsadmin.

Start wsadmin.shfor more information. When using the modify command for the AdminConfig object, use the configuration object ID to modify the attribute to change. If we 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, we 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:

  1. Retrieve the configuration ID of the objects to modify, for example:

    • Jacl:

        set jdbcProvider1 [$AdminConfig getid /JDBCProvider:myJdbcProvider/]
    • Jython:

        jdbcProvider1 = AdminConfig.getid('/JDBCProvider:myJdbcProvider/')

  2. Show the current attribute values of the configuration object with the show command, for example:

    • Jacl:

        $AdminConfig show $jdbcProvider1
    • Jython:

        AdminConfig.show(jdbcProvider1)

  3. Modify the attributes of the configuration object.

    Examples:

    • Jacl:

        $AdminConfig modify $jdbcProvider1 {{description "This is my new description"}}

        $AdminConfig modify $outPort {{retargettedURI "endpoint address"}}
    • Jython list:

        AdminConfig.modify(jdbcProvider1, [['description', "This is my new description"]])

        AdminConfig.modify(outPort, [['retargettedURI', "endpoint address"]])
    • Jython string:

        AdminConfig.modify(jdbcProvider1, '[[description "This is my new description"]]')

        AdminConfig.modify(outPort, '[[retargettedURI "endpoint address"]]')

    We can also modify several attributes at the same time. For example:

    • Jacl:

        {{name1 val1} {name2 val2} {name3 val3}}
    • Jython list:

        [['name1', 'val1'], ['name2', 'val2'], ['name3', 'val3']]
    • Jython string:

        '[[name1 val1] [name2 val2] [name3 val3]]'

  4. List all of the attributes that can be modified:

    • Jacl:

        $AdminConfig attributes JDBCProvider
    • 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. To replace the existing value, you must change the classpath to be an empty list before you modify the new value. For example:

    • Jacl:

      $AdminConfig modify $jdbcProvider1 {{classpath {}}}
      
      $AdminConfig modify $jdbcProvider1 [list [list classpath c:/temp/db2j.jar]]
    • Jython list:

      AdminConfig.modify(jdbcProvider1, [['description', []]])
      
      AdminConfig.modify(jdbcProvider1, [['description', 'c:/temp/db2j.jar']]
    • Jython string:

      AdminConfig.modify(jdbcProvider1, '[]')
      
      AdminConfig.modify(jdbcProvider1, '[[description c:/temp/db2j.jar]]')

  6. Save the configuration changes.

    Use the following command example to save your configuration changes:

      AdminConfig.save()


Related


Use the script library to automate the application serving environment using wsadmin.sh
Start the wsadmin scripting client using wsadmin.sh
Use the wsadmin scripting AdminConfig object for scripted administration


Reference:

Commands for the AdminConfig object using wsadmin.sh


+

Search Tips   |   Advanced Search