You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by bh...@apache.org on 2007/01/25 19:03:09 UTC
svn commit: r499874 - in /incubator/qpid/trunk/qpid/java:
broker/src/main/java/org/apache/qpid/server/
broker/src/main/java/org/apache/qpid/server/exchange/
broker/src/main/java/org/apache/qpid/server/management/
broker/src/main/java/org/apache/qpid/se...
Author: bhupendrab
Date: Thu Jan 25 10:03:08 2007
New Revision: 499874
URL: http://svn.apache.org/viewvc?view=rev&rev=499874
Log:
QPID-319
management console view updated for virtual host hierarchy
Modified:
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TreeObject.java
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java Thu Jan 25 10:03:08 2007
@@ -202,12 +202,9 @@
return _virtualHostMBean;
}
-// public ObjectName getObjectName() throws MalformedObjectNameException
-// {
-// StringBuffer objectName = new StringBuffer(ManagedObject.DOMAIN);
-// objectName.append(".").append(getVirtualHost().getName());
-// objectName.append(":type=").append(getType());
-//
-// return new ObjectName(objectName.toString());
-// }
+ // This will have a single instance for a virtual host, so not having the name property in the ObjectName
+ public ObjectName getObjectName() throws MalformedObjectNameException
+ {
+ return getObjectNameForSingleInstanceMBean();
+ }
} // End of MBean class
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java Thu Jan 25 10:03:08 2007
@@ -100,12 +100,13 @@
return _autoDelete;
}
-// public ObjectName getObjectName() throws MalformedObjectNameException
-// {
-// String objNameString = super.getObjectName().toString();
-// objNameString = objNameString + ",VirtualHost="+ _virtualHost.getName() +",ExchangeType=" + _exchangeType;
-// return new ObjectName(objNameString);
-// }
+ // Added exchangetype in the object name lets maangement apps to do any customization required
+ public ObjectName getObjectName() throws MalformedObjectNameException
+ {
+ String objNameString = super.getObjectName().toString();
+ objNameString = objNameString + ",ExchangeType=" + _exchangeType;
+ return new ObjectName(objNameString);
+ }
protected ManagedObjectRegistry getManagedObjectRegistry()
{
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java Thu Jan 25 10:03:08 2007
@@ -103,8 +103,7 @@
* @return ObjectName
* @throws MalformedObjectNameException
*/
- public ObjectName getObjectName()
- throws MalformedObjectNameException
+ public ObjectName getObjectName() throws MalformedObjectNameException
{
String name = getObjectInstanceName();
StringBuffer objectName = new StringBuffer(ManagedObject.DOMAIN);
@@ -119,26 +118,41 @@
return new ObjectName(objectName.toString());
}
- private String getHierarchicalType(ManagedObject obj)
+ protected ObjectName getObjectNameForSingleInstanceMBean() throws MalformedObjectNameException
+ {
+ StringBuffer objectName = new StringBuffer(ManagedObject.DOMAIN);
+
+ objectName.append(":type=");
+ objectName.append(getHierarchicalType(this));
+
+ String hierarchyName = getHierarchicalName(this);
+ if (hierarchyName != null)
+ {
+ objectName.append(",");
+ objectName.append(hierarchyName.substring(0, hierarchyName.lastIndexOf(",")));
+ }
+
+ return new ObjectName(objectName.toString());
+ }
+
+ protected String getHierarchicalType(ManagedObject obj)
{
- String parentType = null;
if (obj.getParentObject() != null)
{
- parentType = getHierarchicalType(obj.getParentObject()).toString();
+ String parentType = getHierarchicalType(obj.getParentObject()).toString();
return parentType + "." + obj.getType();
}
else
return obj.getType();
}
- private String getHierarchicalName(ManagedObject obj)
+ protected String getHierarchicalName(ManagedObject obj)
{
- String parentName = null;
if (obj.getParentObject() != null)
{
- parentName = obj.getParentObject().getType() + "=" +
- obj.getParentObject().getObjectInstanceName() + ","+
- getHierarchicalName(obj.getParentObject());
+ String parentName = obj.getParentObject().getType() + "=" +
+ obj.getParentObject().getObjectInstanceName() + ","+
+ getHierarchicalName(obj.getParentObject());
return parentName;
}
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java Thu Jan 25 10:03:08 2007
@@ -37,7 +37,7 @@
*/
public interface ManagedBroker
{
- static final String TYPE = "BrokerManager";
+ static final String TYPE = "VirtualHostManager";
/**
* Creates a new Exchange.
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java Thu Jan 25 10:03:08 2007
@@ -90,7 +90,8 @@
_name = name;
_virtualHostMBean = new VirtualHostMBean();
- _virtualHostMBean.register();
+ // This isn't needed to be registered
+ //_virtualHostMBean.register();
_queueRegistry = new DefaultQueueRegistry(this);
_exchangeFactory = new DefaultExchangeFactory(this);
@@ -107,7 +108,8 @@
_name = name;
_virtualHostMBean = new VirtualHostMBean();
- _virtualHostMBean.register();
+ // This isn't needed to be registered
+ //_virtualHostMBean.register();
_queueRegistry = new DefaultQueueRegistry(this);
_exchangeFactory = new DefaultExchangeFactory(this);
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java Thu Jan 25 10:03:08 2007
@@ -33,11 +33,14 @@
public final static String SERVER = "server";
public final static String DOMAIN = "domain";
public final static String NODE_TYPE_MBEANTYPE = "mbeantype";
+ // currently used only for virtual host instances, but will work as general also
+ public final static String TYPE_INSTANCE = "mbeantype_instance";
public final static String MBEAN = "mbean";
public final static String ATTRIBUTE = "Attribute";
public final static String ATTRIBUTES = "Attributes";
public final static String NOTIFICATION = "Notifications";
public final static String RESULT = "Result";
+ public final static String VIRTUAL_HOST = "VirtualHost";
public final static String ATTRIBUTE_QUEUE_DEPTH = "QueueDepth";
@@ -45,14 +48,13 @@
public final static String NAVIGATION_ROOT = "Qpid Connections";
public final static String DESCRIPTION = " Description";
-
- public final static String VIRTUAL_HOST = "VirtualHost";
- public final static String MBEAN_TYPE_BROKER_MANAGER = "VirtualHost.BrokerManager";
- public final static String MBEAN_TYPE_QUEUE = "VirtualHost.Queue";
- public final static String MBEAN_TYPE_EXCHANGE = "VirtualHost.Exchange";
+
+ public final static String BROKER_MANAGER = "Broker_Manager";
+ public final static String QUEUE = "Queue";
+ public final static String EXCHANGE = "Exchange";
public final static String EXCHANGE_TYPE = "ExchangeType";
public final static String[] EXCHANGE_TYPE_VALUES = {"direct", "topic", "headers"};
- public final static String MBEAN_TYPE_CONNECTION ="Connection";
+ public final static String CONNECTION ="Connection";
public final static String ACTION_ADDSERVER = "New Connection";
@@ -88,13 +90,4 @@
public final static int OPERATION_IMPACT_ACTION = 1;
public final static int OPERATION_IMPACT_ACTIONINFO = 2;
public final static int OPERATION_IMPACT_UNKNOWN = 3;
- public static final String NODE_TYPE_VIRTUAL_HOST = "virtualhost";
- public static final String NODE_LABEL_QUEUES = "queues";
- public static final String NODE_LABEL_EXCHANGES = "exchanges";
- public static final String NODE_LABEL_CONNECTIONS = "connections";
-
- public static final String NODE_LABEL_VIRTUAL_HOSTS = "virtual hosts";
- public static final String TAB_LABEL_QUEUES = "queues";
- public static final String TAB_LABEL_EXCHANGES = "exchanges";
- public static final String TAB_LABEL_CONNECTIONS = "connections";
}
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java Thu Jan 25 10:03:08 2007
@@ -32,6 +32,7 @@
private String _uniqueName = "";
private String _domain = "";
private String _type = "";
+ private String _virtualHostName = "Default";
private ManagedServer _server = null;
private HashMap _properties = null;
@@ -47,6 +48,7 @@
public void setProperties(HashMap properties)
{
this._properties = properties;
+ setVirtualHostName(getProperty(Constants.VIRTUAL_HOST));
}
public String getDomain()
{
@@ -80,6 +82,19 @@
public void setUniqueName(String uniqueName)
{
this._uniqueName = uniqueName;
+ }
+
+ public String getVirtualHostName()
+ {
+ return _virtualHostName;
+ }
+
+ public void setVirtualHostName(String virtualHost)
+ {
+ if (virtualHost != null)
+ {
+ this._virtualHostName = virtualHost;
+ }
}
}
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ServerRegistry.java Thu Jan 25 10:03:08 2007
@@ -23,10 +23,8 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import org.apache.qpid.management.ui.jmx.ClientListener;
import org.apache.qpid.management.ui.model.ManagedAttributeModel;
@@ -37,11 +35,14 @@
{
private ManagedServer _managedServer = null;
// list of all Connection mbeans
- protected ConcurrentMap<String,List<ManagedBean>> _connections = new ConcurrentHashMap<String,List<ManagedBean>>();
+ //private List<ManagedBean> _connections = new ArrayList<ManagedBean>();
+ private ConcurrentMap<String,List<ManagedBean>> _connections = new ConcurrentHashMap<String,List<ManagedBean>>();
// list of all exchange mbeans
- protected ConcurrentMap<String,List<ManagedBean>> _exchanges = new ConcurrentHashMap<String,List<ManagedBean>>();
+ //private List<ManagedBean> _exchanges = new ArrayList<ManagedBean>();
+ private ConcurrentMap<String,List<ManagedBean>> _exchanges = new ConcurrentHashMap<String,List<ManagedBean>>();
// list of all queue mbenas
- protected ConcurrentMap<String,List<ManagedBean>> _queues = new ConcurrentHashMap<String,List<ManagedBean>>();
+ //private List<ManagedBean> _queues = new ArrayList<ManagedBean>();
+ private ConcurrentMap<String,List<ManagedBean>> _queues = new ConcurrentHashMap<String,List<ManagedBean>>();
public ServerRegistry()
{
@@ -65,67 +66,57 @@
protected void addConnectionMBean(ManagedBean mbean)
{
- String virtualHostName = mbean.getProperty("VirtualHost");
- _connections.putIfAbsent(virtualHostName, new ArrayList<ManagedBean>());
- List<ManagedBean> beans = _connections.get(virtualHostName);
+ String vHost = mbean.getVirtualHostName();
+ _connections.putIfAbsent(vHost, new ArrayList<ManagedBean>());
+ List<ManagedBean> beans = _connections.get(vHost);
beans.add(mbean);
}
protected void addExchangeMBean(ManagedBean mbean)
{
- String virtualHostName = mbean.getProperty("VirtualHost");
- _exchanges.putIfAbsent(virtualHostName, new ArrayList<ManagedBean>());
- List<ManagedBean> beans = _exchanges.get(virtualHostName);
+ String vHost = mbean.getVirtualHostName();
+ _exchanges.putIfAbsent(vHost, new ArrayList<ManagedBean>());
+ List<ManagedBean> beans = _exchanges.get(vHost);
beans.add(mbean);
}
protected void addQueueMBean(ManagedBean mbean)
{
- String virtualHostName = mbean.getProperty("VirtualHost");
- _queues.putIfAbsent(virtualHostName, new ArrayList<ManagedBean>());
- List<ManagedBean> beans = _queues.get(virtualHostName);
+ String vHost = mbean.getVirtualHostName();
+ _queues.putIfAbsent(vHost, new ArrayList<ManagedBean>());
+ List<ManagedBean> beans = _queues.get(vHost);
beans.add(mbean);
}
protected void removeConnectionMBean(ManagedBean mbean)
{
- String virtualHostName = mbean.getProperty("VirtualHost");
- _connections.putIfAbsent(virtualHostName, new ArrayList<ManagedBean>());
- List<ManagedBean> beans = _connections.get(virtualHostName);
+ String vHost = mbean.getVirtualHostName();
+ List<ManagedBean> beans = _connections.get(vHost);
beans.remove(mbean);
}
protected void removeExchangeMBean(ManagedBean mbean)
{
- String virtualHostName = mbean.getProperty("VirtualHost");
- _exchanges.putIfAbsent(virtualHostName, new ArrayList<ManagedBean>());
- List<ManagedBean> beans = _exchanges.get(virtualHostName);
- beans.remove(mbean);
+ _exchanges.get(mbean.getVirtualHostName()).remove(mbean);
}
protected void removeQueueMBean(ManagedBean mbean)
{
- String virtualHostName = mbean.getProperty("VirtualHost");
- _queues.putIfAbsent(virtualHostName, new ArrayList<ManagedBean>());
- List<ManagedBean> beans = _queues.get(virtualHostName);
- beans.remove(mbean);
+ _queues.get(mbean.getVirtualHostName()).remove(mbean);
}
public List<ManagedBean> getConnections(String virtualHost)
{
- _connections.putIfAbsent(virtualHost, new ArrayList<ManagedBean>());
return _connections.get(virtualHost);
}
public List<ManagedBean> getExchanges(String virtualHost)
{
- _exchanges.putIfAbsent(virtualHost, new ArrayList<ManagedBean>());
return _exchanges.get(virtualHost);
}
public List<ManagedBean> getQueues(String virtualHost)
{
- _queues.putIfAbsent(virtualHost, new ArrayList<ManagedBean>());
return _queues.get(virtualHost);
}
@@ -148,11 +139,11 @@
public abstract OperationDataModel getOperationModel(ManagedBean mbean);
- public abstract String[] getQueueNames(String virtualHost);
+ public abstract String[] getQueueNames(String vistualHostName);
- public abstract String[] getExchangeNames(String virtualHost);
+ public abstract String[] getExchangeNames(String vistualHostName);
- public abstract String[] getConnectionNames(String virtualHost);
+ public abstract String[] getConnectionNames(String vistualHostName);
public abstract List<NotificationObject> getNotifications(ManagedBean mbean);
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java Thu Jan 25 10:03:08 2007
@@ -120,8 +120,7 @@
}
catch (ListenerNotFoundException ex)
{
- System.err.println(ex);
- ex.printStackTrace();
+ System.out.println(ex.toString());
}
}
@@ -132,15 +131,15 @@
public void addManagedObject(ManagedBean mbean)
{
- if (Constants.MBEAN_TYPE_QUEUE.equals(mbean.getType()) && !mbean.getName().startsWith("tmp_"))
+ if (mbean.getType().endsWith(Constants.QUEUE) && !mbean.getName().startsWith("tmp_"))
{
addQueueMBean(mbean);
}
- else if (Constants.MBEAN_TYPE_EXCHANGE.equals(mbean.getType()))
+ else if (mbean.getType().endsWith(Constants.EXCHANGE))
{
addExchangeMBean(mbean);
}
- else if (Constants.MBEAN_TYPE_CONNECTION.equals(mbean.getType()))
+ else if (mbean.getType().endsWith(Constants.CONNECTION))
{
addConnectionMBean(mbean);
}
@@ -150,11 +149,11 @@
public void removeManagedObject(ManagedBean mbean)
{
- if (Constants.MBEAN_TYPE_QUEUE.equals(mbean.getType()))
+ if (mbean.getType().endsWith(Constants.QUEUE))
removeQueueMBean(mbean);
- else if (Constants.MBEAN_TYPE_EXCHANGE.equals(mbean.getType()))
+ else if (mbean.getType().endsWith(Constants.EXCHANGE))
removeExchangeMBean(mbean);
- else if (Constants.MBEAN_TYPE_CONNECTION.equals(mbean.getType()))
+ else if (mbean.getType().endsWith(Constants.CONNECTION))
removeConnectionMBean(mbean);
_mbeansMap.remove(mbean.getUniqueName());
@@ -248,6 +247,7 @@
list.add(type);
}
+ System.out.println("Subscribed for notification :" + mbean.getUniqueName());
}
public boolean hasSubscribedForNotifications(ManagedBean mbean, String name, String type)
@@ -268,6 +268,7 @@
public void removeNotificationListener(ManagedBean mbean, String name, String type) throws Exception
{
+ System.out.println("Removed notification listener :" + mbean.getUniqueName() + name +type);
if (_subscribedNotificationMap.containsKey(mbean.getUniqueName()))
{
HashMap<String, List<String>> map = _subscribedNotificationMap.get(mbean.getUniqueName());
@@ -334,40 +335,49 @@
return _operationModelMap.get(mbean.getUniqueName());
}
- public String[] getQueueNames(String virtualHost)
+ public String[] getQueueNames(String virtualHostName)
{
- List<ManagedBean> queues = _queues.get(virtualHost);
- String[] queueNames = new String[queues.size()];
+ List<ManagedBean> list = getQueues(virtualHostName);
+ if (list == null)
+ return null;
+
+ String[] queues = new String[list.size()];
int i = 0;
- for (ManagedBean mbean : queues)
+ for (ManagedBean mbean : list)
{
- queueNames[i++] = mbean.getName();
+ queues[i++] = mbean.getName();
}
- return queueNames;
+ return queues;
}
- public String[] getExchangeNames(String virtualHost)
+ public String[] getExchangeNames(String virtualHostName)
{
- List<ManagedBean> exchanges = _exchanges.get(virtualHost);
- String[] exchangeNames = new String[exchanges.size()];
+ List<ManagedBean> list = getExchanges(virtualHostName);
+ if (list == null)
+ return null;
+
+ String[] exchanges = new String[list.size()];
int i = 0;
- for (ManagedBean mbean : exchanges)
+ for (ManagedBean mbean : list)
{
- exchangeNames[i++] = mbean.getName();
+ exchanges[i++] = mbean.getName();
}
- return exchangeNames;
+ return exchanges;
}
- public String[] getConnectionNames(String virtualHost)
+ public String[] getConnectionNames(String virtualHostName)
{
- List<ManagedBean> connections = _connections.get(virtualHost);
- String[] connectionNames = new String[connections.size()];
+ List<ManagedBean> list = getExchanges(virtualHostName);
+ if (list == null)
+ return null;
+
+ String[] connections = new String[list.size()];
int i = 0;
- for (ManagedBean mbean : connections)
+ for (ManagedBean mbean : list)
{
- connectionNames[i++] = mbean.getName();
+ connections[i++] = mbean.getName();
}
- return connectionNames;
+ return connections;
}
public ClientNotificationListener getNotificationListener()
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java Thu Jan 25 10:03:08 2007
@@ -91,7 +91,7 @@
for (int i = 0; i < selectedItems.length; i++)
{
String name = selectedItems[i];;
- if (Constants.MBEAN_TYPE_QUEUE.equals(_type))
+ if (Constants.QUEUE.equals(_type))
{
int endIndex = name.lastIndexOf("(");
name = name.substring(0, endIndex -1);
@@ -231,21 +231,21 @@
java.util.List<ManagedBean> list = null;
// populate the map and list with appropriate mbeans
- if (_type.equals(Constants.MBEAN_TYPE_QUEUE) || _type.equals(Constants.NODE_LABEL_QUEUES))
+ if (_type.equals(Constants.QUEUE))
{
- list = serverRegistry.getQueues(MBeanView.getVirtualHostName());
+ list = serverRegistry.getQueues(MBeanView.getVirtualHost());
items = getQueueItems(list);
_sortBySizeButton.setVisible(true);
}
- else if (_type.equals(Constants.MBEAN_TYPE_EXCHANGE) || _type.equals(Constants.NODE_LABEL_EXCHANGES))
+ else if (_type.equals(Constants.EXCHANGE))
{
- list = serverRegistry.getExchanges(MBeanView.getVirtualHostName());
+ list = serverRegistry.getExchanges(MBeanView.getVirtualHost());
items = getItems(list);
_sortBySizeButton.setVisible(false);
}
- else if (_type.equals(Constants.MBEAN_TYPE_CONNECTION) || _type.equals(Constants.NODE_LABEL_CONNECTIONS))
+ else if (_type.equals(Constants.CONNECTION))
{
- list = serverRegistry.getConnections(MBeanView.getVirtualHostName());
+ list = serverRegistry.getConnections(MBeanView.getVirtualHost());
items = getItems(list);
_sortBySizeButton.setVisible(false);
}
@@ -255,11 +255,15 @@
}
_list.setItems(items);
+
}
// sets the map with appropriate mbean and name
private String[] getItems(java.util.List<ManagedBean> list)
{
+ if (list == null)
+ return new String[0];
+
Collections.sort(list, _sorterByName);
String[] items = new String[list.size()];
int i = 0;
@@ -273,6 +277,9 @@
private String[] getQueueItems(java.util.List<ManagedBean> list) throws Exception
{
+ if (list == null)
+ return new String[0];
+
// Sort the list. It will keep the mbeans in sorted order in the _queueMap, which is required for
// sorting the queue according to size etc
Collections.sort(list, _sorterByName);
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java Thu Jan 25 10:03:08 2007
@@ -64,6 +64,7 @@
private static ManagedServer _server = null;
private TreeObject _selectedNode = null;
private ManagedBean _mbean = null;
+ private static String _virtualHostName = null;
// This map contains a TabFolder for each kind of MBean. TabFolder is mapped with mbeantype(eg Connection, Queue etc)
private HashMap<String, TabFolder> tabFolderMap = new HashMap<String, TabFolder>();
private ISelectionListener selectionListener = new SelectionListenerImpl();
@@ -74,12 +75,9 @@
// TabFolder to list all the mbeans for a given mbeantype(eg Connection, Queue, Exchange)
private TabFolder typeTabFolder = null;
- private static String _virtualHostName;
-
-
/*
- * Listener for the selection events in the navigation view
- */
+ * Listener for the selection events in the navigation view
+ */
private class SelectionListenerImpl implements ISelectionListener
{
public void selectionChanged(IWorkbenchPart part, ISelection sel)
@@ -109,10 +107,6 @@
{
refreshTypeTabFolder(_selectedNode.getName());
}
- else if (Constants.NODE_TYPE_VIRTUAL_HOST.equals(_selectedNode.getType()))
- {
- refreshTypeTabFolder(typeTabFolder.getItem(0));
- }
else
{
showSelectedMBean();
@@ -137,6 +131,7 @@
if (Constants.SERVER.equals(_selectedNode.getType()))
{
_server = (ManagedServer)_selectedNode.getManagedObject();
+ _virtualHostName = null;
}
else
{
@@ -148,20 +143,9 @@
if (parent != null && parent.getType().equals(Constants.SERVER))
_server = (ManagedServer)parent.getManagedObject();
+
+ _virtualHostName = _selectedNode.getVirtualHost();
}
-
- TreeObject parent = _selectedNode;
- while (parent != null && !parent.getType().equals(Constants.NODE_TYPE_VIRTUAL_HOST))
- {
- parent = parent.getParent();
- }
-
- if (parent != null)
- {
- _virtualHostName = parent.getName().substring(1, parent.getName().length()-1);
- }
-
-
}
public static ManagedServer getServer()
@@ -169,6 +153,11 @@
return _server;
}
+ public static String getVirtualHost()
+ {
+ return _virtualHostName;
+ }
+
private void showSelectedMBean() throws Exception
{
if (Constants.NOTIFICATION.equals(_selectedNode.getType()))
@@ -443,15 +432,15 @@
typeTabFolder.setData("CONTROLLER", controller);
TabItem tab = new TabItem(typeTabFolder, SWT.NONE);
- tab.setText(Constants.TAB_LABEL_CONNECTIONS);
+ tab.setText(Constants.CONNECTION);
tab.setControl(controller.getControl());
tab = new TabItem(typeTabFolder, SWT.NONE);
- tab.setText(Constants.TAB_LABEL_EXCHANGES);
+ tab.setText(Constants.EXCHANGE);
tab.setControl(controller.getControl());
tab = new TabItem(typeTabFolder, SWT.NONE);
- tab.setText(Constants.TAB_LABEL_QUEUES);
+ tab.setText(Constants.QUEUE);
tab.setControl(controller.getControl());
typeTabFolder.addListener(SWT.Selection, new Listener()
@@ -485,30 +474,21 @@
}
typeTabFolder.setSelection(tab);
MBeanTypeTabControl controller = (MBeanTypeTabControl)typeTabFolder.getData("CONTROLLER");
- String nodeType = Constants.NODE_LABEL_CONNECTIONS;
- if(tab.getText().equals(Constants.TAB_LABEL_QUEUES))
- {
- nodeType = Constants.NODE_LABEL_QUEUES;
- }
- else if(tab.getText().equals(Constants.TAB_LABEL_EXCHANGES))
- {
- nodeType = Constants.NODE_LABEL_EXCHANGES;
- }
- controller.refresh(nodeType);
+ controller.refresh(tab.getText());
typeTabFolder.setVisible(true);
}
- private void refreshTypeTabFolder(String name) throws Exception
+ private void refreshTypeTabFolder(String type) throws Exception
{
- if (Constants.NODE_LABEL_CONNECTIONS.equals(name))
+ if (Constants.CONNECTION.equals(type))
{
refreshTypeTabFolder(typeTabFolder.getItem(0));
}
- else if (Constants.NODE_LABEL_EXCHANGES.equals(name))
+ else if (Constants.EXCHANGE.equals(type))
{
refreshTypeTabFolder(typeTabFolder.getItem(1));
}
- else if (Constants.NODE_LABEL_QUEUES.equals(name))
+ else if (Constants.QUEUE.equals(type))
{
refreshTypeTabFolder(typeTabFolder.getItem(2));
}
@@ -540,12 +520,6 @@
{
typeTabFolder.setVisible(false);
}
- }
-
- public static String getVirtualHostName()
- {
- return _virtualHostName;
-
}
}
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java Thu Jan 25 10:03:08 2007
@@ -29,18 +29,17 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.Constants;
import org.apache.qpid.management.ui.ManagedBean;
+import org.apache.qpid.management.ui.ManagedObject;
import org.apache.qpid.management.ui.ManagedServer;
import org.apache.qpid.management.ui.ServerRegistry;
import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
import org.apache.qpid.management.ui.exceptions.ManagementConsoleException;
import org.apache.qpid.management.ui.jmx.JMXServerRegistry;
import org.apache.qpid.management.ui.jmx.MBeanUtility;
-import org.apache.qpid.management.ui.jmx.JMXManagedObject;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IFontProvider;
@@ -268,7 +267,6 @@
catch(Exception ex)
{
System.out.println("\nError in connecting to Qpid broker ");
- System.out.println("\n" + ex);
ex.printStackTrace();
}
}
@@ -283,88 +281,65 @@
private void populateDomain(TreeObject domain) throws IOException, Exception
{
ManagedServer server = (ManagedServer)domain.getParent().getManagedObject();
-
+ /*
// Add these three types - Connection, Exchange, Queue
// By adding these, these will always be available, even if there are no mbeans under thse types
// This is required because, the mbeans will be added from mbeanview, by selecting from the list
-
-
- TreeObject virtualhosts = new TreeObject(Constants.NODE_LABEL_VIRTUAL_HOSTS, Constants.NODE_TYPE_MBEANTYPE);
- virtualhosts.setParent(domain);
-
- Map<String, TreeObject> virtualHostMap = new HashMap<String, TreeObject>();
-
+ TreeObject typeChild = new TreeObject(Constants.CONNECTION, Constants.TYPE);
+ typeChild.setParent(domain);
+ typeChild = new TreeObject(Constants.EXCHANGE, Constants.TYPE);
+ typeChild.setParent(domain);
+ typeChild = new TreeObject(Constants.QUEUE, Constants.TYPE);
+ typeChild.setParent(domain);
+ */
+
// Now populate the mbenas under those types
List<ManagedBean> mbeans = MBeanUtility.getManagedObjectsForDomain(server, domain.getName());
for (ManagedBean mbean : mbeans)
{
-
- if(mbean.getType().equals(Constants.VIRTUAL_HOST))
- {
- TreeObject host = new TreeObject("[" + mbean.getName() + "]", Constants.NODE_TYPE_VIRTUAL_HOST);
-
- virtualHostMap.put(mbean.getName(), host);
- host.setParent(virtualhosts);
-
- TreeObject child = new TreeObject(Constants.NODE_LABEL_CONNECTIONS, Constants.NODE_TYPE_MBEANTYPE);
-
- child.setParent(host);
- child = new TreeObject(Constants.NODE_LABEL_EXCHANGES, Constants.NODE_TYPE_MBEANTYPE);
- child.setParent(host);
- child = new TreeObject(Constants.NODE_LABEL_QUEUES, Constants.NODE_TYPE_MBEANTYPE);
- child.setParent(host);
-
- }
- }
- for (ManagedBean mbean : mbeans)
- {
-
-
mbean.setServer(server);
-
ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(server);
- serverRegistry.addManagedObject(mbean);
-
- if (mbean.getType().equals(Constants.MBEAN_TYPE_BROKER_MANAGER))
- {
- JMXManagedObject obj = (JMXManagedObject) mbean;
- String host = obj.getProperty("VirtualHost");
- TreeObject node = virtualHostMap.get(host);
- if(node != null)
- {
- TreeObject beanNode = new TreeObject(mbean);
- beanNode.setParent(node);
- }
- }
-
-
+ serverRegistry.addManagedObject(mbean);
+
// Add all mbeans other than Connections, Exchanges and Queues. Because these will be added
// manually by selecting from MBeanView
- if (!(mbean.getType().equals(Constants.MBEAN_TYPE_CONNECTION)
- || mbean.getType().equals(Constants.MBEAN_TYPE_EXCHANGE)
- || mbean.getType().equals(Constants.MBEAN_TYPE_QUEUE)
- || mbean.getType().equals(Constants.VIRTUAL_HOST)
- || mbean.getType().equals(Constants.MBEAN_TYPE_BROKER_MANAGER)))
+
+ if (!(mbean.getType().endsWith(Constants.CONNECTION) ||
+ mbean.getType().endsWith(Constants.EXCHANGE) ||
+ mbean.getType().endsWith(Constants.QUEUE)))
{
- addManagedBean(domain, mbean, virtualHostMap);
+ addManagedBean(domain, mbean);
}
}
}
+ private void addDefaultNodes(TreeObject parent)
+ {
+ TreeObject typeChild = new TreeObject(Constants.CONNECTION, Constants.NODE_TYPE_MBEANTYPE);
+ typeChild.setParent(parent);
+ typeChild.setVirtualHost(parent.getVirtualHost());
+ typeChild = new TreeObject(Constants.EXCHANGE, Constants.NODE_TYPE_MBEANTYPE);
+ typeChild.setParent(parent);
+ typeChild.setVirtualHost(parent.getVirtualHost());
+ typeChild = new TreeObject(Constants.QUEUE, Constants.NODE_TYPE_MBEANTYPE);
+ typeChild.setParent(parent);
+ typeChild.setVirtualHost(parent.getVirtualHost());
+ }
+
/**
* Checks if a particular mbeantype is already there in the navigation view for a domain.
* This is used while populating domain with mbeans.
- * @param domain
+ * @param parent
* @param typeName
* @return Node if given mbeantype already exists, otherwise null
*/
- private TreeObject getMBeanTypeNode(TreeObject domain, String typeName)
+ private TreeObject getMBeanTypeNode(TreeObject parent, String typeName)
{
- List<TreeObject> childNodes = domain.getChildren();
-
+ List<TreeObject> childNodes = parent.getChildren();
for (TreeObject child : childNodes)
{
- if (Constants.NODE_TYPE_MBEANTYPE.equals(child.getType()) && typeName.equals(child.getName()))
+ if ((Constants.NODE_TYPE_MBEANTYPE.equals(child.getType()) || Constants.TYPE_INSTANCE.equals(child.getType())) &&
+ typeName.equals(child.getName()))
return child;
}
return null;
@@ -385,78 +360,85 @@
* Adds the given MBean to the given domain node. Creates Notification node for the MBean.
* @param domain
* @param mbean mbean
- * @param virtualHostMap
*/
- private void addManagedBean(TreeObject domain, ManagedBean mbean, Map<String, TreeObject> virtualHostMap) throws Exception
+ private void addManagedBean(TreeObject domain, ManagedBean mbean) throws Exception
{
- JMXManagedObject obj = (JMXManagedObject) mbean;
-
-
-
- String type = mbean.getType();
String name = mbean.getName();
-
- String virtualHostName = obj.getProperty("VirtualHost");
-
- TreeObject virtualHostNode = virtualHostMap.get(virtualHostName);
-
- TreeObject typeNode = getMBeanTypeNode(virtualHostNode, getNodeLabelForType(type));
- if (typeNode != null && doesMBeanNodeAlreadyExist(typeNode, name))
- return;
-
- TreeObject mbeanNode = null;
- if (typeNode != null) // type node already exists
- {
- if (name == null)
+ String[] types = mbean.getType().split("\\.");
+ TreeObject typeNode = null;
+ TreeObject parentNode = domain;
+ // Run this loop till all nodes for this mbean are created.
+ for (int i = 0; i < types.length; i++)
+ {
+ String type = types[i];
+ String valueOftype = mbean.getProperty(type);
+ typeNode = getMBeanTypeNode(parentNode, type);
+
+ if (typeNode == null)
{
- throw new ManagementConsoleException("Two mbeans can't exist without a name and with same type");
+ // If the ObjectName doesn't have name property, that means there will be only one instance
+ // of this mbean for given "type". So there will be no type node created for this mbean.
+ if (name == null && (i == types.length -1))
+ {
+ break;
+ }
+ typeNode = createTypeNode(parentNode, type);
+ typeNode.setVirtualHost(mbean.getVirtualHostName());
}
- mbeanNode = new TreeObject(mbean);
- mbeanNode.setParent(typeNode);
- }
- else
- {
- // type node does not exist. Now check if node to be created as mbeantype or MBean
- if (name != null) // A managedObject with type and name
+ parentNode = typeNode;
+
+ // Create instances node for this type if value exists. For eg, for different virtual hosts, the
+ // nodes with given value will be created.
+ if (valueOftype == null)
{
- typeNode = new TreeObject(type, Constants.NODE_TYPE_MBEANTYPE);
- typeNode.setParent(virtualHostNode);
- mbeanNode = new TreeObject(mbean);
- mbeanNode.setParent(typeNode);
- }
- else // A managedObject with only type
+ break;
+ }
+ typeNode = getMBeanTypeNode(parentNode, valueOftype);
+ if (typeNode == null)
{
- mbeanNode = new TreeObject(mbean);
- mbeanNode.setParent(domain);
+ typeNode = createTypeInstanceNode(parentNode, valueOftype);
+ typeNode.setVirtualHost(mbean.getVirtualHostName());
+
+ // Create default nodes for VHost instances
+ if (type.equals(Constants.VIRTUAL_HOST))
+ {
+ addDefaultNodes(typeNode);
+ }
}
+ parentNode = typeNode;
+ }
+
+ if (typeNode == null)
+ {
+ typeNode = parentNode;
}
+ if (doesMBeanNodeAlreadyExist(typeNode, name))
+ return;
+
+ TreeObject mbeanNode = new TreeObject(mbean);
+ mbeanNode.setParent(typeNode);
+
// Add notification node
// TODO: show this only if the mbean sends any notification
TreeObject notificationNode = new TreeObject(Constants.NOTIFICATION, Constants.NOTIFICATION);
notificationNode.setParent(mbeanNode);
}
-
- private String getNodeLabelForType(String type)
+
+ private TreeObject createTypeNode(TreeObject parent, String name)
{
- if(type.equals(Constants.MBEAN_TYPE_EXCHANGE))
- {
- return Constants.NODE_LABEL_EXCHANGES;
- }
- else if(type.equals(Constants.MBEAN_TYPE_QUEUE))
- {
- return Constants.NODE_LABEL_QUEUES;
- }
- else if(type.equals(Constants.MBEAN_TYPE_CONNECTION))
- {
- return Constants.NODE_LABEL_CONNECTIONS;
- }
- else
- {
- return type;
- }
+ TreeObject typeNode = new TreeObject(name, Constants.NODE_TYPE_MBEANTYPE);
+ typeNode.setParent(parent);
+ return typeNode;
}
-
+
+ private TreeObject createTypeInstanceNode(TreeObject parent, String name)
+ {
+ TreeObject typeNode = new TreeObject(name, Constants.TYPE_INSTANCE);
+ typeNode.setParent(parent);
+ return typeNode;
+ }
+
/**
* Removes all the child nodes of the given parent node
* @param parent
@@ -749,7 +731,14 @@
public String getText(Object element)
{
TreeObject node = (TreeObject)element;
- return node.getName();
+ if (node.getType().equals(Constants.NODE_TYPE_MBEANTYPE))
+ {
+ return node.getName() + "s";
+ }
+ else
+ {
+ return node.getName();
+ }
}
public Font getFont(Object element)
@@ -821,26 +810,8 @@
break;
}
}
- for (TreeObject child : domain.getChildren())
- {
- if (child.getName().equals(Constants.NODE_LABEL_VIRTUAL_HOSTS))
- {
- domain = child;
- break;
- }
- }
- Map<String, TreeObject> hostMap = new HashMap<String,TreeObject>();
-
- for (TreeObject child: domain.getChildren())
- {
-
- if(child.getType().equals(Constants.NODE_TYPE_VIRTUAL_HOST))
- {
- hostMap.put(child.getName().substring(1,child.getName().length()-1), child);
- }
- }
- addManagedBean(domain, mbean, hostMap);
+ addManagedBean(domain, mbean);
_treeViewer.refresh();
}
@@ -862,6 +833,7 @@
{
for (ManagedBean mbean : removalList)
{
+ System.out.println("removing " + mbean.getName() + " " + mbean.getType());
TreeObject treeServerObject = _managedServerMap.get(mbean.getServer());
List<TreeObject> domains = treeServerObject.getChildren();
TreeObject domain = null;
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java Thu Jan 25 10:03:08 2007
@@ -89,6 +89,7 @@
// for customized method in header exchange
private HashMap<Text, Text> headerBindingHashMap = null;
+ private String _virtualHostName = null;
public OperationTabControl(TabFolder tabFolder)
{
@@ -152,6 +153,7 @@
{
_mbean = mbean;
_opData = opData;
+ _virtualHostName = _mbean.getProperty(Constants.VIRTUAL_HOST);
// Setting the form to be invisible. Just in case the mbean server connection
// is done and it takes time in getting the response, then the ui should be blank
@@ -216,8 +218,8 @@
}
// Customised parameter widgets
- if (_mbean.getType().equals(Constants.MBEAN_TYPE_EXCHANGE) &&
- "headers".equals(_mbean.getProperty(Constants.EXCHANGE_TYPE)) &&
+ if (_mbean.getType().endsWith(Constants.EXCHANGE) &&
+ Constants.EXCHANGE_TYPE_VALUES[2].equals(_mbean.getProperty(Constants.EXCHANGE_TYPE)) &&
_opData.getName().equalsIgnoreCase("createNewBinding"))
{
customCreateNewBinding();
@@ -241,10 +243,10 @@
formData.top = new FormAttachment(0, params.indexOf(param) * heightForAParameter);
formData.left = new FormAttachment(label, 5);
formData.right = new FormAttachment(valueNumerator);
- if (param.getName().equals(Constants.MBEAN_TYPE_QUEUE))
+ if (param.getName().equals(Constants.QUEUE))
{
Combo combo = new Combo(_paramsComposite, SWT.READ_ONLY | SWT.DROP_DOWN);
- String[] items = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_mbean.getProperty("VirtualHost"));
+ String[] items = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_virtualHostName);
combo.setItems(items);
combo.add("Select Queue", 0);
combo.select(0);
@@ -253,10 +255,10 @@
combo.addSelectionListener(parameterSelectionListener);
valueInCombo = true;
}
- else if (param.getName().equals(Constants.MBEAN_TYPE_EXCHANGE))
+ else if (param.getName().equals(Constants.EXCHANGE))
{
Combo combo = new Combo(_paramsComposite, SWT.READ_ONLY | SWT.DROP_DOWN);
- String[] items = ApplicationRegistry.getServerRegistry(_mbean).getExchangeNames(_mbean.getProperty("VirtualHost"));
+ String[] items = ApplicationRegistry.getServerRegistry(_mbean).getExchangeNames(_virtualHostName);
combo.setItems(items);
combo.add("Select Exchange", 0);
combo.select(0);
@@ -357,8 +359,8 @@
formData.left = new FormAttachment(label, 5);
formData.right = new FormAttachment(valueNumerator);
- Combo combo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);
- String[] items = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_mbean.getProperty("VirtualHost"));
+ Combo combo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);
+ String[] items = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_virtualHostName);
combo.setItems(items);
combo.add("Select Queue", 0);
combo.select(0);
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TreeObject.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TreeObject.java?view=diff&rev=499874&r1=499873&r2=499874
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TreeObject.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TreeObject.java Thu Jan 25 10:03:08 2007
@@ -32,6 +32,7 @@
private String _name;
private String _type;
private String _url;
+ private String _virtualHost;
private TreeObject _parent;
private List<TreeObject> _children = new ArrayList<TreeObject>();
private ManagedObject _object;
@@ -47,7 +48,8 @@
_name = obj.getName();
if (_name == null && (obj instanceof ManagedBean))
{
- _name = ((ManagedBean)obj).getType();
+ String[] types = ((ManagedBean)obj).getType().split("\\.");
+ _name = types[types.length - 1];
}
this._type = Constants.MBEAN;
this._object = obj;
@@ -95,6 +97,16 @@
public void setUrl(String url)
{
this._url = url;
+ }
+
+ public String getVirtualHost()
+ {
+ return _virtualHost;
+ }
+
+ public void setVirtualHost(String vHost)
+ {
+ _virtualHost = vHost;
}
public ManagedObject getManagedObject()