Example usage for javax.management MBeanFeatureInfo getDescriptor

List of usage examples for javax.management MBeanFeatureInfo getDescriptor

Introduction

In this page you can find the example usage for javax.management MBeanFeatureInfo getDescriptor.

Prototype

public Descriptor getDescriptor() 

Source Link

Document

Returns the descriptor for the feature.

Usage

From source file:org.apache.geode.management.internal.security.MBeanServerWrapper.java

private ResourcePermission getOperationContext(ObjectName objectName, String featureName, boolean isOp)
        throws InstanceNotFoundException, ReflectionException {
    MBeanInfo beanInfo;//from   w w  w.ja  v a 2  s  .  com
    try {
        beanInfo = mbs.getMBeanInfo(objectName);
    } catch (IntrospectionException e) {
        throw new GemFireSecurityException("error getting beanInfo of " + objectName, e);
    }
    // If there is no annotation defined either in the class level or method level, we should
    // consider this operation/attribute freely accessible
    ResourcePermission result = null;

    // find the context in the beanInfo if defined in the class level
    result = getOperationContext(beanInfo.getDescriptor(), result);

    MBeanFeatureInfo[] featureInfos;
    if (isOp) {
        featureInfos = beanInfo.getOperations();
    } else {
        featureInfos = beanInfo.getAttributes();
    }
    // still look into the attributes/operations to see if it's defined in the method level
    for (MBeanFeatureInfo info : featureInfos) {
        if (info.getName().equals(featureName)) {
            // found the featureInfo of this method on the bean
            result = getOperationContext(info.getDescriptor(), result);
            break;
        }
    }
    return result;
}