java类javax.management.ImmutableDescriptor的实例源码

MBeanIntrospector.java 文件源码 项目:OpenJSharp 阅读 25 收藏 0 点赞 0 评论 0
/** 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);
}
DescriptorCache.java 文件源码 项目:OpenJSharp 阅读 18 收藏 0 点赞 0 评论 0
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;
}
OpenMBeanParameterInfoSupport.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Constructs an {@code OpenMBeanParameterInfoSupport} instance,
 * which describes the parameter used in one or more operations or
 * constructors of a class of open MBeans, with the specified
 * {@code name}, {@code openType}, {@code description},
 * and {@code descriptor}.
 *
 * <p>The {@code descriptor} can contain entries that will define
 * the values returned by certain methods of this class, as
 * explained in the <a href="package-summary.html#constraints">
 * package description</a>.
 *
 * @param name  cannot be a null or empty string.
 *
 * @param description  cannot be a null or empty string.
 *
 * @param openType  cannot be null.
 *
 * @param descriptor The descriptor for the parameter.  This may be null
 * which is equivalent to an empty descriptor.
 *
 * @throws IllegalArgumentException if {@code name} or {@code
 * description} are null or empty string, or {@code openType} is
 * null, or the descriptor entries are invalid as described in the
 * <a href="package-summary.html#constraints">package
 * description</a>.
 *
 * @since 1.6
 */
public OpenMBeanParameterInfoSupport(String name,
                                     String description,
                                     OpenType<?> openType,
                                     Descriptor descriptor) {


    // Construct parent's state
    //
    super(name,
          (openType==null) ? null : openType.getClassName(),
          description,
          ImmutableDescriptor.union(descriptor,(openType==null)?null:
            openType.getDescriptor()));

    // Initialize this instance's specific state
    //
    this.openType = openType;

    descriptor = getDescriptor();  // replace null by empty
    this.defaultValue = valueFrom(descriptor, "defaultValue", openType);
    this.legalValues = valuesFrom(descriptor, "legalValues", openType);
    this.minValue = comparableValueFrom(descriptor, "minValue", openType);
    this.maxValue = comparableValueFrom(descriptor, "maxValue", openType);

    try {
        check(this);
    } catch (OpenDataException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}
StandardMBeanIntrospector.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
@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;
}
MXBeanIntrospector.java 文件源码 项目:jdk8u-jdk 阅读 26 收藏 0 点赞 0 评论 0
@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;
}
MXBeanIntrospector.java 文件源码 项目:jdk8u-jdk 阅读 24 收藏 0 点赞 0 评论 0
private static Descriptor typeDescriptor(OpenType<?> openType,
                                         Type originalType) {
    return new ImmutableDescriptor(
        new String[] {"openType",
                      "originalType"},
        new Object[] {openType,
                      originalTypeString(originalType)});
}
MBeanIntrospector.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
/** 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);
}
DescriptorCache.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
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;
}
OpenMBeanParameterInfoSupport.java 文件源码 项目:jdk8u-jdk 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Constructs an {@code OpenMBeanParameterInfoSupport} instance,
 * which describes the parameter used in one or more operations or
 * constructors of a class of open MBeans, with the specified
 * {@code name}, {@code openType}, {@code description},
 * and {@code descriptor}.
 *
 * <p>The {@code descriptor} can contain entries that will define
 * the values returned by certain methods of this class, as
 * explained in the <a href="package-summary.html#constraints">
 * package description</a>.
 *
 * @param name  cannot be a null or empty string.
 *
 * @param description  cannot be a null or empty string.
 *
 * @param openType  cannot be null.
 *
 * @param descriptor The descriptor for the parameter.  This may be null
 * which is equivalent to an empty descriptor.
 *
 * @throws IllegalArgumentException if {@code name} or {@code
 * description} are null or empty string, or {@code openType} is
 * null, or the descriptor entries are invalid as described in the
 * <a href="package-summary.html#constraints">package
 * description</a>.
 *
 * @since 1.6
 */
public OpenMBeanParameterInfoSupport(String name,
                                     String description,
                                     OpenType<?> openType,
                                     Descriptor descriptor) {


    // Construct parent's state
    //
    super(name,
          (openType==null) ? null : openType.getClassName(),
          description,
          ImmutableDescriptor.union(descriptor,(openType==null)?null:
            openType.getDescriptor()));

    // Initialize this instance's specific state
    //
    this.openType = openType;

    descriptor = getDescriptor();  // replace null by empty
    this.defaultValue = valueFrom(descriptor, "defaultValue", openType);
    this.legalValues = valuesFrom(descriptor, "legalValues", openType);
    this.minValue = comparableValueFrom(descriptor, "minValue", openType);
    this.maxValue = comparableValueFrom(descriptor, "maxValue", openType);

    try {
        check(this);
    } catch (OpenDataException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}
Basic.java 文件源码 项目:jdk8u-jdk 阅读 36 收藏 0 点赞 0 评论 0
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);
}


问题


面经


文章

微信
公众号

扫码关注公众号