Modify nested attributes with the wsadmin tool

 

Overview

The attributes for a WAS configuration object are often deeply nested. For example, a JDBCProvider object has an attribute factory, which is a list of the J2EEResourceFactory type objects. These objects can be DataSource objects that contain a connectionPool attribute with a ConnectionPool type that contains a variety of primitive attributes.

 

Procedure

  1. Invoke the AdminConfig object commands interactively, in a script, or use the wsadmin -c commands from an operating system command prompt.

  2. Obtain the configuration ID of the object, for example:

    Jacl:

    set t1 [$AdminConfig getid /DataSource:TechSamp/]
    

    Jython

    t1=AdminConfig.getid('/DataSource:TechSamp/')
    
    where:

    set is a Jacl command
    t1 is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WAS configuration
    getid is an AdminConfig command
    DataSource is the object type
    TechSamp is the name of the object that will be modified

  3. Modify one of the object parents and specify the location of the nested attribute within the parent, for example:

    Jacl:

    $AdminConfig modify $t1 {{connectionPool {{reapTime 2003}}}}
    

    Jython list

    AdminConfig.modify(t1, [["connectionPool", [["reapTime", 2003]]]])
    

    Jython string

    AdminConfig.modify(t1, '[[connectionPool [[reapTime 2003]]]]')
    
    where:

    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WAS configuration
    modify is an AdminConfig command
    t1 evaluates to the configuration ID of the datasource in step number 2
    connectionPool is an attribute
    reapTime is a nested attribute within the connectionPool attribute
    2003 is the value of the reapTime attribute

  4. Save the configuration by issuing an AdminConfig save command. For example:

    Jacl:

    $AdminConfig save
    

    Jython

    AdminConfig.save()
    
    Use the reset command of the AdminConfig object to undo changes that you made to your workspace since your last save.

 

Example

Jacl:

set techsamp [$AdminConfig getid /DataSource:TechSamp/]
set pool [$AdminConfig showAttribute $techsamp connectionPool]
$AdminConfig modify $pool {{reapTime 2003}}

Jython list

techsamp=AdminConfig.getid('/DataSource:TechSamp/')
pool=AdminConfig.showAttribute(techsamp,'connectionPool')
AdminConfig.modify(pool,[['reapTime',2003]])

Jython string

techsamp=AdminConfig.getid('/DataSource:TechSamp/')
pool=AdminConfig.showAttribute(techsamp,'connectionPool')
AdminConfig.modify(pool,'[[reapTime 2003]]')

 



 

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.