@Override void getNotificationDescriptions(ListIterator<PathElement> iterator, Map<String, NotificationEntry> providers, boolean inherited) { Map<String, NotificationEntry> temp = new HashMap<String, NotificationEntry>(); target.getNotificationDescriptions(iterator, temp, inherited); for (Map.Entry<String, NotificationEntry> entry : providers.entrySet()) { providers.put(entry.getKey(), new NotificationEntry(entry.getValue().getDescriptionProvider(), entry.getValue().isInherited())); } }
private MBeanNotificationInfo[] getNotifications() { List<MBeanNotificationInfo> notifications = new ArrayList<>(); for (Map.Entry<String, NotificationEntry> entry : resourceRegistration.getNotificationDescriptions(PathAddress.EMPTY_ADDRESS, true).entrySet()) { ModelNode descriptionModel = entry.getValue().getDescriptionProvider().getModelDescription(null); String description = descriptionModel.get(DESCRIPTION).asString(); String notificationType = entry.getKey(); MBeanNotificationInfo info = null; if (notificationType.equals(ModelDescriptionConstants.ATTRIBUTE_VALUE_WRITTEN_NOTIFICATION)) { info = new MBeanNotificationInfo(new String[]{AttributeChangeNotification.ATTRIBUTE_CHANGE}, AttributeChangeNotification.class.getName(), description); } else if (notificationType.equals(ModelDescriptionConstants.RESOURCE_ADDED_NOTIFICATION) || notificationType.equals(ModelDescriptionConstants.RESOURCE_REMOVED_NOTIFICATION)) { // do not expose these notifications as they are emitted by the JMImplementation:type=MBeanServerDelegate MBean. } else { info = new MBeanNotificationInfo(new String[]{notificationType}, Notification.class.getName(), description); } if (info != null) { notifications.add(info); } } return notifications.toArray(new MBeanNotificationInfo[notifications.size()]); }
@Override public void registerNotification(NotificationDefinition notification, boolean inherited) { checkPermission(); String type = notification.getType(); NotificationEntry entry = new NotificationEntry(notification.getDescriptionProvider(), inherited); writeLock.lock(); try { if (notifications == null) { notifications = Collections.singletonMap(type, entry); } else { if (notifications.containsKey(type)) { throw alreadyRegistered(NOTIFICATION, type); } if (notifications.size() == 1) { notifications = new HashMap<>(notifications); } notifications.put(type, entry); } } finally { writeLock.unlock(); } }
@Override void getInheritedNotificationEntries(final Map<String, NotificationEntry> providers) { checkPermission(); for (final Map.Entry<String, NotificationEntry> entry : notificationsUpdater.get(this).entrySet()) { if (entry.getValue().isInherited() && !providers.containsKey(entry.getKey())) { providers.put(entry.getKey(), entry.getValue()); } } }
private MBeanNotificationInfo[] getNotifications() { List<MBeanNotificationInfo> notifications = new ArrayList<>(); for (Map.Entry<String, NotificationEntry> entry : resourceRegistration.getNotificationDescriptions(PathAddress.EMPTY_ADDRESS, true).entrySet()) { ModelNode descriptionModel = entry.getValue().getDescriptionProvider().getModelDescription(null); String description = descriptionModel.get(DESCRIPTION).asString(); String notificationType = entry.getKey(); MBeanNotificationInfo info = null; if (notificationType.equals(ModelDescriptionConstants.ATTRIBUTE_VALUE_WRITTEN_NOTIFICATION)) { info = new MBeanNotificationInfo(new String[]{AttributeChangeNotification.ATTRIBUTE_CHANGE}, AttributeChangeNotification.class.getName(), description); } else if (notificationType.equals(ModelDescriptionConstants.RESOURCE_ADDED_NOTIFICATION) || notificationType.equals(ModelDescriptionConstants.RESOURCE_REMOVED_NOTIFICATION)) { // do not expose these notifications as they are emitted by the JMImplementation:type=MBeanServerDelegate MBean. } else { info = new MBeanNotificationInfo(new String[]{notificationType}, Notification.class.getName(), description); } if (info != null) { notifications.add(info); } } return notifications.toArray(new MBeanNotificationInfo[notifications.size()]); }
@Override public void registerNotification(NotificationDefinition notification, boolean inherited) { checkPermission(); String type = notification.getType(); NotificationEntry entry = new NotificationEntry(notification.getDescriptionProvider(), inherited); writeLock.lock(); try { if (notifications == null) { notifications = Collections.singletonMap(type, entry); } else { if (notifications.containsKey(type)) { throw alreadyRegistered(NOTIFICATION, type); } if (notifications.size() == 1) { notifications = new HashMap<>(notifications); } notifications.put(type, entry); } } finally { writeLock.unlock(); } }
@Override void getInheritedNotificationEntries(final Map<String, NotificationEntry> providers) { checkPermission(); readLock.lock(); try { if (notifications != null) { for (final Map.Entry<String, NotificationEntry> entry : notifications.entrySet()) { if (entry.getValue().isInherited() && !providers.containsKey(entry.getKey())) { providers.put(entry.getKey(), entry.getValue()); } } } } finally { readLock.unlock(); } }
@Override void getNotificationDescriptions(ListIterator<PathElement> iterator, Map<String, NotificationEntry> providers, boolean inherited) { Map<String, NotificationEntry> temp = new HashMap<String, NotificationEntry>(); target.getNotificationDescriptions(iterator, temp, inherited); for (Map.Entry<String, NotificationEntry> entry : providers.entrySet()) { providers.put(entry.getKey(), new NotificationEntry(entry.getValue().getDescriptionProvider(), entry.getValue().isInherited())); } }
final DescriptionProvider provider = entry.getValue().getDescriptionProvider(); notifications.put(entry.getKey(), provider.getModelDescription(locale));
@Override public void registerNotification(NotificationDefinition notification, boolean inherited) { NotificationEntry entry = new NotificationEntry(notification.getDescriptionProvider(), inherited); checkPermission(); if (notificationsUpdater.putIfAbsent(this, notification.getType(), entry) != null) { throw alreadyRegistered(NOTIFICATION, notification.getType()); } }
@Override void getInheritedNotificationEntries(final Map<String, NotificationEntry> providers) { checkPermission(); readLock.lock(); try { if (notifications != null) { for (final Map.Entry<String, NotificationEntry> entry : notifications.entrySet()) { if (entry.getValue().isInherited() && !providers.containsKey(entry.getKey())) { providers.put(entry.getKey(), entry.getValue()); } } } } finally { readLock.unlock(); } }
@Override void getNotificationDescriptions(ListIterator<PathElement> iterator, Map<String, NotificationEntry> providers, boolean inherited) { Map<String, NotificationEntry> temp = new HashMap<String, NotificationEntry>(); target.getNotificationDescriptions(iterator, temp, inherited); for (Map.Entry<String, NotificationEntry> entry : providers.entrySet()) { providers.put(entry.getKey(), new NotificationEntry(entry.getValue().getDescriptionProvider(), entry.getValue().isInherited())); } }
final DescriptionProvider provider = entry.getValue().getDescriptionProvider(); notifications.put(entry.getKey(), provider.getModelDescription(locale));
final DescriptionProvider provider = entry.getValue().getDescriptionProvider(); notifications.put(entry.getKey(), provider.getModelDescription(locale));