本文整理汇总了Java中javax.management.modelmbean.ModelMBeanConstructorInfo类的典型用法代码示例。如果您正苦于以下问题:Java ModelMBeanConstructorInfo类的具体用法?Java ModelMBeanConstructorInfo怎么用?Java ModelMBeanConstructorInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModelMBeanConstructorInfo类属于javax.management.modelmbean包,在下文中一共展示了ModelMBeanConstructorInfo类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MBean
import javax.management.modelmbean.ModelMBeanConstructorInfo; //导入依赖的package包/类
public MBean(String className, String description, Collection<MBeanAttribute> attributes, Collection<MBeanOperation> operations)
{
List<MBeanAttributeInfo> attributeInfos = new ArrayList<MBeanAttributeInfo>();
Map<String, MBeanAttribute> attributesBuilder = new TreeMap<String, MBeanAttribute>();
for (MBeanAttribute attribute : attributes) {
attributesBuilder.put(attribute.getName(), attribute);
attributeInfos.add(attribute.getInfo());
}
this.attributes = Collections.unmodifiableMap(attributesBuilder);
Map<Signature, MBeanOperation> operationsBuilder = new HashMap<Signature, MBeanOperation>();
List<MBeanOperationInfo> operationsInfos = new ArrayList<MBeanOperationInfo>();
for (MBeanOperation operation : operations) {
operationsBuilder.put(operation.getSignature(), operation);
operationsInfos.add(operation.getInfo());
}
this.operations = Collections.unmodifiableMap(operationsBuilder);
mbeanInfo = new MBeanInfo(className,
description,
attributeInfos.toArray(new MBeanAttributeInfo[attributeInfos.size()]),
new ModelMBeanConstructorInfo[0],
operationsInfos.toArray(new MBeanOperationInfo[operationsInfos.size()]),
new ModelMBeanNotificationInfo[0]);
}
示例2: getMBeanInfo
import javax.management.modelmbean.ModelMBeanConstructorInfo; //导入依赖的package包/类
@Override
public MBeanInfo getMBeanInfo() {
try {
ModelMBeanAttributeInfo[] attributes = new ModelMBeanAttributeInfo[0];
ModelMBeanConstructorInfo[] constructors = new ModelMBeanConstructorInfo[] {
new ModelMBeanConstructorInfo("-", this.getClass().getConstructor())
};
ModelMBeanOperationInfo[] operations = new ModelMBeanOperationInfo[] {
new ModelMBeanOperationInfo("info", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.INFO),
new ModelMBeanOperationInfo("action", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.ACTION),
new ModelMBeanOperationInfo("actionInfo", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.ACTION_INFO),
new ModelMBeanOperationInfo("unknown", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.UNKNOWN)
};
ModelMBeanNotificationInfo[] notifications = new ModelMBeanNotificationInfo[0];
return new ModelMBeanInfoSupport(this.getClass().getName(), "-", attributes, constructors, operations, notifications);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: testModelMBeanConstructorInfo
import javax.management.modelmbean.ModelMBeanConstructorInfo; //导入依赖的package包/类
/**
* Verify default fields of descriptor from ModelMBeanConstructorInfo:
* name=nameOfConstructor, displayName=nameOfConstructor, role=constructor
* and descriptorType=operation.
*/
public Result testModelMBeanConstructorInfo() throws Exception {
Constructor constructor = sampleClass.getConstructor(null);
ModelMBeanConstructorInfo constructorInfo = new ModelMBeanConstructorInfo(
"description", constructor);
descriptor = constructorInfo.getDescriptor();
assertEquals(descriptor.getFieldValue("name"), constructorInfo
.getName());
assertEquals(descriptor.getFieldValue("displayName"), constructor
.getName());
assertEquals(descriptor.getFieldValue("role"), "constructor");
assertEquals(descriptor.getFieldValue("descriptorType"), "operation");
assertEquals(descriptor.getFields().length, 4);
commonCheck();
return result();
}
示例4: constractModelMBeanInfoSupport
import javax.management.modelmbean.ModelMBeanConstructorInfo; //导入依赖的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;
}
示例5: getConstructorInfo
import javax.management.modelmbean.ModelMBeanConstructorInfo; //导入依赖的package包/类
/**
* Get the constructor metadata for the MBean resource. Subclasses should implement
* this method to return the appropriate metadata for all constructors that should
* be exposed in the management interface for the managed resource.
* <p>Default implementation returns an empty array of {@code ModelMBeanConstructorInfo}.
* @param managedBean the bean instance (might be an AOP proxy)
* @param beanKey the key associated with the MBean in the beans map
* of the {@code MBeanExporter}
* @return the constructor metadata
* @throws JMException in case of errors
*/
protected ModelMBeanConstructorInfo[] getConstructorInfo(Object managedBean, String beanKey)
throws JMException {
return new ModelMBeanConstructorInfo[0];
}