+

Search Tips   |   Advanced Search

 

Modify configuration objects with the wsadmin tool

 

You can modify configuration objects using scripting and the wsadmin tool. Before starting this task, the wsadmin tool must be running. See the Start the wsadmin scripting client article for more information.

 

Overview

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 to modify, for example:

      Use Jacl:

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

    • Use Jython:

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

    where:

    set Jacl command
    jdbcProvider1 variable name
    $ Jacl operator for substituting a variable name with its value
    AdminConfig object that represents the WebSphere Application Server configuration
    getid AdminConfig command
    /JDBCProvider:myJdbcProvider/ hierarchical containment path of the configuration object
    JDBCProvider object type
    myJdbcProvider optional name of the object

  2. Show the current attribute values of the configuration object with the show command...

      Use Jacl:

      $AdminConfig show $jdbcProvider1
      

    • Use Jython:

      AdminConfig.show(jdbcProvider1)
      

    where:

    $ Jacl operator for substituting a variable name with its value
    AdminConfig object that represents the WebSphere Application Server configuration
    show 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...

      Use Jacl:

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

    • Use Jython list:

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

    • Use Jython string:

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

    where:

    $ Jacl operator for substituting a variable name with its value
    AdminConfig object that represents the WebSphere Application Server configuration
    modify AdminConfig command
    jdbcProvider1 evaluates to the ID of the host node that is specified in step number 1
    description attribute of server objects
    This is my new description value of the description attribute

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

      Use Jacl:

      {{name1 val1} {name2 val2} {name3 val3}}
      

    • Use Jython list:

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

    • Use Jython string:

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

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

      Use Jacl:

      $AdminConfig attributes JDBCProvider
      

    • Use 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, change the classpath to be an empty list before you modify the new value. For example:

      Use Jacl:

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

      Use Jython list:

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

      Use Jython string:

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

  6. Save the configuration changes. See the Saving configuration changes with the wsadmin tool article for more information.

  7. In a network deployment environment only, synchronize the node. See the Synchronizing nodes with the wsadmin tool article for more information.



Use the AdminConfig object for scripted administration

 

Related Reference


Commands for the AdminConfig object