javax.management.ImmutableDescriptor Java Examples
The following examples show how to use
javax.management.ImmutableDescriptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void check(Object x, Descriptor d, Descriptor expect) { String fail = null; try { Descriptor u = ImmutableDescriptor.union(d, expect); if (!u.equals(d)) fail = "should contain " + expect + "; is " + d; } catch (IllegalArgumentException e) { fail = e.getMessage(); } if (fail == null) { System.out.println("OK: " + x); } else { failed = "NOT OK: Incorrect descriptor for: " + x; System.out.println(failed); System.out.println("..." + fail); } }
Example #2
Source File: OpenMBeanAttributeInfoSupport.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
static <T> Descriptor makeDescriptor(OpenType<T> openType, T defaultValue, T[] legalValues, Comparable<T> minValue, Comparable<T> maxValue) { Map<String, Object> map = new HashMap<String, Object>(); if (defaultValue != null) map.put("defaultValue", defaultValue); if (legalValues != null) { Set<T> set = new HashSet<T>(); for (T v : legalValues) set.add(v); set = Collections.unmodifiableSet(set); map.put("legalValues", set); } if (minValue != null) map.put("minValue", minValue); if (maxValue != null) map.put("maxValue", maxValue); if (map.isEmpty()) { return openType.getDescriptor(); } else { map.put("openType", openType); return new ImmutableDescriptor(map); } }
Example #3
Source File: OpenMBeanAttributeInfoSupport.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static <T> Descriptor makeDescriptor(OpenType<T> openType, T defaultValue, T[] legalValues, Comparable<T> minValue, Comparable<T> maxValue) { Map<String, Object> map = new HashMap<String, Object>(); if (defaultValue != null) map.put("defaultValue", defaultValue); if (legalValues != null) { Set<T> set = new HashSet<T>(); for (T v : legalValues) set.add(v); set = Collections.unmodifiableSet(set); map.put("legalValues", set); } if (minValue != null) map.put("minValue", minValue); if (maxValue != null) map.put("maxValue", maxValue); if (map.isEmpty()) { return openType.getDescriptor(); } else { map.put("openType", openType); return new ImmutableDescriptor(map); } }
Example #4
Source File: OpenMBeanAttributeInfoSupport.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static <T> Descriptor makeDescriptor(OpenType<T> openType, T defaultValue, T[] legalValues, Comparable<T> minValue, Comparable<T> maxValue) { Map<String, Object> map = new HashMap<String, Object>(); if (defaultValue != null) map.put("defaultValue", defaultValue); if (legalValues != null) { Set<T> set = new HashSet<T>(); for (T v : legalValues) set.add(v); set = Collections.unmodifiableSet(set); map.put("legalValues", set); } if (minValue != null) map.put("minValue", minValue); if (maxValue != null) map.put("maxValue", maxValue); if (map.isEmpty()) { return openType.getDescriptor(); } else { map.put("openType", openType); return new ImmutableDescriptor(map); } }
Example #5
Source File: AnnotationTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void check(Object x, Descriptor d, Descriptor expect) { String fail = null; try { Descriptor u = ImmutableDescriptor.union(d, expect); if (!u.equals(d)) fail = "should contain " + expect + "; is " + d; } catch (IllegalArgumentException e) { fail = e.getMessage(); } if (fail == null) { System.out.println("OK: " + x); } else { failed = "NOT OK: Incorrect descriptor for: " + x; System.out.println(failed); System.out.println("..." + fail); } }
Example #6
Source File: OpenMBeanAttributeInfoSupport.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
static <T> Descriptor makeDescriptor(OpenType<T> openType, T defaultValue, T[] legalValues, Comparable<T> minValue, Comparable<T> maxValue) { Map<String, Object> map = new HashMap<String, Object>(); if (defaultValue != null) map.put("defaultValue", defaultValue); if (legalValues != null) { Set<T> set = new HashSet<T>(); for (T v : legalValues) set.add(v); set = Collections.unmodifiableSet(set); map.put("legalValues", set); } if (minValue != null) map.put("minValue", minValue); if (maxValue != null) map.put("maxValue", maxValue); if (map.isEmpty()) { return openType.getDescriptor(); } else { map.put("openType", openType); return new ImmutableDescriptor(map); } }
Example #7
Source File: OpenMBeanAttributeInfoSupport.java From JDKSourceCode1.8 with MIT License | 6 votes |
static <T> Descriptor makeDescriptor(OpenType<T> openType, T defaultValue, T[] legalValues, Comparable<T> minValue, Comparable<T> maxValue) { Map<String, Object> map = new HashMap<String, Object>(); if (defaultValue != null) map.put("defaultValue", defaultValue); if (legalValues != null) { Set<T> set = new HashSet<T>(); for (T v : legalValues) set.add(v); set = Collections.unmodifiableSet(set); map.put("legalValues", set); } if (minValue != null) map.put("minValue", minValue); if (maxValue != null) map.put("maxValue", maxValue); if (map.isEmpty()) { return openType.getDescriptor(); } else { map.put("openType", openType); return new ImmutableDescriptor(map); } }
Example #8
Source File: AnnotationTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static void check(Object x, Descriptor d, Descriptor expect) { String fail = null; try { Descriptor u = ImmutableDescriptor.union(d, expect); if (!u.equals(d)) fail = "should contain " + expect + "; is " + d; } catch (IllegalArgumentException e) { fail = e.getMessage(); } if (fail == null) { System.out.println("OK: " + x); } else { failed = "NOT OK: Incorrect descriptor for: " + x; System.out.println(failed); System.out.println("..." + fail); } }
Example #9
Source File: OpenMBeanAttributeInfoSupport.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
static <T> Descriptor makeDescriptor(OpenType<T> openType, T defaultValue, T[] legalValues, Comparable<T> minValue, Comparable<T> maxValue) { Map<String, Object> map = new HashMap<String, Object>(); if (defaultValue != null) map.put("defaultValue", defaultValue); if (legalValues != null) { Set<T> set = new HashSet<T>(); for (T v : legalValues) set.add(v); set = Collections.unmodifiableSet(set); map.put("legalValues", set); } if (minValue != null) map.put("minValue", minValue); if (maxValue != null) map.put("maxValue", maxValue); if (map.isEmpty()) { return openType.getDescriptor(); } else { map.put("openType", openType); return new ImmutableDescriptor(map); } }
Example #10
Source File: StandardMBeanIntrospector.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override Descriptor getBasicMBeanDescriptor() { /* We don't bother saying mxbean=false, and we can't know whether the info is immutable until we know whether the MBean class (not interface) is a NotificationBroadcaster. */ return ImmutableDescriptor.EMPTY_DESCRIPTOR; }
Example #11
Source File: MXBeanIntrospector.java From hottub with GNU General Public License v2.0 | 5 votes |
private static Descriptor typeDescriptor(OpenType<?> openType, Type originalType) { return new ImmutableDescriptor( new String[] {"openType", "originalType"}, new Object[] {openType, originalTypeString(originalType)}); }
Example #12
Source File: UnionTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void checkEquivalent(ImmutableDescriptor d, ImmutableDescriptor e) { if (!d.equals(e)) { failure = "Union produced this: " + d + "; but should have " + "produced this: " + e; System.err.println("FAILED: " + failure); Thread.dumpStack(); } }
Example #13
Source File: UnionTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void checkEmpty(ImmutableDescriptor d) { if (d != EMPTY_DESCRIPTOR) { failure = "Union of empty descriptors should be " + "ImmutableDescriptor.EMPTY"; System.err.println("FAILED: " + failure); Thread.dumpStack(); } }
Example #14
Source File: Basic.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void initNotifDescriptorAtt() { String key = "CRABE"; String value = "TAMBOUR"; notifDescriptorAtt = new ImmutableDescriptor(new String[]{key + "=" + value}); notifDescriptorAsMapAtt = new HashMap<String, String>(); notifDescriptorAsMapAtt.put(key, value); }
Example #15
Source File: ReflectionMBeanAttribute.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
public ReflectionMBeanAttribute build() { checkState(name != null); checkState(target != null); checkState(getter != null || setter != null); Descriptor getterDescriptor = null; if (getter != null) { getterDescriptor = DescriptorHelper.build(getter); } Descriptor setterDescriptor = null; if (setter != null) { setterDescriptor = DescriptorHelper.build(setter); } MBeanAttributeInfo info = new MBeanAttributeInfo( name, attributeType(getter, setter).getName(), description, getter != null, // readable setter != null, // writable isIs(getter), ImmutableDescriptor.union(getterDescriptor, setterDescriptor) ); log.trace("Building attribute with info: {}", info); return new ReflectionMBeanAttribute(info, target, getter, setter); }
Example #16
Source File: UnionTest.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void checkEqual(ImmutableDescriptor d, ImmutableDescriptor e) { if (d != e) { failure = "Union should produce one of its arguments but does not"; System.err.println("FAILED: " + failure); Thread.dumpStack(); } }
Example #17
Source File: StandardMBeanIntrospector.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override Descriptor getBasicMBeanDescriptor() { /* We don't bother saying mxbean=false, and we can't know whether the info is immutable until we know whether the MBean class (not interface) is a NotificationBroadcaster. */ return ImmutableDescriptor.EMPTY_DESCRIPTOR; }
Example #18
Source File: MXBeanIntrospector.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static Descriptor typeDescriptor(OpenType<?> openType, Type originalType) { return new ImmutableDescriptor( new String[] {"openType", "originalType"}, new Object[] {openType, originalTypeString(originalType)}); }
Example #19
Source File: Basic.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void initNotifDescriptorAtt() { String key = "CRABE"; String value = "TAMBOUR"; notifDescriptorAtt = new ImmutableDescriptor(new String[]{key + "=" + value}); notifDescriptorAsMapAtt = new HashMap<String, String>(); notifDescriptorAsMapAtt.put(key, value); }
Example #20
Source File: DescriptorCache.java From hottub with GNU General Public License v2.0 | 5 votes |
public ImmutableDescriptor get(ImmutableDescriptor descriptor) { WeakReference<ImmutableDescriptor> wr = map.get(descriptor); ImmutableDescriptor got = (wr == null) ? null : wr.get(); if (got != null) return got; map.put(descriptor, new WeakReference<ImmutableDescriptor>(descriptor)); return descriptor; }
Example #21
Source File: MXBeanIntrospector.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override Descriptor getMBeanDescriptor(Class<?> resourceClass) { /* We already have immutableInfo=true in the Descriptor * included in the MBeanInfo for the MXBean interface. This * method is being called for the MXBean *class* to add any * new items beyond those in the interface Descriptor, which * currently it does not. */ return ImmutableDescriptor.EMPTY_DESCRIPTOR; }
Example #22
Source File: MBeanIntrospector.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** Make an MBeanInfo based on the attributes and operations * found in the interface. */ MBeanInfo makeMBeanInfo(Class<?> mbeanInterface, String description) { final MBeanAttributeInfo[] attrArray = attrs.toArray(new MBeanAttributeInfo[0]); final MBeanOperationInfo[] opArray = ops.toArray(new MBeanOperationInfo[0]); final String interfaceClassName = "interfaceClassName=" + mbeanInterface.getName(); final Descriptor classNameDescriptor = new ImmutableDescriptor(interfaceClassName); final Descriptor mbeanDescriptor = getBasicMBeanDescriptor(); final Descriptor annotatedDescriptor = Introspector.descriptorForElement(mbeanInterface); final Descriptor descriptor = DescriptorCache.getInstance().union( classNameDescriptor, mbeanDescriptor, annotatedDescriptor); return new MBeanInfo(mbeanInterface.getName(), description, attrArray, null, opArray, null, descriptor); }
Example #23
Source File: UnionTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkEquivalent(ImmutableDescriptor d, ImmutableDescriptor e) { if (!d.equals(e)) { failure = "Union produced this: " + d + "; but should have " + "produced this: " + e; System.err.println("FAILED: " + failure); Thread.dumpStack(); } }
Example #24
Source File: MXBeanIntrospector.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override Descriptor getMBeanDescriptor(Class<?> resourceClass) { /* We already have immutableInfo=true in the Descriptor * included in the MBeanInfo for the MXBean interface. This * method is being called for the MXBean *class* to add any * new items beyond those in the interface Descriptor, which * currently it does not. */ return ImmutableDescriptor.EMPTY_DESCRIPTOR; }
Example #25
Source File: MXBeanIntrospector.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override Descriptor getMBeanDescriptor(Class<?> resourceClass) { /* We already have immutableInfo=true in the Descriptor * included in the MBeanInfo for the MXBean interface. This * method is being called for the MXBean *class* to add any * new items beyond those in the interface Descriptor, which * currently it does not. */ return ImmutableDescriptor.EMPTY_DESCRIPTOR; }
Example #26
Source File: MBeanIntrospector.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** Make an MBeanInfo based on the attributes and operations * found in the interface. */ MBeanInfo makeMBeanInfo(Class<?> mbeanInterface, String description) { final MBeanAttributeInfo[] attrArray = attrs.toArray(new MBeanAttributeInfo[0]); final MBeanOperationInfo[] opArray = ops.toArray(new MBeanOperationInfo[0]); final String interfaceClassName = "interfaceClassName=" + mbeanInterface.getName(); final Descriptor classNameDescriptor = new ImmutableDescriptor(interfaceClassName); final Descriptor mbeanDescriptor = getBasicMBeanDescriptor(); final Descriptor annotatedDescriptor = Introspector.descriptorForElement(mbeanInterface); final Descriptor descriptor = DescriptorCache.getInstance().union( classNameDescriptor, mbeanDescriptor, annotatedDescriptor); return new MBeanInfo(mbeanInterface.getName(), description, attrArray, null, opArray, null, descriptor); }
Example #27
Source File: UnionTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void checkEmpty(ImmutableDescriptor d) { if (d != EMPTY_DESCRIPTOR) { failure = "Union of empty descriptors should be " + "ImmutableDescriptor.EMPTY"; System.err.println("FAILED: " + failure); Thread.dumpStack(); } }
Example #28
Source File: UnionTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void checkEquivalent(ImmutableDescriptor d, ImmutableDescriptor e) { if (!d.equals(e)) { failure = "Union produced this: " + d + "; but should have " + "produced this: " + e; System.err.println("FAILED: " + failure); Thread.dumpStack(); } }
Example #29
Source File: UnionTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkEmpty(ImmutableDescriptor d) { if (d != EMPTY_DESCRIPTOR) { failure = "Union of empty descriptors should be " + "ImmutableDescriptor.EMPTY"; System.err.println("FAILED: " + failure); Thread.dumpStack(); } }
Example #30
Source File: UnionTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void checkEmpty(ImmutableDescriptor d) { if (d != EMPTY_DESCRIPTOR) { failure = "Union of empty descriptors should be " + "ImmutableDescriptor.EMPTY"; System.err.println("FAILED: " + failure); Thread.dumpStack(); } }