Java 类javax.management.modelmbean.ModelMBeanConstructorInfo 实例源码

项目:TayzGrid    文件:MBean.java   
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]);
}
项目:wildfly-core    文件:TestModelMBean.java   
@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);
    }
}
项目:freeVM    文件:DefaultDescriptorTest.java   
/**
 * 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();
}
项目:freeVM    文件:UserDefinedDescriptorTest.java   
/**
 * 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;
}
项目:lams    文件:AbstractMBeanInfoAssembler.java   
/**
 * 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];
}
项目:spring4-understanding    文件:AbstractMBeanInfoAssembler.java   
/**
 * 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];
}
项目:my-spring-cache-redis    文件:AbstractMBeanInfoAssembler.java   
/**
 * 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];
}
项目:spring    文件:AbstractMBeanInfoAssembler.java   
/**
 * 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];
}
项目:class-guard    文件:AbstractMBeanInfoAssembler.java   
/**
 * 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];
}