1 /* 2 * @(#)OpenMBeanInfo.java 3.22 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 9 package javax.management.openmbean; 10 11 12 // java import 13 // 14 15 16 // jmx import 17 // 18 import javax.management.MBeanAttributeInfo; 19 import javax.management.MBeanOperationInfo; 20 import javax.management.MBeanConstructorInfo; 21 import javax.management.MBeanNotificationInfo; 22 23 24 25 /** 26 * <p>Describes an Open MBean: an Open MBean is recognized as such if 27 * its {@link javax.management.DynamicMBean#getMBeanInfo() 28 * getMBeanInfo()} method returns an instance of a class which 29 * implements the {@link OpenMBeanInfo} interface, typically {@link 30 * OpenMBeanInfoSupport}.</p> 31 * 32 * <p>This interface declares the same methods as the class {@link 33 * javax.management.MBeanInfo}. A class implementing this interface 34 * (typically {@link OpenMBeanInfoSupport}) should extend {@link 35 * javax.management.MBeanInfo}.</p> 36 * 37 * <p>The {@link #getAttributes()}, {@link #getOperations()} and 38 * {@link #getConstructors()} methods of the implementing class should 39 * return at runtime an array of instances of a subclass of {@link 40 * MBeanAttributeInfo}, {@link MBeanOperationInfo} or {@link 41 * MBeanConstructorInfo} respectively which implement the {@link 42 * OpenMBeanAttributeInfo}, {@link OpenMBeanOperationInfo} or {@link 43 * OpenMBeanConstructorInfo} interface respectively. 44 * 45 * @version 3.22 03/12/19 46 * @author Sun Microsystems, Inc. 47 * 48 * @since 1.5 49 * @since.unbundled JMX 1.1 50 */ 51 public interface OpenMBeanInfo { 52 53 // Re-declares the methods that are in class MBeanInfo of JMX 1.0 54 // (methods will be removed when MBeanInfo is made a parent interface of this interface) 55 56 /** 57 * Returns the fully qualified Java class name of the open MBean 58 * instances this <tt>OpenMBeanInfo</tt> describes. 59 * 60 * @return the class name. 61 */ 62 public String getClassName() ; 63 64 /** 65 * Returns a human readable description of the type of open MBean 66 * instances this <tt>OpenMBeanInfo</tt> describes. 67 * 68 * @return the description. 69 */ 70 public String getDescription() ; 71 72 /** 73 * Returns an array of <tt>OpenMBeanAttributeInfo</tt> instances 74 * describing each attribute in the open MBean described by this 75 * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned 76 * array should actually be a subclass of 77 * <tt>MBeanAttributeInfo</tt> which implements the 78 * <tt>OpenMBeanAttributeInfo</tt> interface (typically {@link 79 * OpenMBeanAttributeInfoSupport}). 80 * 81 * @return the attribute array. 82 */ 83 public MBeanAttributeInfo[] getAttributes() ; 84 85 /** 86 * Returns an array of <tt>OpenMBeanOperationInfo</tt> instances 87 * describing each operation in the open MBean described by this 88 * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned 89 * array should actually be a subclass of 90 * <tt>MBeanOperationInfo</tt> which implements the 91 * <tt>OpenMBeanOperationInfo</tt> interface (typically {@link 92 * OpenMBeanOperationInfoSupport}). 93 * 94 * @return the operation array. 95 */ 96 public MBeanOperationInfo[] getOperations() ; 97 98 /** 99 * Returns an array of <tt>OpenMBeanConstructorInfo</tt> instances 100 * describing each constructor in the open MBean described by this 101 * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned 102 * array should actually be a subclass of 103 * <tt>MBeanConstructorInfo</tt> which implements the 104 * <tt>OpenMBeanConstructorInfo</tt> interface (typically {@link 105 * OpenMBeanConstructorInfoSupport}). 106 * 107 * @return the constructor array. 108 */ 109 public MBeanConstructorInfo[] getConstructors() ; 110 111 /** 112 * Returns an array of <tt>MBeanNotificationInfo</tt> instances 113 * describing each notification emitted by the open MBean 114 * described by this <tt>OpenMBeanInfo</tt> instance. 115 * 116 * @return the notification array. 117 */ 118 public MBeanNotificationInfo[] getNotifications() ; 119 120 121 // commodity methods 122 // 123 124 /** 125 * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanInfo</code> instance for equality. 126 * <p> 127 * Returns <tt>true</tt> if and only if all of the following statements are true: 128 * <ul> 129 * <li><var>obj</var> is non null,</li> 130 * <li><var>obj</var> also implements the <code>OpenMBeanInfo</code> interface,</li> 131 * <li>their class names are equal</li> 132 * <li>their infos on attributes, constructors, operations and notifications are equal</li> 133 * </ul> 134 * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are 135 * different implementations of the <code>OpenMBeanInfo</code> interface. 136 * <br> 137 * @param obj the object to be compared for equality with this <code>OpenMBeanInfo</code> instance; 138 * 139 * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanInfo</code> instance. 140 */ 141 public boolean equals(Object obj); 142 143 /** 144 * Returns the hash code value for this <code>OpenMBeanInfo</code> instance. 145 * <p> 146 * The hash code of an <code>OpenMBeanInfo</code> instance is the sum of the hash codes 147 * of all elements of information used in <code>equals</code> comparisons 148 * (ie: its class name, and its infos on attributes, constructors, operations and notifications, 149 * where the hashCode of each of these arrays is calculated by a call to 150 * <tt>new java.util.HashSet(java.util.Arrays.asList(this.getSignature)).hashCode()</tt>). 151 * <p> 152 * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code> 153 * for any two <code>OpenMBeanInfo</code> instances <code>t1</code> and <code>t2</code>, 154 * as required by the general contract of the method 155 * {@link Object#hashCode() Object.hashCode()}. 156 * <p> 157 * 158 * @return the hash code value for this <code>OpenMBeanInfo</code> instance 159 */ 160 public int hashCode(); 161 162 /** 163 * Returns a string representation of this <code>OpenMBeanInfo</code> instance. 164 * <p> 165 * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanInfo</code>), 166 * the MBean class name, 167 * and the string representation of infos on attributes, constructors, operations and notifications of the described MBean. 168 * 169 * @return a string representation of this <code>OpenMBeanInfo</code> instance 170 */ 171 public String toString(); 172 173 } 174