1/* 2 * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. 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 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 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 * 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. 24 */ 25 26package javax.management.monitor; 27 28// jmx imports 29// 30import javax.management.ObjectName; 31 32/** 33 * Exposes the remote management interface of monitor MBeans. 34 * 35 * 36 * @since 1.5 37 */ 38public interface MonitorMBean { 39 40 /** 41 * Starts the monitor. 42 */ 43 public void start(); 44 45 /** 46 * Stops the monitor. 47 */ 48 public void stop(); 49 50 // GETTERS AND SETTERS 51 //-------------------- 52 53 /** 54 * Adds the specified object in the set of observed MBeans. 55 * 56 * @param object The object to observe. 57 * @exception java.lang.IllegalArgumentException the specified object is null. 58 * 59 */ 60 public void addObservedObject(ObjectName object) throws java.lang.IllegalArgumentException; 61 62 /** 63 * Removes the specified object from the set of observed MBeans. 64 * 65 * @param object The object to remove. 66 * 67 */ 68 public void removeObservedObject(ObjectName object); 69 70 /** 71 * Tests whether the specified object is in the set of observed MBeans. 72 * 73 * @param object The object to check. 74 * @return <CODE>true</CODE> if the specified object is in the set, <CODE>false</CODE> otherwise. 75 * 76 */ 77 public boolean containsObservedObject(ObjectName object); 78 79 /** 80 * Returns an array containing the objects being observed. 81 * 82 * @return The objects being observed. 83 * 84 */ 85 public ObjectName[] getObservedObjects(); 86 87 /** 88 * Gets the object name of the object being observed. 89 * 90 * @return The object being observed. 91 * 92 * @see #setObservedObject 93 * 94 * @deprecated As of JMX 1.2, replaced by {@link #getObservedObjects} 95 */ 96 @Deprecated 97 public ObjectName getObservedObject(); 98 99 /** 100 * Sets the object to observe identified by its object name. 101 * 102 * @param object The object to observe. 103 * 104 * @see #getObservedObject 105 * 106 * @deprecated As of JMX 1.2, replaced by {@link #addObservedObject} 107 */ 108 @Deprecated 109 public void setObservedObject(ObjectName object); 110 111 /** 112 * Gets the attribute being observed. 113 * 114 * @return The attribute being observed. 115 * 116 * @see #setObservedAttribute 117 */ 118 public String getObservedAttribute(); 119 120 /** 121 * Sets the attribute to observe. 122 * 123 * @param attribute The attribute to observe. 124 * 125 * @see #getObservedAttribute 126 */ 127 public void setObservedAttribute(String attribute); 128 129 /** 130 * Gets the granularity period (in milliseconds). 131 * 132 * @return The granularity period. 133 * 134 * @see #setGranularityPeriod 135 */ 136 public long getGranularityPeriod(); 137 138 /** 139 * Sets the granularity period (in milliseconds). 140 * 141 * @param period The granularity period. 142 * @exception java.lang.IllegalArgumentException The granularity 143 * period is less than or equal to zero. 144 * 145 * @see #getGranularityPeriod 146 */ 147 public void setGranularityPeriod(long period) throws java.lang.IllegalArgumentException; 148 149 /** 150 * Tests if the monitor MBean is active. 151 * A monitor MBean is marked active when the {@link #start start} method is called. 152 * It becomes inactive when the {@link #stop stop} method is called. 153 * 154 * @return <CODE>true</CODE> if the monitor MBean is active, <CODE>false</CODE> otherwise. 155 */ 156 public boolean isActive(); 157} 158