Search in sources :

Example 36 with Descriptor

use of javax.management.Descriptor in project cxf by apache.

the class ModelMBeanInfoSupporter method buildOperationDescriptor.

public Descriptor buildOperationDescriptor(ManagedOperation mo, String operationName) {
    Descriptor desc = new DescriptorSupport();
    desc.setField("name", operationName);
    desc.setField("descriptorType", "operation");
    desc.setField("role", "operation");
    if (mo.description() != null) {
        desc.setField("displayName", mo.description());
    }
    if (mo.currencyTimeLimit() >= -1) {
        desc.setField("currencyTimeLimit", mo.currencyTimeLimit());
    }
    return desc;
}
Also used : Descriptor(javax.management.Descriptor) DescriptorSupport(javax.management.modelmbean.DescriptorSupport)

Example 37 with Descriptor

use of javax.management.Descriptor in project cxf by apache.

the class ModelMBeanInfoSupporter method buildAttributeOperationDescriptor.

public Descriptor buildAttributeOperationDescriptor(String operationName) {
    Descriptor desc = new DescriptorSupport();
    desc.setField("name", operationName);
    desc.setField("descriptorType", "operation");
    if (operationName.indexOf("set") == 0) {
        desc.setField("role", "setter");
    } else {
        desc.setField("role", "getter");
    }
    return desc;
}
Also used : Descriptor(javax.management.Descriptor) DescriptorSupport(javax.management.modelmbean.DescriptorSupport)

Example 38 with Descriptor

use of javax.management.Descriptor in project cxf by apache.

the class ModelMBeanInfoSupporter method buildAttributeDescriptor.

public Descriptor buildAttributeDescriptor(ManagedAttribute ma, String attributeName, boolean is, boolean read, boolean write) {
    Descriptor desc = new DescriptorSupport();
    desc.setField("name", attributeName);
    desc.setField("descriptorType", "attribute");
    if (read) {
        if (is) {
            desc.setField("getMethod", "is" + attributeName);
        } else {
            desc.setField("getMethod", "get" + attributeName);
        }
    }
    if (write) {
        desc.setField("setMethod", "set" + attributeName);
    }
    if (ma.currencyTimeLimit() >= -1) {
        desc.setField("currencyTimeLimit", ma.currencyTimeLimit());
    }
    if (ma.persistPolicy().length() > 0) {
        desc.setField("persistPolicy", ma.persistPolicy());
    }
    if (ma.persistPeriod() >= -1) {
        desc.setField("persistPeriod", ma.persistPeriod());
    }
    if (ma.defaultValue() != null) {
        desc.setField("default", ma.defaultValue());
    }
    return desc;
}
Also used : Descriptor(javax.management.Descriptor) DescriptorSupport(javax.management.modelmbean.DescriptorSupport)

Example 39 with Descriptor

use of javax.management.Descriptor in project Payara by payara.

the class MBeanInterfaceGenerator method getOperationComment.

public String getOperationComment(MBeanOperationInfo info, final String[] paramNames) {
    final String description = info.getDescription();
    final StringBuffer buf = new StringBuffer();
    if (description != null && description.length() != 0) {
        buf.append(description + NEWLINE);
    }
    final Descriptor desc = info.getDescriptor();
    buf.append(toString(desc));
    final MBeanParameterInfo[] signature = info.getSignature();
    for (int i = 0; i < paramNames.length; ++i) {
        final String paramDescription = signature[i].getDescription();
        buf.append("@param " + paramNames[i] + " " + paramDescription + NEWLINE);
    }
    final String returnType = getCodeClassname(info.getReturnType());
    if (!returnType.equals("void")) {
        buf.append("@return " + returnType + NEWLINE);
    }
    return (makeJavadocComment(buf.toString()));
}
Also used : Descriptor(javax.management.Descriptor) MBeanParameterInfo(javax.management.MBeanParameterInfo)

Example 40 with Descriptor

use of javax.management.Descriptor in project Payara by payara.

the class ConfigBeanJMXSupport method _getMBeanInfo.

private MBeanInfo _getMBeanInfo() {
    final List<MBeanAttributeInfo> attrsList = new ArrayList<MBeanAttributeInfo>();
    for (final AttributeMethodInfo info : mAttrInfos) {
        attrsList.add(attributeToMBeanAttributeInfo(info));
    }
    for (final ElementMethodInfo e : mElementInfos) {
        final MBeanAttributeInfo attrInfo = elementToMBeanAttributeInfo(e.method());
        if (attrInfo != null) {
            attrsList.add(attrInfo);
        }
    }
    final MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[attrsList.size()];
    attrsList.toArray(attrs);
    final String classname = mIntf.getName();
    final String description = "ConfigBean " + mIntf.getName();
    final MBeanOperationInfo[] operations = toMBeanOperationInfos();
    final Descriptor descriptor = descriptor();
    final MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[] { ATTRIBUTE_CHANGE_NOTIF_INFO };
    final MBeanInfo info = new MBeanInfo(classname, description, attrs, null, operations, notifications, descriptor);
    return info;
}
Also used : MBeanInfo(javax.management.MBeanInfo) MBeanOperationInfo(javax.management.MBeanOperationInfo) ArrayList(java.util.ArrayList) MBeanAttributeInfo(javax.management.MBeanAttributeInfo) MBeanNotificationInfo(javax.management.MBeanNotificationInfo) Descriptor(javax.management.Descriptor)

Aggregations

Descriptor (javax.management.Descriptor)73 RuntimeOperationsException (javax.management.RuntimeOperationsException)18 ModelMBeanAttributeInfo (javax.management.modelmbean.ModelMBeanAttributeInfo)16 ModelMBeanInfo (javax.management.modelmbean.ModelMBeanInfo)16 DescriptorSupport (javax.management.modelmbean.DescriptorSupport)11 ModelMBeanOperationInfo (javax.management.modelmbean.ModelMBeanOperationInfo)11 Method (java.lang.reflect.Method)10 ImmutableDescriptor (javax.management.ImmutableDescriptor)9 MBeanException (javax.management.MBeanException)9 AttributeNotFoundException (javax.management.AttributeNotFoundException)8 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)8 MBeanInfo (javax.management.MBeanInfo)8 MBeanServer (javax.management.MBeanServer)8 ObjectName (javax.management.ObjectName)8 ServiceNotFoundException (javax.management.ServiceNotFoundException)8 ArrayList (java.util.ArrayList)7 InstanceNotFoundException (javax.management.InstanceNotFoundException)7 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)7 MBeanOperationInfo (javax.management.MBeanOperationInfo)7 MBeanParameterInfo (javax.management.MBeanParameterInfo)7