blob: 718684ccd7bb37f7cceb59d96ecb534786b8b520 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001<html>
2<head>
3<title>javax.management.openmbean package</title>
4<!--
5Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
6DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7
8This code is free software; you can redistribute it and/or modify it
9under the terms of the GNU General Public License version 2 only, as
10published by the Free Software Foundation. Sun designates this
11particular file as subject to the "Classpath" exception as provided
12by Sun in the LICENSE file that accompanied this code.
13
14This code is distributed in the hope that it will be useful, but WITHOUT
15ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17version 2 for more details (a copy is included in the LICENSE file that
18accompanied this code).
19
20You should have received a copy of the GNU General Public License version
212 along with this work; if not, write to the Free Software Foundation,
22Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23
24Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
25CA 95054 USA or visit www.sun.com if you need additional information or
26have any questions.
27-->
28</head>
29<body bgcolor="white">
30
31 <p>Provides the open data types and Open MBean descriptor classes.
32 An <em>Open MBean</em> is an MBean where the types of attributes
33 and of operation parameters and return values are built using a
34 small set of predefined Java classes. Open MBeans facilitate
35 operation with remote management programs that do not necessarily
36 have access to application-specific types, including non-Java
37 programs.</p>
38
39 <p>Every MBean has an {@link javax.management.MBeanInfo
40 MBeanInfo} with information about the MBean itself, and its
41 attributes, operations, constructors, and notifications. In an
42 Open MBean, this <code>MBeanInfo</code> implements the {@link
43 javax.management.openmbean.OpenMBeanInfo OpenMBeanInfo}
44 interface, usually by being an instance of {@link
45 javax.management.openmbean.OpenMBeanInfoSupport
46 OpenMBeanInfoSupport}.</p>
47
48 <p>The attribute information returned by {@link
49 javax.management.MBeanInfo#getAttributes()
50 MBeanInfo.getAttributes} for an Open MBean is an array of
51 objects implementing {@link
52 javax.management.openmbean.OpenMBeanAttributeInfo
53 OpenMBeanAttributeInfo}, usually instances of {@link
54 javax.management.openmbean.OpenMBeanAttributeInfoSupport
55 OpenMBeanAttributeInfoSupport}. In addition to the usual
56 information about attributes, an
57 <code>OpenMBeanAttributeInfo</code> specifies the {@link
58 javax.management.openmbean.OpenType OpenType} of the attribute.
59 The possible <code>OpenType</code> values are predefined, which
60 is what ensures that remote managers will understand them.</p>
61
62 <p>Similar remarks apply to the parameter types of operations and
63 constructors, and to the return types of operations.</p>
64
65 <p>There is a distinction between an attribute's Java language
66 type, as returned by {@link
67 javax.management.MBeanAttributeInfo#getType() getType()}, and
68 its <code>OpenType</code>, as returned by {@link
69 javax.management.openmbean.OpenMBeanAttributeInfo#getOpenType()
70 getOpenType()}. For example, if the Java language type is
71 <code>java.lang.String</code>, the <code>OpenType</code> will be
72 {@link javax.management.openmbean.SimpleType#STRING
73 SimpleType.String}. If the Java language type is {@link
74 javax.management.openmbean.CompositeData}, the
75 <code>OpenType</code> will be a {@link
76 javax.management.openmbean.CompositeType CompositeType} that
77 describes the items in the <code>CompositeData</code> instances
78 for the attribute.</p>
79
80 <h2><a name="constraints">Default values and constraints</a></h2>
81
82 <p>In Open MBeans, attributes and parameters can have default values
83 and/or constraints associated with them in the {@code
84 OpenMBeanAttributeInfo} or {@code OpenMBeanParameterInfo}.
85 There are two ways to specify these constraints. Either the
86 values are directly specified as parameters to one of the
87 constructors of {@code OpenMBeanAttributeInfoSupport} or
88 {@code OpenMBeanParameterInfoSupport}, for example
89 {@link
90 javax.management.openmbean.OpenMBeanParameterInfoSupport#OpenMBeanParameterInfoSupport(
91 String, String, OpenType, Object, Object[])}; or the values are
92 specified in a {@link javax.management.Descriptor Descriptor} given
93 as a parameter to one of the constructors.</p>
94
95 <p>When a {@code Descriptor} is used, the fields of interest are
96 these:</p>
97
98 <ul>
99
100 <li>{@code defaultValue} defines the value returned by
101 {@link javax.management.openmbean.OpenMBeanParameterInfo#getDefaultValue()
102 getDefaultValue()};
103
104 <li>{@code minValue} defines the value returned by {@link
105 javax.management.openmbean.OpenMBeanParameterInfo#getMinValue() getMinValue()};
106
107 <li>{@code maxValue} defines the value returned by {@link
108 javax.management.openmbean.OpenMBeanParameterInfo#getMaxValue() getMaxValue()};
109
110 <li>{@code legalValues} defines the values returned by {@link
111 javax.management.openmbean.OpenMBeanParameterInfo#getLegalValues() getLegalValues()}.
112
113 </ul>
114
115 <p>For {@code defaultValue}, {@code minValue}, and {@code
116 maxValue}, the associated value must either be of the Java type
117 corresponding to {@code openType}, or be a string that can be
118 converted into that type. The conversion uses the static method
119 {@code valueOf(String)} if it finds one; otherwise a constructor
120 with a single {@code String} parameter if it finds one; otherwise
121 it fails.</p>
122
123 <p>For {@code legalValues}, the associated value must be either
124 an array or a {@code Set}, and the elements of the array or set
125 must be convertible as described for {@code defaultValue} etc.</p>
126
127 <p>The following conditions must be met for these fields:</p>
128
129 <ul>
130 <li>the values must be of the appropriate type, or be strings
131 that can be converted to the appropriate type as explained
132 above;
133
134 <li>if {@code legalValues} is present then neither {@code
135 minValue} nor {@code maxValue} must be present;
136
137 <li>if {@code defaultValue} is present then it must satisfy the
138 constraints defined by {@code legalValues}, {@code minValue}, or
139 {@code maxValue} when any of these is also present;
140
141 <li>if {@code minValue} and {@code maxValue} are both present
142 then {@code minValue} must not be greater than {@code maxValue}.
143 </ul>
144
145 @see <a href="{@docRoot}/../technotes/guides/jmx/">
146 Java SE 6 Platform documentation on JMX technology</a>,
147 in particular the
148 <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
149 JMX Specification, version 1.4</a>
150
151 @since 1.5
152
153</BODY>
154</HTML>