2
|
1 |
/*
|
24368
|
2 |
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5506
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
|
|
27 |
package javax.management.openmbean;
|
|
28 |
|
|
29 |
|
|
30 |
// java import
|
|
31 |
//
|
|
32 |
|
|
33 |
|
|
34 |
// jmx import
|
|
35 |
//
|
|
36 |
import javax.management.MBeanAttributeInfo;
|
|
37 |
import javax.management.MBeanOperationInfo;
|
|
38 |
import javax.management.MBeanConstructorInfo;
|
|
39 |
import javax.management.MBeanNotificationInfo;
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
/**
|
|
44 |
* <p>Describes an Open MBean: an Open MBean is recognized as such if
|
|
45 |
* its {@link javax.management.DynamicMBean#getMBeanInfo()
|
|
46 |
* getMBeanInfo()} method returns an instance of a class which
|
|
47 |
* implements the {@link OpenMBeanInfo} interface, typically {@link
|
|
48 |
* OpenMBeanInfoSupport}.</p>
|
|
49 |
*
|
|
50 |
* <p>This interface declares the same methods as the class {@link
|
|
51 |
* javax.management.MBeanInfo}. A class implementing this interface
|
|
52 |
* (typically {@link OpenMBeanInfoSupport}) should extend {@link
|
|
53 |
* javax.management.MBeanInfo}.</p>
|
|
54 |
*
|
|
55 |
* <p>The {@link #getAttributes()}, {@link #getOperations()} and
|
|
56 |
* {@link #getConstructors()} methods of the implementing class should
|
|
57 |
* return at runtime an array of instances of a subclass of {@link
|
|
58 |
* MBeanAttributeInfo}, {@link MBeanOperationInfo} or {@link
|
|
59 |
* MBeanConstructorInfo} respectively which implement the {@link
|
|
60 |
* OpenMBeanAttributeInfo}, {@link OpenMBeanOperationInfo} or {@link
|
|
61 |
* OpenMBeanConstructorInfo} interface respectively.
|
|
62 |
*
|
|
63 |
*
|
|
64 |
* @since 1.5
|
|
65 |
*/
|
|
66 |
public interface OpenMBeanInfo {
|
|
67 |
|
|
68 |
// Re-declares the methods that are in class MBeanInfo of JMX 1.0
|
|
69 |
// (methods will be removed when MBeanInfo is made a parent interface of this interface)
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Returns the fully qualified Java class name of the open MBean
|
|
73 |
* instances this <tt>OpenMBeanInfo</tt> describes.
|
|
74 |
*
|
|
75 |
* @return the class name.
|
|
76 |
*/
|
|
77 |
public String getClassName() ;
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Returns a human readable description of the type of open MBean
|
|
81 |
* instances this <tt>OpenMBeanInfo</tt> describes.
|
|
82 |
*
|
|
83 |
* @return the description.
|
|
84 |
*/
|
|
85 |
public String getDescription() ;
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Returns an array of <tt>OpenMBeanAttributeInfo</tt> instances
|
|
89 |
* describing each attribute in the open MBean described by this
|
|
90 |
* <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
|
|
91 |
* array should actually be a subclass of
|
|
92 |
* <tt>MBeanAttributeInfo</tt> which implements the
|
|
93 |
* <tt>OpenMBeanAttributeInfo</tt> interface (typically {@link
|
|
94 |
* OpenMBeanAttributeInfoSupport}).
|
|
95 |
*
|
|
96 |
* @return the attribute array.
|
|
97 |
*/
|
|
98 |
public MBeanAttributeInfo[] getAttributes() ;
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns an array of <tt>OpenMBeanOperationInfo</tt> instances
|
|
102 |
* describing each operation in the open MBean described by this
|
|
103 |
* <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
|
|
104 |
* array should actually be a subclass of
|
|
105 |
* <tt>MBeanOperationInfo</tt> which implements the
|
|
106 |
* <tt>OpenMBeanOperationInfo</tt> interface (typically {@link
|
|
107 |
* OpenMBeanOperationInfoSupport}).
|
|
108 |
*
|
|
109 |
* @return the operation array.
|
|
110 |
*/
|
|
111 |
public MBeanOperationInfo[] getOperations() ;
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Returns an array of <tt>OpenMBeanConstructorInfo</tt> instances
|
|
115 |
* describing each constructor in the open MBean described by this
|
|
116 |
* <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
|
|
117 |
* array should actually be a subclass of
|
|
118 |
* <tt>MBeanConstructorInfo</tt> which implements the
|
|
119 |
* <tt>OpenMBeanConstructorInfo</tt> interface (typically {@link
|
|
120 |
* OpenMBeanConstructorInfoSupport}).
|
|
121 |
*
|
|
122 |
* @return the constructor array.
|
|
123 |
*/
|
|
124 |
public MBeanConstructorInfo[] getConstructors() ;
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Returns an array of <tt>MBeanNotificationInfo</tt> instances
|
|
128 |
* describing each notification emitted by the open MBean
|
|
129 |
* described by this <tt>OpenMBeanInfo</tt> instance.
|
|
130 |
*
|
|
131 |
* @return the notification array.
|
|
132 |
*/
|
|
133 |
public MBeanNotificationInfo[] getNotifications() ;
|
|
134 |
|
|
135 |
|
|
136 |
// commodity methods
|
|
137 |
//
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Compares the specified <var>obj</var> parameter with this <code>OpenMBeanInfo</code> instance for equality.
|
|
141 |
* <p>
|
|
142 |
* Returns <tt>true</tt> if and only if all of the following statements are true:
|
|
143 |
* <ul>
|
|
144 |
* <li><var>obj</var> is non null,</li>
|
|
145 |
* <li><var>obj</var> also implements the <code>OpenMBeanInfo</code> interface,</li>
|
|
146 |
* <li>their class names are equal</li>
|
|
147 |
* <li>their infos on attributes, constructors, operations and notifications are equal</li>
|
|
148 |
* </ul>
|
|
149 |
* This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
|
|
150 |
* different implementations of the <code>OpenMBeanInfo</code> interface.
|
|
151 |
* <br>
|
|
152 |
* @param obj the object to be compared for equality with this <code>OpenMBeanInfo</code> instance;
|
|
153 |
*
|
|
154 |
* @return <code>true</code> if the specified object is equal to this <code>OpenMBeanInfo</code> instance.
|
|
155 |
*/
|
|
156 |
public boolean equals(Object obj);
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Returns the hash code value for this <code>OpenMBeanInfo</code> instance.
|
|
160 |
* <p>
|
|
161 |
* The hash code of an <code>OpenMBeanInfo</code> instance is the sum of the hash codes
|
|
162 |
* of all elements of information used in <code>equals</code> comparisons
|
|
163 |
* (ie: its class name, and its infos on attributes, constructors, operations and notifications,
|
|
164 |
* where the hashCode of each of these arrays is calculated by a call to
|
|
165 |
* <tt>new java.util.HashSet(java.util.Arrays.asList(this.getSignature)).hashCode()</tt>).
|
|
166 |
* <p>
|
|
167 |
* This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
|
|
168 |
* for any two <code>OpenMBeanInfo</code> instances <code>t1</code> and <code>t2</code>,
|
|
169 |
* as required by the general contract of the method
|
|
170 |
* {@link Object#hashCode() Object.hashCode()}.
|
|
171 |
*
|
|
172 |
* @return the hash code value for this <code>OpenMBeanInfo</code> instance
|
|
173 |
*/
|
|
174 |
public int hashCode();
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Returns a string representation of this <code>OpenMBeanInfo</code> instance.
|
|
178 |
* <p>
|
|
179 |
* The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanInfo</code>),
|
|
180 |
* the MBean class name,
|
|
181 |
* and the string representation of infos on attributes, constructors, operations and notifications of the described MBean.
|
|
182 |
*
|
|
183 |
* @return a string representation of this <code>OpenMBeanInfo</code> instance
|
|
184 |
*/
|
|
185 |
public String toString();
|
|
186 |
|
|
187 |
}
|