FileDocCategorySizeDatePackage
MBeanServerCommand.javaAPI DocJBoss 4.2.12543Fri Jul 13 21:02:16 BST 2007org.jboss.console.twiddle.command

MBeanServerCommand

public abstract class MBeanServerCommand extends AbstractCommand
An abstract command to opperate on an MBeanServer.
version
$Revision: 57191 $
author
Jason Dillon
author
Scott.Stark@jboss.org

Fields Summary
Constructors Summary
protected MBeanServerCommand(String name, String desc)

      super(name, desc);
   
Methods Summary
protected javax.management.ObjectNamecreateObjectName(java.lang.String name)

      try {
         return new ObjectName(name);
      }
      catch (MalformedObjectNameException e) {
         throw new CommandException("Invalid object name: " + name);
      }
   
protected javax.management.MBeanServerConnectiongetMBeanServer()

      return context.getServer();
   
protected javax.management.ObjectName[]queryMBeans(java.lang.String query)

      // query the mbean server
      MBeanServerConnection server = getMBeanServer();
      
      Set matches = server.queryNames(new ObjectName(query), null);
      log.debug("Query matches: " + matches);

      if (matches.size() == 0) {
         throw new CommandException("No MBean matches for query: " + query);
      }

      ObjectName[] names =
         (ObjectName[])matches.toArray(new ObjectName[matches.size()]);

      return names;