You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by fa...@apache.org on 2014/02/23 16:26:44 UTC
svn commit: r1571021 - in /qpid/trunk/qpid/tools/src/java/src:
main/java/org/apache/qpid/qmf2/util/
qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/
Author: fadams
Date: Sun Feb 23 15:26:44 2014
New Revision: 1571021
URL: http://svn.apache.org/r1571021
Log:
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
Modified:
qpid/trunk/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java
qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java
qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java
qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java
qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java
Modified: qpid/trunk/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java?rev=1571021&r1=1571020&r2=1571021&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java (original)
+++ qpid/trunk/qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/util/ConnectionHelper.java Sun Feb 23 15:26:44 2014
@@ -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)
Modified: qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java?rev=1571021&r1=1571020&r2=1571021&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java (original)
+++ qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Broker.java Sun Feb 23 15:26:44 2014
@@ -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?
Modified: qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java?rev=1571021&r1=1571020&r2=1571021&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java (original)
+++ qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Exchange.java Sun Feb 23 15:26:44 2014
@@ -134,6 +134,10 @@ public class Exchange extends QmfAgentDa
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;
Modified: qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java?rev=1571021&r1=1571020&r2=1571021&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java (original)
+++ qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Queue.java Sun Feb 23 15:26:44 2014
@@ -41,8 +41,9 @@ import org.apache.qpid.qmf2.common.Schem
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());
Modified: qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java?rev=1571021&r1=1571020&r2=1571021&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java (original)
+++ qpid/trunk/qpid/tools/src/java/src/qpid-broker-plugins-management-qmf2/java/org/apache/qpid/server/qmf2/agentdata/Subscription.java Sun Feb 23 15:26:44 2014
@@ -39,6 +39,7 @@ import org.apache.qpid.qmf2.common.Schem
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 QmfAge
// 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;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org