javax.management.modelmbean.ModelMBeanNotificationInfo Java Examples
The following examples show how to use
javax.management.modelmbean.ModelMBeanNotificationInfo.
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: ModelMBeanInfoSupporter.java From cxf with Apache License 2.0 | 6 votes |
public ModelMBeanInfo buildModelMBeanInfo(Descriptor desc) { ModelMBeanOperationInfo[] ops = operations.values().toArray(new ModelMBeanOperationInfo[operations.values().size()]); ModelMBeanAttributeInfo[] atts = attributes.values().toArray(new ModelMBeanAttributeInfo[attributes.values().size()]); ModelMBeanConstructorInfo[] cons = constructors.values().toArray(new ModelMBeanConstructorInfo[constructors.values().size()]); ModelMBeanNotificationInfo[] notifs = notifications.values().toArray(new ModelMBeanNotificationInfo[notifications.values().size()]); return new ModelMBeanInfoSupport("javax.management.modelmbean.ModelMBeanInfo", "description", atts, cons, ops, notifs, desc); }
Example #2
Source File: TestModelMBean.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public MBeanInfo getMBeanInfo() { try { ModelMBeanAttributeInfo[] attributes = new ModelMBeanAttributeInfo[0]; ModelMBeanConstructorInfo[] constructors = new ModelMBeanConstructorInfo[] { new ModelMBeanConstructorInfo("-", this.getClass().getConstructor()) }; ModelMBeanOperationInfo[] operations = new ModelMBeanOperationInfo[] { new ModelMBeanOperationInfo("info", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.INFO), new ModelMBeanOperationInfo("action", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.ACTION), new ModelMBeanOperationInfo("actionInfo", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.ACTION_INFO), new ModelMBeanOperationInfo("unknown", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.UNKNOWN) }; ModelMBeanNotificationInfo[] notifications = new ModelMBeanNotificationInfo[0]; return new ModelMBeanInfoSupport(this.getClass().getName(), "-", attributes, constructors, operations, notifications); } catch (Exception e) { throw new RuntimeException(e); } }
Example #3
Source File: AnnotationMBeanInfoAssembler.java From cuba with Apache License 2.0 | 6 votes |
/** * Reads the {@link ManagedNotification} metadata from the {@code Class} of the managed resource * and generates and returns the corresponding {@link javax.management.modelmbean.ModelMBeanNotificationInfo} metadata. */ @Override @Nonnull protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { Class intf = findJmxInterface(beanKey, AopUtils.getTargetClass(managedBean)); ManagedNotification[] notificationAttributes = this.attributeSource.getManagedNotifications(intf); ModelMBeanNotificationInfo[] notificationInfos = new ModelMBeanNotificationInfo[notificationAttributes.length]; for (int i = 0; i < notificationAttributes.length; i++) { ManagedNotification attribute = notificationAttributes[i]; notificationInfos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(attribute); } return notificationInfos; }
Example #4
Source File: MetadataMBeanInfoAssembler.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Reads the {@link ManagedNotification} metadata from the {@code Class} of the managed resource * and generates and returns the corresponding {@link ModelMBeanNotificationInfo} metadata. */ @Override protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { ManagedNotification[] notificationAttributes = this.attributeSource.getManagedNotifications(getClassToExpose(managedBean)); ModelMBeanNotificationInfo[] notificationInfos = new ModelMBeanNotificationInfo[notificationAttributes.length]; for (int i = 0; i < notificationAttributes.length; i++) { ManagedNotification attribute = notificationAttributes[i]; notificationInfos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(attribute); } return notificationInfos; }
Example #5
Source File: ModelMBeanInfoSupporter.java From cxf with Apache License 2.0 | 5 votes |
public void addModelMBeanNotification(String[] type, String className, String description, Descriptor desc) { notifications.put(className, new ModelMBeanNotificationInfo(type, className, description, desc)); }
Example #6
Source File: MBeanInfoAssembler.java From flowable-engine with Apache License 2.0 | 5 votes |
private void extractMbeanNotifications(Object managedBean, Set<ModelMBeanNotificationInfo> mBeanNotifications) { ManagedNotifications notifications = managedBean.getClass().getAnnotation(ManagedNotifications.class); if (notifications != null) { for (ManagedNotification notification : notifications.value()) { ModelMBeanNotificationInfo info = new ModelMBeanNotificationInfo(notification.notificationTypes(), notification.name(), notification.description()); mBeanNotifications.add(info); LOGGER.trace("Assembled notification: {}", info); } } }
Example #7
Source File: AbstractConfigurableMBeanInfoAssembler.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { ModelMBeanNotificationInfo[] result = null; if (StringUtils.hasText(beanKey)) { result = this.notificationInfoMappings.get(beanKey); } if (result == null) { result = this.notificationInfos; } return (result != null ? result : new ModelMBeanNotificationInfo[0]); }
Example #8
Source File: AbstractConfigurableMBeanInfoAssembler.java From spring4-understanding with Apache License 2.0 | 5 votes |
public void setNotificationInfos(ManagedNotification[] notificationInfos) { ModelMBeanNotificationInfo[] infos = new ModelMBeanNotificationInfo[notificationInfos.length]; for (int i = 0; i < notificationInfos.length; i++) { ManagedNotification notificationInfo = notificationInfos[i]; infos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(notificationInfo); } this.notificationInfos = infos; }
Example #9
Source File: MetadataMBeanInfoAssembler.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Reads the {@link ManagedNotification} metadata from the {@code Class} of the managed resource * and generates and returns the corresponding {@link ModelMBeanNotificationInfo} metadata. */ @Override protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { ManagedNotification[] notificationAttributes = this.attributeSource.getManagedNotifications(getClassToExpose(managedBean)); ModelMBeanNotificationInfo[] notificationInfos = new ModelMBeanNotificationInfo[notificationAttributes.length]; for (int i = 0; i < notificationAttributes.length; i++) { ManagedNotification attribute = notificationAttributes[i]; notificationInfos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(attribute); } return notificationInfos; }
Example #10
Source File: JmxMetadataUtils.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Convert the supplied {@link ManagedNotification} into the corresponding * {@link javax.management.modelmbean.ModelMBeanNotificationInfo}. */ public static ModelMBeanNotificationInfo convertToModelMBeanNotificationInfo(ManagedNotification notificationInfo) { String name = notificationInfo.getName(); if (!StringUtils.hasText(name)) { throw new IllegalArgumentException("Must specify notification name"); } String[] notifTypes = notificationInfo.getNotificationTypes(); if (notifTypes == null || notifTypes.length == 0) { throw new IllegalArgumentException("Must specify at least one notification type"); } String description = notificationInfo.getDescription(); return new ModelMBeanNotificationInfo(notifTypes, name, description); }
Example #11
Source File: AbstractConfigurableMBeanInfoAssembler.java From lams with GNU General Public License v2.0 | 5 votes |
@Override protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { ModelMBeanNotificationInfo[] result = null; if (StringUtils.hasText(beanKey)) { result = this.notificationInfoMappings.get(beanKey); } if (result == null) { result = this.notificationInfos; } return (result != null ? result : new ModelMBeanNotificationInfo[0]); }
Example #12
Source File: AbstractConfigurableMBeanInfoAssembler.java From lams with GNU General Public License v2.0 | 5 votes |
public void setNotificationInfos(ManagedNotification[] notificationInfos) { ModelMBeanNotificationInfo[] infos = new ModelMBeanNotificationInfo[notificationInfos.length]; for (int i = 0; i < notificationInfos.length; i++) { ManagedNotification notificationInfo = notificationInfos[i]; infos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(notificationInfo); } this.notificationInfos = infos; }
Example #13
Source File: JmxMetadataUtils.java From spring-analysis-note with MIT License | 5 votes |
/** * Convert the supplied {@link ManagedNotification} into the corresponding * {@link javax.management.modelmbean.ModelMBeanNotificationInfo}. */ public static ModelMBeanNotificationInfo convertToModelMBeanNotificationInfo(ManagedNotification notificationInfo) { String[] notifTypes = notificationInfo.getNotificationTypes(); if (ObjectUtils.isEmpty(notifTypes)) { throw new IllegalArgumentException("Must specify at least one notification type"); } String name = notificationInfo.getName(); if (!StringUtils.hasText(name)) { throw new IllegalArgumentException("Must specify notification name"); } String description = notificationInfo.getDescription(); return new ModelMBeanNotificationInfo(notifTypes, name, description); }
Example #14
Source File: JmxMetadataUtils.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Convert the supplied {@link ManagedNotification} into the corresponding * {@link javax.management.modelmbean.ModelMBeanNotificationInfo}. */ public static ModelMBeanNotificationInfo convertToModelMBeanNotificationInfo(ManagedNotification notificationInfo) { String[] notifTypes = notificationInfo.getNotificationTypes(); if (ObjectUtils.isEmpty(notifTypes)) { throw new IllegalArgumentException("Must specify at least one notification type"); } String name = notificationInfo.getName(); if (!StringUtils.hasText(name)) { throw new IllegalArgumentException("Must specify notification name"); } String description = notificationInfo.getDescription(); return new ModelMBeanNotificationInfo(notifTypes, name, description); }
Example #15
Source File: MBeanInfoAssembler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
private void extractMbeanNotifications(Object managedBean, Set<ModelMBeanNotificationInfo> mBeanNotifications) { ManagedNotifications notifications = managedBean.getClass().getAnnotation(ManagedNotifications.class); if (notifications != null) { for (ManagedNotification notification : notifications.value()) { ModelMBeanNotificationInfo info = new ModelMBeanNotificationInfo(notification.notificationTypes(), notification.name(), notification.description()); mBeanNotifications.add(info); LOG.trace("Assembled notification: {}", info); } } }
Example #16
Source File: AbstractConfigurableMBeanInfoAssembler.java From java-technology-stack with MIT License | 5 votes |
@Override protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { ModelMBeanNotificationInfo[] result = null; if (StringUtils.hasText(beanKey)) { result = this.notificationInfoMappings.get(beanKey); } if (result == null) { result = this.notificationInfos; } return (result != null ? result : new ModelMBeanNotificationInfo[0]); }
Example #17
Source File: AbstractConfigurableMBeanInfoAssembler.java From java-technology-stack with MIT License | 5 votes |
public void setNotificationInfos(ManagedNotification[] notificationInfos) { ModelMBeanNotificationInfo[] infos = new ModelMBeanNotificationInfo[notificationInfos.length]; for (int i = 0; i < notificationInfos.length; i++) { ManagedNotification notificationInfo = notificationInfos[i]; infos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(notificationInfo); } this.notificationInfos = infos; }
Example #18
Source File: MetadataMBeanInfoAssembler.java From java-technology-stack with MIT License | 5 votes |
/** * Reads the {@link ManagedNotification} metadata from the {@code Class} of the managed resource * and generates and returns the corresponding {@link ModelMBeanNotificationInfo} metadata. */ @Override protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { ManagedNotification[] notificationAttributes = obtainAttributeSource().getManagedNotifications(getClassToExpose(managedBean)); ModelMBeanNotificationInfo[] notificationInfos = new ModelMBeanNotificationInfo[notificationAttributes.length]; for (int i = 0; i < notificationAttributes.length; i++) { ManagedNotification attribute = notificationAttributes[i]; notificationInfos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(attribute); } return notificationInfos; }
Example #19
Source File: JmxMetadataUtils.java From java-technology-stack with MIT License | 5 votes |
/** * Convert the supplied {@link ManagedNotification} into the corresponding * {@link javax.management.modelmbean.ModelMBeanNotificationInfo}. */ public static ModelMBeanNotificationInfo convertToModelMBeanNotificationInfo(ManagedNotification notificationInfo) { String[] notifTypes = notificationInfo.getNotificationTypes(); if (ObjectUtils.isEmpty(notifTypes)) { throw new IllegalArgumentException("Must specify at least one notification type"); } String name = notificationInfo.getName(); if (!StringUtils.hasText(name)) { throw new IllegalArgumentException("Must specify notification name"); } String description = notificationInfo.getDescription(); return new ModelMBeanNotificationInfo(notifTypes, name, description); }
Example #20
Source File: AbstractConfigurableMBeanInfoAssembler.java From spring-analysis-note with MIT License | 5 votes |
@Override protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { ModelMBeanNotificationInfo[] result = null; if (StringUtils.hasText(beanKey)) { result = this.notificationInfoMappings.get(beanKey); } if (result == null) { result = this.notificationInfos; } return (result != null ? result : new ModelMBeanNotificationInfo[0]); }
Example #21
Source File: AbstractConfigurableMBeanInfoAssembler.java From spring-analysis-note with MIT License | 5 votes |
public void setNotificationInfos(ManagedNotification[] notificationInfos) { ModelMBeanNotificationInfo[] infos = new ModelMBeanNotificationInfo[notificationInfos.length]; for (int i = 0; i < notificationInfos.length; i++) { ManagedNotification notificationInfo = notificationInfos[i]; infos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(notificationInfo); } this.notificationInfos = infos; }
Example #22
Source File: MetadataMBeanInfoAssembler.java From spring-analysis-note with MIT License | 5 votes |
/** * Reads the {@link ManagedNotification} metadata from the {@code Class} of the managed resource * and generates and returns the corresponding {@link ModelMBeanNotificationInfo} metadata. */ @Override protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) { ManagedNotification[] notificationAttributes = obtainAttributeSource().getManagedNotifications(getClassToExpose(managedBean)); ModelMBeanNotificationInfo[] notificationInfos = new ModelMBeanNotificationInfo[notificationAttributes.length]; for (int i = 0; i < notificationAttributes.length; i++) { ManagedNotification attribute = notificationAttributes[i]; notificationInfos[i] = JmxMetadataUtils.convertToModelMBeanNotificationInfo(attribute); } return notificationInfos; }
Example #23
Source File: MBeanInfoAssembler.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public ModelMBeanInfo getMBeanInfo(Object defaultManagedBean, Object customManagedBean, String objectName) throws JMException { if ((defaultManagedBean == null && customManagedBean == null) || objectName == null) return null; // skip proxy classes if (defaultManagedBean != null && Proxy.isProxyClass(defaultManagedBean.getClass())) { LOG.trace("Skip creating ModelMBeanInfo due proxy class {}", defaultManagedBean.getClass()); return null; } // maps and lists to contain information about attributes and operations Map<String, ManagedAttributeInfo> attributes = new LinkedHashMap<String, ManagedAttributeInfo>(); Set<ManagedOperationInfo> operations = new LinkedHashSet<ManagedOperationInfo>(); Set<ModelMBeanAttributeInfo> mBeanAttributes = new LinkedHashSet<ModelMBeanAttributeInfo>(); Set<ModelMBeanOperationInfo> mBeanOperations = new LinkedHashSet<ModelMBeanOperationInfo>(); Set<ModelMBeanNotificationInfo> mBeanNotifications = new LinkedHashSet<ModelMBeanNotificationInfo>(); // extract details from default managed bean if (defaultManagedBean != null) { extractAttributesAndOperations(defaultManagedBean.getClass(), attributes, operations); extractMbeanAttributes(defaultManagedBean, attributes, mBeanAttributes, mBeanOperations); extractMbeanOperations(defaultManagedBean, operations, mBeanOperations); extractMbeanNotifications(defaultManagedBean, mBeanNotifications); } // extract details from custom managed bean if (customManagedBean != null) { extractAttributesAndOperations(customManagedBean.getClass(), attributes, operations); extractMbeanAttributes(customManagedBean, attributes, mBeanAttributes, mBeanOperations); extractMbeanOperations(customManagedBean, operations, mBeanOperations); extractMbeanNotifications(customManagedBean, mBeanNotifications); } // create the ModelMBeanInfo String name = getName(customManagedBean != null ? customManagedBean : defaultManagedBean, objectName); String description = getDescription(customManagedBean != null ? customManagedBean : defaultManagedBean, objectName); ModelMBeanAttributeInfo[] arrayAttributes = mBeanAttributes.toArray(new ModelMBeanAttributeInfo[mBeanAttributes.size()]); ModelMBeanOperationInfo[] arrayOperations = mBeanOperations.toArray(new ModelMBeanOperationInfo[mBeanOperations.size()]); ModelMBeanNotificationInfo[] arrayNotifications = mBeanNotifications.toArray(new ModelMBeanNotificationInfo[mBeanNotifications.size()]); ModelMBeanInfo info = new ModelMBeanInfoSupport(name, description, arrayAttributes, null, arrayOperations, arrayNotifications); LOG.trace("Created ModelMBeanInfo {}", info); return info; }
Example #24
Source File: MBeanInfoAssembler.java From flowable-engine with Apache License 2.0 | 4 votes |
public ModelMBeanInfo getMBeanInfo(Object defaultManagedBean, Object customManagedBean, String objectName) throws JMException { if ((defaultManagedBean == null && customManagedBean == null) || objectName == null) return null; // skip proxy classes if (defaultManagedBean != null && Proxy.isProxyClass(defaultManagedBean.getClass())) { LOGGER.trace("Skip creating ModelMBeanInfo due proxy class {}", defaultManagedBean.getClass()); return null; } // maps and lists to contain information about attributes and operations Map<String, ManagedAttributeInfo> attributes = new LinkedHashMap<>(); Set<ManagedOperationInfo> operations = new LinkedHashSet<>(); Set<ModelMBeanAttributeInfo> mBeanAttributes = new LinkedHashSet<>(); Set<ModelMBeanOperationInfo> mBeanOperations = new LinkedHashSet<>(); Set<ModelMBeanNotificationInfo> mBeanNotifications = new LinkedHashSet<>(); // extract details from default managed bean if (defaultManagedBean != null) { extractAttributesAndOperations(defaultManagedBean.getClass(), attributes, operations); extractMbeanAttributes(defaultManagedBean, attributes, mBeanAttributes, mBeanOperations); extractMbeanOperations(defaultManagedBean, operations, mBeanOperations); extractMbeanNotifications(defaultManagedBean, mBeanNotifications); } // extract details from custom managed bean if (customManagedBean != null) { extractAttributesAndOperations(customManagedBean.getClass(), attributes, operations); extractMbeanAttributes(customManagedBean, attributes, mBeanAttributes, mBeanOperations); extractMbeanOperations(customManagedBean, operations, mBeanOperations); extractMbeanNotifications(customManagedBean, mBeanNotifications); } // create the ModelMBeanInfo String name = getName(customManagedBean != null ? customManagedBean : defaultManagedBean, objectName); String description = getDescription(customManagedBean != null ? customManagedBean : defaultManagedBean, objectName); ModelMBeanAttributeInfo[] arrayAttributes = mBeanAttributes.toArray(new ModelMBeanAttributeInfo[mBeanAttributes.size()]); ModelMBeanOperationInfo[] arrayOperations = mBeanOperations.toArray(new ModelMBeanOperationInfo[mBeanOperations.size()]); ModelMBeanNotificationInfo[] arrayNotifications = mBeanNotifications.toArray(new ModelMBeanNotificationInfo[mBeanNotifications.size()]); ModelMBeanInfo info = new ModelMBeanInfoSupport(name, description, arrayAttributes, null, arrayOperations, arrayNotifications); LOGGER.trace("Created ModelMBeanInfo {}", info); return info; }
Example #25
Source File: AbstractMBeanInfoAssembler.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Get the notification metadata for the MBean resource. Subclasses should implement * this method to return the appropriate metadata for all notifications that should * be exposed in the management interface for the managed resource. * <p>Default implementation returns an empty array of {@code ModelMBeanNotificationInfo}. * @param managedBean the bean instance (might be an AOP proxy) * @param beanKey the key associated with the MBean in the beans map * of the {@code MBeanExporter} * @return the notification metadata * @throws JMException in case of errors */ protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) throws JMException { return new ModelMBeanNotificationInfo[0]; }
Example #26
Source File: AbstractMBeanInfoAssembler.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Get the notification metadata for the MBean resource. Subclasses should implement * this method to return the appropriate metadata for all notifications that should * be exposed in the management interface for the managed resource. * <p>Default implementation returns an empty array of {@code ModelMBeanNotificationInfo}. * @param managedBean the bean instance (might be an AOP proxy) * @param beanKey the key associated with the MBean in the beans map * of the {@code MBeanExporter} * @return the notification metadata * @throws JMException in case of errors */ protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) throws JMException { return new ModelMBeanNotificationInfo[0]; }
Example #27
Source File: AbstractMBeanInfoAssembler.java From java-technology-stack with MIT License | 2 votes |
/** * Get the notification metadata for the MBean resource. Subclasses should implement * this method to return the appropriate metadata for all notifications that should * be exposed in the management interface for the managed resource. * <p>Default implementation returns an empty array of {@code ModelMBeanNotificationInfo}. * @param managedBean the bean instance (might be an AOP proxy) * @param beanKey the key associated with the MBean in the beans map * of the {@code MBeanExporter} * @return the notification metadata * @throws JMException in case of errors */ protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) throws JMException { return new ModelMBeanNotificationInfo[0]; }
Example #28
Source File: AbstractMBeanInfoAssembler.java From spring-analysis-note with MIT License | 2 votes |
/** * Get the notification metadata for the MBean resource. Subclasses should implement * this method to return the appropriate metadata for all notifications that should * be exposed in the management interface for the managed resource. * <p>Default implementation returns an empty array of {@code ModelMBeanNotificationInfo}. * @param managedBean the bean instance (might be an AOP proxy) * @param beanKey the key associated with the MBean in the beans map * of the {@code MBeanExporter} * @return the notification metadata * @throws JMException in case of errors */ protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) throws JMException { return new ModelMBeanNotificationInfo[0]; }