Example usage for javax.management MBeanFeatureInfo getName

List of usage examples for javax.management MBeanFeatureInfo getName

Introduction

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

Prototype

public String getName() 

Source Link

Document

Returns the name of 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 2s.  c o m
    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;
}