0N/ACopyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. 0N/ADO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/AThis code is free software; you can redistribute it and/or modify it 0N/Aunder the terms of the GNU General Public License version 2 only, as 0N/Apublished by the Free Software Foundation. Sun designates this 0N/Aparticular file as subject to the "Classpath" exception as provided 0N/Aby Sun in the LICENSE file that accompanied this code. 0N/AThis code is distributed in the hope that it will be useful, but WITHOUT 0N/AANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/AFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3516N/Aversion 2 for more details (a copy is included in the LICENSE file that 0N/AYou should have received a copy of the GNU General Public License version 0N/A2 along with this work; if not, write to the Free Software Foundation, 3516N/AInc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3516N/APlease contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A<
body bgcolor="white">
0N/A <
p>Provides the definition of the ModelMBean classes. A Model
0N/A MBean is an MBean that acts as a bridge between the management
3516N/A interface and the underlying managed resource. Both the
0N/A management interface and the managed resource are specified as
0N/A Java objects. The same Model MBean implementation can be
3516N/A reused many times with different management interfaces and
3516N/A managed resources, and it can provide common functionality
3516N/A such as persistence and caching.</
p>
3516N/A <
p>A Model MBean implements the {@link
3516N/A getMBeanInfo} method returns an object implementing {@link
0N/A MBeanInfo} with information about the MBean itself, and its
0N/A attributes, operations, constructors, and notifications. A
3516N/A Model MBean augments this <
code>MBeanInfo</
code> with {@link
0N/A additional information in the form of (key,value) pairs.
3516N/A Usually, <
code>Descriptor</
code>s are instances of {@link
0N/A DescriptorSupport}.</
p>
0N/A RequiredModelMBean} provides a standard Model MBean
3516N/A <
p>The following example shows a Model MBean being used to make
0N/A the <
code>get</
code> method of a <
code>HashMap</
code>
0N/A available for management through an MBean server. No other
0N/A methods are available through the MBean server. There is
0N/A nothing special about <
code>HashMap</
code> here. Public
0N/A methods from any public class can be exposed for management in
0N/AHashMap map = new HashMap();
0N/A// The resource that will be managed
0N/A// Construct the management interface for the Model MBean
0N/AModelMBeanOperationInfo getInfo =
0N/A new ModelMBeanOperationInfo("Get value for key", getMethod);
0N/A "Map of keys and values",
0N/A null, // no attributes
0N/A null, // no constructors
0N/A new ModelMBeanOperationInfo[] {getInfo},
0N/A null); // no notifications
3516N/A// Make the Model MBean and link it to the resource
3516N/AModelMBean mmb = new RequiredModelMBean(mmbi);
0N/A// Register the Model MBean in the MBean Server
0N/AObjectName mapName = new ObjectName(":type=Map,name=whatever");
3516N/A// Resource can evolve independently of the MBean
0N/A// Can access the "get" method through the MBean Server
0N/A <
h2><
a name="spec">Package Specification</
a></
h2>
3516N/A <
li>See the <
i>JMX 1.4 Specification</
i>
3516N/A PDF document available from the
0N/A Java SE 6 Platform documentation on JMX</
a>