本文整理汇总了Java中javax.management.modelmbean.ModelMBeanInfoSupport.getMBeanDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java ModelMBeanInfoSupport.getMBeanDescriptor方法的具体用法?Java ModelMBeanInfoSupport.getMBeanDescriptor怎么用?Java ModelMBeanInfoSupport.getMBeanDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.modelmbean.ModelMBeanInfoSupport
的用法示例。
在下文中一共展示了ModelMBeanInfoSupport.getMBeanDescriptor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyModelMBeanInfo
import javax.management.modelmbean.ModelMBeanInfoSupport; //导入方法依赖的package包/类
/**
* Do 11-15 steps.
*/
private void verifyModelMBeanInfo(ModelMBeanInfoSupport modelMBeanInfo)
throws Exception {
Descriptor descriptor = modelMBeanInfo.getMBeanDescriptor();
Descriptor descriptor2 = (Descriptor)map.get(modelMBeanInfo.getClass()
.getName());
assertTrue(DefaultDescriptorTest.compareDescriptors(descriptor,
descriptor2));
verifyDescriptor(modelMBeanInfo.getAttribute("name"));
verifyDescriptor(modelMBeanInfo.getAttributes());
verifyDescriptor(modelMBeanInfo.getConstructors());
verifyDescriptor(modelMBeanInfo.getNotification("name"));
verifyDescriptor(modelMBeanInfo.getNotifications());
verifyDescriptor(modelMBeanInfo.getOperations());
}
示例2: constractModelMBeanInfoSupport
import javax.management.modelmbean.ModelMBeanInfoSupport; //导入方法依赖的package包/类
/**
* Do 1-6 steps.
*/
private ModelMBeanInfoSupport constractModelMBeanInfoSupport()
throws Exception {
ModelMBeanOperationInfo operationInfo = new ModelMBeanOperationInfo(
"description", class1.getMethod("simpleOperartion", null));
setDescriptor(operationInfo);
ModelMBeanConstructorInfo constructorInfo = new ModelMBeanConstructorInfo(
"description", class1.getConstructor(null));
setDescriptor(constructorInfo);
ModelMBeanAttributeInfo attributeInfo = new ModelMBeanAttributeInfo(
"name", "description", class1.getMethod("getH", null), class1
.getMethod("setH", new Class[] { int.class }));
setDescriptor(attributeInfo);
ModelMBeanNotificationInfo notificationInfo = new ModelMBeanNotificationInfo(
new String[] { "specific notification tepes" }, "name",
"description");
setDescriptor(notificationInfo);
ModelMBeanInfoSupport beanInfoSupport = new ModelMBeanInfoSupport(
class1.getName(), "description",
new ModelMBeanAttributeInfo[] { attributeInfo },
new ModelMBeanConstructorInfo[] { constructorInfo },
new ModelMBeanOperationInfo[] { operationInfo },
new ModelMBeanNotificationInfo[] { notificationInfo });
Descriptor descriptor = beanInfoSupport.getMBeanDescriptor();
String[] strings = getSpesific(beanInfoSupport.getClass());
descriptor.setField(strings[0], strings[1]);
map.put(beanInfoSupport.getClass().getName(), descriptor);
beanInfoSupport.setMBeanDescriptor(descriptor);
return beanInfoSupport;
}
示例3: testModelMBeanInfoSupport
import javax.management.modelmbean.ModelMBeanInfoSupport; //导入方法依赖的package包/类
/**
* Verify default fields of descriptor from ModelMBeanInfoSupport:
* name=nameofClassUsedInConstructor, descriptorType=mbean,
* displayName=nameofClassUsedInConstructor, persistPolicy=never, log=F,
* visibility=1.
* <ul>
* Step by step:
* <li>Create ModelMBeanInfoSupport object using ModelMBeanInfoSupport.
* <li>Extract a descriptor from created object using getMBeanDescriptor()
* method.
* <li>Verify that all default fields of the descriptor exist using
* getFieldValue(String inFieldName) method.
* <li>There are no other fields.
* <li>Convert the descriptor to xml.
* <li>Create new descriptor from xml using DescriptorSupport(String inStr)
* constructor.
* </ul>
*/
public Result testModelMBeanInfoSupport() throws Exception {
ModelMBeanInfoSupport modelMBeanInfoSupport = new ModelMBeanInfoSupport(
sampleClass.getName(), "description", null, null, null, null);
descriptor = modelMBeanInfoSupport.getMBeanDescriptor();
assertEquals(descriptor.getFieldValue("name"), sampleClass.getName());
assertEquals(descriptor.getFieldValue("descriptorType"), "mbean");
assertEquals(descriptor.getFieldValue("displayName"), sampleClass
.getName());
assertEquals(descriptor.getFieldValue("persistPolicy"), "never");
assertEquals(descriptor.getFieldValue("log"), "F");
assertEquals(descriptor.getFieldValue("visibility"), "1");
assertEquals(descriptor.getFieldValue("export"), "F");
assertEquals(descriptor.getFields().length, 7);
commonCheck();
return result();
}