summaryrefslogtreecommitdiff
path: root/java/broker/src/main
diff options
context:
space:
mode:
authorMarnie McCormack <marnie@apache.org>2010-07-05 20:00:54 +0000
committerMarnie McCormack <marnie@apache.org>2010-07-05 20:00:54 +0000
commit3c57e4b18865b717404ea41efbd4b80516a92a33 (patch)
tree4ca087388cc0ee54ef99961f48b4340c08d05feb /java/broker/src/main
parent0f7f0aa39aabb79d49f0fb7294fa233d3f8d5981 (diff)
downloadqpid-python-3c57e4b18865b717404ea41efbd4b80516a92a33.tar.gz
QPID-2700 Patch for ability to remove bindings from exchanges and additional tests for direct and topic exchange add/remove logic from Andrew Kennedy
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@960678 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/src/main')
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java
index 0dca91b7be..c69d499674 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java
@@ -20,6 +20,9 @@
*/
package org.apache.qpid.server.exchange;
+import java.util.Collections;
+import java.util.Map;
+
import org.apache.qpid.AMQException;
import org.apache.qpid.AMQSecurityException;
import org.apache.qpid.server.management.AMQManagedObject;
@@ -28,6 +31,7 @@ import org.apache.qpid.server.management.ManagedObjectRegistry;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.binding.BindingFactory;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.actors.ManagementActor;
import org.apache.qpid.management.common.mbeans.ManagedExchange;
@@ -147,4 +151,31 @@ public abstract class AbstractExchangeMBean<T extends AbstractExchange> extends
}
CurrentActor.remove();
}
+
+ /**
+ * Removes a queue binding from the exchange.
+ *
+ * @see BindingFactory#removeBinding(String, AMQQueue, Exchange, Map)
+ */
+ public void removeBinding(String queueName, String binding) throws JMException
+ {
+ VirtualHost vhost = getExchange().getVirtualHost();
+ AMQQueue queue = vhost.getQueueRegistry().getQueue(new AMQShortString(queueName));
+ if (queue == null)
+ {
+ throw new JMException("Queue \"" + queueName + "\" is not registered with the exchange.");
+ }
+
+ CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger()));
+ try
+ {
+ vhost.getBindingFactory().removeBinding(binding, queue, _exchange, Collections.<String, Object>emptyMap());
+ }
+ catch (AMQException ex)
+ {
+ JMException jme = new JMException(ex.toString());
+ throw new MBeanException(jme, "Error removing binding " + binding);
+ }
+ CurrentActor.remove();
+ }
}