Specify running objects
- Invoke the AdminControl object.
- Obtain the configuration ID using one of the following methods:
- completeObjectName:
set var [$AdminControl completeObjectName template]If there are several MBeans that match the template, the completeObjectName command only retuns the first match. The matching MBean object name is then assigned to a variable. To look only for the serverA MBean in nodename:
set serverA [$AdminControl completeObjectName node=nodename,server:serverA*]- queryNames:
set var [$AdminControl queryNames template]The difference between queryNames and completeObjectName commands is the queryNames command returns a list of all the MBean object names that matches the template.
- To look for all the MBeans:
set allMbeans [$AdminControl queryNames *]- To look for all the server MBeans:
set servers [$AdminControl queryNames type=Server,*]- To look for all the server Mbeans in nodename:
set nodeServers [$AdminControl queryNames node=nodename,type=Server,*]- If multiple objects are returned from the queryNames command, the objects are returned in a list syntax. To retrieve a single element from a list one can use the lindex command...
set allServers [$AdminControl queryNames type=Server,*]
set aServer [lindex $allServers 0]...or one can use regexp...
set allServers [$AdminControl queryNames type=Server,*] foreach server $allServers { if {[regexp serverA $allServers] == 1} { puts "Found serverA: $serverA" } }