summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2009-07-21 09:32:53 +0000
committerRobert Gemmell <robbie@apache.org>2009-07-21 09:32:53 +0000
commit0a12f1815c7f07b4cdfeb04bf973a18ab0632cf4 (patch)
tree555c5fe886a6cccdd901bb9dd32d9fbe6ae9df19
parent1714298659d2fe90e8c5d8070f8da23fcbb73556 (diff)
downloadqpid-python-0a12f1815c7f07b4cdfeb04bf973a18ab0632cf4.tar.gz
QPID-1969: restrict the Notifications areas in each VirtualHost tree to only show the notifications from that VirtualHost, instead of those from the entire server.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@796212 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java2
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java27
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java12
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java10
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();
}