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