Modify configuration objects with wsadmin


 

+

Search Tips   |   Advanced Search

 

We can modify configuration objects using scripting and wsadmin.

Use the configuration object ID with AdminConfig to modify attributes.

If we use the parent object ID, 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.

Jython...

### Retrieve the configuration ID of the objects
jdbcProvider1 = AdminConfig.getid('/JDBCProvider:myJdbcProvider/')

### Show the current attribute values of the configuration object
AdminConfig.show(jdbcProvider1)

### Modify the attributes of the configuration object.
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:
###
### '[[name1 val1] [name2 val2] [name3 val3]]'

### List all of the attributes that can be modified:
print AdminConfig.attributes('JDBCProvider')

### Modify an attribute that has a type of list and collection.
###
### By default, if we 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:

AdminConfig.modify(jdbcProvider1, [['description', []]])
AdminConfig.modify(jdbcProvider1, [['description', '/tmp/db2j.jar']]

### Use Jython string:
###
### AdminConfig.modify(jdbcProvider1, '[]')
### AdminConfig.modify(jdbcProvider1, '[[description /tmp/db2j.jar]]')

### Save the configuration changes.
AdminConfig.save()

### Synchronize the node
AdminNodeManagement.syncActiveNodes()

### Alternate sync syntax
### AdminNodeManagement.syncNode("myNode")

Jacl...


### Retrieve the configuration ID of the objects
set jdbcProvider1 [$AdminConfig getid /JDBCProvider:myJdbcProvider/]

### Show the current attribute values of the configuration object
$AdminConfig show $jdbcProvider1

### Modify the attributes of the configuration object.
$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:
###
### {{name1 val1} {name2 val2} {name3 val3}}

### List all of the attributes that can be modified:
$AdminConfig attributes JDBCProvider

### For example...
###
### $AdminConfig attributes JDBCProvider
###
### "classpath String*"
### "description String"
### "implementationClassName String"
### "name String"
### "nativepath String*"
### "propertySet J2EEResourcePropertySet"
### "providerType String"
### "xa boolean"

### Modify an attribute that has a type of list and collection.
###
### By default, if we 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:

$AdminConfig modify $jdbcProvider1 {{classpath {}}}
$AdminConfig modify $jdbcProvider1 [list [list classpath /tmp/db2j.jar]]

 

Related tasks

Use the script library to automate the application serving environment
Synchronizing nodes with wsadmin
Use the AdminConfig object for scripted administration

 

Related

Commands for the AdminConfig object