java类javax.management.MBeanConstructorInfo的实例源码

MustBeValidCommand.java 文件源码 项目:jdk8u-jdk 阅读 25 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MXBeanInteropTest2.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
private void printMBeanInfo(MBeanInfo mbInfo) {
    System.out.println("Description " + mbInfo.getDescription());

    for (MBeanConstructorInfo ctor : mbInfo.getConstructors()) {
        System.out.println("Constructor " + ctor.getName());
    }

    for (MBeanAttributeInfo att : mbInfo.getAttributes()) {
        System.out.println("Attribute " + att.getName()
        + " [" + att.getType() + "]");
    }

    for (MBeanOperationInfo oper : mbInfo.getOperations()) {
        System.out.println("Operation " + oper.getName());
    }

    for (MBeanNotificationInfo notif : mbInfo.getNotifications()) {
        System.out.println("Notification " + notif.getName());
    }
}
MustBeValidCommand.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MXBeanInteropTest2.java 文件源码 项目:openjdk-jdk10 阅读 24 收藏 0 点赞 0 评论 0
private void printMBeanInfo(MBeanInfo mbInfo) {
    System.out.println("Description " + mbInfo.getDescription());

    for (MBeanConstructorInfo ctor : mbInfo.getConstructors()) {
        System.out.println("Constructor " + ctor.getName());
    }

    for (MBeanAttributeInfo att : mbInfo.getAttributes()) {
        System.out.println("Attribute " + att.getName()
        + " [" + att.getType() + "]");
    }

    for (MBeanOperationInfo oper : mbInfo.getOperations()) {
        System.out.println("Operation " + oper.getName());
    }

    for (MBeanNotificationInfo notif : mbInfo.getNotifications()) {
        System.out.println("Notification " + notif.getName());
    }
}
MustBeValidCommand.java 文件源码 项目:openjdk9 阅读 28 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MXBeanInteropTest2.java 文件源码 项目:openjdk9 阅读 19 收藏 0 点赞 0 评论 0
private void printMBeanInfo(MBeanInfo mbInfo) {
    System.out.println("Description " + mbInfo.getDescription());

    for (MBeanConstructorInfo ctor : mbInfo.getConstructors()) {
        System.out.println("Constructor " + ctor.getName());
    }

    for (MBeanAttributeInfo att : mbInfo.getAttributes()) {
        System.out.println("Attribute " + att.getName()
        + " [" + att.getType() + "]");
    }

    for (MBeanOperationInfo oper : mbInfo.getOperations()) {
        System.out.println("Operation " + oper.getName());
    }

    for (MBeanNotificationInfo notif : mbInfo.getNotifications()) {
        System.out.println("Notification " + notif.getName());
    }
}
MustBeValidCommand.java 文件源码 项目:jdk8u_jdk 阅读 25 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MXBeanInteropTest2.java 文件源码 项目:jdk8u_jdk 阅读 21 收藏 0 点赞 0 评论 0
private void printMBeanInfo(MBeanInfo mbInfo) {
    System.out.println("Description " + mbInfo.getDescription());

    for (MBeanConstructorInfo ctor : mbInfo.getConstructors()) {
        System.out.println("Constructor " + ctor.getName());
    }

    for (MBeanAttributeInfo att : mbInfo.getAttributes()) {
        System.out.println("Attribute " + att.getName()
        + " [" + att.getType() + "]");
    }

    for (MBeanOperationInfo oper : mbInfo.getOperations()) {
        System.out.println("Operation " + oper.getName());
    }

    for (MBeanNotificationInfo notif : mbInfo.getNotifications()) {
        System.out.println("Notification " + notif.getName());
    }
}
MustBeValidCommand.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 22 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MXBeanInteropTest2.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 22 收藏 0 点赞 0 评论 0
private void printMBeanInfo(MBeanInfo mbInfo) {
    System.out.println("Description " + mbInfo.getDescription());

    for (MBeanConstructorInfo ctor : mbInfo.getConstructors()) {
        System.out.println("Constructor " + ctor.getName());
    }

    for (MBeanAttributeInfo att : mbInfo.getAttributes()) {
        System.out.println("Attribute " + att.getName()
        + " [" + att.getType() + "]");
    }

    for (MBeanOperationInfo oper : mbInfo.getOperations()) {
        System.out.println("Operation " + oper.getName());
    }

    for (MBeanNotificationInfo notif : mbInfo.getNotifications()) {
        System.out.println("Notification " + notif.getName());
    }
}
HierarchyDynamicMBean.java 文件源码 项目:cacheonix-core 阅读 21 收藏 0 点赞 0 评论 0
private
void buildDynamicMBeanInfo() {
  Constructor[] constructors = this.getClass().getConstructors();
  dConstructors[0] = new MBeanConstructorInfo(
       "HierarchyDynamicMBean(): Constructs a HierarchyDynamicMBean instance",
constructors[0]);

  vAttributes.add(new MBeanAttributeInfo(THRESHOLD,
               "java.lang.String",
               "The \"threshold\" state of the hiearchy.",
               true,
               true,
               false));

  MBeanParameterInfo[] params = new MBeanParameterInfo[1];
  params[0] = new MBeanParameterInfo("name", "java.lang.String",
               "Create a logger MBean" );
  dOperations[0] = new MBeanOperationInfo("addLoggerMBean",
            "addLoggerMBean(): add a loggerMBean",
            params ,
            "javax.management.ObjectName",
            MBeanOperationInfo.ACTION);
}
RouterStatisticsAdvice.java 文件源码 项目:Telepathology 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object. 
 * @see javax.management.DynamicMBean#getMBeanInfo()
 */
@Override
   public MBeanInfo getMBeanInfo()
   {
    MBeanConstructorInfo[] constructors = null;
    MBeanAttributeInfo[] attributes = getMBeanAttributes();
    MBeanOperationInfo[] operations = getMBeanOperations();
    MBeanNotificationInfo[] notifications = null;

    MBeanInfo info = new MBeanInfo(
            this.getClass().getName(), 
            "Router Statistics", 
            attributes, 
            constructors, 
            operations, 
            notifications);

    return info;
   }
HierarchyDynamicMBean.java 文件源码 项目:daq-eclipse 阅读 43 收藏 0 点赞 0 评论 0
private
void buildDynamicMBeanInfo() {
  Constructor[] constructors = this.getClass().getConstructors();
  dConstructors[0] = new MBeanConstructorInfo(
       "HierarchyDynamicMBean(): Constructs a HierarchyDynamicMBean instance",
constructors[0]);

  vAttributes.add(new MBeanAttributeInfo(THRESHOLD,
               "java.lang.String",
               "The \"threshold\" state of the hiearchy.",
               true,
               true,
               false));

  MBeanParameterInfo[] params = new MBeanParameterInfo[1];
  params[0] = new MBeanParameterInfo("name", "java.lang.String",
               "Create a logger MBean" );
  dOperations[0] = new MBeanOperationInfo("addLoggerMBean",
            "addLoggerMBean(): add a loggerMBean",
            params ,
            "javax.management.ObjectName",
            MBeanOperationInfo.ACTION);
}
MustBeValidCommand.java 文件源码 项目:infobip-open-jdk-8 阅读 26 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MustBeValidCommand.java 文件源码 项目:jdk8u-dev-jdk 阅读 24 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
PlatformMBeanGenerator.java 文件源码 项目:hawkular-agent 阅读 22 收藏 0 点赞 0 评论 0
private MBeanInfo buildProcessorMBeanInfo() {
    ArrayList<MBeanAttributeInfo> info = new ArrayList<>();

    info.add(new MBeanAttributeInfo(
            Constants.PlatformMetricType.PROCESSOR_CPU_USAGE.getMetricTypeId().getIDString(),
            Double.class.getCanonicalName(),
            "CPU usage",
            true,
            false,
            false));

    return new MBeanInfo(
            PlatformMBean.class.getCanonicalName(),
            "Processor information",
            info.toArray(new MBeanAttributeInfo[0]),
            new MBeanConstructorInfo[0],
            new MBeanOperationInfo[0],
            new MBeanNotificationInfo[0]);
}
MustBeValidCommand.java 文件源码 项目:jdk7-jdk 阅读 21 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
HierarchyDynamicMBean.java 文件源码 项目:nabs 阅读 24 收藏 0 点赞 0 评论 0
private
void buildDynamicMBeanInfo() {
  Constructor[] constructors = this.getClass().getConstructors();
  dConstructors[0] = new MBeanConstructorInfo(
       "HierarchyDynamicMBean(): Constructs a HierarchyDynamicMBean instance",
constructors[0]);

  vAttributes.add(new MBeanAttributeInfo(THRESHOLD,
               "java.lang.String",
               "The \"threshold\" state of the hiearchy.",
               true,
               true,
               false));

  MBeanParameterInfo[] params = new MBeanParameterInfo[1];
  params[0] = new MBeanParameterInfo("name", "java.lang.String",
               "Create a logger MBean" );
  dOperations[0] = new MBeanOperationInfo("addLoggerMBean",
            "addLoggerMBean(): add a loggerMBean",
            params ,
            "javax.management.ObjectName",
            MBeanOperationInfo.ACTION);
}
MustBeValidCommand.java 文件源码 项目:openjdk-source-code-learn 阅读 29 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MustBeValidCommand.java 文件源码 项目:OLD-OpenJDK8 阅读 23 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
Statistics.java 文件源码 项目:oceandata 阅读 26 收藏 0 点赞 0 评论 0
@Override
public MBeanInfo getMBeanInfo() {
    try {
        Class<?> cls = this.getClass();
        Constructor<?> constructor = cls.getConstructor(new Class[] {});
        Method readConnectionsRequested = cls.getMethod("readConnectionsRequested", new Class[]{});
        Method readConnectionsRelease = cls.getMethod("readConnectionsRelease", new Class[]{});
        Method readCacheInts = cls.getMethod("readCacheInts", new Class[]{});
        Method readCacheMiss = cls.getMethod("readCacheMiss", new Class[]{});
        MBeanAttributeInfo connectionsRequested = new MBeanAttributeInfo("connections requested", "connections requested", readConnectionsRequested, null);
        MBeanAttributeInfo connectionsRelease = new MBeanAttributeInfo("Connections Release", "Connections Release", readConnectionsRelease, null);
        MBeanAttributeInfo cacheInts = new MBeanAttributeInfo("cache ints", "cache ints", readCacheInts, null);
        MBeanAttributeInfo cacheMiss = new MBeanAttributeInfo("Cache Miss", "Cache Miss", readCacheMiss, null);
        MBeanConstructorInfo mBeanConstructorInfo = new MBeanConstructorInfo("Constructor for Statistics", constructor);
        MBeanInfo mBeanInfo = new MBeanInfo(cls.getName(), "Monitor that controls the server", new MBeanAttributeInfo[] { connectionsRequested, connectionsRelease, cacheInts, cacheMiss }, new MBeanConstructorInfo[] {mBeanConstructorInfo}, null, null);
        return mBeanInfo;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
MustBeValidCommand.java 文件源码 项目:JAVA_UNIT 阅读 26 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MBeanIntrospector.java 文件源码 项目:andes 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Retrieves the constructor info from given constructor.
 * @param cons
 * @return MBeanConstructorInfo
 */
private static MBeanConstructorInfo getMBeanConstructorInfo(Constructor cons)
{
    String desc = _defaultConstructorDescription;
    Annotation anno = cons.getAnnotation(MBeanConstructor.class);
    if (anno != null && MBeanConstructor.class.isInstance(anno))
    {
        desc = MBeanConstructor.class.cast(anno).value();
        if(desc == null)
        {
            desc = _defaultConstructorDescription;
        }
    }

    //MBeanParameterInfo[] paramsInfo = getParametersInfo(cons.getParameterAnnotations(),
    //                                                    cons.getParameterTypes());

    return new MBeanConstructorInfo(cons.getName(), desc, null);
}
MustBeValidCommand.java 文件源码 项目:openjdk-jdk7u-jdk 阅读 28 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
MBeanConstructorInfoTest.java 文件源码 项目:freeVM 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Create MBeanConstructorInfo objects.
 * 
 * @throws NoSuchMethodException
 * @throws SecurityException
 */
public void setUp() throws Exception {
    final Class c = Hello.class;

    inf1 = new MBeanConstructorInfo("Constructor with parameters", c
        .getConstructor(new Class[] { String.class, String.class,
            String.class, boolean.class, Object.class }));
    inf2 = new MBeanConstructorInfo(
        "org.apache.harmony.test.func.api.javax.management.share.Hello",
        "Constructor with parameters", sig2);

    inf3 = new MBeanConstructorInfo("Constructor without parameters", c
        .getConstructor(new Class[0]));
    inf4 = new MBeanConstructorInfo(
        "org.apache.harmony.test.func.api.javax.management.share.Hello",
        "Constructor without parameters", sig1);
}
MustBeValidCommand.java 文件源码 项目:openjdk-icedtea7 阅读 31 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    // Instantiate the MBean server
    //
    final MBeanAttributeInfo[]    atts   = makeAttInfos(attributes);
    final MBeanConstructorInfo[]  ctors  = makeCtorInfos(constructors);
    final MBeanOperationInfo[]    ops    = makeOpInfos(operations);
    final MBeanNotificationInfo[] notifs =
        makeNotifInfos(notificationclasses);

    for (int i=0; i<mbeanclasses.length;i++) {
        System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
        final MBeanInfo mbi =
            new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
                          atts, ctors, ops, notifs);
    }

    // Test OK!
    //
    System.out.println("All MBeanInfo successfuly created!");
    System.out.println("Bye! Bye!");
}
FieldBasedDynamicMBean.java 文件源码 项目:basis 阅读 23 收藏 0 点赞 0 评论 0
@Override
public MBeanInfo getMBeanInfo() {
    List<MBeanAttributeInfo> atts = new LinkedList<>();

    for (Field field : fields.values()) {
        MBeanAttributeInfo att = new MBeanAttributeInfo(
                field.getName(),
                field.getType().getName(),
                null,
                true,
                !(readonly || Modifier.isFinal(field.getModifiers())),
                field.getType() == Boolean.TYPE,
                null);

        atts.add(att);
    }

    return new MBeanInfo(
            getClass().getName(), null,
            atts.toArray(new MBeanAttributeInfo[atts.size()]),
            new MBeanConstructorInfo[0],
            new MBeanOperationInfo[0],
            new MBeanNotificationInfo[0]);
}
MBeanIntrospector.java 文件源码 项目:OpenJSharp 阅读 28 收藏 0 点赞 0 评论 0
private static MBeanConstructorInfo[] findConstructors(Class<?> c) {
    Constructor<?>[] cons = c.getConstructors();
    MBeanConstructorInfo[] mbc = new MBeanConstructorInfo[cons.length];
    for (int i = 0; i < cons.length; i++) {
        final String descr = "Public constructor of the MBean";
        mbc[i] = new MBeanConstructorInfo(descr, cons[i]);
    }
    return mbc;
}
ModelMBeanInfoSupport.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Returns the ModelMBeanConstructorInfo requested by name.
 * If no ModelMBeanConstructorInfo exists for this name null is returned.
 *
 * @param inName the name of the constructor.
 *
 * @return the constructor info for the named constructor, or null
 * if there is none.
 *
 * @exception MBeanException Wraps a distributed communication Exception.
 * @exception RuntimeOperationsException Wraps an IllegalArgumentException
 *            for a null constructor name.
 */

public ModelMBeanConstructorInfo getConstructor(String inName)
throws MBeanException, RuntimeOperationsException {
    ModelMBeanConstructorInfo retInfo = null;
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanInfoSupport.class.getName(),
                "getConstructor(String)", "Entry");
    }
    if (inName == null) {
        throw new RuntimeOperationsException(
                new IllegalArgumentException("Constructor name is null"),
                "Exception occurred trying to get the " +
                "ModelMBeanConstructorInfo of the MBean");
    }
    MBeanConstructorInfo[] consList = modelMBeanConstructors; //this.getConstructors();
    int numCons = 0;
    if (consList != null) numCons = consList.length;

    for (int i=0; (i < numCons) && (retInfo == null); i++) {
        if (inName.equals(consList[i].getName())) {
            retInfo = ((ModelMBeanConstructorInfo) consList[i].clone());
        }
    }
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                ModelMBeanInfoSupport.class.getName(),
                "getConstructor(String)", "Exit");
    }

    return retInfo;
}
ModelMBeanInfoSupport.java 文件源码 项目:OpenJSharp 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Deserializes a {@link ModelMBeanInfoSupport} from an {@link ObjectInputStream}.
 */
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
    if (compat) {
        // Read an object serialized in the old serial form
        //
        ObjectInputStream.GetField fields = in.readFields();
        modelMBeanDescriptor =
                (Descriptor) fields.get("modelMBeanDescriptor", null);
        if (fields.defaulted("modelMBeanDescriptor")) {
            throw new NullPointerException("modelMBeanDescriptor");
        }
        modelMBeanAttributes =
                (MBeanAttributeInfo[]) fields.get("mmbAttributes", null);
        if (fields.defaulted("mmbAttributes")) {
            throw new NullPointerException("mmbAttributes");
        }
        modelMBeanConstructors =
                (MBeanConstructorInfo[]) fields.get("mmbConstructors", null);
        if (fields.defaulted("mmbConstructors")) {
            throw new NullPointerException("mmbConstructors");
        }
        modelMBeanNotifications =
                (MBeanNotificationInfo[]) fields.get("mmbNotifications", null);
        if (fields.defaulted("mmbNotifications")) {
            throw new NullPointerException("mmbNotifications");
        }
        modelMBeanOperations =
                (MBeanOperationInfo[]) fields.get("mmbOperations", null);
        if (fields.defaulted("mmbOperations")) {
            throw new NullPointerException("mmbOperations");
        }
    } else {
        // Read an object serialized in the new serial form
        //
        in.defaultReadObject();
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号