4230N/ACopyright (c) 2000, 2011, Oracle and/or its affiliates. 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 2362N/Apublished by the Free Software Foundation. Oracle designates this 0N/Aparticular file as subject to the "Classpath" exception as provided 2362N/Aby Oracle 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 0N/Aversion 2 for more details (a copy is included in the LICENSE file that 0N/Aaccompanied this code). 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, 0N/AInc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2365N/APlease contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 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
0N/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
0N/A reused many times with different management interfaces and
0N/A managed resources, and it can provide common functionality
0N/A such as persistence and caching.</
p>
0N/A <
p>A Model MBean implements the {@link
0N/A getMBeanInfo} method returns an object implementing {@link
0N/A ModelMBeanInfo}.</
p>
0N/A MBeanInfo} with information about the MBean itself, and its
0N/A attributes, operations, constructors, and notifications. A
0N/A Model MBean augments this <
code>MBeanInfo</
code> with {@link
0N/A additional information in the form of (key,value) pairs.
0N/A Usually, <
code>Descriptor</
code>s are instances of {@link
0N/A DescriptorSupport}.</
p>
0N/A RequiredModelMBean} provides a standard Model MBean
0N/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/AModelMBeanInfo mmbi =
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
0N/A// Make the Model MBean and link it to the resource
0N/AModelMBean mmb = new RequiredModelMBean(mmbi);
0N/A// Register the Model MBean in the MBean Server
0N/AObjectName mapName = new ObjectName(":type=Map,name=whatever");
0N/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>
0N/A <
li>See the <
i>JMX 1.4 Specification</
i>
0N/A PDF document available from the
4230N/A Java Platform documentation on JMX technology</
a>