0N/A/*
2362N/A * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.management;
0N/A
0N/A
0N/A// java import
0N/Aimport java.io.IOException;
0N/Aimport java.util.Set;
0N/A
0N/A
0N/A/**
0N/A * This interface represents a way to talk to an MBean server, whether
0N/A * local or remote. The {@link MBeanServer} interface, representing a
0N/A * local MBean server, extends this interface.
0N/A *
0N/A *
0N/A * @since 1.5
0N/A */
1790N/Apublic interface MBeanServerConnection {
0N/A /**
0N/A * <p>Instantiates and registers an MBean in the MBean server. The
0N/A * MBean server will use its {@link
0N/A * javax.management.loading.ClassLoaderRepository Default Loader
0N/A * Repository} to load the class of the MBean. An object name is
736N/A * associated with the MBean. If the object name given is null, the
1790N/A * MBean must provide its own name by implementing the {@link
0N/A * javax.management.MBeanRegistration MBeanRegistration} interface
0N/A * and returning the name from the {@link
1790N/A * MBeanRegistration#preRegister preRegister} method.</p>
0N/A *
0N/A * <p>This method is equivalent to {@link
0N/A * #createMBean(String,ObjectName,Object[],String[])
0N/A * createMBean(className, name, (Object[]) null, (String[])
0N/A * null)}.</p>
0N/A *
0N/A * @param className The class name of the MBean to be instantiated.
0N/A * @param name The object name of the MBean. May be null.
0N/A *
0N/A * @return An <CODE>ObjectInstance</CODE>, containing the
0N/A * <CODE>ObjectName</CODE> and the Java class name of the newly
0N/A * instantiated MBean. If the contained <code>ObjectName</code>
0N/A * is <code>n</code>, the contained Java class name is
0N/A * <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>.
0N/A *
0N/A * @exception ReflectionException Wraps a
0N/A * <CODE>java.lang.ClassNotFoundException</CODE> or a
0N/A * <CODE>java.lang.Exception</CODE> that occurred
0N/A * when trying to invoke the MBean's constructor.
0N/A * @exception InstanceAlreadyExistsException The MBean is already
0N/A * under the control of the MBean server.
0N/A * @exception MBeanRegistrationException The
0N/A * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
0N/A * interface) method of the MBean has thrown an exception. The
0N/A * MBean will not be registered.
693N/A * @exception RuntimeMBeanException If the MBean's constructor or its
693N/A * {@code preRegister} or {@code postRegister} method threw
693N/A * a {@code RuntimeException}. If the <CODE>postRegister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws a
526N/A * <CODE>RuntimeException</CODE>, the <CODE>createMBean</CODE> method will
467N/A * throw a <CODE>RuntimeMBeanException</CODE>, although the MBean creation
467N/A * and registration succeeded. In such a case, the MBean will be actually
526N/A * registered even though the <CODE>createMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeMBeanException</CODE> can
467N/A * also be thrown by <CODE>preRegister</CODE>, in which case the MBean
467N/A * will not be registered.
467N/A * @exception RuntimeErrorException If the <CODE>postRegister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws an
526N/A * <CODE>Error</CODE>, the <CODE>createMBean</CODE> method will
467N/A * throw a <CODE>RuntimeErrorException</CODE>, although the MBean creation
467N/A * and registration succeeded. In such a case, the MBean will be actually
526N/A * registered even though the <CODE>createMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeErrorException</CODE> can
467N/A * also be thrown by <CODE>preRegister</CODE>, in which case the MBean
467N/A * will not be registered.
0N/A * @exception MBeanException The constructor of the MBean has
0N/A * thrown an exception
0N/A * @exception NotCompliantMBeanException This class is not a JMX
0N/A * compliant MBean
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The className
0N/A * passed in parameter is null, the <CODE>ObjectName</CODE> passed
0N/A * in parameter contains a pattern or no <CODE>ObjectName</CODE>
0N/A * is specified for the MBean.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
467N/A * @see javax.management.MBeanRegistration
0N/A */
0N/A public ObjectInstance createMBean(String className, ObjectName name)
0N/A throws ReflectionException, InstanceAlreadyExistsException,
0N/A MBeanRegistrationException, MBeanException,
0N/A NotCompliantMBeanException, IOException;
0N/A
0N/A /**
0N/A * <p>Instantiates and registers an MBean in the MBean server. The
0N/A * class loader to be used is identified by its object name. An
736N/A * object name is associated with the MBean. If the object name of
0N/A * the loader is null, the ClassLoader that loaded the MBean
1790N/A * server will be used. If the MBean's object name given is null,
1790N/A * the MBean must provide its own name by implementing the {@link
0N/A * javax.management.MBeanRegistration MBeanRegistration} interface
0N/A * and returning the name from the {@link
1790N/A * MBeanRegistration#preRegister preRegister} method.</p>
0N/A *
0N/A * <p>This method is equivalent to {@link
0N/A * #createMBean(String,ObjectName,ObjectName,Object[],String[])
0N/A * createMBean(className, name, loaderName, (Object[]) null,
0N/A * (String[]) null)}.</p>
0N/A *
0N/A * @param className The class name of the MBean to be instantiated.
0N/A * @param name The object name of the MBean. May be null.
0N/A * @param loaderName The object name of the class loader to be used.
0N/A *
0N/A * @return An <CODE>ObjectInstance</CODE>, containing the
0N/A * <CODE>ObjectName</CODE> and the Java class name of the newly
0N/A * instantiated MBean. If the contained <code>ObjectName</code>
0N/A * is <code>n</code>, the contained Java class name is
0N/A * <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>.
0N/A *
0N/A * @exception ReflectionException Wraps a
0N/A * <CODE>java.lang.ClassNotFoundException</CODE> or a
0N/A * <CODE>java.lang.Exception</CODE> that occurred when trying to
0N/A * invoke the MBean's constructor.
0N/A * @exception InstanceAlreadyExistsException The MBean is already
0N/A * under the control of the MBean server.
0N/A * @exception MBeanRegistrationException The
0N/A * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
0N/A * interface) method of the MBean has thrown an exception. The
0N/A * MBean will not be registered.
693N/A * @exception RuntimeMBeanException If the MBean's constructor or its
693N/A * {@code preRegister} or {@code postRegister} method threw
693N/A * a {@code RuntimeException}. If the <CODE>postRegister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws a
526N/A * <CODE>RuntimeException</CODE>, the <CODE>createMBean</CODE> method will
467N/A * throw a <CODE>RuntimeMBeanException</CODE>, although the MBean creation
467N/A * and registration succeeded. In such a case, the MBean will be actually
526N/A * registered even though the <CODE>createMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeMBeanException</CODE> can
467N/A * also be thrown by <CODE>preRegister</CODE>, in which case the MBean
467N/A * will not be registered.
467N/A * @exception RuntimeErrorException If the <CODE>postRegister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws an
526N/A * <CODE>Error</CODE>, the <CODE>createMBean</CODE> method will
467N/A * throw a <CODE>RuntimeErrorException</CODE>, although the MBean creation
467N/A * and registration succeeded. In such a case, the MBean will be actually
526N/A * registered even though the <CODE>createMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeErrorException</CODE> can
467N/A * also be thrown by <CODE>preRegister</CODE>, in which case the MBean
467N/A * will not be registered.
0N/A * @exception MBeanException The constructor of the MBean has
0N/A * thrown an exception
0N/A * @exception NotCompliantMBeanException This class is not a JMX
0N/A * compliant MBean
0N/A * @exception InstanceNotFoundException The specified class loader
0N/A * is not registered in the MBean server.
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The className
0N/A * passed in parameter is null, the <CODE>ObjectName</CODE> passed
0N/A * in parameter contains a pattern or no <CODE>ObjectName</CODE>
0N/A * is specified for the MBean.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
467N/A * @see javax.management.MBeanRegistration
0N/A */
0N/A public ObjectInstance createMBean(String className, ObjectName name,
0N/A ObjectName loaderName)
0N/A throws ReflectionException, InstanceAlreadyExistsException,
0N/A MBeanRegistrationException, MBeanException,
0N/A NotCompliantMBeanException, InstanceNotFoundException,
0N/A IOException;
0N/A
0N/A
0N/A /**
0N/A * Instantiates and registers an MBean in the MBean server. The
0N/A * MBean server will use its {@link
0N/A * javax.management.loading.ClassLoaderRepository Default Loader
0N/A * Repository} to load the class of the MBean. An object name is
736N/A * associated with the MBean. If the object name given is null, the
1790N/A * MBean must provide its own name by implementing the {@link
0N/A * javax.management.MBeanRegistration MBeanRegistration} interface
0N/A * and returning the name from the {@link
1790N/A * MBeanRegistration#preRegister preRegister} method.
0N/A *
0N/A * @param className The class name of the MBean to be instantiated.
0N/A * @param name The object name of the MBean. May be null.
0N/A * @param params An array containing the parameters of the
0N/A * constructor to be invoked.
0N/A * @param signature An array containing the signature of the
0N/A * constructor to be invoked.
0N/A *
0N/A * @return An <CODE>ObjectInstance</CODE>, containing the
0N/A * <CODE>ObjectName</CODE> and the Java class name of the newly
0N/A * instantiated MBean. If the contained <code>ObjectName</code>
0N/A * is <code>n</code>, the contained Java class name is
0N/A * <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>.
0N/A *
0N/A * @exception ReflectionException Wraps a
0N/A * <CODE>java.lang.ClassNotFoundException</CODE> or a
0N/A * <CODE>java.lang.Exception</CODE> that occurred when trying to
0N/A * invoke the MBean's constructor.
0N/A * @exception InstanceAlreadyExistsException The MBean is already
0N/A * under the control of the MBean server.
0N/A * @exception MBeanRegistrationException The
0N/A * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
0N/A * interface) method of the MBean has thrown an exception. The
0N/A * MBean will not be registered.
693N/A * @exception RuntimeMBeanException If the MBean's constructor or its
693N/A * {@code preRegister} or {@code postRegister} method threw
693N/A * a {@code RuntimeException}. If the <CODE>postRegister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws a
526N/A * <CODE>RuntimeException</CODE>, the <CODE>createMBean</CODE> method will
467N/A * throw a <CODE>RuntimeMBeanException</CODE>, although the MBean creation
467N/A * and registration succeeded. In such a case, the MBean will be actually
526N/A * registered even though the <CODE>createMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeMBeanException</CODE> can
467N/A * also be thrown by <CODE>preRegister</CODE>, in which case the MBean
467N/A * will not be registered.
467N/A * @exception RuntimeErrorException If the <CODE>postRegister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws an
526N/A * <CODE>Error</CODE>, the <CODE>createMBean</CODE> method will
467N/A * throw a <CODE>RuntimeErrorException</CODE>, although the MBean creation
467N/A * and registration succeeded. In such a case, the MBean will be actually
526N/A * registered even though the <CODE>createMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeErrorException</CODE> can
467N/A * also be thrown by <CODE>preRegister</CODE>, in which case the MBean
467N/A * will not be registered.
0N/A * @exception MBeanException The constructor of the MBean has
0N/A * thrown an exception
0N/A * @exception NotCompliantMBeanException This class is not a JMX
0N/A * compliant MBean
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The className
0N/A * passed in parameter is null, the <CODE>ObjectName</CODE> passed
0N/A * in parameter contains a pattern or no <CODE>ObjectName</CODE>
0N/A * is specified for the MBean.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
467N/A * @see javax.management.MBeanRegistration
0N/A */
0N/A public ObjectInstance createMBean(String className, ObjectName name,
0N/A Object params[], String signature[])
0N/A throws ReflectionException, InstanceAlreadyExistsException,
0N/A MBeanRegistrationException, MBeanException,
0N/A NotCompliantMBeanException, IOException;
0N/A
0N/A /**
736N/A * <p>Instantiates and registers an MBean in the MBean server. The
0N/A * class loader to be used is identified by its object name. An
736N/A * object name is associated with the MBean. If the object name of
0N/A * the loader is not specified, the ClassLoader that loaded the
1790N/A * MBean server will be used. If the MBean object name given is
1790N/A * null, the MBean must provide its own name by implementing the
1790N/A * {@link javax.management.MBeanRegistration MBeanRegistration}
1790N/A * interface and returning the name from the {@link
1790N/A * MBeanRegistration#preRegister preRegister} method.
0N/A *
0N/A * @param className The class name of the MBean to be instantiated.
0N/A * @param name The object name of the MBean. May be null.
0N/A * @param params An array containing the parameters of the
0N/A * constructor to be invoked.
0N/A * @param signature An array containing the signature of the
0N/A * constructor to be invoked.
0N/A * @param loaderName The object name of the class loader to be used.
0N/A *
0N/A * @return An <CODE>ObjectInstance</CODE>, containing the
0N/A * <CODE>ObjectName</CODE> and the Java class name of the newly
0N/A * instantiated MBean. If the contained <code>ObjectName</code>
0N/A * is <code>n</code>, the contained Java class name is
0N/A * <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>.
0N/A *
0N/A * @exception ReflectionException Wraps a
0N/A * <CODE>java.lang.ClassNotFoundException</CODE> or a
0N/A * <CODE>java.lang.Exception</CODE> that occurred when trying to
0N/A * invoke the MBean's constructor.
0N/A * @exception InstanceAlreadyExistsException The MBean is already
0N/A * under the control of the MBean server.
0N/A * @exception MBeanRegistrationException The
0N/A * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
0N/A * interface) method of the MBean has thrown an exception. The
0N/A * MBean will not be registered.
693N/A * @exception RuntimeMBeanException The MBean's constructor or its
693N/A * {@code preRegister} or {@code postRegister} method threw
693N/A * a {@code RuntimeException}. If the <CODE>postRegister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws a
526N/A * <CODE>RuntimeException</CODE>, the <CODE>createMBean</CODE> method will
467N/A * throw a <CODE>RuntimeMBeanException</CODE>, although the MBean creation
467N/A * and registration succeeded. In such a case, the MBean will be actually
526N/A * registered even though the <CODE>createMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeMBeanException</CODE> can
467N/A * also be thrown by <CODE>preRegister</CODE>, in which case the MBean
467N/A * will not be registered.
467N/A * @exception RuntimeErrorException If the <CODE>postRegister</CODE> method
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws an
526N/A * <CODE>Error</CODE>, the <CODE>createMBean</CODE> method will
467N/A * throw a <CODE>RuntimeErrorException</CODE>, although the MBean creation
467N/A * and registration succeeded. In such a case, the MBean will be actually
526N/A * registered even though the <CODE>createMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeErrorException</CODE> can
467N/A * also be thrown by <CODE>preRegister</CODE>, in which case the MBean
467N/A * will not be registered.
0N/A * @exception MBeanException The constructor of the MBean has
0N/A * thrown an exception
0N/A * @exception NotCompliantMBeanException This class is not a JMX
0N/A * compliant MBean
0N/A * @exception InstanceNotFoundException The specified class loader
0N/A * is not registered in the MBean server.
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The className
0N/A * passed in parameter is null, the <CODE>ObjectName</CODE> passed
0N/A * in parameter contains a pattern or no <CODE>ObjectName</CODE>
0N/A * is specified for the MBean.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
467N/A * @see javax.management.MBeanRegistration
0N/A */
0N/A public ObjectInstance createMBean(String className, ObjectName name,
0N/A ObjectName loaderName, Object params[],
0N/A String signature[])
0N/A throws ReflectionException, InstanceAlreadyExistsException,
0N/A MBeanRegistrationException, MBeanException,
0N/A NotCompliantMBeanException, InstanceNotFoundException,
0N/A IOException;
0N/A
0N/A /**
0N/A * Unregisters an MBean from the MBean server. The MBean is
0N/A * identified by its object name. Once the method has been
0N/A * invoked, the MBean may no longer be accessed by its object
0N/A * name.
0N/A *
0N/A * @param name The object name of the MBean to be unregistered.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean specified is not
0N/A * registered in the MBean server.
0N/A * @exception MBeanRegistrationException The preDeregister
0N/A * ((<CODE>MBeanRegistration</CODE> interface) method of the MBean
0N/A * has thrown an exception.
467N/A * @exception RuntimeMBeanException If the <CODE>postDeregister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws a
526N/A * <CODE>RuntimeException</CODE>, the <CODE>unregisterMBean</CODE> method
467N/A * will throw a <CODE>RuntimeMBeanException</CODE>, although the MBean
467N/A * unregistration succeeded. In such a case, the MBean will be actually
526N/A * unregistered even though the <CODE>unregisterMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeMBeanException</CODE> can
467N/A * also be thrown by <CODE>preDeregister</CODE>, in which case the MBean
467N/A * will remain registered.
467N/A * @exception RuntimeErrorException If the <CODE>postDeregister</CODE>
467N/A * (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws an
526N/A * <CODE>Error</CODE>, the <CODE>unregisterMBean</CODE> method will
467N/A * throw a <CODE>RuntimeErrorException</CODE>, although the MBean
467N/A * unregistration succeeded. In such a case, the MBean will be actually
526N/A * unregistered even though the <CODE>unregisterMBean</CODE> method
467N/A * threw an exception. Note that <CODE>RuntimeMBeanException</CODE> can
467N/A * also be thrown by <CODE>preDeregister</CODE>, in which case the MBean
467N/A * will remain registered.
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The object
0N/A * name in parameter is null or the MBean you are when trying to
0N/A * unregister is the {@link javax.management.MBeanServerDelegate
0N/A * MBeanServerDelegate} MBean.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
467N/A * @see javax.management.MBeanRegistration
0N/A */
0N/A public void unregisterMBean(ObjectName name)
0N/A throws InstanceNotFoundException, MBeanRegistrationException,
0N/A IOException;
0N/A
0N/A /**
0N/A * Gets the <CODE>ObjectInstance</CODE> for a given MBean
0N/A * registered with the MBean server.
0N/A *
0N/A * @param name The object name of the MBean.
0N/A *
0N/A * @return The <CODE>ObjectInstance</CODE> associated with the MBean
0N/A * specified by <VAR>name</VAR>. The contained <code>ObjectName</code>
0N/A * is <code>name</code> and the contained class name is
0N/A * <code>{@link #getMBeanInfo getMBeanInfo(name)}.getClassName()</code>.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean specified is not
0N/A * registered in the MBean server.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A */
0N/A public ObjectInstance getObjectInstance(ObjectName name)
0N/A throws InstanceNotFoundException, IOException;
0N/A
0N/A /**
0N/A * Gets MBeans controlled by the MBean server. This method allows
0N/A * any of the following to be obtained: All MBeans, a set of
0N/A * MBeans specified by pattern matching on the
0N/A * <CODE>ObjectName</CODE> and/or a Query expression, a specific
0N/A * MBean. When the object name is null or no domain and key
0N/A * properties are specified, all objects are to be selected (and
0N/A * filtered if a query is specified). It returns the set of
0N/A * <CODE>ObjectInstance</CODE> objects (containing the
0N/A * <CODE>ObjectName</CODE> and the Java Class name) for the
0N/A * selected MBeans.
0N/A *
0N/A * @param name The object name pattern identifying the MBeans to
0N/A * be retrieved. If null or no domain and key properties are
0N/A * specified, all the MBeans registered will be retrieved.
0N/A * @param query The query expression to be applied for selecting
0N/A * MBeans. If null no query expression will be applied for
1790N/A * selecting MBeans.
0N/A *
0N/A * @return A set containing the <CODE>ObjectInstance</CODE>
0N/A * objects for the selected MBeans. If no MBean satisfies the
0N/A * query an empty list is returned.
0N/A *
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A */
0N/A public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query)
0N/A throws IOException;
0N/A
0N/A /**
0N/A * Gets the names of MBeans controlled by the MBean server. This
0N/A * method enables any of the following to be obtained: The names
0N/A * of all MBeans, the names of a set of MBeans specified by
0N/A * pattern matching on the <CODE>ObjectName</CODE> and/or a Query
0N/A * expression, a specific MBean name (equivalent to testing
0N/A * whether an MBean is registered). When the object name is null
0N/A * or no domain and key properties are specified, all objects are
0N/A * selected (and filtered if a query is specified). It returns the
0N/A * set of ObjectNames for the MBeans selected.
0N/A *
0N/A * @param name The object name pattern identifying the MBean names
0N/A * to be retrieved. If null or no domain and key properties are
0N/A * specified, the name of all registered MBeans will be retrieved.
0N/A * @param query The query expression to be applied for selecting
0N/A * MBeans. If null no query expression will be applied for
1790N/A * selecting MBeans.
0N/A *
0N/A * @return A set containing the ObjectNames for the MBeans
0N/A * selected. If no MBean satisfies the query, an empty list is
0N/A * returned.
0N/A *
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A */
0N/A public Set<ObjectName> queryNames(ObjectName name, QueryExp query)
0N/A throws IOException;
0N/A
0N/A
0N/A
0N/A /**
0N/A * Checks whether an MBean, identified by its object name, is
0N/A * already registered with the MBean server.
0N/A *
0N/A * @param name The object name of the MBean to be checked.
0N/A *
0N/A * @return True if the MBean is already registered in the MBean
0N/A * server, false otherwise.
0N/A *
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The object
0N/A * name in parameter is null.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A */
0N/A public boolean isRegistered(ObjectName name)
0N/A throws IOException;
0N/A
0N/A
0N/A /**
0N/A * Returns the number of MBeans registered in the MBean server.
0N/A *
0N/A * @return the number of MBeans registered.
0N/A *
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A */
0N/A public Integer getMBeanCount()
0N/A throws IOException;
0N/A
0N/A /**
0N/A * Gets the value of a specific attribute of a named MBean. The MBean
0N/A * is identified by its object name.
0N/A *
0N/A * @param name The object name of the MBean from which the
0N/A * attribute is to be retrieved.
0N/A * @param attribute A String specifying the name of the attribute
0N/A * to be retrieved.
0N/A *
0N/A * @return The value of the retrieved attribute.
0N/A *
0N/A * @exception AttributeNotFoundException The attribute specified
0N/A * is not accessible in the MBean.
0N/A * @exception MBeanException Wraps an exception thrown by the
0N/A * MBean's getter.
0N/A * @exception InstanceNotFoundException The MBean specified is not
0N/A * registered in the MBean server.
0N/A * @exception ReflectionException Wraps a
0N/A * <CODE>java.lang.Exception</CODE> thrown when trying to invoke
0N/A * the setter.
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The object
0N/A * name in parameter is null or the attribute in parameter is
0N/A * null.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A * @see #setAttribute
0N/A */
0N/A public Object getAttribute(ObjectName name, String attribute)
0N/A throws MBeanException, AttributeNotFoundException,
0N/A InstanceNotFoundException, ReflectionException,
0N/A IOException;
0N/A
0N/A
0N/A /**
700N/A * <p>Retrieves the values of several attributes of a named MBean. The MBean
700N/A * is identified by its object name.</p>
700N/A *
700N/A * <p>If one or more attributes cannot be retrieved for some reason, they
700N/A * will be omitted from the returned {@code AttributeList}. The caller
700N/A * should check that the list is the same size as the {@code attributes}
700N/A * array. To discover what problem prevented a given attribute from being
700N/A * retrieved, call {@link #getAttribute getAttribute} for that attribute.</p>
700N/A *
700N/A * <p>Here is an example of calling this method and checking that it
700N/A * succeeded in retrieving all the requested attributes:</p>
700N/A *
700N/A * <pre>
700N/A * String[] attrNames = ...;
700N/A * AttributeList list = mbeanServerConnection.getAttributes(objectName, attrNames);
700N/A * if (list.size() == attrNames.length)
700N/A * System.out.println("All attributes were retrieved successfully");
700N/A * else {
700N/A * {@code List<String>} missing = new {@code ArrayList<String>}(<!--
700N/A * -->{@link java.util.Arrays#asList Arrays.asList}(attrNames));
1790N/A * for (Attribute a : list.asList())
1790N/A * missing.remove(a.getName());
700N/A * System.out.println("Did not retrieve: " + missing);
700N/A * }
700N/A * </pre>
0N/A *
0N/A * @param name The object name of the MBean from which the
0N/A * attributes are retrieved.
0N/A * @param attributes A list of the attributes to be retrieved.
0N/A *
0N/A * @return The list of the retrieved attributes.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean specified is not
0N/A * registered in the MBean server.
0N/A * @exception ReflectionException An exception occurred when
0N/A * trying to invoke the getAttributes method of a Dynamic MBean.
0N/A * @exception RuntimeOperationsException Wrap a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The object
0N/A * name in parameter is null or attributes in parameter is null.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A * @see #setAttributes
0N/A */
0N/A public AttributeList getAttributes(ObjectName name, String[] attributes)
0N/A throws InstanceNotFoundException, ReflectionException,
0N/A IOException;
0N/A
700N/A
0N/A /**
0N/A * Sets the value of a specific attribute of a named MBean. The MBean
0N/A * is identified by its object name.
0N/A *
0N/A * @param name The name of the MBean within which the attribute is
0N/A * to be set.
0N/A * @param attribute The identification of the attribute to be set
0N/A * and the value it is to be set to.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean specified is not
0N/A * registered in the MBean server.
0N/A * @exception AttributeNotFoundException The attribute specified
0N/A * is not accessible in the MBean.
0N/A * @exception InvalidAttributeValueException The value specified
0N/A * for the attribute is not valid.
0N/A * @exception MBeanException Wraps an exception thrown by the
0N/A * MBean's setter.
0N/A * @exception ReflectionException Wraps a
0N/A * <CODE>java.lang.Exception</CODE> thrown when trying to invoke
0N/A * the setter.
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The object
0N/A * name in parameter is null or the attribute in parameter is
0N/A * null.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A * @see #getAttribute
0N/A */
0N/A public void setAttribute(ObjectName name, Attribute attribute)
0N/A throws InstanceNotFoundException, AttributeNotFoundException,
0N/A InvalidAttributeValueException, MBeanException,
0N/A ReflectionException, IOException;
0N/A
0N/A
0N/A /**
700N/A * <p>Sets the values of several attributes of a named MBean. The MBean is
700N/A * identified by its object name.</p>
700N/A *
700N/A * <p>If one or more attributes cannot be set for some reason, they will be
700N/A * omitted from the returned {@code AttributeList}. The caller should check
700N/A * that the input {@code AttributeList} is the same size as the output one.
700N/A * To discover what problem prevented a given attribute from being retrieved,
700N/A * it will usually be possible to call {@link #setAttribute setAttribute}
700N/A * for that attribute, although this is not guaranteed to work. (For
700N/A * example, the values of two attributes may have been rejected because
700N/A * they were inconsistent with each other. Setting one of them alone might
700N/A * be allowed.)<p>
700N/A *
700N/A * <p>Here is an example of calling this method and checking that it
700N/A * succeeded in setting all the requested attributes:</p>
700N/A *
700N/A * <pre>
700N/A * AttributeList inputAttrs = ...;
700N/A * AttributeList outputAttrs = mbeanServerConnection.setAttributes(<!--
700N/A * -->objectName, inputAttrs);
700N/A * if (inputAttrs.size() == outputAttrs.size())
700N/A * System.out.println("All attributes were set successfully");
700N/A * else {
1790N/A * {@code List<String>} missing = new {@code ArrayList<String>}();
1790N/A * for (Attribute a : inputAttrs.asList())
1790N/A * missing.add(a.getName());
1790N/A * for (Attribute a : outputAttrs.asList())
1790N/A * missing.remove(a.getName());
700N/A * System.out.println("Did not set: " + missing);
700N/A * }
700N/A * </pre>
0N/A *
0N/A * @param name The object name of the MBean within which the
0N/A * attributes are to be set.
0N/A * @param attributes A list of attributes: The identification of
0N/A * the attributes to be set and the values they are to be set to.
0N/A *
0N/A * @return The list of attributes that were set, with their new
0N/A * values.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean specified is not
0N/A * registered in the MBean server.
0N/A * @exception ReflectionException An exception occurred when
0N/A * trying to invoke the getAttributes method of a Dynamic MBean.
0N/A * @exception RuntimeOperationsException Wraps a
0N/A * <CODE>java.lang.IllegalArgumentException</CODE>: The object
0N/A * name in parameter is null or attributes in parameter is null.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A * @see #getAttributes
0N/A */
0N/A public AttributeList setAttributes(ObjectName name,
0N/A AttributeList attributes)
0N/A throws InstanceNotFoundException, ReflectionException, IOException;
0N/A
0N/A /**
700N/A * <p>Invokes an operation on an MBean.</p>
700N/A *
700N/A * <p>Because of the need for a {@code signature} to differentiate
700N/A * possibly-overloaded operations, it is much simpler to invoke operations
700N/A * through an {@linkplain JMX#newMBeanProxy(MBeanServerConnection, ObjectName,
700N/A * Class) MBean proxy} where possible. For example, suppose you have a
700N/A * Standard MBean interface like this:</p>
700N/A *
700N/A * <pre>
700N/A * public interface FooMBean {
700N/A * public int countMatches(String[] patterns, boolean ignoreCase);
700N/A * }
700N/A * </pre>
700N/A *
700N/A * <p>The {@code countMatches} operation can be invoked as follows:</p>
700N/A *
700N/A * <pre>
700N/A * String[] myPatterns = ...;
700N/A * int count = (Integer) mbeanServerConnection.invoke(
700N/A * objectName,
700N/A * "countMatches",
700N/A * new Object[] {myPatterns, true},
700N/A * new String[] {String[].class.getName(), boolean.class.getName()});
700N/A * </pre>
700N/A *
700N/A * <p>Alternatively, it can be invoked through a proxy as follows:</p>
700N/A *
700N/A * <pre>
700N/A * String[] myPatterns = ...;
700N/A * FooMBean fooProxy = JMX.newMBeanProxy(
700N/A * mbeanServerConnection, objectName, FooMBean.class);
700N/A * int count = fooProxy.countMatches(myPatterns, true);
700N/A * </pre>
0N/A *
0N/A * @param name The object name of the MBean on which the method is
0N/A * to be invoked.
0N/A * @param operationName The name of the operation to be invoked.
0N/A * @param params An array containing the parameters to be set when
0N/A * the operation is invoked
0N/A * @param signature An array containing the signature of the
700N/A * operation, an array of class names in the format returned by
700N/A * {@link Class#getName()}. The class objects will be loaded using the same
0N/A * class loader as the one used for loading the MBean on which the
0N/A * operation was invoked.
0N/A *
0N/A * @return The object returned by the operation, which represents
0N/A * the result of invoking the operation on the MBean specified.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean specified is not
0N/A * registered in the MBean server.
0N/A * @exception MBeanException Wraps an exception thrown by the
0N/A * MBean's invoked method.
0N/A * @exception ReflectionException Wraps a
0N/A * <CODE>java.lang.Exception</CODE> thrown while trying to invoke
0N/A * the method.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A */
0N/A public Object invoke(ObjectName name, String operationName,
0N/A Object params[], String signature[])
0N/A throws InstanceNotFoundException, MBeanException,
0N/A ReflectionException, IOException;
0N/A
0N/A
0N/A
0N/A /**
0N/A * Returns the default domain used for naming the MBean.
0N/A * The default domain name is used as the domain part in the ObjectName
0N/A * of MBeans if no domain is specified by the user.
0N/A *
0N/A * @return the default domain.
0N/A *
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A */
0N/A public String getDefaultDomain()
0N/A throws IOException;
0N/A
0N/A /**
0N/A * <p>Returns the list of domains in which any MBean is currently
0N/A * registered. A string is in the returned array if and only if
0N/A * there is at least one MBean registered with an ObjectName whose
0N/A * {@link ObjectName#getDomain() getDomain()} is equal to that
0N/A * string. The order of strings within the returned array is
0N/A * not defined.</p>
0N/A *
0N/A * @return the list of domains.
0N/A *
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A */
0N/A public String[] getDomains()
0N/A throws IOException;
0N/A
1790N/A /**
1790N/A * <p>Adds a listener to a registered MBean.
1790N/A * Notifications emitted by the MBean will be forwarded to the listener.</p>
1790N/A *
1790N/A * @param name The name of the MBean on which the listener should
1790N/A * be added.
1790N/A * @param listener The listener object which will handle the
1790N/A * notifications emitted by the registered MBean.
1790N/A * @param filter The filter object. If filter is null, no
1790N/A * filtering will be performed before handling notifications.
1790N/A * @param handback The context to be sent to the listener when a
1790N/A * notification is emitted.
1790N/A *
1790N/A * @exception InstanceNotFoundException The MBean name provided
1790N/A * does not match any of the registered MBeans.
1790N/A * @exception IOException A communication problem occurred when
1790N/A * talking to the MBean server.
1790N/A *
1790N/A * @see #removeNotificationListener(ObjectName, NotificationListener)
1790N/A * @see #removeNotificationListener(ObjectName, NotificationListener,
1790N/A * NotificationFilter, Object)
1790N/A */
0N/A public void addNotificationListener(ObjectName name,
0N/A NotificationListener listener,
0N/A NotificationFilter filter,
0N/A Object handback)
0N/A throws InstanceNotFoundException, IOException;
0N/A
0N/A
0N/A /**
0N/A * <p>Adds a listener to a registered MBean.</p>
0N/A *
0N/A * <p>A notification emitted by an MBean will be forwarded by the
0N/A * MBeanServer to the listener. If the source of the notification
0N/A * is a reference to an MBean object, the MBean server will
0N/A * replace it by that MBean's ObjectName. Otherwise the source is
0N/A * unchanged.</p>
0N/A *
0N/A * <p>The listener object that receives notifications is the one
0N/A * that is registered with the given name at the time this method
0N/A * is called. Even if it is subsequently unregistered, it will
0N/A * continue to receive notifications.</p>
0N/A *
0N/A * @param name The name of the MBean on which the listener should
0N/A * be added.
0N/A * @param listener The object name of the listener which will
0N/A * handle the notifications emitted by the registered MBean.
0N/A * @param filter The filter object. If filter is null, no
0N/A * filtering will be performed before handling notifications.
0N/A * @param handback The context to be sent to the listener when a
0N/A * notification is emitted.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean name of the
0N/A * notification listener or of the notification broadcaster does
0N/A * not match any of the registered MBeans.
0N/A * @exception RuntimeOperationsException Wraps an {@link
0N/A * IllegalArgumentException}. The MBean named by
0N/A * <code>listener</code> exists but does not implement the {@link
0N/A * NotificationListener} interface.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A * @see #removeNotificationListener(ObjectName, ObjectName)
0N/A * @see #removeNotificationListener(ObjectName, ObjectName,
0N/A * NotificationFilter, Object)
0N/A */
0N/A public void addNotificationListener(ObjectName name,
0N/A ObjectName listener,
0N/A NotificationFilter filter,
0N/A Object handback)
0N/A throws InstanceNotFoundException, IOException;
0N/A
0N/A
0N/A /**
0N/A * Removes a listener from a registered MBean.
0N/A *
0N/A * <P> If the listener is registered more than once, perhaps with
0N/A * different filters or callbacks, this method will remove all
0N/A * those registrations.
0N/A *
0N/A * @param name The name of the MBean on which the listener should
0N/A * be removed.
0N/A * @param listener The object name of the listener to be removed.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean name provided
0N/A * does not match any of the registered MBeans.
0N/A * @exception ListenerNotFoundException The listener is not
0N/A * registered in the MBean.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A * @see #addNotificationListener(ObjectName, ObjectName,
0N/A * NotificationFilter, Object)
0N/A */
0N/A public void removeNotificationListener(ObjectName name,
0N/A ObjectName listener)
0N/A throws InstanceNotFoundException, ListenerNotFoundException,
0N/A IOException;
0N/A
0N/A /**
0N/A * <p>Removes a listener from a registered MBean.</p>
0N/A *
0N/A * <p>The MBean must have a listener that exactly matches the
0N/A * given <code>listener</code>, <code>filter</code>, and
0N/A * <code>handback</code> parameters. If there is more than one
0N/A * such listener, only one is removed.</p>
0N/A *
0N/A * <p>The <code>filter</code> and <code>handback</code> parameters
0N/A * may be null if and only if they are null in a listener to be
0N/A * removed.</p>
0N/A *
0N/A * @param name The name of the MBean on which the listener should
0N/A * be removed.
0N/A * @param listener The object name of the listener to be removed.
0N/A * @param filter The filter that was specified when the listener
0N/A * was added.
0N/A * @param handback The handback that was specified when the
0N/A * listener was added.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean name provided
0N/A * does not match any of the registered MBeans.
0N/A * @exception ListenerNotFoundException The listener is not
0N/A * registered in the MBean, or it is not registered with the given
0N/A * filter and handback.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A * @see #addNotificationListener(ObjectName, ObjectName,
0N/A * NotificationFilter, Object)
0N/A *
0N/A */
0N/A public void removeNotificationListener(ObjectName name,
0N/A ObjectName listener,
0N/A NotificationFilter filter,
0N/A Object handback)
0N/A throws InstanceNotFoundException, ListenerNotFoundException,
0N/A IOException;
0N/A
1790N/A
1790N/A /**
1790N/A * <p>Removes a listener from a registered MBean.</p>
1790N/A *
1790N/A * <P> If the listener is registered more than once, perhaps with
1790N/A * different filters or callbacks, this method will remove all
1790N/A * those registrations.
1790N/A *
1790N/A * @param name The name of the MBean on which the listener should
1790N/A * be removed.
1790N/A * @param listener The listener to be removed.
1790N/A *
1790N/A * @exception InstanceNotFoundException The MBean name provided
1790N/A * does not match any of the registered MBeans.
1790N/A * @exception ListenerNotFoundException The listener is not
1790N/A * registered in the MBean.
1790N/A * @exception IOException A communication problem occurred when
1790N/A * talking to the MBean server.
1790N/A *
1790N/A * @see #addNotificationListener(ObjectName, NotificationListener,
1790N/A * NotificationFilter, Object)
1790N/A */
0N/A public void removeNotificationListener(ObjectName name,
0N/A NotificationListener listener)
0N/A throws InstanceNotFoundException, ListenerNotFoundException,
0N/A IOException;
0N/A
1790N/A /**
1790N/A * <p>Removes a listener from a registered MBean.</p>
1790N/A *
1790N/A * <p>The MBean must have a listener that exactly matches the
1790N/A * given <code>listener</code>, <code>filter</code>, and
1790N/A * <code>handback</code> parameters. If there is more than one
1790N/A * such listener, only one is removed.</p>
1790N/A *
1790N/A * <p>The <code>filter</code> and <code>handback</code> parameters
1790N/A * may be null if and only if they are null in a listener to be
1790N/A * removed.</p>
1790N/A *
1790N/A * @param name The name of the MBean on which the listener should
1790N/A * be removed.
1790N/A * @param listener The listener to be removed.
1790N/A * @param filter The filter that was specified when the listener
1790N/A * was added.
1790N/A * @param handback The handback that was specified when the
1790N/A * listener was added.
1790N/A *
1790N/A * @exception InstanceNotFoundException The MBean name provided
1790N/A * does not match any of the registered MBeans.
1790N/A * @exception ListenerNotFoundException The listener is not
1790N/A * registered in the MBean, or it is not registered with the given
1790N/A * filter and handback.
1790N/A * @exception IOException A communication problem occurred when
1790N/A * talking to the MBean server.
1790N/A *
1790N/A * @see #addNotificationListener(ObjectName, NotificationListener,
1790N/A * NotificationFilter, Object)
1790N/A *
1790N/A */
0N/A public void removeNotificationListener(ObjectName name,
0N/A NotificationListener listener,
0N/A NotificationFilter filter,
0N/A Object handback)
0N/A throws InstanceNotFoundException, ListenerNotFoundException,
0N/A IOException;
0N/A
0N/A /**
0N/A * This method discovers the attributes and operations that an
0N/A * MBean exposes for management.
0N/A *
0N/A * @param name The name of the MBean to analyze
0N/A *
0N/A * @return An instance of <CODE>MBeanInfo</CODE> allowing the
0N/A * retrieval of all attributes and operations of this MBean.
0N/A *
0N/A * @exception IntrospectionException An exception occurred during
0N/A * introspection.
0N/A * @exception InstanceNotFoundException The MBean specified was
0N/A * not found.
0N/A * @exception ReflectionException An exception occurred when
0N/A * trying to invoke the getMBeanInfo of a Dynamic MBean.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A */
0N/A public MBeanInfo getMBeanInfo(ObjectName name)
0N/A throws InstanceNotFoundException, IntrospectionException,
0N/A ReflectionException, IOException;
0N/A
0N/A
0N/A /**
0N/A * <p>Returns true if the MBean specified is an instance of the
0N/A * specified class, false otherwise.</p>
0N/A *
0N/A * <p>If <code>name</code> does not name an MBean, this method
0N/A * throws {@link InstanceNotFoundException}.</p>
0N/A *
0N/A * <p>Otherwise, let<br>
0N/A * X be the MBean named by <code>name</code>,<br>
0N/A * L be the ClassLoader of X,<br>
0N/A * N be the class name in X's {@link MBeanInfo}.</p>
0N/A *
0N/A * <p>If N equals <code>className</code>, the result is true.</p>
0N/A *
0N/A * <p>Otherwise, if L successfully loads <code>className</code>
0N/A * and X is an instance of this class, the result is true.
0N/A *
0N/A * <p>Otherwise, if L successfully loads both N and
0N/A * <code>className</code>, and the second class is assignable from
0N/A * the first, the result is true.</p>
0N/A *
0N/A * <p>Otherwise, the result is false.</p>
0N/A *
0N/A * @param name The <CODE>ObjectName</CODE> of the MBean.
0N/A * @param className The name of the class.
0N/A *
0N/A * @return true if the MBean specified is an instance of the
0N/A * specified class according to the rules above, false otherwise.
0N/A *
0N/A * @exception InstanceNotFoundException The MBean specified is not
0N/A * registered in the MBean server.
0N/A * @exception IOException A communication problem occurred when
0N/A * talking to the MBean server.
0N/A *
0N/A * @see Class#isInstance
0N/A */
0N/A public boolean isInstanceOf(ObjectName name, String className)
0N/A throws InstanceNotFoundException, IOException;
0N/A}