diff options
Diffstat (limited to 'qpid/java')
4 files changed, 46 insertions, 5 deletions
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java index cc44a19781..23879a779c 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java @@ -169,6 +169,8 @@ public abstract class ServerRegistry public abstract List<NotificationObject> getNotifications(ManagedBean mbean); + public abstract List<NotificationObject> getNotifications(String virtualhost); + public abstract boolean hasSubscribedForNotifications(ManagedBean mbean, String name, String type); public abstract void clearNotifications(ManagedBean mbean, List<NotificationObject> list); diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java index bf3e95e308..f280e20fdd 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java @@ -248,6 +248,33 @@ public class JMXServerRegistry extends ServerRegistry } } + public List<NotificationObject> getNotifications(String virtualhost) + { + List<NotificationObject> vhostNotificationsList = new ArrayList<NotificationObject>(); + + //iterate over all the notification lists for mbeans with subscribed notifications + for (List<NotificationObject> list : _notificationsMap.values()) + { + //Check the source vhost of the first notification + NotificationObject notification = list.get(0); + + if (notification != null) + { + String sourceVhost = notification.getSourceVirtualHost(); + if(sourceVhost != null) + { + if(sourceVhost.equalsIgnoreCase(virtualhost)) + { + //If it matches, add the entire list as they are from the same vhost (same source mbean) + vhostNotificationsList.addAll(list); + } + } + } + } + + return vhostNotificationsList; + } + public void clearNotifications(ManagedBean mbean, List<NotificationObject> list) { if (mbean == null) diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java index 926e5f0a24..e42b3c53b6 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java @@ -26,6 +26,8 @@ import java.util.TimeZone; import javax.management.ObjectName; +import static org.apache.qpid.management.ui.Constants.VIRTUAL_HOST; + public class NotificationObject { @@ -65,6 +67,16 @@ public class NotificationObject return null; } + public String getSourceVirtualHost() + { + if (_source instanceof ObjectName) + { + return ((ObjectName)_source).getKeyProperty(VIRTUAL_HOST); + } + + return null; + } + public String getMessage() { return _message; diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java index be25707bd3..b937c9b29a 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java @@ -466,16 +466,16 @@ public class VHNotificationsTabControl extends TabControl } /** - * Updates the table with new notifications received from mbean server for all mbeans + * Updates the table with new notifications received from mbean server for all mbeans in this virtual host */ protected void updateTableViewer() { - ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer()); - List<NotificationObject> newList = serverRegistry.getNotifications(null); - if (newList == null) - return; + String virtualhost = MBeanView.getVirtualHost(); + ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer()); + List<NotificationObject> newList = serverRegistry.getNotifications(virtualhost); _notifications = newList; + _tableViewer.setInput(_notifications); _tableViewer.refresh(); } |
