summaryrefslogtreecommitdiff
path: root/qpid
diff options
context:
space:
mode:
authorFraser Adams <fadams@apache.org>2014-02-23 15:26:44 +0000
committerFraser Adams <fadams@apache.org>2014-02-23 15:26:44 +0000
commit5f16207bf77afd5caed1ba9329da7a32f1b0c718 (patch)
treeb0c59467d3647e1b4cb3e5f3a27468bb79d6865d /qpid
parent689bfd6a3f927bf1451d995a2c135bb154f74460 (diff)
downloadqpid-python-5f16207bf77afd5caed1ba9329da7a32f1b0c718.tar.gz
JIRA:QPID-5555 Get the QMF plugin working again. There was still a gotcha on the ExclusivityPolicy, which compiled OK but gave ClassCastExceptions. This commit sorts that problem and also tweaks the returned port to report the TCP based AMQP port not the WS one
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1571021 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
-rw-r--r--qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java4
-rw-r--r--qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java24
-rw-r--r--qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java4
-rw-r--r--qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java17
-rw-r--r--qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java8
5 files changed, 45 insertions, 12 deletions
diff --git a/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java b/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java
index c0df65ef1c..193d863823 100644
--- a/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java
+++ b/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java
@@ -544,11 +544,11 @@ public final class ConnectionHelper
brokerList = "'" + buf.toString() + "'";
}
else if (url.contains("@"))
- { // BrokerURL format
+ { // BrokerURL format as used in the Python tools.
String[] split = url.split("@");
url = split[1];
- split = split[0].split("/");
+ split = split[0].split("[/:]"); // Accept both <username>/<password> and <username>:<password>
username = split[0];
if (split.length == 2)
diff --git a/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java b/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java
index 3427708276..d6be065c81 100644
--- a/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java
+++ b/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java
@@ -53,6 +53,7 @@ import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.Protocol;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.State;
+import org.apache.qpid.server.model.Transport;
import org.apache.qpid.server.model.VirtualHost;
/**
@@ -349,11 +350,15 @@ public class Broker extends QmfAgentData
_defaultVirtualHost = (String)broker.getAttribute("defaultVirtualHost");
int amqpPort = 5672; // Default AMQP Port.
- // Search through the available Ports on this Broker looking for the AMQP Port. When we find the
- // AMQP Port we record that in amqpPort;
+ // Search through the available Ports on this Broker looking for the AMQP Port using the TCP Transport
+ // and record that in amqpPort. N.B. The Java Broker supports several Protocol and Transport types so
+ // it might be good to return more detailed info, but for QMF the "port" property description for the
+ // Broker Object says "TCP Port for AMQP Service" so doing anything fancier might break consumers.
+ // TODO The C++ and Java Brokers should really return consistent information.
for (Port port : _broker.getPorts())
{
boolean isAMQP = false;
+ boolean isTCP = false;
for (Protocol protocol : port.getProtocols())
{
isAMQP = protocol.isAMQP();
@@ -363,15 +368,22 @@ public class Broker extends QmfAgentData
}
}
- if (isAMQP)
+ for (Transport transport : port.getTransports())
+ {
+ isTCP = (transport == Transport.TCP);
+ if (isTCP)
+ {
+ break;
+ }
+ }
+
+ if (isAMQP && isTCP)
{
amqpPort = port.getPort();
break;
}
}
- String port = "" + amqpPort;
-
// systemRef is ignored in this implementation.
// stagingThreshold is ignored in this implementation (it's deprecated anyway I believe).
@@ -380,7 +392,7 @@ public class Broker extends QmfAgentData
// _object_name in the ObjectId that we set below uses actually uses "amqp-broker" vice "amqp-java-broker",
// this is because qpid-config uses a "hardcoded" ObjectId to invoke methods so we need to use the same name.
setValue("name", "amqp-java-broker");
- setValue("port", port);
+ setValue("port", amqpPort);
// workerThreads doesn't *appear* to be configurable in the Java Broker, looks like there's no pool and the
// Threads just grow with the number of Connections?
diff --git a/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java b/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java
index 7b399e593f..3dbf4332ad 100644
--- a/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java
+++ b/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java
@@ -134,6 +134,10 @@ public class Exchange extends QmfAgentData
setCompareKey(_name);
}
+ // In the Java Broker LifetimePolicy may be PERMANENT, DELETE_ON_CONNECTION_CLOSE,
+ // DELETE_ON_SESSION_END, DELETE_ON_NO_OUTBOUND_LINKS, DELETE_ON_NO_LINKS, IN_USE
+ // We map these to a boolean value to be consistent with the C++ Broker QMF value.
+ // TODO The C++ and Java Brokers should really return consistent information.
LifetimePolicy lifetimePolicy = (LifetimePolicy)_exchange.getAttribute("lifetimePolicy");
boolean autoDelete = (lifetimePolicy != LifetimePolicy.PERMANENT) ? true : false;
diff --git a/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java b/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java
index 1797979de6..17e5f0a041 100644
--- a/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java
+++ b/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java
@@ -41,8 +41,9 @@ import org.apache.qpid.qmf2.common.SchemaEventClass;
import org.apache.qpid.qmf2.common.SchemaObjectClass;
//import org.apache.qpid.qmf2.common.SchemaProperty;
-import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Exchange;
+import org.apache.qpid.server.model.ExclusivityPolicy;
+import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Statistics;
/**
@@ -140,15 +141,25 @@ public class Queue extends QmfAgentData
setCompareKey(name);
}
+ // In the Java Broker LifetimePolicy may be PERMANENT, DELETE_ON_CONNECTION_CLOSE,
+ // DELETE_ON_SESSION_END, DELETE_ON_NO_OUTBOUND_LINKS, DELETE_ON_NO_LINKS, IN_USE
+ // We map these to a boolean value to be consistent with the C++ Broker QMF value.
+ // TODO The C++ and Java Brokers should really return consistent information.
LifetimePolicy lifetimePolicy = (LifetimePolicy)_queue.getAttribute("lifetimePolicy");
boolean autoDelete = (lifetimePolicy != LifetimePolicy.PERMANENT) ? true : false;
+ // In the Java Broker exclusivity may be NONE, SESSION, CONNECTION, CONTAINER, PRINCIPAL, LINK
+ // We map these to a boolean value to be consistent with the C++ Broker QMF value.
+ // TODO The C++ and Java Brokers should really return consistent information.
+ ExclusivityPolicy exclusivityPolicy = (ExclusivityPolicy)_queue.getAttribute("exclusive");
+ boolean exclusive = (exclusivityPolicy != ExclusivityPolicy.NONE) ? true : false;
+
// TODO vhostRef - currently just use its name to try and get things working with standard command line tools.
setValue("name", name);
setValue("durable", _queue.getAttribute("durable"));
setValue("autoDelete", autoDelete);
- setValue("exclusive", _queue.getAttribute("exclusive"));
+ setValue("exclusive", exclusive);
// altExchange needs to be set later, done in mapEncode() for convenience, because it isn't set during
// Queue construction in the Java Broker.
@@ -199,7 +210,7 @@ public class Queue extends QmfAgentData
queueDeclare.setValue("autoDel", getBooleanValue("autoDelete"));
queueDeclare.setValue("disp", "created");
queueDeclare.setValue("durable", getBooleanValue("durable"));
- queueDeclare.setValue("excl", getBooleanValue("durable"));
+ queueDeclare.setValue("excl", getBooleanValue("exclusive"));
queueDeclare.setValue("qName", getStringValue("name"));
// TODO Not sure of a way to get these for Java Broker Exchange.
//queueDeclare.setValue("rhost", _connection.getName());
diff --git a/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java b/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java
index 028059f64b..4b074ec985 100644
--- a/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java
+++ b/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java
@@ -39,6 +39,7 @@ import org.apache.qpid.qmf2.common.SchemaEventClass;
import org.apache.qpid.qmf2.common.SchemaObjectClass;
//import org.apache.qpid.qmf2.common.SchemaProperty;
+import org.apache.qpid.server.model.ExclusivityPolicy;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.Statistics;
@@ -149,7 +150,12 @@ public class Subscription extends QmfAgentData
// so we pass a reference ourselves when we do setQueueRef. This is because some Subscription properties
// are *actually" related to the associated Queue.
_qName = queue.getName();
- _exclusive = ((Boolean)queue.getAttribute("exclusive")).booleanValue();
+
+ // In the Java Broker exclusivity may be NONE, SESSION, CONNECTION, CONTAINER, PRINCIPAL, LINK
+ // We map these to a boolean value to be consistent with the C++ Broker QMF values.
+ // TODO The C++ and Java Brokers should really return consistent information.
+ ExclusivityPolicy exclusivityPolicy = (ExclusivityPolicy)queue.getAttribute("exclusive");
+ _exclusive = (exclusivityPolicy != ExclusivityPolicy.NONE) ? true : false;
}
/**