public void execute(String[] args) throws Exception
   {
      processArguments(args);

      if (objectName == null)
         throw new CommandException("Missing object name");

      log.debug("attribute names: " + attributeNames);

      MBeanServerConnection server = getMBeanServer();
      if (attributeNames.size() == 0)
      {
         // Display all readable attributes
         attributeNames.clear();
         MBeanInfo info = server.getMBeanInfo(objectName);
         MBeanAttributeInfo[] attrInfos = info.getAttributes();
         for (int a = 0; a < attrInfos.length; a++)
         {
            MBeanAttributeInfo attrInfo = attrInfos[a];
            if (attrInfo.isReadable())
               attributeNames.add(attrInfo.getName());
         }
      }

      String[] names = new String[attributeNames.size()];
      attributeNames.toArray(names);
      log.debug("as string[]: " + Strings.join(names, ","));

      AttributeList attrList = server.getAttributes(objectName, names);
      log.debug("attribute list: " + attrList);

      if (attrList.size() == 0)
      {
         throw new CommandException("No matching attributes");
      }
      else if (attrList.size() != names.length)
      {
         log.warn("Not all specified attributes were found");
      }

      PrintWriter out = context.getWriter();

      Iterator iter = attrList.iterator();
      while (iter.hasNext())
      {
         Attribute attr = (Attribute) iter.next();
         if (prefix)
         {
            out.print(attr.getName());
            out.print("=");
         }
         out.println(attr.getValue());
      }
      closeServer();
   }