|
This document applies only to the following language
version(s):
English |
|
Problem |
How to modify (WebSphere Variables)
VariableSubstitutionEntry attributes of a VariableMap using wsadmin
scripting? |
|
Cause |
Example in WebSphere Information Center creates a new
VariableMap and then creates a new VariableSubstitutionEntry instead of
modifying the existing entry attributes. |
|
Solution |
# Script to Modify symbolicName of VariableSubstitutionEntry of
VariableMap at node level
set mycell WAS511Cell
set mynode WAS511Node
set symbolicName MQ_INSTALL_ROOT
# get node config id
set node [$AdminConfig getid /Cell:$mycell/Node:$mynode/]
# get list of VariableMap at node level
set varmap [$AdminConfig list VariableMap $node]
# number of VariableMap at node level
set varmap_l [llength $varmap]
# interate through all the VariableMap at nodelevel
for {set i 0} {$i < $varmap_l} {incr i} {
# start examining i-th VariableMap entry at nodelevel
set varmapi [lindex $varmap $i]
# list the VariableSubstitutionEntry of the i-th VariableMap entry at
nodelevel
set vsentries [$AdminConfig list VariableSubstitutionEntry $varmapi]
# list the VariableSubstitutionEntry of the i-th VariableMap entry at
nodelevel
set vsentriesl [llength $vsentries]
# interate through all VariableSubstitutionEntry to find the one we are
interested in
for {set j 0} {$j < $vsentriesl} {incr j} {
# number of VariableSubstitutionEntry
set vsentryj [lindex $vsentries $j]
# get symbolicName attribute of j-th VariableSubstitutionEntry
set symname [$AdminConfig showAttribute $vsentryj {symbolicName}]
# get value attribute of j-th VariableSubstitutionEntry
set valueis [$AdminConfig showAttribute $vsentryj {value}]
# get description attribute of j-th VariableSubstitutionEntry
set descriptionis [$AdminConfig showAttribute $vsentryj {description}]
# if symbolicName name matches the one we are interested in
if {$symname == $symbolicName} {
# print all old attributes
puts "symbolicName = $symname"
puts "Old value = $valueis"
puts "Old description = $descriptionis"
# modify value attribute of j-th VariableSubstitutionEntry
$AdminConfig modify $vsentryj {{value D:/temp}}
# modify description attribute of j-th VariableSubstitutionEntry
$AdminConfig modify $vsentryj {{description "new description value"}}
# read all new attributes
set newvalue [$AdminConfig showAttribute $vsentryj {value}]
set newdescription [$AdminConfig showAttribute $vsentryj {description}]
# print all new attributes
puts "new value = $newvalue"
puts "new description = $newdescription"
}
}
} |
|