use of javax.management.MBeanAttributeInfo in project spring-framework by spring-projects.
the class InterfaceBasedMBeanInfoAssemblerMappedTests method testNickNameIsExposed.
@Test
public void testNickNameIsExposed() throws Exception {
ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
MBeanAttributeInfo attr = inf.getAttribute("NickName");
assertNickName(attr);
}
use of javax.management.MBeanAttributeInfo in project spring-framework by spring-projects.
the class InterfaceBasedMBeanInfoAssemblerMappedTests method testWithFallThrough.
@Test
public void testWithFallThrough() throws Exception {
InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("foobar", "org.springframework.jmx.export.assembler.ICustomJmxBean");
assembler.setManagedInterfaces(new Class<?>[] { IAdditionalTestMethods.class });
ModelMBeanInfo inf = assembler.getMBeanInfo(getBean(), getObjectName());
MBeanAttributeInfo attr = inf.getAttribute("NickName");
assertNickName(attr);
}
use of javax.management.MBeanAttributeInfo in project spring-framework by spring-projects.
the class MethodExclusionMBeanInfoAssemblerMappedTests method testNickNameIsExposed.
@Test
public void testNickNameIsExposed() throws Exception {
ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
MBeanAttributeInfo attr = inf.getAttribute("NickName");
assertNotNull("Nick Name should not be null", attr);
assertTrue("Nick Name should be writable", attr.isWritable());
assertTrue("Nick Name should be readable", attr.isReadable());
}
use of javax.management.MBeanAttributeInfo in project spring-framework by spring-projects.
the class MethodExclusionMBeanInfoAssemblerNotMappedTests method testNickNameIsExposed.
@Test
public void testNickNameIsExposed() throws Exception {
ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
MBeanAttributeInfo attr = inf.getAttribute("NickName");
assertNotNull("Nick Name should not be null", attr);
assertTrue("Nick Name should be writable", attr.isWritable());
assertTrue("Nick Name should be readable", attr.isReadable());
}
use of javax.management.MBeanAttributeInfo in project opennms by OpenNMS.
the class MBeanServerQuery method execute.
public QueryResult execute(MBeanServerConnection mbeanServerConnection) throws MBeanServerQueryException {
try {
if (filterCriteriaList.isEmpty()) {
filterCriteriaList.add(new FilterCriteria());
}
// retrieve all Mbeans
QueryResult queryResult = executeQuery(filterCriteriaList, mbeanServerConnection);
queryResult.setTotalMBeanCount(mbeanServerConnection.getMBeanCount());
// retrieve all ignoring Mbeans
QueryResult ignoreResult = executeQuery(ignoreFilterList, mbeanServerConnection);
// filter out all ignored attributes
for (QueryResult.MBeanResult eachResult : ignoreResult.getMBeanResults()) {
for (MBeanAttributeInfo eachAttribute : eachResult.attributeResult.attributes) {
queryResult.remove(eachResult.objectName, eachAttribute);
}
}
// now build the result
if (!showEmptyMbeans) {
queryResult.removeEmptyMBeanResults();
}
if (sort) {
queryResult.sort();
}
if (fetchValues) {
for (QueryResult.MBeanResult eachMbeanResult : queryResult.getMBeanResults()) {
QueryResult.AttributeResult attributeResult = eachMbeanResult.attributeResult;
for (MBeanAttributeInfo eachAttribute : attributeResult.attributes) {
if (eachAttribute.isReadable()) {
try {
Object value = mbeanServerConnection.getAttribute(eachMbeanResult.objectName, eachAttribute.getName());
attributeResult.setValue(eachAttribute, value);
} catch (Exception uoe) {
// while receiving the value an exception could occur, we mark
// the values as such.
attributeResult.setValue(eachAttribute, "ERROR: " + uoe.getMessage());
}
}
}
}
}
return queryResult;
} catch (IOException | JMException e) {
throw new MBeanServerQueryException(e);
}
}
Aggregations