001: /* JFox, the OpenSource J2EE Application Server
002: *
003: * Copyright (C) 2002 huihoo.org
004: * Distributable under GNU LGPL license
005: * See the GNU Lesser General Public License for more details.
006: */
007:
008: package javax.management.openmbean;
009:
010: import javax.management.MBeanNotificationInfo;
011: import javax.management.MBeanConstructorInfo;
012: import javax.management.MBeanOperationInfo;
013: import javax.management.MBeanAttributeInfo;
014:
015: /**
016: * <p>Describes an Open MBean: an Open MBean is recognized as such if
017: * its {@link javax.management.DynamicMBean#getMBeanInfo()
018: * getMBeanInfo()} method returns an instance of a class which
019: * implements the {@link OpenMBeanInfo} interface, typically {@link
020: * OpenMBeanInfoSupport}.</p>
021: *
022: * <p>This interface declares the same methods as the class {@link
023: * javax.management.MBeanInfo}. A class implementing this interface
024: * (typically {@link OpenMBeanInfoSupport}) should extend {@link
025: * javax.management.MBeanInfo}.</p>
026: *
027: * <p>The {@link #getAttributes()}, {@link #getOperations()} and
028: * {@link #getConstructors()} methods of the implementing class should
029: * return at runtime an array of instances of a subclass of {@link
030: * MBeanAttributeInfo}, {@link MBeanOperationInfo} or {@link
031: * MBeanConstructorInfo} respectively which implement the {@link
032: * OpenMBeanAttributeInfo}, {@link OpenMBeanOperationInfo} or {@link
033: * OpenMBeanConstructorInfo} interface respectively.
034: *
035: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
036: */
037:
038: public interface OpenMBeanInfo {
039:
040: // Re-declares the methods that are in class MBeanInfo of JMX 1.0
041: // (methods will be removed when MBeanInfo is made a parent interface of this interface)
042:
043: /**
044: * Returns the fully qualified Java class name of the open MBean
045: * instances this <tt>OpenMBeanInfo</tt> describes.
046: *
047: * @return the class name.
048: */
049: public String getClassName();
050:
051: /**
052: * Returns a human readable description of the type of open MBean
053: * instances this <tt>OpenMBeanInfo</tt> describes.
054: *
055: * @return the description.
056: */
057: public String getDescription();
058:
059: /**
060: * Returns an array of <tt>OpenMBeanAttributeInfo</tt> instances
061: * describing each attribute in the open MBean described by this
062: * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
063: * array should actually be a subclass of
064: * <tt>MBeanAttributeInfo</tt> which implements the
065: * <tt>OpenMBeanAttributeInfo</tt> interface (typically {@link
066: * OpenMBeanAttributeInfoSupport}).
067: *
068: * @return the attribute array.
069: */
070: public MBeanAttributeInfo[] getAttributes();
071:
072: /**
073: * Returns an array of <tt>OpenMBeanOperationInfo</tt> instances
074: * describing each operation in the open MBean described by this
075: * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
076: * array should actually be a subclass of
077: * <tt>MBeanOperationInfo</tt> which implements the
078: * <tt>OpenMBeanOperationInfo</tt> interface (typically {@link
079: * OpenMBeanOperationInfoSupport}).
080: *
081: * @return the operation array.
082: */
083: public MBeanOperationInfo[] getOperations();
084:
085: /**
086: * Returns an array of <tt>OpenMBeanConstructorInfo</tt> instances
087: * describing each constructor in the open MBean described by this
088: * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
089: * array should actually be a subclass of
090: * <tt>MBeanConstructorInfo</tt> which implements the
091: * <tt>OpenMBeanConstructorInfo</tt> interface (typically {@link
092: * OpenMBeanConstructorInfoSupport}).
093: *
094: * @return the constructor array.
095: */
096: public MBeanConstructorInfo[] getConstructors();
097:
098: /**
099: * Returns an array of <tt>MBeanNotificationInfo</tt> instances
100: * describing each notification emitted by the open MBean
101: * described by this <tt>OpenMBeanInfo</tt> instance.
102: *
103: * @return the notification array.
104: */
105: public MBeanNotificationInfo[] getNotifications();
106:
107: // commodity methods
108: //
109:
110: /**
111: * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanInfo</code> instance for equality.
112: * <p>
113: * Returns <tt>true</tt> if and only if all of the following statements are true:
114: * <ul>
115: * <li><var>obj</var> is non null,</li>
116: * <li><var>obj</var> also implements the <code>OpenMBeanInfo</code> interface,</li>
117: * <li>their class names are equal</li>
118: * <li>their infos on attributes, constructors, operations and notifications are equal</li>
119: * </ul>
120: * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
121: * different implementations of the <code>OpenMBeanInfo</code> interface.
122: * <br>
123: * @param obj the object to be compared for equality with this <code>OpenMBeanInfo</code> instance;
124: *
125: * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanInfo</code> instance.
126: */
127: public boolean equals(Object obj);
128:
129: /**
130: * Returns the hash code value for this <code>OpenMBeanInfo</code> instance.
131: * <p>
132: * The hash code of an <code>OpenMBeanInfo</code> instance is the sum of the hash codes
133: * of all elements of information used in <code>equals</code> comparisons
134: * (ie: its class name, and its infos on attributes, constructors, operations and notifications,
135: * where the hashCode of each of these arrays is calculated by a call to
136: * <tt>new java.util.HashSet(java.util.Arrays.asList(this.getSignature)).hashCode()</tt>).
137: * <p>
138: * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
139: * for any two <code>OpenMBeanInfo</code> instances <code>t1</code> and <code>t2</code>,
140: * as required by the general contract of the method
141: * {@link <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#hashCode()">
142: * <code>Object.hashCode</code> </a>}.
143: * <p>
144: *
145: * @return the hash code value for this <code>OpenMBeanInfo</code> instance
146: */
147: public int hashCode();
148:
149: /**
150: * Returns a string representation of this <code>OpenMBeanInfo</code> instance.
151: * <p>
152: * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanInfo</code>),
153: * the MBean class name,
154: * and the string representation of infos on attributes, constructors, operations and notifications of the described MBean.
155: *
156: * @return a string representation of this <code>OpenMBeanInfo</code> instance
157: */
158: public String toString();
159:
160: }
|