MBeanMOInfo.java :  » Net » snmp4j » org » snmp4j » agent » mo » jmx » Java Open Source

Java Open Source » Net » snmp4j 
snmp4j » org » snmp4j » agent » mo » jmx » MBeanMOInfo.java
/*_############################################################################
  _##
  _##  SNMP4J-AgentJMX - MBeanMOInfo.java
  _##
  _##  Copyright (C) 2006-2007  Frank Fock (SNMP4J.org)
  _##
  _##  This program is free software; you can redistribute it and/or modify
  _##  it under the terms of the GNU General Public License version 2 as
  _##  published by the Free Software Foundation.
  _##
  _##  This program is distributed in the hope that it will be useful,
  _##  but WITHOUT ANY WARRANTY; without even the implied warranty of
  _##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  _##  GNU General Public License for more details.
  _##
  _##  You should have received a copy of the GNU General Public License
  _##  along with this program; if not, write to the Free Software
  _##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  _##  MA  02110-1301  USA
  _##
  _##########################################################################*/

package org.snmp4j.agent.mo.jmx;

import javax.management.ObjectName;
import java.util.Set;
import javax.management.MBeanServerConnection;
import java.io.IOException;
import javax.management.ObjectInstance;

/**
 * The <code>MBeanMOInfo</code> provides information associated with a MBean
 * through its <code>ObjectName</code>.
 *
 * @author Frank Fock
 * @version 1.0
 */
public class MBeanMOInfo {

  private ObjectName name;

  public MBeanMOInfo(ObjectName name) {
    this.name = name;
  }

  /**
   * Returns the name of the MBean.
   * @return
   *    the MBean's <code>ObjectName</code>.
   */
  public ObjectName getObjectName() {
    return name;
  }

  /**
   * Returns the MBean object instances associated with this
   * {@link #getObjectName()} at the supplied MBean server.
   *
   * @param server
   *    a <code>MBeanServerConnection</code>.
   * @return Set
   *    a set of {@link ObjectInstance}s.
   * @throws IOException
   */
  public Set<ObjectInstance> getMBeanNames(MBeanServerConnection server)
      throws IOException
  {
    return server.queryMBeans(getObjectName(), null);
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.