1. /*
  2. * @(#)OpenMBeanOperationInfo.java 3.20 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.MBeanParameterInfo;
  13. import javax.management.MBeanOperationInfo;
  14. /**
  15. * <p>Describes an operation of an Open MBean.</p>
  16. *
  17. * <p>This interface declares the same methods as the class {@link
  18. * javax.management.MBeanOperationInfo}. A class implementing this
  19. * interface (typically {@link OpenMBeanOperationInfoSupport}) should
  20. * extend {@link javax.management.MBeanOperationInfo}.</p>
  21. *
  22. * <p>The {@link #getSignature()} method should return at runtime an
  23. * array of instances of a subclass of {@link MBeanParameterInfo}
  24. * which implements the {@link OpenMBeanParameterInfo} interface
  25. * (typically {@link OpenMBeanParameterInfoSupport}).</p>
  26. *
  27. * @version 3.20 03/12/19
  28. * @author Sun Microsystems, Inc.
  29. *
  30. * @since 1.5
  31. * @since.unbundled JMX 1.1
  32. */
  33. public interface OpenMBeanOperationInfo {
  34. // Re-declares fields and methods that are in class MBeanOperationInfo of JMX 1.0
  35. // (fields and methods will be removed when MBeanOperationInfo is made a parent interface of this interface)
  36. /**
  37. * Returns a human readable description of the operation
  38. * described by this <tt>OpenMBeanOperationInfo</tt> instance.
  39. *
  40. * @return the description.
  41. */
  42. public String getDescription() ;
  43. /**
  44. * Returns the name of the operation
  45. * described by this <tt>OpenMBeanOperationInfo</tt> instance.
  46. *
  47. * @return the name.
  48. */
  49. public String getName() ;
  50. /**
  51. * Returns an array of <tt>OpenMBeanParameterInfo</tt> instances
  52. * describing each parameter in the signature of the operation
  53. * described by this <tt>OpenMBeanOperationInfo</tt> instance.
  54. * Each instance in the returned array should actually be a
  55. * subclass of <tt>MBeanParameterInfo</tt> which implements the
  56. * <tt>OpenMBeanParameterInfo</tt> interface (typically {@link
  57. * OpenMBeanParameterInfoSupport}).
  58. *
  59. * @return the signature.
  60. */
  61. public MBeanParameterInfo[] getSignature() ;
  62. /**
  63. * Returns an <tt>int</tt> constant qualifying the impact of the
  64. * operation described by this <tt>OpenMBeanOperationInfo</tt>
  65. * instance.
  66. *
  67. * The returned constant is one of {@link
  68. * javax.management.MBeanOperationInfo#INFO}, {@link
  69. * javax.management.MBeanOperationInfo#ACTION} or {@link
  70. * javax.management.MBeanOperationInfo#ACTION_INFO}.
  71. *
  72. * @return the impact code.
  73. */
  74. public int getImpact() ;
  75. /**
  76. * Returns the fully qualified Java class name of the values
  77. * returned by the operation described by this
  78. * <tt>OpenMBeanOperationInfo</tt> instance. This method should
  79. * return the same value as a call to
  80. * <tt>getReturnOpenType().getClassName()</tt>.
  81. *
  82. * @return the return type.
  83. */
  84. public String getReturnType() ;
  85. // Now declares methods that are specific to open MBeans
  86. //
  87. /**
  88. * Returns the <i>open type</i> of the values returned by the
  89. * operation described by this <tt>OpenMBeanOperationInfo</tt>
  90. * instance.
  91. *
  92. * @return the return type.
  93. */
  94. public OpenType getReturnOpenType() ; // open MBean specific method
  95. // commodity methods
  96. //
  97. /**
  98. * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanOperationInfo</code> instance for equality.
  99. * <p>
  100. * Returns <tt>true</tt> if and only if all of the following statements are true:
  101. * <ul>
  102. * <li><var>obj</var> is non null,</li>
  103. * <li><var>obj</var> also implements the <code>OpenMBeanOperationInfo</code> interface,</li>
  104. * <li>their names are equal</li>
  105. * <li>their signatures are equal</li>
  106. * <li>their return open types are equal</li>
  107. * <li>their impacts are equal</li>
  108. * </ul>
  109. * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
  110. * different implementations of the <code>OpenMBeanOperationInfo</code> interface.
  111. * <br> 
  112. * @param obj the object to be compared for equality with this <code>OpenMBeanOperationInfo</code> instance;
  113. *
  114. * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanOperationInfo</code> instance.
  115. */
  116. public boolean equals(Object obj);
  117. /**
  118. * Returns the hash code value for this <code>OpenMBeanOperationInfo</code> instance.
  119. * <p>
  120. * The hash code of an <code>OpenMBeanOperationInfo</code> instance is the sum of the hash codes
  121. * of all elements of information used in <code>equals</code> comparisons
  122. * (ie: its name, return open type, impact and signature, where the signature hashCode is calculated by a call to
  123. * <tt>java.util.Arrays.asList(this.getSignature).hashCode()</tt>).
  124. * <p>
  125. * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
  126. * for any two <code>OpenMBeanOperationInfo</code> instances <code>t1</code> and <code>t2</code>,
  127. * as required by the general contract of the method
  128. * {@link Object#hashCode() Object.hashCode()}.
  129. * <p>
  130. *
  131. * @return the hash code value for this <code>OpenMBeanOperationInfo</code> instance
  132. */
  133. public int hashCode();
  134. /**
  135. * Returns a string representation of this <code>OpenMBeanOperationInfo</code> instance.
  136. * <p>
  137. * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanOperationInfo</code>),
  138. * and the name, signature, return open type and impact of the described operation.
  139. *
  140. * @return a string representation of this <code>OpenMBeanOperationInfo</code> instance
  141. */
  142. public String toString();
  143. }