Package javax.management

Examples of javax.management.Description


        List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();

        instance = givenInstance;

        // class
        Description classDescription = annotatedMBean.getAnnotation(Description.class);
        description = getDescription(classDescription, "a MBean built by OpenEJB");

        NotificationInfo notification = annotatedMBean.getAnnotation(NotificationInfo.class);
        if (notification != null) {
            MBeanNotificationInfo notificationInfo = getNotificationInfo(notification);
            notificationInfos.add(notificationInfo);
        }

        NotificationInfos notifications = annotatedMBean.getAnnotation(NotificationInfos.class);
        if (notifications != null && notifications.value() != null) {
            for (NotificationInfo n : notifications.value()) {
                MBeanNotificationInfo notificationInfo = getNotificationInfo(n);
                notificationInfos.add(notificationInfo);
            }
        }


        // methods
        for (Method m : annotatedMBean.getMethods()) {
            int modifiers = m.getModifiers();
            if (m.getDeclaringClass().equals(Object.class)
                    || !Modifier.isPublic(modifiers)
                    || Modifier.isAbstract(modifiers)) {
                continue;
            }

            if (m.getAnnotation(ManagedAttribute.class) != null) {
                String methodName = m.getName();
                String attrName = methodName;
                if (((attrName.startsWith("get") && m.getParameterTypes().length == 0)
                        || (attrName.startsWith("set") && m.getParameterTypes().length == 1))
                        && attrName.length() > 3) {
                    attrName = attrName.substring(3);
                    if (attrName.length() > 1) {
                        attrName = Character.toLowerCase(attrName.charAt(0)) + attrName.substring(1);
                    } else {
                        attrName = attrName.toLowerCase();
                    }
                } else {
                    logger.warning("ignoring attribute " + m.getName() + " for " + annotatedMBean.getName());
                }

                if (methodName.startsWith("get")) {
                    getters.put(attrName, m);
                } else if (methodName.startsWith("set")) {
                    setters.put(attrName, m);
                }
            } else if (m.getAnnotation(ManagedOperation.class) != null) {
                operations.put(m.getName(), m);

                String operationDescr = "";
                Description descr = m.getAnnotation(Description.class);
                if (descr != null) {
                    operationDescr = getDescription(descr, "-");
                }

                operationInfos.add(new MBeanOperationInfo(operationDescr, m));
            }
        }

        for (Map.Entry<String, Method> e : getters.entrySet()) {
            String key = e.getKey();
            Method mtd = e.getValue();

            String attrDescr = "";
            Description descr = mtd.getAnnotation(Description.class);
            if (descr != null) {
                attrDescr = getDescription(descr, "-");
            }

            try {
View Full Code Here


        List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();

        instance = givenInstance;

        // class
        Description classDescription = annotatedMBean.getAnnotation(Description.class);
        description = getDescription(classDescription, "a MBean built by OpenEJB");

        NotificationInfo notification = annotatedMBean.getAnnotation(NotificationInfo.class);
        if (notification != null) {
            MBeanNotificationInfo notificationInfo = getNotificationInfo(notification);
            notificationInfos.add(notificationInfo);
        }

        NotificationInfos notifications = annotatedMBean.getAnnotation(NotificationInfos.class);
        if (notifications != null && notifications.value() != null) {
            for (NotificationInfo n : notifications.value()) {
                MBeanNotificationInfo notificationInfo = getNotificationInfo(n);
                notificationInfos.add(notificationInfo);
            }
        }


        // methods
        for (Method m : annotatedMBean.getMethods()) {
            int modifiers = m.getModifiers();
            if (m.getDeclaringClass().equals(Object.class)
                    || !Modifier.isPublic(modifiers)
                    || Modifier.isAbstract(modifiers)) {
                continue;
            }

            if (m.getAnnotation(ManagedAttribute.class) != null) {
                String methodName = m.getName();
                String attrName = methodName;
                if (((attrName.startsWith("get") && m.getParameterTypes().length == 0)
                        || (attrName.startsWith("set") && m.getParameterTypes().length == 1))
                        && attrName.length() > 3) {
                    attrName = attrName.substring(3);
                    if (attrName.length() > 1) {
                        attrName = Character.toLowerCase(attrName.charAt(0)) + attrName.substring(1);
                    } else {
                        attrName = attrName.toLowerCase();
                    }
                } else {
                    logger.warning("ignoring attribute " + m.getName() + " for " + annotatedMBean.getName());
                }

                if (methodName.startsWith("get")) {
                    getters.put(attrName, m);
                } else if (methodName.startsWith("set")) {
                    setters.put(attrName, m);
                }
            } else if (m.getAnnotation(ManagedOperation.class) != null) {
                operations.put(m.getName(), m);

                String operationDescr = "";
                Description descr = m.getAnnotation(Description.class);
                if (descr != null) {
                    operationDescr = getDescription(descr, "-");
                }

                operationInfos.add(new MBeanOperationInfo(operationDescr, m));
            }
        }

        for (Map.Entry<String, Method> e : getters.entrySet()) {
            String key = e.getKey();
            Method mtd = e.getValue();

            String attrDescr = "";
            Description descr = mtd.getAnnotation(Description.class);
            if (descr != null) {
                attrDescr = getDescription(descr, "-");
            }

            try {
View Full Code Here

TOP

Related Classes of javax.management.Description

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.