Specify running objects

 

  1. Invoke the AdminControl object.

  2. Obtain the configuration ID using one of the following methods:

    1. 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*]

    2. 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.

  3. To look for all the MBeans:

    set allMbeans [$AdminControl queryNames *]

  4. To look for all the server MBeans:

    set servers [$AdminControl queryNames type=Server,*]

  5. To look for all the server Mbeans in nodename:

    set nodeServers [$AdminControl queryNames node=nodename,type=Server,*]

  6. 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"
       }
    }