예제 #1
0
 /** @since Java DMK 1.5 */
 public String[] getDomains() {
   if (interceptor instanceof MBeanServerInterceptor) {
     return ((MBeanServerInterceptor) interceptor).getDomains();
   }
   final Set names = interceptor.queryNames(null, null);
   final Set tmpSet = new HashSet(1);
   for (final Iterator i = names.iterator(); i.hasNext(); ) {
     final ObjectName x = (ObjectName) i.next();
     final String domain = x.getDomain();
     if (tmpSet.contains(domain)) continue;
     tmpSet.add(domain);
   }
   final String[] result = new String[tmpSet.size()];
   return (String[]) tmpSet.toArray(result);
 }
예제 #2
0
  /**
   * Gets the names of MBeans controlled by the MBean server. This method enables any of the
   * following to be obtained: The names of all MBeans, the names of a set of MBeans specified by
   * pattern matching on the <CODE>ObjectName</CODE> and/or a Query expression, a specific MBean
   * name (equivalent to testing whether an MBean is registered). When the object name is null or or
   * no domain and key properties are specified, all objects are selected (and filtered if a query
   * is specified). It returns the set of ObjectNames for the MBeans selected.
   *
   * @param name The object name pattern identifying the MBeans to be retrieved. If null or no
   *     domain and key properties are specified, all the MBeans registered will be retrieved.
   * @param query The query expression to be applied for selecting MBeans. If null no query
   *     expression will be applied for selecting MBeans.
   * @return A set containing the ObjectNames for the MBeans selected. If no MBean satisfies the
   *     query, an empty list is returned.
   */
  public Set queryNames(ObjectName name, QueryExp query) {

    return interceptor.queryNames(name, query);
  }