| 1 |
772 |
jeremybenn |
/* DynamicMBean.java -- A management bean with a dynamic interface.
|
| 2 |
|
|
Copyright (C) 2006 Free Software Foundation, Inc.
|
| 3 |
|
|
|
| 4 |
|
|
This file is part of GNU Classpath.
|
| 5 |
|
|
|
| 6 |
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
| 7 |
|
|
it under the terms of the GNU General Public License as published by
|
| 8 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
| 9 |
|
|
any later version.
|
| 10 |
|
|
|
| 11 |
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
| 12 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
|
|
General Public License for more details.
|
| 15 |
|
|
|
| 16 |
|
|
You should have received a copy of the GNU General Public License
|
| 17 |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
| 18 |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
| 19 |
|
|
02110-1301 USA.
|
| 20 |
|
|
|
| 21 |
|
|
Linking this library statically or dynamically with other modules is
|
| 22 |
|
|
making a combined work based on this library. Thus, the terms and
|
| 23 |
|
|
conditions of the GNU General Public License cover the whole
|
| 24 |
|
|
combination.
|
| 25 |
|
|
|
| 26 |
|
|
As a special exception, the copyright holders of this library give you
|
| 27 |
|
|
permission to link this library with independent modules to produce an
|
| 28 |
|
|
executable, regardless of the license terms of these independent
|
| 29 |
|
|
modules, and to copy and distribute the resulting executable under
|
| 30 |
|
|
terms of your choice, provided that you also meet, for each linked
|
| 31 |
|
|
independent module, the terms and conditions of the license of that
|
| 32 |
|
|
module. An independent module is a module which is not derived from
|
| 33 |
|
|
or based on this library. If you modify this library, you may extend
|
| 34 |
|
|
this exception to your version of the library, but you are not
|
| 35 |
|
|
obligated to do so. If you do not wish to do so, delete this
|
| 36 |
|
|
exception statement from your version. */
|
| 37 |
|
|
|
| 38 |
|
|
package javax.management;
|
| 39 |
|
|
|
| 40 |
|
|
/**
|
| 41 |
|
|
* Represents a management bean that provides a
|
| 42 |
|
|
* dynamic interface. Users of a {@link DynamicMBean}
|
| 43 |
|
|
* may retrieve information about its attributes at
|
| 44 |
|
|
* runtime and use this information to dynamically
|
| 45 |
|
|
* obtain the corresponding values of these attributes.
|
| 46 |
|
|
*
|
| 47 |
|
|
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
|
| 48 |
|
|
* @since 1.5
|
| 49 |
|
|
*/
|
| 50 |
|
|
public interface DynamicMBean
|
| 51 |
|
|
{
|
| 52 |
|
|
|
| 53 |
|
|
/**
|
| 54 |
|
|
* Obtains the value of the specified attribute of the
|
| 55 |
|
|
* management bean. The management bean should perform
|
| 56 |
|
|
* a lookup for the named attribute, and return its value
|
| 57 |
|
|
* by calling the appropriate getter method, if possible.
|
| 58 |
|
|
*
|
| 59 |
|
|
* @param name the name of the attribute to retrieve.
|
| 60 |
|
|
* @return the value of the specified attribute.
|
| 61 |
|
|
* @throws AttributeNotFoundException if the name does not
|
| 62 |
|
|
* correspond to an attribute
|
| 63 |
|
|
* of the bean.
|
| 64 |
|
|
* @throws MBeanException if retrieving the attribute causes
|
| 65 |
|
|
* the bean to throw an exception (which
|
| 66 |
|
|
* becomes the cause of this exception).
|
| 67 |
|
|
* @throws ReflectionException if an exception occurred in trying
|
| 68 |
|
|
* to use the reflection interface
|
| 69 |
|
|
* to lookup the attribute. The
|
| 70 |
|
|
* thrown exception is the cause of
|
| 71 |
|
|
* this exception.
|
| 72 |
|
|
* @see #setAttribute(String)
|
| 73 |
|
|
*/
|
| 74 |
|
|
Object getAttribute(String name)
|
| 75 |
|
|
throws AttributeNotFoundException, MBeanException,
|
| 76 |
|
|
ReflectionException;
|
| 77 |
|
|
|
| 78 |
|
|
/**
|
| 79 |
|
|
* Obtains the values of each of the specified attributes
|
| 80 |
|
|
* of the management bean. The returned list includes
|
| 81 |
|
|
* those attributes that were retrieved and their
|
| 82 |
|
|
* corresponding values.
|
| 83 |
|
|
*
|
| 84 |
|
|
* @param names the names of the attributes to retrieve.
|
| 85 |
|
|
* @return a list of the retrieved attributes.
|
| 86 |
|
|
* @see #setAttributes(AttributeList)
|
| 87 |
|
|
*/
|
| 88 |
|
|
AttributeList getAttributes(String[] names);
|
| 89 |
|
|
|
| 90 |
|
|
/**
|
| 91 |
|
|
* Returns an information object which lists the attributes
|
| 92 |
|
|
* and actions associated with the management bean.
|
| 93 |
|
|
*
|
| 94 |
|
|
* @return a description of the management bean, including
|
| 95 |
|
|
* all exposed attributes and actions.
|
| 96 |
|
|
*/
|
| 97 |
|
|
MBeanInfo getMBeanInfo();
|
| 98 |
|
|
|
| 99 |
|
|
/**
|
| 100 |
|
|
* Invokes the specified action on the management bean using
|
| 101 |
|
|
* the supplied parameters. The signature of the action is
|
| 102 |
|
|
* specified by a {@link String} array, which lists the classes
|
| 103 |
|
|
* corresponding to each parameter. The class loader used to
|
| 104 |
|
|
* load these classes is the same as that used for loading the
|
| 105 |
|
|
* management bean itself.
|
| 106 |
|
|
*
|
| 107 |
|
|
* @param name the name of the action to invoke.
|
| 108 |
|
|
* @param params the parameters used to call the action.
|
| 109 |
|
|
* @param signature the signature of the action.
|
| 110 |
|
|
* @return the return value of the action.
|
| 111 |
|
|
* @throws MBeanException if the action throws an exception. The
|
| 112 |
|
|
* thrown exception is the cause of this
|
| 113 |
|
|
* exception.
|
| 114 |
|
|
* @throws ReflectionException if an exception occurred in trying
|
| 115 |
|
|
* to use the reflection interface
|
| 116 |
|
|
* to invoke the action. The
|
| 117 |
|
|
* thrown exception is the cause of
|
| 118 |
|
|
* this exception.
|
| 119 |
|
|
*/
|
| 120 |
|
|
Object invoke(String name, Object[] params, String[] signature)
|
| 121 |
|
|
throws MBeanException, ReflectionException;
|
| 122 |
|
|
|
| 123 |
|
|
/**
|
| 124 |
|
|
* Sets the value of the specified attribute of the
|
| 125 |
|
|
* management bean. The management bean should perform
|
| 126 |
|
|
* a lookup for the named attribute, and sets its value
|
| 127 |
|
|
* using the associated setter method, if possible.
|
| 128 |
|
|
*
|
| 129 |
|
|
* @param attribute the attribute to set.
|
| 130 |
|
|
* @throws AttributeNotFoundException if the attribute does not
|
| 131 |
|
|
* correspond to an attribute
|
| 132 |
|
|
* of the bean.
|
| 133 |
|
|
* @throws InvalidAttributeValueException if the value is invalid
|
| 134 |
|
|
* for this particular
|
| 135 |
|
|
* attribute of the bean.
|
| 136 |
|
|
* @throws MBeanException if setting the attribute causes
|
| 137 |
|
|
* the bean to throw an exception (which
|
| 138 |
|
|
* becomes the cause of this exception).
|
| 139 |
|
|
* @throws ReflectionException if an exception occurred in trying
|
| 140 |
|
|
* to use the reflection interface
|
| 141 |
|
|
* to lookup the attribute. The
|
| 142 |
|
|
* thrown exception is the cause of
|
| 143 |
|
|
* this exception.
|
| 144 |
|
|
* @see #getAttribute(String)
|
| 145 |
|
|
*/
|
| 146 |
|
|
void setAttribute(Attribute attribute)
|
| 147 |
|
|
throws AttributeNotFoundException, InvalidAttributeValueException,
|
| 148 |
|
|
MBeanException, ReflectionException;
|
| 149 |
|
|
|
| 150 |
|
|
/**
|
| 151 |
|
|
* Sets the value of each of the specified attributes
|
| 152 |
|
|
* to that supplied by the {@link Attribute} object.
|
| 153 |
|
|
* The returned list contains the attributes that were
|
| 154 |
|
|
* set and their new values.
|
| 155 |
|
|
*
|
| 156 |
|
|
* @param attributes the attributes to set.
|
| 157 |
|
|
* @return a list of the changed attributes.
|
| 158 |
|
|
* @see #getAttributes(AttributeList)
|
| 159 |
|
|
*/
|
| 160 |
|
|
AttributeList setAttributes(AttributeList attributes);
|
| 161 |
|
|
|
| 162 |
|
|
}
|