javax.management.openmbean.OpenMBeanInfoSupport Java Examples

The following examples show how to use javax.management.openmbean.OpenMBeanInfoSupport. 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: GreetingOpenMBean.java    From thinking-in-spring-boot-samples with Apache License 2.0 5 votes vote down vote up
@Override
public MBeanInfo getMBeanInfo() {
    return new OpenMBeanInfoSupport(
            Greeting.class.getName(),            // OpenMBean 类名称
            "Greeting OpenMBean 信息", // OpenMBean 描述信息
            of(),                                // OpenMBeanAttributeInfo[] : 无属性信息
            of(defaultOpenConstructorInfo()),    // OpenMBeanConstructorInfo[] : 默认构造器
            of(greetOpenOperationInfo()),        // OpenMBeanOperationInfo[] : greet(String) 方法
            of()                                 // MBeanNotificationInfo[] : 无通知信息
    );
}
 
Example #2
Source File: MBeanInfoFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MBeanInfo createMBeanInfo() {
    return new OpenMBeanInfoSupport(ModelControllerMBeanHelper.CLASS_NAME,
            getDescription(providedDescription),
            getAttributes(),
            getConstructors(),
            getOperations(),
            getNotifications(),
            createMBeanDescriptor());
}
 
Example #3
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();
    }
}