javax.management.openmbean.OpenMBeanAttributeInfo Java Examples

The following examples show how to use javax.management.openmbean.OpenMBeanAttributeInfo. 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: StandardMBean.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #2
Source File: MBeanInfoFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private OpenMBeanAttributeInfo getAttribute(String name) {
    final String escapedName = NameConverter.convertToCamelCase(name);
    ModelNode attribute = providedDescription.require(ATTRIBUTES).require(name);
    AttributeAccess access = resourceRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, name);
    if (access == null) {
        // Check for a bogus attribute in the description that's really a child
        Set<String> childTypes = resourceRegistration.getChildNames(PathAddress.EMPTY_ADDRESS);
        if (childTypes.contains(name)) {
            return null;
        }
    }
    final boolean writable = mutabilityChecker.mutable(pathAddress) && (access != null && access.getAccessType() == AccessType.READ_WRITE);

    return new OpenMBeanAttributeInfoSupport(
            escapedName,
            getDescription(attribute),
            converters.convertToMBeanType(attribute),
            true,
            writable,
            false,
            createAttributeDescriptor(attribute));
}
 
Example #3
Source File: StandardMBean.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #4
Source File: StandardMBean.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #5
Source File: StandardMBean.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #6
Source File: StandardMBean.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #7
Source File: StandardMBean.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #8
Source File: StandardMBean.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #9
Source File: StandardMBean.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #10
Source File: StandardMBean.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #11
Source File: StandardMBean.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #12
Source File: StandardMBean.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #13
Source File: StandardMBean.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #14
Source File: StandardMBean.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #15
Source File: StandardMBean.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #16
Source File: StandardMBean.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #17
Source File: StandardMBean.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #18
Source File: MBeanInfoFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private OpenMBeanAttributeInfo[] getAttributes() {
    List<OpenMBeanAttributeInfo> infos = new LinkedList<OpenMBeanAttributeInfo>();
    if (providedDescription.hasDefined(ATTRIBUTES)) {
        for (final String name : providedDescription.require(ATTRIBUTES).keys()) {
            OpenMBeanAttributeInfo attributeInfo = getAttribute(name);
            if (attributeInfo != null) {
                infos.add(getAttribute(name));
            }
        }
    }
    return infos.toArray(new OpenMBeanAttributeInfo[infos.size()]);
}
 
Example #19
Source File: ModelControllerMBeanTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void checkMBeanInfoAttributes(MBeanInfo info, boolean writable, boolean expressions) {
    //All attributes should be read-only
    MBeanAttributeInfo[] attributes = info.getAttributes();
    Assert.assertEquals(14, attributes.length);
    Arrays.sort(attributes, new Comparator<MBeanAttributeInfo>() {
        @Override
        public int compare(MBeanAttributeInfo o1, MBeanAttributeInfo o2) {
            return o1.getName().compareTo(o2.getName());
        }
    });
    assertAttributeDescription(attributes[0], "bigdec", expressions ? String.class.getName() : BigDecimal.class.getName(), "bigdec", true, writable);
    assertAttributeDescription(attributes[1], "bigint", expressions ? String.class.getName() : BigInteger.class.getName(), "bigint", true, writable);
    assertAttributeDescription(attributes[2], "boolean", expressions ? String.class.getName() : Boolean.class.getName(), "boolean", true, writable);
    assertAttributeDescription(attributes[3], "bytes", byte[].class.getName(), "bytes", true, writable);
    checkComplexTypeInfo(assertCast(CompositeType.class, assertCast(OpenMBeanAttributeInfo.class, attributes[4]).getOpenType()), expressions, "complex.");
    assertAttributeDescription(attributes[5], "double", expressions ? String.class.getName() : Double.class.getName(), "double", true, writable);
    assertAttributeDescription(attributes[6], "int", expressions ? String.class.getName() : Integer.class.getName(), "int", true, writable);
    assertAttributeDescription(attributes[7], "list", expressions ? String[].class.getName() : Integer[].class.getName(), "list", true, writable);
    assertAttributeDescription(attributes[8], "long", expressions ? String.class.getName() : Long.class.getName(), "long", true, writable);
    //type=OBJECT, value-type=a simple type -> a map
    assertAttributeDescription(attributes[9], "map", TabularData.class.getName(), "map", true, writable);
    assertMapType(assertCast(OpenMBeanAttributeInfo.class, attributes[9]).getOpenType(), SimpleType.STRING, expressions ? SimpleType.STRING : SimpleType.INTEGER);
    assertAttributeDescription(attributes[10], "roInt", expressions ? String.class.getName() : Integer.class.getName(), "ro-int", true, false);
    assertAttributeDescription(attributes[11], "string", expressions ? String.class.getName() : String.class.getName(), "string", true, writable);
    assertAttributeDescription(attributes[12], "type", String.class.getName(), "type", true, writable);
    assertAttributeDescription(attributes[13], "undefinedInt", expressions ? String.class.getName() : Integer.class.getName(), "undefined-int", true, writable);

}
 
Example #20
Source File: ModelControllerMBeanTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private OpenMBeanAttributeInfo findAttribute(MBeanAttributeInfo[] attrs, String name) {
    for (MBeanAttributeInfo attr : attrs) {
        Assert.assertNotNull(attr.getName());
        if (attr.getName().equals(name)) {
            return assertCast(OpenMBeanAttributeInfo.class, attr);
        }
    }
    Assert.fail("No attr called " + name);
    return null;
}