1. /*
  2. * @(#)MonitorMBean.java 4.23 04/05/18
  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.monitor;
  8. // jmx imports
  9. //
  10. import javax.management.ObjectName;
  11. /**
  12. * Exposes the remote management interface of monitor MBeans.
  13. *
  14. * @version 4.23 05/18/04
  15. * @author Sun Microsystems, Inc
  16. *
  17. * @since 1.5
  18. */
  19. public interface MonitorMBean {
  20. /**
  21. * Starts the monitor.
  22. */
  23. public void start();
  24. /**
  25. * Stops the monitor.
  26. */
  27. public void stop();
  28. // GETTERS AND SETTERS
  29. //--------------------
  30. /**
  31. * Adds the specified object in the set of observed MBeans.
  32. *
  33. * @param object The object to observe.
  34. * @exception java.lang.IllegalArgumentException the specified object is null.
  35. *
  36. * @since.unbundled JMX 1.2
  37. */
  38. public void addObservedObject(ObjectName object) throws java.lang.IllegalArgumentException;
  39. /**
  40. * Removes the specified object from the set of observed MBeans.
  41. *
  42. * @param object The object to remove.
  43. *
  44. * @since.unbundled JMX 1.2
  45. */
  46. public void removeObservedObject(ObjectName object);
  47. /**
  48. * Tests whether the specified object is in the set of observed MBeans.
  49. *
  50. * @param object The object to check.
  51. * @return <CODE>true</CODE> if the specified object is in the set, <CODE>false</CODE> otherwise.
  52. *
  53. * @since.unbundled JMX 1.2
  54. */
  55. public boolean containsObservedObject(ObjectName object);
  56. /**
  57. * Returns an array containing the objects being observed.
  58. *
  59. * @return The objects being observed.
  60. *
  61. * @since.unbundled JMX 1.2
  62. */
  63. public ObjectName[] getObservedObjects();
  64. /**
  65. * Gets the object name of the object being observed.
  66. *
  67. * @return The object being observed.
  68. *
  69. * @see #setObservedObject
  70. *
  71. * @deprecated As of JMX 1.2, replaced by {@link #getObservedObjects}
  72. */
  73. @Deprecated
  74. public ObjectName getObservedObject();
  75. /**
  76. * Sets the object to observe identified by its object name.
  77. *
  78. * @param object The object to observe.
  79. *
  80. * @see #getObservedObject
  81. *
  82. * @deprecated As of JMX 1.2, replaced by {@link #addObservedObject}
  83. */
  84. @Deprecated
  85. public void setObservedObject(ObjectName object);
  86. /**
  87. * Gets the attribute being observed.
  88. *
  89. * @return The attribute being observed.
  90. *
  91. * @see #setObservedAttribute
  92. */
  93. public String getObservedAttribute();
  94. /**
  95. * Sets the attribute to observe.
  96. *
  97. * @param attribute The attribute to observe.
  98. *
  99. * @see #getObservedAttribute
  100. */
  101. public void setObservedAttribute(String attribute);
  102. /**
  103. * Gets the granularity period (in milliseconds).
  104. *
  105. * @return The granularity period.
  106. *
  107. * @see #setGranularityPeriod
  108. */
  109. public long getGranularityPeriod();
  110. /**
  111. * Sets the granularity period (in milliseconds).
  112. *
  113. * @param period The granularity period.
  114. * @exception java.lang.IllegalArgumentException The granularity
  115. * period is less than or equal to zero.
  116. *
  117. * @see #getGranularityPeriod
  118. */
  119. public void setGranularityPeriod(long period) throws java.lang.IllegalArgumentException;
  120. /**
  121. * Tests if the monitor MBean is active.
  122. * A monitor MBean is marked active when the {@link #start start} method is called.
  123. * It becomes inactive when the {@link #stop stop} method is called.
  124. *
  125. * @return <CODE>true</CODE> if the monitor MBean is active, <CODE>false</CODE> otherwise.
  126. */
  127. public boolean isActive();
  128. }