code: public Map<String, Map<String, String>> getMBeanAttributesByRegex(String regex) throws Exception {
          Map<String, Map<String, String>> result = Maps.newLinkedHashMap();
          ObjectName name = new ObjectName(regex);
          Set<ObjectName> objs = mBeanServer.queryNames(name, null);
          
          // Convert object naems to a tree
          for (ObjectName objName : objs) {
              result.put(objName.getCanonicalName(), getMBeanAttributes(objName));
          }
  
          return result;
      }
docs: Return a map of all attributes for objects matching the regex.
  @param regex
  @return
  @throws Exception