001    /* OpenMBeanInfo.java -- Open typed info about a management bean.
002       Copyright (C) 2006 Free Software Foundation, Inc.
003    
004    This file is part of GNU Classpath.
005    
006    GNU Classpath is free software; you can redistribute it and/or modify
007    it under the terms of the GNU General Public License as published by
008    the Free Software Foundation; either version 2, or (at your option)
009    any later version.
010    
011    GNU Classpath is distributed in the hope that it will be useful, but
012    WITHOUT ANY WARRANTY; without even the implied warranty of
013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014    General Public License for more details.
015    
016    You should have received a copy of the GNU General Public License
017    along with GNU Classpath; see the file COPYING.  If not, write to the
018    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019    02110-1301 USA.
020    
021    Linking this library statically or dynamically with other modules is
022    making a combined work based on this library.  Thus, the terms and
023    conditions of the GNU General Public License cover the whole
024    combination.
025    
026    As a special exception, the copyright holders of this library give you
027    permission to link this library with independent modules to produce an
028    executable, regardless of the license terms of these independent
029    modules, and to copy and distribute the resulting executable under
030    terms of your choice, provided that you also meet, for each linked
031    independent module, the terms and conditions of the license of that
032    module.  An independent module is a module which is not derived from
033    or based on this library.  If you modify this library, you may extend
034    this exception to your version of the library, but you are not
035    obligated to do so.  If you do not wish to do so, delete this
036    exception statement from your version. */
037    
038    package javax.management.openmbean;
039    
040    import javax.management.MBeanAttributeInfo;
041    import javax.management.MBeanConstructorInfo;
042    import javax.management.MBeanNotificationInfo;
043    import javax.management.MBeanOperationInfo;
044    
045    /**
046     * Describes an open management bean.  Open management beans are
047     * management beans where {@link
048     * javax.management.DynamicMBean#getMBeanInfo()} returns an
049     * implementation of this interface.  This interface includes those
050     * methods specified by {@link javax.management.MBeanInfo},
051     * so implementations should extend this class.  Each method
052     * which returns an array of one of the <code>MBeanXXXInfo</code>
053     * classes should return an array containing instances
054     * of the equivalent open version (<code>OpenMBeanXXXInfo</code>).
055     *
056     * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
057     * @since 1.5
058     */
059    public interface OpenMBeanInfo
060    {
061    
062      /**
063       * Compares this attribute with the supplied object.  This returns
064       * true iff the object is an instance of {@link OpenMBeanInfo}
065       * with the same class name and equal instances of the info classes.
066       *
067       * @param obj the object to compare.
068       * @return true if the object is a {@link OpenMBeanInfo}
069       *         instance, 
070       *         <code>className.equals(object.getClassName())</code>
071       *         and each info class has an equal in the other object.
072       */
073      boolean equals(Object obj);
074    
075      /**
076       * Returns descriptions of each of the attributes provided by this
077       * management bean.  The elements should be implementations of the
078       * {@link OpenMBeanAttributeInfo} class.
079       *
080       * @return an array of {@link OpenMBeanAttributeInfo} objects,
081       *         representing the attributes emitted by this
082       *         management bean.
083       */
084      MBeanAttributeInfo[] getAttributes();
085    
086      /**
087       * Returns the class name of the management bean.
088       *
089       * @return the bean's class name.
090       */
091      String getClassName();
092    
093      /**
094       * Returns descriptions of each of the constructors provided by this
095       * management bean.  The elements should be implementations of the
096       * {@link OpenMBeanConstructorInfo} class.
097       *
098       * @return an array of {@link OpenMBeanConstructorInfo} objects,
099       *         representing the constructors emitted by this
100       *         management bean.
101       */
102      MBeanConstructorInfo[] getConstructors();
103    
104      /**
105       * Returns a description of this operation.
106       *
107       * @return a human-readable description.
108       */
109      String getDescription();
110    
111      /**
112       * Returns descriptions of each of the notifications provided by this
113       * management bean.  The elements should be implementations of the
114       * {@link OpenMBeanNotificationInfo} class.
115       *
116       * @return an array of {@link OpenMBeanNotificationInfo} objects,
117       *         representing the notifications emitted by this
118       *         management bean.
119       */
120      MBeanNotificationInfo[] getNotifications();
121    
122      /**
123       * Returns descriptions of each of the operations provided by this
124       * management bean.  The elements should be implementations of the
125       * {@link OpenMBeanOperationInfo} class.
126       *
127       * @return an array of {@link OpenMBeanOperationInfo} objects,
128       *         representing the operations emitted by this
129       *         management bean.
130       */
131      MBeanOperationInfo[] getOperations();
132    
133      /**
134       * Returns the hashcode of the bean information as the sum of the
135       * hashcodes of the class name and each array (calculated using
136       * java.util.HashSet(<code>java.util.Arrays.asList(signature)).hashCode()</code>).
137       *
138       * @return the hashcode of the bean information.
139       */
140      int hashCode();
141    
142      /**
143       * Returns a textual representation of this instance.  This
144       * is constructed using the class name
145       * (<code>javax.management.openmbean.OpenMBeanInfo</code>)
146       * along with the class name and textual representations
147       * of each array.
148       *
149       * @return a @link{java.lang.String} instance representing
150       *         the instance in textual form.
151       */
152      String toString();
153    
154    }