Package org.apache.openejb.api.jmx

Examples of org.apache.openejb.api.jmx.Description


            final List<MBeanAttributeInfo> attributeInfos = new ArrayList<MBeanAttributeInfo>();
            final List<MBeanOperationInfo> operationInfos = new ArrayList<MBeanOperationInfo>();
            final List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();

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

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

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


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

                if (findAnnotation(m, ManagedAttribute.class) != null) {
                    final 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 (findAnnotation(m, ManagedOperation.class) != null) {
                    operations.put(m.getName(), m);

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

                    operationInfos.add(newMethodDescriptor(operationDescr, m));
                }
            }

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

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

                try {
                    attributeInfos.add(new MBeanAttributeInfo(key, attrDescr, mtd, setters.get(key)));
                } catch (final IntrospectionException ex) {
                    logger.warning("can't manage " + key + " for " + mtd.getName(), ex);
                }
            }

            // for updatable but not readable attributes
            for (final Map.Entry<String, Method> e : setters.entrySet()) {
                final String key = e.getKey();
                if (getters.get(key) != null) {
                    continue; //already done
                }

                final Method mtd = e.getValue();

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

                try {
View Full Code Here


            final List<MBeanAttributeInfo> attributeInfos = new ArrayList<MBeanAttributeInfo>();
            final List<MBeanOperationInfo> operationInfos = new ArrayList<MBeanOperationInfo>();
            final List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();

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

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

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


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

                if (findAnnotation(m, ManagedAttribute.class) != null) {
                    final 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 (findAnnotation(m, ManagedOperation.class) != null) {
                    operations.put(m.getName(), m);

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

                    operationInfos.add(newMethodDescriptor(operationDescr, m));
                }
            }

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

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

                try {
                    attributeInfos.add(new MBeanAttributeInfo(key, attrDescr, mtd, setters.get(key)));
                } catch (final IntrospectionException ex) {
                    logger.warning("can't manage " + key + " for " + mtd.getName(), ex);
                }
            }

            // for updatable but not readable attributes
            for (final Map.Entry<String, Method> e : setters.entrySet()) {
                final String key = e.getKey();
                if (getters.get(key) != null) {
                    continue; //already done
                }

                final Method mtd = e.getValue();

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

                try {
View Full Code Here

            List<MBeanAttributeInfo> attributeInfos = new ArrayList<MBeanAttributeInfo>();
            List<MBeanOperationInfo> operationInfos = new ArrayList<MBeanOperationInfo>();
            List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();

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

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

            NotificationInfos notifications = findAnnotation(annotatedMBean, 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 (findAnnotation(m, 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 (findAnnotation(m, ManagedOperation.class) != null) {
                    operations.put(m.getName(), m);

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

                    operationInfos.add(newMethodDescriptor(operationDescr, m));
                }
            }

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

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

                try {
                    attributeInfos.add(new MBeanAttributeInfo(key, attrDescr, mtd, setters.get(key)));
                } catch (IntrospectionException ex) {
                    logger.warning("can't manage " + key + " for " + mtd.getName(), ex);
                }
            }

            // for updatable but not readable attributes
            for (Map.Entry<String, Method> e : setters.entrySet()) {
                String key = e.getKey();
                if (getters.get(key) != null) {
                    continue; //already done
                }

                Method mtd = e.getValue();

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

                try {
View Full Code Here

            final List<MBeanAttributeInfo> attributeInfos = new ArrayList<MBeanAttributeInfo>();
            final List<MBeanOperationInfo> operationInfos = new ArrayList<MBeanOperationInfo>();
            final List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();

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

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

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


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

                if (findAnnotation(m, ManagedAttribute.class) != null) {
                    final 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 (findAnnotation(m, ManagedOperation.class) != null) {
                    operations.put(m.getName(), m);

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

                    operationInfos.add(newMethodDescriptor(operationDescr, m));
                }
            }

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

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

                try {
                    attributeInfos.add(new MBeanAttributeInfo(key, attrDescr, mtd, setters.get(key)));
                } catch (final IntrospectionException ex) {
                    logger.warning("can't manage " + key + " for " + mtd.getName(), ex);
                }
            }

            // for updatable but not readable attributes
            for (final Map.Entry<String, Method> e : setters.entrySet()) {
                final String key = e.getKey();
                if (getters.get(key) != null) {
                    continue; //already done
                }

                final Method mtd = e.getValue();

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

                try {
View Full Code Here

            List<MBeanAttributeInfo> attributeInfos = new ArrayList<MBeanAttributeInfo>();
            List<MBeanOperationInfo> operationInfos = new ArrayList<MBeanOperationInfo>();
            List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();

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

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

            NotificationInfos notifications = findAnnotation(annotatedMBean, 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 (findAnnotation(m, 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 (findAnnotation(m, ManagedOperation.class) != null) {
                    operations.put(m.getName(), m);

                    String operationDescr = "";
                    Description descr = findAnnotation(m, 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 = findAnnotation(mtd, Description.class);
                if (descr != null) {
                    attrDescr = getDescription(descr, "-");
                }

                try {
                    attributeInfos.add(new MBeanAttributeInfo(key, attrDescr, mtd, setters.get(key)));
                } catch (IntrospectionException ex) {
                    logger.warning("can't manage " + key + " for " + mtd.getName(), ex);
                }
            }

            // for updatable but not readable attributes
            for (Map.Entry<String, Method> e : setters.entrySet()) {
                String key = e.getKey();
                if (getters.get(key) != null) {
                    continue; //already done
                }

                Method mtd = e.getValue();

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

                try {
View Full Code Here

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

        instance = givenInstance;

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

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

        NotificationInfos notifications = findAnnotation(annotatedMBean, 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 (findAnnotation(m, 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 (findAnnotation(m, ManagedOperation.class) != null) {
                operations.put(m.getName(), m);

                String operationDescr = "";
                Description descr = findAnnotation(m, 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 = findAnnotation(mtd, Description.class);
            if (descr != null) {
                attrDescr = getDescription(descr, "-");
            }

            try {
View Full Code Here

TOP

Related Classes of org.apache.openejb.api.jmx.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.