diff options
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | javax/management/MBeanAttributeInfo.java | 33 | ||||
-rw-r--r-- | javax/management/MBeanConstructorInfo.java | 29 | ||||
-rw-r--r-- | javax/management/MBeanFeatureInfo.java | 31 | ||||
-rw-r--r-- | javax/management/MBeanInfo.java | 36 | ||||
-rw-r--r-- | javax/management/MBeanNotificationInfo.java | 29 | ||||
-rw-r--r-- | javax/management/MBeanOperationInfo.java | 49 | ||||
-rw-r--r-- | javax/management/MBeanParameterInfo.java | 28 | ||||
-rw-r--r-- | javax/management/StandardMBean.java | 14 |
9 files changed, 266 insertions, 4 deletions
@@ -1,3 +1,24 @@ +2006-08-03 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * examples/gnu/classpath/examples/management/TestBeans.java: + New file. + * javax/management/MBeanAttributeInfo.java: + (toString()): Implemented. + * javax/management/MBeanConstructorInfo.java: + (toString()): Implemented. + * javax/management/MBeanFeatureInfo.java: + (toString()): Implemented. + * javax/management/MBeanInfo.java: + (toString()): Implemented. + * javax/management/MBeanNotificationInfo.java: + (toString()): Implemented. + * javax/management/MBeanOperationInfo.java: + (toString()): Implemented. + * javax/management/MBeanParameterInfo.java: + (toString()): Implemented. + * javax/management/StandardMBean.java: + (getMBeanInfo()): Fix attribute naming. + 2006-08-02 Mark Wielaard <mark@klomp.org> PR 28535 diff --git a/javax/management/MBeanAttributeInfo.java b/javax/management/MBeanAttributeInfo.java index 3f0b16274..bded7e41a 100644 --- a/javax/management/MBeanAttributeInfo.java +++ b/javax/management/MBeanAttributeInfo.java @@ -265,4 +265,37 @@ public class MBeanAttributeInfo return isWrite; } + /** + * <p> + * Returns a textual representation of this instance. This + * is constructed using the class name + * (<code>javax.management.MBeanAttributeInfo</code>), + * the name, description and type of the attribute and the + * current settings of the {@link #isReadable()}, + * {@link #isWritable()} and {@link #isIs()} properties. + * </p> + * <p> + * As instances of this class are immutable, the return value + * is computed just once for each instance and reused + * throughout its life. + * </p> + * + * @return a @link{java.lang.String} instance representing + * the instance in textual form. + */ + public String toString() + { + if (string == null) + { + super.toString(); + string = string.substring(0, string.length() - 1) + + ",type=" + attributeType + + ",isReadable=" + (isRead ? "yes" : "no") + + ",isWritable=" + (isWrite ? "yes" : "no") + + ",isIs=" + (is ? "yes" : "no") + + "]"; + } + return string; + } + } diff --git a/javax/management/MBeanConstructorInfo.java b/javax/management/MBeanConstructorInfo.java index 22dd7d404..832a3296d 100644 --- a/javax/management/MBeanConstructorInfo.java +++ b/javax/management/MBeanConstructorInfo.java @@ -196,4 +196,33 @@ public class MBeanConstructorInfo return super.hashCode() + Arrays.hashCode(signature); } + /** + * <p> + * Returns a textual representation of this instance. This + * is constructed using the class name + * (<code>javax.management.MBeanConstructorInfo</code>), + * the name and description of the constructor and the + * contents of the array of parameters. + * </p> + * <p> + * As instances of this class are immutable, the return value + * is computed just once for each instance and reused + * throughout its life. + * </p> + * + * @return a @link{java.lang.String} instance representing + * the instance in textual form. + */ + public String toString() + { + if (string == null) + { + super.toString(); + string = string.substring(0, string.length() - 1) + + ",signature=" + Arrays.toString(signature) + + "]"; + } + return string; + } + } diff --git a/javax/management/MBeanFeatureInfo.java b/javax/management/MBeanFeatureInfo.java index 79acc7b39..4f0243e18 100644 --- a/javax/management/MBeanFeatureInfo.java +++ b/javax/management/MBeanFeatureInfo.java @@ -77,6 +77,11 @@ public class MBeanFeatureInfo protected String name; /** + * The <code>toString()</code> result of this instance. + */ + protected transient String string; + + /** * Constructs a new {@link MBeanFeatureInfo} with the specified * name and description. * @@ -152,4 +157,30 @@ public class MBeanFeatureInfo + (description == null ? -1 : description.hashCode()); } + /** + * <p> + * Returns a textual representation of this instance. This + * is constructed using the class name + * (<code>javax.management.MBeanFeatureInfo</code>) and + * the name and description of the feature. + * </p> + * <p> + * As instances of this class are immutable, the return value + * is computed just once for each instance and reused + * throughout its life. + * </p> + * + * @return a @link{java.lang.String} instance representing + * the instance in textual form. + */ + public String toString() + { + if (string == null) + string = getClass().getName() + + "[name=" + name + + ",desc=" + description + + "]"; + return string; + } + } diff --git a/javax/management/MBeanInfo.java b/javax/management/MBeanInfo.java index 439272f7d..e6f03f065 100644 --- a/javax/management/MBeanInfo.java +++ b/javax/management/MBeanInfo.java @@ -128,6 +128,11 @@ public class MBeanInfo private MBeanNotificationInfo[] notifications; /** + * The <code>toString()</code> result of this instance. + */ + private transient String string; + + /** * Constructs a new {@link MBeanInfo} using the supplied * class name and description with the given attributes, * operations, constructors and notifications. The class @@ -358,4 +363,35 @@ public class MBeanInfo + Arrays.hashCode(operations) + Arrays.hashCode(notifications); } + /** + * <p> + * Returns a textual representation of this instance. This + * is constructed using the class name + * (<code>javax.management.MBeanInfo</code>), + * the name and description of the bean and the contents + * of the four arrays. + * </p> + * <p> + * As instances of this class are immutable, the return value + * is computed just once for each instance and reused + * throughout its life. + * </p> + * + * @return a @link{java.lang.String} instance representing + * the instance in textual form. + */ + public String toString() + { + if (string == null) + string = getClass().getName() + + "[name=" + className + + ",desc=" + description + + ",attributes=" + Arrays.toString(attributes) + + ",constructors=" + Arrays.toString(constructors) + + ",operations=" + Arrays.toString(operations) + + ",notifications=" + Arrays.toString(notifications) + + "]"; + return string; + } + } diff --git a/javax/management/MBeanNotificationInfo.java b/javax/management/MBeanNotificationInfo.java index 1e02f763b..ba4077e8f 100644 --- a/javax/management/MBeanNotificationInfo.java +++ b/javax/management/MBeanNotificationInfo.java @@ -195,4 +195,33 @@ public class MBeanNotificationInfo return super.hashCode() + Arrays.hashCode(types); } + /** + * <p> + * Returns a textual representation of this instance. This + * is constructed using the class name + * (<code>javax.management.MBeanNotificationInfo</code>), + * the name and description of the notification and the + * contents of the array of types. + * </p> + * <p> + * As instances of this class are immutable, the return value + * is computed just once for each instance and reused + * throughout its life. + * </p> + * + * @return a @link{java.lang.String} instance representing + * the instance in textual form. + */ + public String toString() + { + if (string == null) + { + super.toString(); + string = string.substring(0, string.length() - 1) + + ",types=" + Arrays.toString(types) + + "]"; + } + return string; + } + } diff --git a/javax/management/MBeanOperationInfo.java b/javax/management/MBeanOperationInfo.java index 9317d9a06..a2db8d1b0 100644 --- a/javax/management/MBeanOperationInfo.java +++ b/javax/management/MBeanOperationInfo.java @@ -292,4 +292,53 @@ public class MBeanOperationInfo + type.hashCode() + Integer.valueOf(impact).hashCode(); } + /** + * <p> + * Returns a textual representation of this instance. This + * is constructed using the class name + * (<code>javax.management.MBeanOperationInfo</code>), + * the name, description, return type and impact of the + * operation and the contents of the array of parameters. + * </p> + * <p> + * As instances of this class are immutable, the return value + * is computed just once for each instance and reused + * throughout its life. + * </p> + * + * @return a @link{java.lang.String} instance representing + * the instance in textual form. + */ + public String toString() + { + if (string == null) + { + String impactString; + switch (impact) + { + case INFO: + impactString = "INFO"; + break; + case ACTION: + impactString = "ACTION"; + break; + case ACTION_INFO: + impactString = "ACTION_INFO"; + break; + case UNKNOWN: + impactString = "UNKNOWN"; + break; + default: + impactString = "ERRONEOUS VALUE"; + } + super.toString(); + string = string.substring(0, string.length() - 1) + + ",returnType=" + type + + ",impact=" + impactString + + ",signature=" + Arrays.toString(signature) + + "]"; + } + return string; + } + } diff --git a/javax/management/MBeanParameterInfo.java b/javax/management/MBeanParameterInfo.java index 227e14c7e..ee6ef99b8 100644 --- a/javax/management/MBeanParameterInfo.java +++ b/javax/management/MBeanParameterInfo.java @@ -145,4 +145,32 @@ public class MBeanParameterInfo return super.hashCode() + type.hashCode(); } + /** + * <p> + * Returns a textual representation of this instance. This + * is constructed using the class name + * (<code>javax.management.MBeanParameterInfo</code>) along + * with the name, description and type of the parameter. + * </p> + * <p> + * As instances of this class are immutable, the return value + * is computed just once for each instance and reused + * throughout its life. + * </p> + * + * @return a @link{java.lang.String} instance representing + * the instance in textual form. + */ + public String toString() + { + if (string == null) + { + super.toString(); + string = string.substring(0, string.length() - 1) + + ",type=" + type + + "]"; + } + return string; + } + } diff --git a/javax/management/StandardMBean.java b/javax/management/StandardMBean.java index a8c8db701..736192ee2 100644 --- a/javax/management/StandardMBean.java +++ b/javax/management/StandardMBean.java @@ -562,7 +562,13 @@ public class StandardMBean methods[a].getParameterTypes().length == 0) { Method[] amethods; - String attrib = name.substring(3); + String attrib; + if (name.startsWith("is")) + attrib = name.substring(2,3).toLowerCase() + + name.substring(3); + else + attrib = name.substring(3,4).toLowerCase() + + name.substring(4); if (attributes.containsKey(attrib)) amethods = (Method[]) attributes.get(attrib); else @@ -577,7 +583,8 @@ public class StandardMBean methods[a].getParameterTypes().length == 1) { Method[] amethods; - String attrib = name.substring(3); + String attrib = name.substring(3,4).toLowerCase() + + name.substring(4); if (attributes.containsKey(attrib)) amethods = (Method[]) attributes.get(attrib); else @@ -625,8 +632,7 @@ public class StandardMBean MBeanConstructorInfo[] cinfo = new MBeanConstructorInfo[cons.length]; for (int a = 0; a < cinfo.length; ++a) { - MBeanConstructorInfo oldInfo = new MBeanConstructorInfo("", - cons[a]); + MBeanConstructorInfo oldInfo = new MBeanConstructorInfo("", cons[a]); String desc = getDescription(oldInfo); MBeanParameterInfo[] params = oldInfo.getSignature(); MBeanParameterInfo[] pinfo = new MBeanParameterInfo[params.length]; |