001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package javax.management.monitor;
023:
024: import javax.management.ObjectName;
025:
026: /**
027: * The monitor service MBean interface. <p>
028: *
029: * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>
030: * @version $Revision: 57200 $
031: */
032: public interface MonitorMBean {
033: // Constants -----------------------------------------------------
034:
035: // Static --------------------------------------------------------
036:
037: // Public --------------------------------------------------------
038:
039: /**
040: * Starts the monitor.
041: */
042: public void start();
043:
044: /**
045: * Stops the monitor.
046: */
047: public void stop();
048:
049: /**
050: * Add the object name of the MBean monitored.<p>
051: *
052: * @param object the object name.
053: */
054: public void addObservedObject(ObjectName object)
055: throws IllegalArgumentException;
056:
057: /**
058: * Remove the object name of the MBean monitored.<p>
059: *
060: * @param object the object name.
061: */
062: public void removeObservedObject(ObjectName object);
063:
064: /**
065: * Checks whether the object name is monitored.<p>
066: *
067: * @param object the object name.
068: * @return true when it is monitored.
069: */
070: public boolean containsObservedObject(ObjectName object);
071:
072: /**
073: * Retrieves the object names of the MBeans monitored.
074: *
075: * @return the object names.
076: */
077: public ObjectName[] getObservedObjects();
078:
079: /**
080: * Retrieves the object name of the MBean monitored.
081: *
082: * @return the object name.
083: * @deprecated use {@link #getObservedObjects()}
084: */
085: public ObjectName getObservedObject();
086:
087: /**
088: * Sets the object name of the MBean monitored.<p>
089: * <p/>
090: * The default value is null.
091: *
092: * @param object the object name.
093: * @deprecated use {@link #addObservedObject(ObjectName)}
094: */
095: public void setObservedObject(ObjectName object);
096:
097: /**
098: * Retrieves the name of the attribute monitored.
099: *
100: * @return the attribute monitored.
101: */
102: public String getObservedAttribute();
103:
104: /**
105: * Sets the name of the attribute monitored.<p>
106: * <p/>
107: * The default value is null.
108: *
109: * @param attribute the attribute monitored.
110: * @throws IllegalArgumentException when the period is not positive.
111: */
112: public void setObservedAttribute(String attribute);
113:
114: /**
115: * Retrieves the granularity period in milliseconds.<p>
116: * <p/>
117: * The monitoring takes place once per granularity period.
118: *
119: * @return the granularity period.
120: */
121: public long getGranularityPeriod();
122:
123: /**
124: * Sets the granularity period in milliseconds.<p>
125: * <p/>
126: * The monitoring takes place once per granularity period.<p>
127: * <p/>
128: * The default value is 10 seconds.
129: *
130: * @param period the granularity period.
131: * @throws IllegalArgumentException when the period is not positive.
132: */
133: public void setGranularityPeriod(long period)
134: throws IllegalArgumentException;
135:
136: /**
137: * Tests whether this monitoring service is active.
138: *
139: * @return true when the service is active, false otherwise.
140: */
141: public boolean isActive();
142:
143: }
|