javax.management.openmbean.OpenMBeanAttributeInfoSupport Java Examples

The following examples show how to use javax.management.openmbean.OpenMBeanAttributeInfoSupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StandardMBean.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #2
Source File: MBeanInfoFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private OpenMBeanAttributeInfo getAttribute(String name) {
    final String escapedName = NameConverter.convertToCamelCase(name);
    ModelNode attribute = providedDescription.require(ATTRIBUTES).require(name);
    AttributeAccess access = resourceRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, name);
    if (access == null) {
        // Check for a bogus attribute in the description that's really a child
        Set<String> childTypes = resourceRegistration.getChildNames(PathAddress.EMPTY_ADDRESS);
        if (childTypes.contains(name)) {
            return null;
        }
    }
    final boolean writable = mutabilityChecker.mutable(pathAddress) && (access != null && access.getAccessType() == AccessType.READ_WRITE);

    return new OpenMBeanAttributeInfoSupport(
            escapedName,
            getDescription(attribute),
            converters.convertToMBeanType(attribute),
            true,
            writable,
            false,
            createAttributeDescriptor(attribute));
}
 
Example #3
Source File: StandardMBean.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #4
Source File: StandardMBean.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #5
Source File: StandardMBean.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #6
Source File: StandardMBean.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #7
Source File: StandardMBean.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #8
Source File: StandardMBean.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #9
Source File: StandardMBean.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #10
Source File: StandardMBean.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #11
Source File: StandardMBean.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #12
Source File: StandardMBean.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #13
Source File: StandardMBean.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #14
Source File: StandardMBean.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #15
Source File: StandardMBean.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #16
Source File: StandardMBean.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #17
Source File: StandardMBean.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
 
Example #18
Source File: MetricsMap.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public MBeanInfo getMBeanInfo() {
  ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<>();
  Map<String,Object> stats = getValue(true);
  if (useCachedStatsBetweenGetMBeanInfoCalls) {
    cachedValue = stats;
  }
  jmxAttributes.forEach((k, v) -> {
    attrInfoList.add(new MBeanAttributeInfo(k, String.class.getName(),
        null, true, false, false));
  });
  try {
    stats.forEach((k, v) -> {
      if (jmxAttributes.containsKey(k)) {
        return;
      }
      @SuppressWarnings({"rawtypes"})
      Class type = v.getClass();
      @SuppressWarnings({"rawtypes"})
      OpenType typeBox = determineType(type);
      if (type.equals(String.class) || typeBox == null) {
        attrInfoList.add(new MBeanAttributeInfo(k, String.class.getName(),
            null, true, false, false));
      } else {
        attrInfoList.add(new OpenMBeanAttributeInfoSupport(
            k, k, typeBox, true, false, false));
      }
    });
  } catch (Exception e) {
    // don't log issue if the core is closing
    if (!(SolrException.getRootCause(e) instanceof AlreadyClosedException))
      log.warn("Could not get attributes of MetricsMap: {}", this, e);
  }
  MBeanAttributeInfo[] attrInfoArr = attrInfoList
      .toArray(new MBeanAttributeInfo[attrInfoList.size()]);
  return new MBeanInfo(getClass().getName(), "MetricsMap", attrInfoArr, null, null, null);
}
 
Example #19
Source File: KnowledgeBaseMonitoring.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
/**
 *  Initialize the open mbean metadata
 */
private void initOpenMBeanInfo() {
    OpenMBeanAttributeInfoSupport[] attributes = new OpenMBeanAttributeInfoSupport[4];
    OpenMBeanConstructorInfoSupport[] constructors = new OpenMBeanConstructorInfoSupport[1];
    OpenMBeanOperationInfoSupport[] operations = new OpenMBeanOperationInfoSupport[2];
    MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[0];

    try {
        // Define the attributes 
        attributes[0] = new OpenMBeanAttributeInfoSupport(ATTR_ID,
                                                          "Knowledge Base Id",
                                                          SimpleType.STRING,
                                                          true,
                                                          false,
                                                          false);
        attributes[1] = new OpenMBeanAttributeInfoSupport(ATTR_SESSION_COUNT,
                                                          "Number of created sessions for this Knowledge Base",
                                                          SimpleType.LONG,
                                                          true,
                                                          false,
                                                          false);
        attributes[2] = new OpenMBeanAttributeInfoSupport(ATTR_GLOBALS,
                                                          "List of globals",
                                                           globalsTableType,
                                                           true,
                                                           false,
                                                           false );
        attributes[3] = new OpenMBeanAttributeInfoSupport( ATTR_PACKAGES,
                                                           "List of Packages",
                                                           new ArrayType( 1,
                                                                          SimpleType.STRING ),
                                                           true,
                                                           false,
                                                           false );
        //No arg constructor                
        constructors[0] = new OpenMBeanConstructorInfoSupport( "KnowledgeBaseMonitoringMXBean",
                                                               "Constructs a KnowledgeBaseMonitoringMXBean instance.",
                                                               new OpenMBeanParameterInfoSupport[0] );
        //Operations 
        OpenMBeanParameterInfo[] params = new OpenMBeanParameterInfoSupport[0];
        operations[0] = new OpenMBeanOperationInfoSupport( OP_START_INTERNAL_MBEANS,
                                                           "Creates, registers and starts all the dependent MBeans that allow monitor all the details in this KnowledgeBase.",
                                                           params,
                                                           SimpleType.VOID,
                                                           MBeanOperationInfo.INFO );
        operations[1] = new OpenMBeanOperationInfoSupport( OP_STOP_INTERNAL_MBEANS,
                                                           "Stops and disposes all the dependent MBeans that allow monitor all the details in this KnowledgeBase.",
                                                           params,
                                                           SimpleType.VOID,
                                                           MBeanOperationInfo.INFO );

        //Build the info 
        info = new OpenMBeanInfoSupport( this.getClass().getName(),
                                         "Knowledge Base Monitor MXBean",
                                         attributes,
                                         constructors,
                                         operations,
                                         notifications );
    } catch ( Exception e ) {
        e.printStackTrace();
    }
}