diff options
author | Bhupendra Bhusman Bhardwaj <bhupendrab@apache.org> | 2006-10-25 16:15:06 +0000 |
---|---|---|
committer | Bhupendra Bhusman Bhardwaj <bhupendrab@apache.org> | 2006-10-25 16:15:06 +0000 |
commit | ce74fdafd2ce0eace7a29469819458645eec0364 (patch) | |
tree | 66fb00e7162331fbe0b79b8b64a6c6081a3d9f02 | |
parent | 98c3e650c7d0f35aa2196ef8983c073fe0bb947c (diff) | |
download | qpid-python-ce74fdafd2ce0eace7a29469819458645eec0364.tar.gz |
MBeans updated. Management operation implemented in HeadersExchange
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@467700 13f79535-47bb-0310-9956-ffa450edef68
5 files changed, 51 insertions, 22 deletions
diff --git a/java/broker/src/org/apache/qpid/server/exchange/DestNameExchange.java b/java/broker/src/org/apache/qpid/server/exchange/DestNameExchange.java index f89223825f..9b0ab17dd8 100644 --- a/java/broker/src/org/apache/qpid/server/exchange/DestNameExchange.java +++ b/java/broker/src/org/apache/qpid/server/exchange/DestNameExchange.java @@ -78,12 +78,12 @@ public class DestNameExchange extends AbstractExchange _bindingItemTypes[1] = new ArrayType(1, SimpleType.STRING); _bindingDataType = new CompositeType("QueueBinding", - "Queue and binding keye", + "Binding key and bound Queue names", _bindingItemNames, _bindingItemDescriptions, _bindingItemTypes); _bindinglistDataType = new TabularType("Bindings", - "List of queues and binding keys", + "List of queue bindings for " + getName() , _bindingDataType, _bindingItemIndexNames); } diff --git a/java/broker/src/org/apache/qpid/server/exchange/DestWildExchange.java b/java/broker/src/org/apache/qpid/server/exchange/DestWildExchange.java index 25d91027e9..792ea0138d 100644 --- a/java/broker/src/org/apache/qpid/server/exchange/DestWildExchange.java +++ b/java/broker/src/org/apache/qpid/server/exchange/DestWildExchange.java @@ -77,12 +77,12 @@ public class DestWildExchange extends AbstractExchange _bindingItemTypes[1] = new ArrayType(1, SimpleType.STRING); _bindingDataType = new CompositeType("QueueBinding", - "Queue and binding keye", + "Binding key and bound Queue names", _bindingItemNames, _bindingItemDescriptions, _bindingItemTypes); _bindinglistDataType = new TabularType("Bindings", - "List of queues and binding keys", + "List of queue bindings for " + getName(), _bindingDataType, _bindingItemIndexNames); } diff --git a/java/broker/src/org/apache/qpid/server/exchange/HeadersExchange.java b/java/broker/src/org/apache/qpid/server/exchange/HeadersExchange.java index 1167d05875..de0efba7d2 100644 --- a/java/broker/src/org/apache/qpid/server/exchange/HeadersExchange.java +++ b/java/broker/src/org/apache/qpid/server/exchange/HeadersExchange.java @@ -19,20 +19,23 @@ package org.apache.qpid.server.exchange; import org.apache.log4j.Logger; import org.apache.qpid.AMQException; -import org.apache.qpid.framing.*; -import org.apache.qpid.server.queue.AMQQueue; -import org.apache.qpid.server.queue.AMQMessage; -import org.apache.qpid.server.management.MBeanDescription; +import org.apache.qpid.framing.BasicContentHeaderProperties; +import org.apache.qpid.framing.ContentHeaderBody; +import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.management.MBeanConstructor; +import org.apache.qpid.server.management.MBeanDescription; +import org.apache.qpid.server.queue.AMQMessage; +import org.apache.qpid.server.queue.AMQQueue; +import org.apache.qpid.server.registry.ApplicationRegistry; -import javax.management.openmbean.*; -import javax.management.ServiceNotFoundException; +import javax.management.JMException; import javax.management.NotCompliantMBeanException; -import java.util.concurrent.CopyOnWriteArrayList; +import javax.management.openmbean.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; /** * An exchange that binds queues based on a set of required headers and header values @@ -76,7 +79,7 @@ public class HeadersExchange extends AbstractExchange { private String[] _bindingItemNames = {"Queue", "HeaderBinding"}; private String[] _bindingItemDescriptions = {"Queue Name", "Header attribute bindings"}; - private String[] _bindingItemIndexNames = {"Queue"}; + private String[] _bindingItemIndexNames = {"HeaderBinding"}; private OpenType[] _bindingItemTypes = new OpenType[2]; private CompositeType _bindingDataType = null; @@ -97,15 +100,15 @@ public class HeadersExchange extends AbstractExchange try { _bindingItemTypes[0] = SimpleType.STRING; - _bindingItemTypes[1] = new ArrayType(1, SimpleType.STRING);; + _bindingItemTypes[1] = new ArrayType(1, SimpleType.STRING); _bindingDataType = new CompositeType("QueueAndHeaderAttributesBinding", - "Queue and header attributes binding", + "Queue name and header bindings", _bindingItemNames, _bindingItemDescriptions, _bindingItemTypes); _bindinglistDataType = new TabularType("HeaderBindings", - "List of queues and related header attribute bindings", + "List of queue bindings for " + getName(), _bindingDataType, _bindingItemIndexNames); } @@ -148,10 +151,36 @@ public class HeadersExchange extends AbstractExchange return _bindingList; } - public void createBinding(String QueueName, String binding) - throws ServiceNotFoundException + /** + * Creates bindings. Binding pattern is as follows- + * <attributename>=<value>,<attributename>=<value>,... + * @param queueName + * @param binding + * @throws JMException + */ + public void createBinding(String queueName, String binding) + throws JMException { - throw new ServiceNotFoundException("This service is not supported by \"" + this.getName() + "\""); + AMQQueue queue = ApplicationRegistry.getInstance().getQueueRegistry().getQueue(queueName); + + if (queue == null) + { + throw new JMException("Queue \"" + queueName + "\" is not registered with the exchange."); + } + + String[] bindings = binding.split(","); + FieldTable fieldTable = new FieldTable(); + for (int i = 0; i < bindings.length; i++) + { + String[] keyAndValue = bindings[i].split("="); + if (keyAndValue == null || keyAndValue.length < 2) + { + throw new JMException("Format for headers binding should be \"<attribute1>=<value1>,<attribute2>=<value2>\" "); + } + fieldTable.put(keyAndValue[0], keyAndValue[1]); + } + + _bindings.add(new Registration(new HeadersBinding(fieldTable), queue)); } } // End of MBean class diff --git a/java/broker/src/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java b/java/broker/src/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java index 35bc7fb4c7..44ab9127ff 100644 --- a/java/broker/src/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java +++ b/java/broker/src/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java @@ -178,13 +178,13 @@ public class AMQMinaProtocolSession implements AMQProtocolSession, try { _channelType = new CompositeType("channel", - "a Channel", + "Channel Details", _channelAtttibuteNames, _channelAttributeDescriptions, _channelAttributeTypes); _channelsType = new TabularType("channelsType", - "List of available channelsType", + "List of available channels", _channelType, _indexNames); } diff --git a/java/broker/src/org/apache/qpid/server/protocol/ManagedConnection.java b/java/broker/src/org/apache/qpid/server/protocol/ManagedConnection.java index 2a800f327d..70485df62c 100644 --- a/java/broker/src/org/apache/qpid/server/protocol/ManagedConnection.java +++ b/java/broker/src/org/apache/qpid/server/protocol/ManagedConnection.java @@ -85,8 +85,6 @@ public interface ManagedConnection * taking required action is there are more channels being created. * @return maximum number of channels allowed to be created. */ - @MBeanAttribute(name="MaximumNumberOfAllowedChannels", - description="The maximum number of channels that can be opened using this connection") Long getMaximumNumberOfAllowedChannels(); /** @@ -94,6 +92,8 @@ public interface ManagedConnection * this connection. * @param value */ + @MBeanAttribute(name="MaximumNumberOfAllowedChannels", + description="The maximum number of channels that can be opened using this connection") void setMaximumNumberOfAllowedChannels(Long value); //********** Operations *****************// |