You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2012/06/20 17:54:17 UTC

svn commit: r1352172 [1/2] - in /qpid/branches/java-config-and-management/qpid/java: bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/ bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/ bdbstore/src/test/java/org/apac...

Author: kwall
Date: Wed Jun 20 15:54:15 2012
New Revision: 1352172

URL: http://svn.apache.org/viewvc?rev=1352172&view=rev
Log:
NO-JIRA: Queues now support a description attribute which can be specified at queue declaration time (x-qpid-description argument) either via AMQP (QueueDeclare) or JMX (ManagedBroker#createNewQueue). After queue declaration time, queue description is maintainable via JMX ManagedQueue#setDescription. It can be queried via AMQ QueueQuery.

Workarounds for the historic mis-use of owner as a description:

ManagedBroker#createNewQueue has been changed to map the owner actual parameter into the description
argument.  BDB V5 to V6 store upgrade will move the contents of the owner field to the description
argument for all non-exclusive queues. These workarounds can be disabled by system property.

Updated JMX minor version by one.

Added:
    qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/QueueMBeanTest.java
    qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBeanTest.java
Modified:
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/AbstractUpgradeTestCase.java
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4to5Test.java
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v4/test-store/00000000.jdb
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000000.jdb
    qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000001.jdb
    qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java
    qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java
    qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java
    qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/UserManagementMBeanTest.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Queue.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/UUIDGenerator.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfiguredObjectHelper.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java
    qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
    qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java
    qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java
    qpid/branches/java-config-and-management/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
    qpid/branches/java-config-and-management/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagedBrokerMBeanTest.java
    qpid/branches/java-config-and-management/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagedQueueMBeanTest.java

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java Wed Jun 20 15:54:15 2012
@@ -45,6 +45,7 @@ import org.apache.qpid.server.model.Exch
 import org.apache.qpid.server.model.LifetimePolicy;
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.model.UUIDGenerator;
+import org.apache.qpid.server.queue.AMQQueueFactory;
 import org.apache.qpid.server.store.berkeleydb.AMQShortStringEncoding;
 import org.apache.qpid.server.store.berkeleydb.FieldTableEncoding;
 import org.apache.qpid.server.util.MapJsonSerializer;
@@ -93,6 +94,8 @@ public class UpgradeFrom5To6 extends Abs
 
     private MapJsonSerializer _serializer = new MapJsonSerializer();
 
+    private static final boolean _moveNonExclusiveQueueOwnerToDescription = Boolean.parseBoolean(System.getProperty("qpid.move_non_exclusive_queue_owner_to_description", Boolean.TRUE.toString()));
+
     /**
      * Upgrades from a v5 database to a v6 database
      *
@@ -554,17 +557,49 @@ public class UpgradeFrom5To6 extends Abs
     private UpgradeConfiguredObjectRecord createQueueConfiguredObjectRecord(String queueName, String owner, boolean exclusive,
             FieldTable arguments)
     {
+        Map<String, Object> attributesMap = buildQueueArgumentMap(queueName,
+                owner, exclusive, arguments);
+        String json = _serializer.serialize(attributesMap);
+        UpgradeConfiguredObjectRecord configuredObject = new UpgradeConfiguredObjectRecord(Queue.class.getName(), json);
+        return configuredObject;
+    }
+
+    private Map<String, Object> buildQueueArgumentMap(String queueName,
+            String owner, boolean exclusive, FieldTable arguments)
+    {
+
         Map<String, Object> attributesMap = new HashMap<String, Object>();
         attributesMap.put(Queue.NAME, queueName);
-        attributesMap.put(Queue.OWNER, owner);
         attributesMap.put(Queue.EXCLUSIVE, exclusive);
+
+        FieldTable argumentsCopy = new FieldTable();
         if (arguments != null)
         {
-            attributesMap.put("ARGUMENTS", FieldTable.convertToMap(arguments));
+            argumentsCopy.addAll(arguments);
         }
-        String json = _serializer.serialize(attributesMap);
-        UpgradeConfiguredObjectRecord configuredObject = new UpgradeConfiguredObjectRecord(Queue.class.getName(), json);
-        return configuredObject;
+
+        if (moveNonExclusiveOwnerToDescription(owner, exclusive))
+        {
+            _logger.info("Non-exclusive owner " + owner + " for queue " + queueName + " moved to " + AMQQueueFactory.X_QPID_DESCRIPTION);
+
+            attributesMap.put(Queue.OWNER, null);
+            argumentsCopy.put(AMQShortString.valueOf(AMQQueueFactory.X_QPID_DESCRIPTION), owner);
+        }
+        else
+        {
+            attributesMap.put(Queue.OWNER, owner);
+        }
+        if (!argumentsCopy.isEmpty())
+        {
+            attributesMap.put(Queue.ARGUMENTS, FieldTable.convertToMap(argumentsCopy));
+        }
+        return attributesMap;
+    }
+
+    private boolean moveNonExclusiveOwnerToDescription(String owner,
+            boolean exclusive)
+    {
+        return exclusive == false && owner != null && _moveNonExclusiveQueueOwnerToDescription;
     }
 
     private UpgradeConfiguredObjectRecord createExchangeConfiguredObjectRecord(String exchangeName, String exchangeType,

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java Wed Jun 20 15:54:15 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
 package org.apache.qpid.server.store.berkeleydb;
 
 import org.apache.qpid.server.store.DurableConfigurationStoreTest;

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java Wed Jun 20 15:54:15 2012
@@ -55,7 +55,7 @@ import org.apache.qpid.transport.Message
 
 /**
  * Subclass of MessageStoreTest which runs the standard tests from the superclass against
- * the BDB Store as well as additional tests specific to the DBB store-implementation.
+ * the BDB Store as well as additional tests specific to the BDB store-implementation.
  */
 public class BDBMessageStoreTest extends org.apache.qpid.server.store.MessageStoreTest
 {

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/AbstractUpgradeTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/AbstractUpgradeTestCase.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/AbstractUpgradeTestCase.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/AbstractUpgradeTestCase.java Wed Jun 20 15:54:15 2012
@@ -52,8 +52,8 @@ public abstract class AbstractUpgradeTes
     }
 
     public static final String[] QUEUE_NAMES = { "clientid:myDurSubName", "clientid:mySelectorDurSubName", "myUpgradeQueue",
-            "queue-non-durable" };
-    public static int[] QUEUE_SIZES = { 1, 1, 10, 3 };
+            "queue-non-durable", "nonexclusive-with-erroneous-owner" };
+    public static int[] QUEUE_SIZES = { 1, 1, 10, 3, 0};
     public static int TOTAL_MESSAGE_NUMBER = 15;
     protected static final LogSubject LOG_SUBJECT = new TestBlankSubject();
 
@@ -98,7 +98,7 @@ public abstract class AbstractUpgradeTes
         finally
         {
             _environment = null;
-            deleteDirectoryIfExists(_storeLocation);
+            //deleteDirectoryIfExists(_storeLocation);
         }
         super.tearDown();
     }

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4to5Test.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4to5Test.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4to5Test.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4to5Test.java Wed Jun 20 15:54:15 2012
@@ -23,10 +23,13 @@ package org.apache.qpid.server.store.ber
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.qpid.common.AMQPFilterTypes;
 import org.apache.qpid.framing.AMQShortString;
@@ -49,6 +52,7 @@ public class UpgradeFrom4to5Test extends
 {
     private static final String NON_DURABLE_QUEUE = BDBStoreUpgradeTestPreparer.NON_DURABLE_QUEUE_NAME;
     private static final String DURABLE_QUEUE = BDBStoreUpgradeTestPreparer.QUEUE_NAME;
+    private static final String NON_EXCLUSIVE_WITH_ERRONEOUS_OWNER = "nonexclusive-with-erroneous-owner";
     private static final String DURABLE_SUBSCRIPTION_QUEUE_WITH_SELECTOR = "clientid:mySelectorDurSubName";
     private static final String DURABLE_SUBSCRIPTION_QUEUE = "clientid:myDurSubName";
     private static final String EXCHANGE_DB_NAME = "exchangeDb_v5";
@@ -87,6 +91,10 @@ public class UpgradeFrom4to5Test extends
                 BDBStoreUpgradeTestPreparer.SELECTOR_TOPIC_NAME, "testprop='true'");
         assertBindingRecord(queueBindings, DURABLE_QUEUE, "amq.direct", DURABLE_QUEUE, null);
         assertBindingRecord(queueBindings, NON_DURABLE_QUEUE, "amq.direct", NON_DURABLE_QUEUE, null);
+        assertBindingRecord(queueBindings, NON_EXCLUSIVE_WITH_ERRONEOUS_OWNER, "amq.direct", NON_EXCLUSIVE_WITH_ERRONEOUS_OWNER, null);
+
+        assertQueueHasOwner(NON_EXCLUSIVE_WITH_ERRONEOUS_OWNER, "misused-owner-as-description");
+
         assertContent();
     }
 
@@ -94,7 +102,7 @@ public class UpgradeFrom4to5Test extends
     {
         UpgradeFrom4To5 upgrade = new UpgradeFrom4To5();
         upgrade.performUpgrade(_environment, new StaticAnswerHandler(UpgradeInteractionResponse.NO), getVirtualHostName());
-        assertQueues(new HashSet<String>(Arrays.asList(DURABLE_SUBSCRIPTION_QUEUE, DURABLE_SUBSCRIPTION_QUEUE_WITH_SELECTOR, DURABLE_QUEUE)));
+        assertQueues(new HashSet<String>(Arrays.asList(DURABLE_SUBSCRIPTION_QUEUE, DURABLE_SUBSCRIPTION_QUEUE_WITH_SELECTOR, DURABLE_QUEUE, NON_EXCLUSIVE_WITH_ERRONEOUS_OWNER)));
 
         assertDatabaseRecordCount(DELIVERY_DB_NAME, 12);
         assertDatabaseRecordCount(MESSAGE_META_DATA_DB_NAME, 12);
@@ -112,6 +120,9 @@ public class UpgradeFrom4to5Test extends
         assertBindingRecord(queueBindings, DURABLE_SUBSCRIPTION_QUEUE_WITH_SELECTOR, "amq.topic",
                 BDBStoreUpgradeTestPreparer.SELECTOR_TOPIC_NAME, "testprop='true'");
         assertBindingRecord(queueBindings, DURABLE_QUEUE, "amq.direct", DURABLE_QUEUE, null);
+
+        assertQueueHasOwner(NON_EXCLUSIVE_WITH_ERRONEOUS_OWNER, "misused-owner-as-description");
+
         assertContent();
     }
 
@@ -257,7 +268,7 @@ public class UpgradeFrom4to5Test extends
 
     private void assertQueues(Set<String> expectedQueueNames)
     {
-        List<AMQShortString> durableSubNames = new ArrayList<AMQShortString>();
+        List<AMQShortString> durableSubNames = Collections.emptyList();
         final UpgradeFrom4To5.QueueRecordBinding binding = new UpgradeFrom4To5.QueueRecordBinding(durableSubNames);
         final Set<String> actualQueueNames = new HashSet<String>();
 
@@ -278,6 +289,35 @@ public class UpgradeFrom4to5Test extends
         assertEquals("Unexpected queue names", expectedQueueNames, actualQueueNames);
     }
 
+    private void assertQueueHasOwner(String queueName, final String expectedOwner)
+    {
+        List<AMQShortString> durableSubNames = Collections.emptyList();
+        final UpgradeFrom4To5.QueueRecordBinding binding = new UpgradeFrom4To5.QueueRecordBinding(durableSubNames);
+        final AtomicReference<String> actualOwner = new AtomicReference<String>();
+        final AtomicBoolean foundQueue = new AtomicBoolean(false);
+
+        CursorOperation queueNameCollector = new CursorOperation()
+        {
+
+            @Override
+            public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction,
+                    DatabaseEntry key, DatabaseEntry value)
+            {
+                QueueRecord record = binding.entryToObject(value);
+                String queueName = record.getNameShortString().asString();
+                if (queueName.equals(queueName))
+                {
+                    foundQueue.set(true);
+                    actualOwner.set(AMQShortString.toString(record.getOwner()));
+                }
+            }
+        };
+        new DatabaseTemplate(_environment, "queueDb_v5", null).run(queueNameCollector);
+
+        assertTrue("Could not find queue in database", foundQueue.get());
+        assertEquals("Queue has unexpected owner", expectedOwner, actualOwner.get());
+    }
+
     private void assertContent()
     {
         final UpgradeFrom4To5.ContentBinding contentBinding = new UpgradeFrom4To5.ContentBinding();

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java Wed Jun 20 15:54:15 2012
@@ -29,6 +29,7 @@ import static org.apache.qpid.server.sto
 import static org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom5To6.OLD_XID_DB_NAME;
 
 import java.io.File;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -41,6 +42,7 @@ import org.apache.qpid.server.model.Bind
 import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.model.UUIDGenerator;
+import org.apache.qpid.server.queue.AMQQueueFactory;
 import org.apache.qpid.server.store.berkeleydb.entry.Xid;
 import org.apache.qpid.server.store.berkeleydb.tuple.XidBinding;
 import org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom5To6.CompoundKey;
@@ -260,7 +262,7 @@ public class UpgradeFrom5To6Test extends
 
     private void assertDatabaseRecordCounts()
     {
-        assertDatabaseRecordCount(CONFIGURED_OBJECTS_DB_NAME, 9);
+        assertDatabaseRecordCount(CONFIGURED_OBJECTS_DB_NAME, 12);
         assertDatabaseRecordCount(NEW_DELIVERY_DB_NAME, 12);
 
         assertDatabaseRecordCount(NEW_METADATA_DB_NAME, 12);
@@ -270,64 +272,25 @@ public class UpgradeFrom5To6Test extends
     private void assertConfiguredObjects()
     {
         Map<UUID, UpgradeConfiguredObjectRecord> configuredObjects = loadConfiguredObjects();
-        assertEquals("Unexpected number of configured objects", 9, configuredObjects.size());
+        assertEquals("Unexpected number of configured objects", 12, configuredObjects.size());
 
-        Set<Map<String, Object>> expected = new HashSet<Map<String, Object>>(9);
-        Map<String, Object> queue1 = new HashMap<String, Object>();
-        queue1.put("exclusive", Boolean.FALSE);
-        queue1.put("name", "myUpgradeQueue");
-        queue1.put("owner", null);
-        expected.add(queue1);
-        Map<String, Object> queue2 = new HashMap<String, Object>();
-        queue2.put("exclusive", Boolean.TRUE);
-        queue2.put("name", "clientid:mySelectorDurSubName");
-        queue2.put("owner", "clientid");
-        expected.add(queue2);
-        Map<String, Object> queue3 = new HashMap<String, Object>();
-        queue3.put("exclusive", Boolean.TRUE);
-        queue3.put("name", "clientid:myDurSubName");
-        queue3.put("owner", "clientid");
-        expected.add(queue3);
-
-        Map<String, Object> queueBinding1 = new HashMap<String, Object>();
-        queueBinding1.put("queue", UUIDGenerator.generateUUID("myUpgradeQueue", getVirtualHostName()).toString());
-        queueBinding1.put("name", "myUpgradeQueue");
-        queueBinding1.put("exchange", UUIDGenerator.generateUUID("<<default>>", getVirtualHostName()).toString());
-        expected.add(queueBinding1);
-        Map<String, Object> queueBinding2 = new HashMap<String, Object>();
-        queueBinding2.put("queue", UUIDGenerator.generateUUID("myUpgradeQueue", getVirtualHostName()).toString());
-        queueBinding2.put("name", "myUpgradeQueue");
-        queueBinding2.put("exchange", UUIDGenerator.generateUUID("amq.direct", getVirtualHostName()).toString());
-        Map<String, Object> arguments2 = new HashMap<String, Object>();
-        arguments2.put("x-filter-jms-selector", "");
-        queueBinding2.put("arguments", arguments2);
-        expected.add(queueBinding2);
-        Map<String, Object> queueBinding3 = new HashMap<String, Object>();
-        queueBinding3.put("queue", UUIDGenerator.generateUUID("clientid:myDurSubName", getVirtualHostName()).toString());
-        queueBinding3.put("name", "myUpgradeTopic");
-        queueBinding3.put("exchange", UUIDGenerator.generateUUID("amq.topic", getVirtualHostName()).toString());
-        Map<String, Object> arguments3 = new HashMap<String, Object>();
-        arguments3.put("x-filter-jms-selector", "");
-        queueBinding3.put("arguments", arguments3);
-        expected.add(queueBinding3);
-        Map<String, Object> queueBinding4 = new HashMap<String, Object>();
-        queueBinding4.put("queue", UUIDGenerator.generateUUID("clientid:mySelectorDurSubName", getVirtualHostName()).toString());
-        queueBinding4.put("name", "mySelectorUpgradeTopic");
-        queueBinding4.put("exchange", UUIDGenerator.generateUUID("amq.topic", getVirtualHostName()).toString());
-        Map<String, Object> arguments4 = new HashMap<String, Object>();
-        arguments4.put("x-filter-jms-selector", "testprop='true'");
-        queueBinding4.put("arguments", arguments4);
-        expected.add(queueBinding4);
-        Map<String, Object> queueBinding5 = new HashMap<String, Object>();
-        queueBinding5.put("queue", UUIDGenerator.generateUUID("clientid:myDurSubName", getVirtualHostName()).toString());
-        queueBinding5.put("name", "clientid:myDurSubName");
-        queueBinding5.put("exchange", UUIDGenerator.generateUUID("<<default>>", getVirtualHostName()).toString());
-        expected.add(queueBinding5);
-        Map<String, Object> queueBinding6 = new HashMap<String, Object>();
-        queueBinding6.put("queue", UUIDGenerator.generateUUID("clientid:mySelectorDurSubName", getVirtualHostName()).toString());
-        queueBinding6.put("name", "clientid:mySelectorDurSubName");
-        queueBinding6.put("exchange", UUIDGenerator.generateUUID("<<default>>", getVirtualHostName()).toString());
-        expected.add(queueBinding6);
+        Set<Map<String, Object>> expected = new HashSet<Map<String, Object>>(12);
+        expected.add(createExpectedQueueMap("myUpgradeQueue", Boolean.FALSE, null, null));
+        expected.add(createExpectedQueueMap("clientid:mySelectorDurSubName", Boolean.TRUE, "clientid", null));
+        expected.add(createExpectedQueueMap("clientid:myDurSubName", Boolean.TRUE, "clientid", null));
+        expected.add(createExpectedQueueMap("nonexclusive-with-erroneous-owner", Boolean.FALSE, null,
+                     Collections.singletonMap(AMQQueueFactory.X_QPID_DESCRIPTION, "misused-owner-as-description")));
+
+        expected.add(createExpectedQueueBindingMap("myUpgradeQueue","myUpgradeQueue", "<<default>>", null));
+        expected.add(createExpectedQueueBindingMap("myUpgradeQueue", "myUpgradeQueue", "amq.direct", null));
+        expected.add(createExpectedQueueBindingMap("clientid:myDurSubName", "myUpgradeTopic", "amq.topic",
+                Collections.singletonMap("x-filter-jms-selector", "")));
+        expected.add(createExpectedQueueBindingMap("clientid:mySelectorDurSubName", "mySelectorUpgradeTopic", "amq.topic",
+                Collections.singletonMap("x-filter-jms-selector", "testprop='true'")));
+        expected.add(createExpectedQueueBindingMap("clientid:myDurSubName", "clientid:myDurSubName", "<<default>>", null));
+        expected.add(createExpectedQueueBindingMap("clientid:mySelectorDurSubName", "clientid:mySelectorDurSubName", "<<default>>", null));
+        expected.add(createExpectedQueueBindingMap("nonexclusive-with-erroneous-owner", "nonexclusive-with-erroneous-owner", "amq.direct", null));
+        expected.add(createExpectedQueueBindingMap("nonexclusive-with-erroneous-owner","nonexclusive-with-erroneous-owner", "<<default>>", null));
 
         Set<String> expectedTypes = new HashSet<String>();
         expectedTypes.add(Queue.class.getName());
@@ -337,11 +300,11 @@ public class UpgradeFrom5To6Test extends
         for (Entry<UUID, UpgradeConfiguredObjectRecord> entry : configuredObjects.entrySet())
         {
             UpgradeConfiguredObjectRecord object = entry.getValue();
-            UUID key = entry.getKey();
             Map<String, Object> deserialized = jsonSerializer.deserialize(object.getAttributes());
             assertTrue("Unexpected entry:" + object.getAttributes(), expected.remove(deserialized));
             String type = object.getType();
             assertTrue("Unexpected type:" + type, expectedTypes.contains(type));
+            UUID key = entry.getKey();
             if (type.equals(Exchange.class.getName()) || type.equals(Queue.class.getName()))
             {
                 assertEquals("Unexpected key", key, UUIDGenerator.generateUUID(((String) deserialized.get("name")), getVirtualHostName()));
@@ -354,6 +317,32 @@ public class UpgradeFrom5To6Test extends
         assertTrue("Not all expected configured objects found:" + expected, expected.isEmpty());
     }
 
+    private Map<String, Object> createExpectedQueueBindingMap(String queue, String bindingName, String exchangeName, Map<String, String> argumentMap)
+    {
+        Map<String, Object> expectedQueueBinding = new HashMap<String, Object>();
+        expectedQueueBinding.put(Binding.QUEUE, UUIDGenerator.generateUUID(queue, getVirtualHostName()).toString());
+        expectedQueueBinding.put(Binding.NAME, bindingName);
+        expectedQueueBinding.put(Binding.EXCHANGE, UUIDGenerator.generateUUID(exchangeName, getVirtualHostName()).toString());
+        if (argumentMap != null)
+        {
+            expectedQueueBinding.put(Binding.ARGUMENTS, argumentMap);
+        }
+        return expectedQueueBinding;
+    }
+
+    private Map<String, Object> createExpectedQueueMap(String name, boolean exclusiveFlag, String owner, Map<String, String> argumentMap)
+    {
+        Map<String, Object> expectedQueueEntry = new HashMap<String, Object>();
+        expectedQueueEntry.put(Queue.NAME, name);
+        expectedQueueEntry.put(Queue.EXCLUSIVE, exclusiveFlag);
+        expectedQueueEntry.put(Queue.OWNER, owner);
+        if (argumentMap != null)
+        {
+            expectedQueueEntry.put(Queue.ARGUMENTS, argumentMap);
+        }
+        return expectedQueueEntry;
+    }
+
     private Map<UUID, UpgradeConfiguredObjectRecord> loadConfiguredObjects()
     {
         final Map<UUID, UpgradeConfiguredObjectRecord> configuredObjectsRecords = new HashMap<UUID, UpgradeConfiguredObjectRecord>();

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v4/test-store/00000000.jdb
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v4/test-store/00000000.jdb?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
Files qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v4/test-store/00000000.jdb (original) and qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v4/test-store/00000000.jdb Wed Jun 20 15:54:15 2012 differ

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000000.jdb
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000000.jdb?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
Files qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000000.jdb (original) and qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000000.jdb Wed Jun 20 15:54:15 2012 differ

Modified: qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000001.jdb
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000001.jdb?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
Files qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000001.jdb (original) and qpid/branches/java-config-and-management/qpid/java/bdbstore/src/test/resources/upgrade/bdbstore-v5/test-store/00000001.jdb Wed Jun 20 15:54:15 2012 differ

Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java Wed Jun 20 15:54:15 2012
@@ -141,6 +141,7 @@ public class QueueMBean extends AMQManag
         return _queue.getName();
     }
 
+
     public Integer getMessageCount()
     {
         return getStatisticValue(Queue.QUEUE_DEPTH_MESSAGES).intValue();
@@ -182,6 +183,12 @@ public class QueueMBean extends AMQManag
         return (String) _queue.getAttribute(Queue.OWNER);
     }
 
+    @Override
+    public String getQueueType()
+    {
+        return (String) _queue.getAttribute(Queue.TYPE);
+    }
+
     public boolean isDurable()
     {
         return _queue.isDurable();
@@ -661,6 +668,18 @@ public class QueueMBean extends AMQManag
 
         return new MBeanNotificationInfo[] { info1 };
     }
+
+    @Override
+    public String getDescription()
+    {
+        return (String) _queue.getAttribute(Queue.DESCRIPTION);
+    }
+
+    @Override
+    public void setDescription(String description)
+    {
+        _queue.setAttribute(Queue.DESCRIPTION, getDescription(), description);
+    }
 }
 
 

Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java Wed Jun 20 15:54:15 2012
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -33,6 +34,7 @@ import javax.management.MBeanException;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
+import org.apache.log4j.Logger;
 import org.apache.qpid.management.common.mbeans.ManagedBroker;
 import org.apache.qpid.management.common.mbeans.ManagedQueue;
 import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor;
@@ -44,10 +46,14 @@ import org.apache.qpid.server.model.Life
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.queue.AMQQueueFactory;
 
 @MBeanDescription("This MBean exposes the broker level management features")
 public class VirtualHostManagerMBean extends AbstractStatisticsGatheringMBean<VirtualHost> implements ManagedBroker
 {
+    private static final Logger LOGGER = Logger.getLogger(VirtualHostManagerMBean.class);
+
+    private static final boolean _moveNonExclusiveQueueOwnerToDescription = Boolean.parseBoolean(System.getProperty("qpid.move_non_exclusive_queue_owner_to_description", Boolean.TRUE.toString()));
 
     private final VirtualHostMBean _virtualHostMBean;
 
@@ -159,11 +165,42 @@ public class VirtualHostManagerMBean ext
         createNewQueue(queueName, owner, durable, Collections.EMPTY_MAP);
     }
 
-    public void createNewQueue(String queueName, String owner, boolean durable, Map<String, Object> arguments)
+    public void createNewQueue(String queueName, String owner, boolean durable, Map<String, Object> originalArguments)
             throws IOException, JMException
     {
-        // TODO - ignores owner (not sure that this isn't actually a good thing though)
-        getConfiguredObject().createQueue(queueName, State.ACTIVE, durable, false, LifetimePolicy.PERMANENT, 0l, arguments);
+        final Map<String, Object> createArgs = processNewQueueArguments(queueName, owner, originalArguments);
+        getConfiguredObject().createQueue(queueName, State.ACTIVE, durable, false, LifetimePolicy.PERMANENT, 0l, createArgs);
+    }
+
+
+    /**
+     * Some users have been abusing the owner field to store a queue description.  As the owner field
+     * only makes sense if exclusive=true, and it is currently impossible to create an exclusive queue via
+     * the JMX interface, if the user specifies a owner, then we assume that they actually mean to pass a description.
+     */
+    private Map<String, Object> processNewQueueArguments(String queueName,
+            String owner, Map<String, Object> arguments)
+    {
+        final Map<String, Object> argumentsCopy;
+        if (_moveNonExclusiveQueueOwnerToDescription && owner != null)
+        {
+            argumentsCopy = new HashMap<String, Object>(arguments == null ? new HashMap<String, Object>() : arguments);
+            if (!argumentsCopy.containsKey(AMQQueueFactory.X_QPID_DESCRIPTION))
+            {
+                LOGGER.warn("Non-exclusive owner " + owner + " for new queue " + queueName + " moved to " + AMQQueueFactory.X_QPID_DESCRIPTION);
+
+                argumentsCopy.put(AMQQueueFactory.X_QPID_DESCRIPTION, owner);
+            }
+            else
+            {
+                LOGGER.warn("Non-exclusive owner " + owner + " for new queue " + queueName + " ignored.");
+            }
+        }
+        else
+        {
+            argumentsCopy = arguments;
+        }
+        return argumentsCopy;
     }
 
     public void deleteQueue(

Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java Wed Jun 20 15:54:15 2012
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.*;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 
-import org.apache.qpid.server.jmx.ManagedObject;
 import org.apache.qpid.server.jmx.ManagedObjectRegistry;
 import org.apache.qpid.server.util.InternalBrokerBaseCase;
 

Added: qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/QueueMBeanTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/QueueMBeanTest.java?rev=1352172&view=auto
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/QueueMBeanTest.java (added)
+++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/QueueMBeanTest.java Wed Jun 20 15:54:15 2012
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.qpid.server.jmx.mbeans;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.qpid.server.jmx.ManagedObjectRegistry;
+import org.apache.qpid.server.model.Queue;
+
+import junit.framework.TestCase;
+
+public class QueueMBeanTest extends TestCase
+{
+    private static final String QUEUE_NAME = "QUEUE_NAME";
+    private static final String QUEUE_DESCRIPTION = "QUEUE_DESCRIPTION";
+
+    private Queue _mockQueue;
+    private VirtualHostMBean _mockVirtualHostMBean;
+    private ManagedObjectRegistry _mockManagedObjectRegistry;
+    private QueueMBean _queueMBean;
+
+    @Override
+    protected void setUp() throws Exception
+    {
+        _mockQueue = mock(Queue.class);
+        _mockVirtualHostMBean = mock(VirtualHostMBean.class);
+
+        _mockManagedObjectRegistry = mock(ManagedObjectRegistry.class);
+        when(_mockVirtualHostMBean.getRegistry()).thenReturn(_mockManagedObjectRegistry);
+
+        _queueMBean = new QueueMBean(_mockQueue, _mockVirtualHostMBean);
+    }
+
+    public void testQueueName()
+    {
+        when(_mockQueue.getName()).thenReturn(QUEUE_NAME);
+
+        assertEquals(QUEUE_NAME, _queueMBean.getName());
+    }
+
+    public void testQueueDescription()
+    {
+        when(_mockQueue.getAttribute(Queue.DESCRIPTION)).thenReturn(QUEUE_DESCRIPTION);
+
+        assertEquals(QUEUE_DESCRIPTION, _queueMBean.getDescription());
+    }
+}

Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/UserManagementMBeanTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/UserManagementMBeanTest.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/UserManagementMBeanTest.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/UserManagementMBeanTest.java Wed Jun 20 15:54:15 2012
@@ -45,7 +45,6 @@ import org.apache.qpid.server.util.Inter
  */
 public class UserManagementMBeanTest extends InternalBrokerBaseCase
 {
-    private PlainPasswordFilePrincipalDatabase _database;
     private UserManagementMBean _umMBean;
     
     private File _passwordFile;
@@ -60,8 +59,6 @@ public class UserManagementMBeanTest ext
     {
         super.setUp();
 
-        _database = new PlainPasswordFilePrincipalDatabase();
-        
         _passwordFile = File.createTempFile(this.getClass().getName(),".password");
         
         createFreshTestPasswordFile();

Added: qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBeanTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBeanTest.java?rev=1352172&view=auto
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBeanTest.java (added)
+++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBeanTest.java Wed Jun 20 15:54:15 2012
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.jmx.mbeans;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.util.Collections;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.qpid.server.jmx.ManagedObjectRegistry;
+import org.apache.qpid.server.model.LifetimePolicy;
+import org.apache.qpid.server.model.State;
+import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.queue.AMQQueueFactory;
+
+public class VirtualHostManagerMBeanTest extends TestCase
+{
+    private static final String TEST_QUEUE_NAME = "QUEUE_NAME";
+    private static final String TEST_OWNER = "OWNER";
+    private static final String TEST_DESCRIPTION = "DESCRIPTION";
+
+    private static final Map<String, Object> EMPTY_ARGUMENT_MAP = Collections.emptyMap();
+
+    private VirtualHost _mockVirtualHost;
+    private ManagedObjectRegistry _mockManagedObjectRegistry;
+    private VirtualHostManagerMBean _virtualHostManagerMBean;
+
+    @Override
+    protected void setUp() throws Exception
+    {
+        _mockVirtualHost = mock(VirtualHost.class);
+        _mockManagedObjectRegistry = mock(ManagedObjectRegistry.class);
+
+        _virtualHostManagerMBean = new VirtualHostManagerMBean(new VirtualHostMBean(_mockVirtualHost, _mockManagedObjectRegistry));
+    }
+
+    public void testCreateQueueWithNoOwner() throws Exception
+    {
+        _virtualHostManagerMBean.createNewQueue(TEST_QUEUE_NAME, null, true);
+
+        verify(_mockVirtualHost).createQueue(TEST_QUEUE_NAME, State.ACTIVE, true, false, LifetimePolicy.PERMANENT, 0, EMPTY_ARGUMENT_MAP);
+    }
+
+    /**
+     * Some users have been abusing the owner parameter as a description.  Decision has been taken to map this parameter
+     * through to the description field (if the description field is passed, the owner is discarded).
+     */
+    public void testCreateQueueWithOwnerMappedThroughToDescription() throws Exception
+    {
+        _virtualHostManagerMBean.createNewQueue(TEST_QUEUE_NAME, TEST_OWNER, true);
+
+        Map<String, Object> expectedArguments = Collections.singletonMap(AMQQueueFactory.X_QPID_DESCRIPTION, (Object)TEST_OWNER);
+        verify(_mockVirtualHost).createQueue(TEST_QUEUE_NAME, State.ACTIVE, true, false, LifetimePolicy.PERMANENT, 0, expectedArguments);
+    }
+
+    public void testCreateQueueWithOwnerAndDescriptionDiscardsOwner() throws Exception
+    {
+        Map<String, Object> arguments = Collections.singletonMap(AMQQueueFactory.X_QPID_DESCRIPTION, (Object)TEST_DESCRIPTION);
+        _virtualHostManagerMBean.createNewQueue(TEST_QUEUE_NAME, TEST_OWNER, true, arguments);
+
+        Map<String, Object> expectedArguments = Collections.singletonMap(AMQQueueFactory.X_QPID_DESCRIPTION, (Object)TEST_DESCRIPTION);
+        verify(_mockVirtualHost).createQueue(TEST_QUEUE_NAME, State.ACTIVE, true, false, LifetimePolicy.PERMANENT, 0, expectedArguments);
+    }
+
+}

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java Wed Jun 20 15:54:15 2012
@@ -126,6 +126,11 @@ public class QueueConfiguration extends 
         return _name;
     }
 
+    public String getDescription()
+    {
+        return getStringValue("description");
+    }
+
     public int getMaximumMessageAge()
     {
         return getIntValue("maximumMessageAge", _vHostConfig.getMaximumMessageAge());
@@ -226,4 +231,5 @@ public class QueueConfiguration extends 
           
 
     }
+
 }

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java Wed Jun 20 15:54:15 2012
@@ -82,7 +82,7 @@ public interface ConfiguredObject
      * @param desiredState the state the caller wishes the object to attain
      * @return the new current state
      * @throws IllegalStateTransitionException  the requested state tranisition is invalid
-     * @throws AccessControlException the current context does not have sufficeint permissions to change the state
+     * @throws AccessControlException the current context does not have sufficient permissions to change the state
      */
     State setDesiredState(State currentState, State desiredState) throws IllegalStateTransitionException,
                                                                          AccessControlException;
@@ -90,7 +90,7 @@ public interface ConfiguredObject
     /**
      * Get the actual state of the object.
      *
-     * This state is derived fromt the desired state of the object itself and
+     * This state is derived from the desired state of the object itself and
      * the actual state of its parents. If an object "desires" to be ACTIVE, but one of its parents is STOPPED, then
      * the actual state of the object will be STOPPED
      *
@@ -127,7 +127,7 @@ public interface ConfiguredObject
     /**
      * Returns whether the the object configuration is durably stored
      *
-     * @return the durablity
+     * @return the durability
      */
     boolean isDurable();
 

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Queue.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Queue.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Queue.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Queue.java Wed Jun 20 15:54:15 2012
@@ -70,6 +70,7 @@ public interface Queue extends Configure
 
 
     public static final String ID = "id";
+    public static final String DESCRIPTION = "description";
     public static final String NAME = "name";
     public static final String STATE = "state";
     public static final String DURABLE = "durable";
@@ -77,6 +78,7 @@ public interface Queue extends Configure
     public static final String TIME_TO_LIVE = "timeToLive";
     public static final String CREATED = "created";
     public static final String UPDATED = "updated";
+    public static final String ARGUMENTS = "arguments";
 
     public static final String ALERT_REPEAT_GAP = "alertRepeatGap";
     public static final String ALERT_THRESHOLD_MESSAGE_AGE = "alertThresholdMessageAge";
@@ -105,6 +107,7 @@ public interface Queue extends Configure
             Collections.unmodifiableList(
                     Arrays.asList(ID,
                                   NAME,
+                                  DESCRIPTION,
                                   STATE,
                                   DURABLE,
                                   LIFETIME_POLICY,

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/UUIDGenerator.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/UUIDGenerator.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/UUIDGenerator.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/UUIDGenerator.java Wed Jun 20 15:54:15 2012
@@ -40,11 +40,11 @@ public class UUIDGenerator
         return UUID.nameUUIDFromBytes(sb.toString().getBytes());
     }
 
-    public static UUID generateExchangeUUID(String echangeName, String virtualHostName)
+    public static UUID generateExchangeUUID(String exchangeName, String virtualHostName)
     {
-        if(ExchangeDefaults.DEFAULT_EXCHANGE_NAME.asString().equals(echangeName) || echangeName.startsWith("amq.") || echangeName.startsWith("qpid."))
+        if(ExchangeDefaults.DEFAULT_EXCHANGE_NAME.asString().equals(exchangeName) || exchangeName.startsWith("amq.") || exchangeName.startsWith("qpid."))
         {
-            return generateUUID(echangeName, virtualHostName);
+            return generateUUID(exchangeName, virtualHostName);
         }
         else
         {

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java Wed Jun 20 15:54:15 2012
@@ -28,6 +28,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import org.apache.qpid.AMQException;
+import org.apache.qpid.AMQStoreException;
 import org.apache.qpid.server.binding.Binding;
 import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.Consumer;
@@ -200,92 +201,116 @@ final class QueueAdapter extends Abstrac
     @Override
     public Object setAttribute(String name, Object expected, Object desired) throws IllegalStateException, AccessControlException, IllegalArgumentException
     {
-        if(ALERT_REPEAT_GAP.equals(name))
-        {
-            _queue.setMinimumAlertRepeatGap((Long)desired);
-            return desired;
-        }
-        else if(ALERT_THRESHOLD_MESSAGE_AGE.equals(name))
-        {
-            _queue.setMaximumMessageAge((Long)desired);
-            return desired;
-        }
-        else if(ALERT_THRESHOLD_MESSAGE_SIZE.equals(name))
-        {
-            _queue.setMaximumMessageSize((Long)desired);
-            return desired;
-        }
-        else if(ALERT_THRESHOLD_QUEUE_DEPTH_BYTES.equals(name))
-        {
-            _queue.setMaximumQueueDepth((Long)desired);
-            return desired;
-        }
-        else if(ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES.equals(name))
-        {
-            _queue.setMaximumMessageCount((Long)desired);
-            return desired;
-        }
-        else if(ALTERNATE_EXCHANGE.equals(name))
-        {
-            // TODO
-        }
-        else if(EXCLUSIVE.equals(name))
-        {
-            // TODO
-        }
-        else if(MESSAGE_GROUP_KEY.equals(name))
-        {
-            // TODO
-        }
-        else if(MESSAGE_GROUP_DEFAULT_GROUP.equals(name))
-        {
-            // TODO
-        }
-        else if(MESSAGE_GROUP_SHARED_GROUPS.equals(name))
-        {
-            // TODO
-        }
-        else if(LVQ_KEY.equals(name))
-        {
-            // TODO
-        }
-        else if(MAXIMUM_DELIVERY_ATTEMPTS.equals(name))
-        {
-            _queue.setMaximumDeliveryCount((Integer)desired);
-            return desired;
-        }
-        else if(NO_LOCAL.equals(name))
-        {
-            // TODO
-        }
-        else if(OWNER.equals(name))
-        {
-            // TODO
-        }
-        else if(QUEUE_FLOW_CONTROL_SIZE_BYTES.equals(name))
-        {
-            _queue.setCapacity((Long)desired);
-            return desired;
-        }
-        else if(QUEUE_FLOW_RESUME_SIZE_BYTES.equals(name))
-        {
-            _queue.setFlowResumeCapacity((Long)desired);
-            return desired;
-        }
-        else if(QUEUE_FLOW_STOPPED.equals(name))
-        {
-            // TODO
-        }
-        else if(SORT_KEY.equals(name))
+        try
         {
-            // TODO
+            if(ALERT_REPEAT_GAP.equals(name))
+            {
+                _queue.setMinimumAlertRepeatGap((Long)desired);
+                return desired;
+            }
+            else if(ALERT_THRESHOLD_MESSAGE_AGE.equals(name))
+            {
+                _queue.setMaximumMessageAge((Long)desired);
+                return desired;
+            }
+            else if(ALERT_THRESHOLD_MESSAGE_SIZE.equals(name))
+            {
+                _queue.setMaximumMessageSize((Long)desired);
+                return desired;
+            }
+            else if(ALERT_THRESHOLD_QUEUE_DEPTH_BYTES.equals(name))
+            {
+                _queue.setMaximumQueueDepth((Long)desired);
+                return desired;
+            }
+            else if(ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES.equals(name))
+            {
+                _queue.setMaximumMessageCount((Long)desired);
+                return desired;
+            }
+            else if(ALTERNATE_EXCHANGE.equals(name))
+            {
+                // TODO
+            }
+            else if(EXCLUSIVE.equals(name))
+            {
+                Boolean exclusiveFlag = (Boolean) desired;
+                _queue.setExclusive(exclusiveFlag);
+                return desired;
+            }
+            else if(MESSAGE_GROUP_KEY.equals(name))
+            {
+                // TODO
+            }
+            else if(MESSAGE_GROUP_DEFAULT_GROUP.equals(name))
+            {
+                // TODO
+            }
+            else if(MESSAGE_GROUP_SHARED_GROUPS.equals(name))
+            {
+                // TODO
+            }
+            else if(LVQ_KEY.equals(name))
+            {
+                // TODO
+            }
+            else if(MAXIMUM_DELIVERY_ATTEMPTS.equals(name))
+            {
+                _queue.setMaximumDeliveryCount((Integer)desired);
+                return desired;
+            }
+            else if(NO_LOCAL.equals(name))
+            {
+                // TODO
+            }
+            else if(OWNER.equals(name))
+            {
+                // TODO
+            }
+            else if(QUEUE_FLOW_CONTROL_SIZE_BYTES.equals(name))
+            {
+                _queue.setCapacity((Long)desired);
+                return desired;
+            }
+            else if(QUEUE_FLOW_RESUME_SIZE_BYTES.equals(name))
+            {
+                _queue.setFlowResumeCapacity((Long)desired);
+                return desired;
+            }
+            else if(QUEUE_FLOW_STOPPED.equals(name))
+            {
+                // TODO
+            }
+            else if(SORT_KEY.equals(name))
+            {
+                // TODO
+            }
+            else if(TYPE.equals(name))
+            {
+                // TODO
+            }
+            else if (DESCRIPTION.equals(name))
+            {
+                _queue.setDescription((String) desired);
+                return desired;
+            }
+
+            return super.setAttribute(name, expected, desired);
         }
-        else if(TYPE.equals(name))
+        finally
         {
-            // TODO
+            if (_queue.isDurable())
+            {
+                try
+                {
+                    _queue.getVirtualHost().getMessageStore().updateQueue(_queue);
+                }
+                catch (AMQStoreException e)
+                {
+                    throw new IllegalStateException(e);
+                }
+            }
         }
-
-        return super.setAttribute(name, expected, desired);
     }
 
     @Override
@@ -418,6 +443,10 @@ final class QueueAdapter extends Abstrac
         {
             // TODO
         }
+        else if (DESCRIPTION.equals(name))
+        {
+            return _queue.getDescription();
+        }
 
         return super.getAttribute(name);
     }

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java Wed Jun 20 15:54:15 2012
@@ -261,12 +261,12 @@ public interface AMQQueue extends Compar
     }
 
     /**
-     * ExistingSubscriptionPreventsExclusive signals a failure to create an exclusize subscription, as a subscription
+     * ExistingSubscriptionPreventsExclusive signals a failure to create an exclusive subscription, as a subscription
      * already exists.
      *
      * <p/><table id="crc"><caption>CRC Card</caption>
      * <tr><th> Responsibilities <th> Collaborations
-     * <tr><td> Represent failure to create an exclusize subscription, as a subscription already exists.
+     * <tr><td> Represent failure to create an exclusive subscription, as a subscription already exists.
      * </table>
      *
      * @todo Not an AMQP exception as no status code.
@@ -290,7 +290,7 @@ public interface AMQQueue extends Compar
 
     ConfigurationPlugin getConfiguration();
 
-    void setExclusive(boolean exclusive) throws AMQException;
+    void setExclusive(boolean exclusive);
 
     /**
      * Gets the maximum delivery count.   If a message on this queue
@@ -310,4 +310,18 @@ public interface AMQQueue extends Compar
     public void setMaximumDeliveryCount(final int maximumDeliveryCount);
 
     void setNotificationListener(NotificationListener listener);
+
+    /**
+     * Sets the free text description of this queue.
+     *
+     * @param description
+     *
+     */
+    void setDescription(String description);
+
+    /**
+     * Gets the free text description of this queue.
+     */
+    String getDescription();
+
 }

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java Wed Jun 20 15:54:15 2012
@@ -20,6 +20,7 @@
  */
 package org.apache.qpid.server.queue;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -41,6 +42,7 @@ import org.apache.qpid.server.virtualhos
 public class AMQQueueFactory
 {
     public static final String X_QPID_PRIORITIES = "x-qpid-priorities";
+    public static final String X_QPID_DESCRIPTION = "x-qpid-description";
     public static final String QPID_LVQ_KEY = "qpid.LVQ_key";
     public static final String QPID_LAST_VALUE_QUEUE = "qpid.last_value_queue";
     public static final String QPID_LAST_VALUE_QUEUE_KEY = "qpid.last_value_queue_key";
@@ -350,32 +352,7 @@ public class AMQQueueFactory
         boolean autodelete = config.getAutoDelete();
         boolean exclusive = config.getExclusive();
         String owner = config.getOwner();
-        Map<String,Object> arguments = null;
-
-        if(config.isLVQ() || config.getLVQKey() != null)
-        {
-            arguments = new HashMap<String,Object>();
-            arguments.put(QPID_LAST_VALUE_QUEUE, 1);
-            arguments.put(QPID_LAST_VALUE_QUEUE_KEY, config.getLVQKey() == null ? QPID_LVQ_KEY : config.getLVQKey());
-        }
-        else if (config.getPriority() || config.getPriorities() > 0)
-        {
-            arguments = new HashMap<String,Object>();
-            arguments.put(X_QPID_PRIORITIES, config.getPriorities() < 0 ? 10 : config.getPriorities());
-        }
-        else if (config.getQueueSortKey() != null && !"".equals(config.getQueueSortKey()))
-        {
-            arguments = new HashMap<String,Object>();
-            arguments.put(QPID_QUEUE_SORT_KEY, config.getQueueSortKey());
-        }
-        if (!config.getAutoDelete() && config.isDeadLetterQueueEnabled())
-        {
-            if (arguments == null)
-            {
-                arguments = new HashMap<String,Object>();
-            }
-            arguments.put(X_QPID_DLQ_ENABLED, true);
-        }
+        Map<String, Object> arguments = createQueueArgumentsFromConfig(config);
 
         // we need queues that are defined in config to have deterministic ids.
         UUID id = UUIDGenerator.generateUUID(queueName, host.getName());
@@ -385,7 +362,6 @@ public class AMQQueueFactory
         return q;
     }
 
-
     /**
      * Validates DLQ and DLE names
      * <p>
@@ -475,4 +451,43 @@ public class AMQQueueFactory
         String dlExchangeName = name + serverConfig.getDeadLetterExchangeSuffix();
         return dlExchangeName;
     }
+
+    private static Map<String, Object> createQueueArgumentsFromConfig(QueueConfiguration config)
+    {
+        Map<String,Object> arguments = new HashMap<String,Object>();
+
+        if(config.isLVQ() || config.getLVQKey() != null)
+        {
+            arguments.put(QPID_LAST_VALUE_QUEUE, 1);
+            arguments.put(QPID_LAST_VALUE_QUEUE_KEY, config.getLVQKey() == null ? QPID_LVQ_KEY : config.getLVQKey());
+        }
+        else if (config.getPriority() || config.getPriorities() > 0)
+        {
+            arguments.put(X_QPID_PRIORITIES, config.getPriorities() < 0 ? 10 : config.getPriorities());
+        }
+        else if (config.getQueueSortKey() != null && !"".equals(config.getQueueSortKey()))
+        {
+            arguments.put(QPID_QUEUE_SORT_KEY, config.getQueueSortKey());
+        }
+
+        if (!config.getAutoDelete() && config.isDeadLetterQueueEnabled())
+        {
+            arguments.put(X_QPID_DLQ_ENABLED, true);
+        }
+
+        if (config.getDescription() != null && !"".equals(config.getDescription()))
+        {
+            arguments.put(X_QPID_DESCRIPTION, config.getDescription());
+        }
+
+        if (arguments.isEmpty())
+        {
+            return Collections.emptyMap();
+        }
+        else
+        {
+            return arguments;
+        }
+    }
+
 }

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java Wed Jun 20 15:54:15 2012
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumSet;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -33,8 +34,6 @@ import java.util.concurrent.atomic.Atomi
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
-import javax.management.Notification;
-
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.AMQSecurityException;
@@ -70,6 +69,7 @@ import org.apache.qpid.server.virtualhos
 public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, MessageGroupManager.SubscriptionResetHelper
 {
     private static final Logger _logger = Logger.getLogger(SimpleAMQQueue.class);
+
     private static final String QPID_GROUP_HEADER_KEY = "qpid.group_header_key";
     private static final String QPID_SHARED_MSG_GROUP = "qpid.shared_msg_group";
     private static final String QPID_DEFAULT_MESSAGE_GROUP = "qpid.default-message-group";
@@ -77,11 +77,9 @@ public class SimpleAMQQueue implements A
     // TODO - should make this configurable at the vhost / broker level
     private static final int DEFAULT_MAX_GROUPS = 255;
 
-
     private final VirtualHost _virtualHost;
 
     private final AMQShortString _name;
-    private final String _resourceName;
 
     /** null means shared */
     private final AMQShortString _owner;
@@ -234,14 +232,13 @@ public class SimpleAMQQueue implements A
         }
 
         _name = name;
-        _resourceName = String.valueOf(name);
         _durable = durable;
         _owner = owner;
         _autoDelete = autoDelete;
         _exclusive = exclusive;
         _virtualHost = virtualHost;
         _entries = entryListFactory.createQueueEntryList(this);
-        _arguments = arguments;
+        _arguments = arguments == null ? new HashMap<String, Object>() : new HashMap<String, Object>(arguments);
 
         _id = id;
 
@@ -337,14 +334,9 @@ public class SimpleAMQQueue implements A
         return _exclusive;
     }
 
-    public void setExclusive(boolean exclusive) throws AMQException
+    public void setExclusive(boolean exclusive)
     {
         _exclusive = exclusive;
-
-        if(isDurable())
-        {
-            getVirtualHost().getMessageStore().updateQueue(this);
-        }
     }
 
     public Exchange getAlternateExchange()
@@ -381,6 +373,10 @@ public class SimpleAMQQueue implements A
         setAlternateExchange(exchange);
     }
 
+    /**
+     * Arguments used to create this queue.  The caller is assured
+     * that null will never be returned.
+     */
     public Map<String, Object> getArguments()
     {
         return _arguments;
@@ -2368,12 +2364,6 @@ public class SimpleAMQQueue implements A
         return _queueConfiguration;
     }
 
-    public String getResourceName()
-    {
-        return _resourceName;
-    }
-
-
     public ConfigStore getConfigStore()
     {
         return getVirtualHost().getConfigStore();
@@ -2522,4 +2512,24 @@ public class SimpleAMQQueue implements A
     {
         _notificationListener = listener;
     }
+
+    @Override
+    public void setDescription(String description)
+    {
+        if (description == null)
+        {
+            _arguments.remove(AMQQueueFactory.X_QPID_DESCRIPTION);
+        }
+        else
+        {
+            _arguments.put(AMQQueueFactory.X_QPID_DESCRIPTION, description);
+        }
+    }
+
+    @Override
+    public String getDescription()
+    {
+        return (String) _arguments.get(AMQQueueFactory.X_QPID_DESCRIPTION);
+    }
+
 }

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfiguredObjectHelper.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfiguredObjectHelper.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfiguredObjectHelper.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfiguredObjectHelper.java Wed Jun 20 15:54:15 2012
@@ -40,12 +40,7 @@ import org.apache.qpid.server.util.MapJs
 
 public class ConfiguredObjectHelper
 {
-    /**
-     * Name of queue attribute to store queue creation arguments.
-     * <p>
-     * This attribute is not defined yet on Queue configured object interface.
-     */
-    private static final String QUEUE_ARGUMENTS = "ARGUMENTS";
+
 
     private MapJsonSerializer _serializer = new MapJsonSerializer();
 
@@ -58,7 +53,7 @@ public class ConfiguredObjectHelper
             String owner = (String) attributeMap.get(Queue.OWNER);
             boolean exclusive = (Boolean) attributeMap.get(Queue.EXCLUSIVE);
             @SuppressWarnings("unchecked")
-            Map<String, Object> queueArgumentsMap = (Map<String, Object>) attributeMap.get(QUEUE_ARGUMENTS);
+            Map<String, Object> queueArgumentsMap = (Map<String, Object>) attributeMap.get(Queue.ARGUMENTS);
             FieldTable arguments = null;
             if (queueArgumentsMap != null)
             {
@@ -73,6 +68,16 @@ public class ConfiguredObjectHelper
         Map<String, Object> attributesMap = _serializer.deserialize(queueRecord.getAttributes());
         attributesMap.put(Queue.NAME, queue.getName());
         attributesMap.put(Queue.EXCLUSIVE, queue.isExclusive());
+        if (attributesMap.containsKey(Queue.ARGUMENTS))
+        {
+            // We wouldn't need this if createQueueConfiguredObject took only AMQQueue
+            Map<String, Object> currentArgs = (Map<String, Object>) attributesMap.get(Queue.ARGUMENTS);
+            currentArgs.putAll(queue.getArguments());
+        }
+        else
+        {
+            attributesMap.put(Queue.ARGUMENTS, queue.getArguments());
+        }
         String newJson = _serializer.serialize(attributesMap);
         ConfiguredObjectRecord newQueueRecord = new ConfiguredObjectRecord(queue.getId(), queueRecord.getType(), newJson);
         return newQueueRecord;
@@ -84,9 +89,11 @@ public class ConfiguredObjectHelper
         attributesMap.put(Queue.NAME, queue.getName());
         attributesMap.put(Queue.OWNER, AMQShortString.toString(queue.getOwner()));
         attributesMap.put(Queue.EXCLUSIVE, queue.isExclusive());
+        // TODO KW i think the arguments could come from the queue itself removing the need for the parameter arguments.
+        // It would also do away with the need for the if/then/else within updateQueueConfiguredObject
         if (arguments != null)
         {
-            attributesMap.put(QUEUE_ARGUMENTS, FieldTable.convertToMap(arguments));
+            attributesMap.put(Queue.ARGUMENTS, FieldTable.convertToMap(arguments));
         }
         String json = _serializer.serialize(attributesMap);
         ConfiguredObjectRecord configuredObject = new ConfiguredObjectRecord(queue.getId(), Queue.class.getName(), json);

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java Wed Jun 20 15:54:15 2012
@@ -189,7 +189,7 @@ public class Subscription_0_10 implement
         }
         _queue = queue;
 
-        Map<String, Object> arguments = queue.getArguments() == null ? Collections.EMPTY_MAP : queue.getArguments();
+        Map<String, Object> arguments = queue.getArguments();
         _traceExclude = (String) arguments.get("qpid.trace.exclude");
         _trace = (String) arguments.get("qpid.trace.id");
         _id = getConfigStore().createId();

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java Wed Jun 20 15:54:15 2012
@@ -1226,11 +1226,7 @@ public class ServerSessionDelegate exten
                     try
                     {
                         queue = createQueue(queueName, method, virtualHost, (ServerSession)session);
-                        if(method.getExclusive())
-                        {
-                            queue.setExclusive(true);
-                        }
-                        else if(method.getAutoDelete())
+                        if(!method.getExclusive() && method.getAutoDelete())
                         {
                             queue.setDeleteOnNoConsumers(true);
                         }

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java Wed Jun 20 15:54:15 2012
@@ -204,6 +204,18 @@ public class QueueConfigurationTest exte
         assertEquals("test-sort-key", qConf.getQueueSortKey());
     }
 
+    public void testQueueDescription() throws ConfigurationException
+    {
+        //Check default value
+        QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
+        assertNull(qConf.getDescription());
+
+        // Check explicit value
+        final VirtualHostConfiguration vhostConfig = overrideConfiguration("description", "mydescription");
+        qConf = new QueueConfiguration("test", vhostConfig);
+        assertEquals("mydescription", qConf.getDescription());
+    }
+
     private VirtualHostConfiguration overrideConfiguration(String property, Object value)
             throws ConfigurationException
     {

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java Wed Jun 20 15:54:15 2012
@@ -52,7 +52,6 @@ public class MockAMQQueue implements AMQ
     private AuthorizationHolder _authorizationHolder;
 
     private AMQSessionModel _exclusiveOwner;
-    private AMQShortString _owner;
     private List<Binding> _bindings = new CopyOnWriteArrayList<Binding>();
     private boolean _autoDelete;
 
@@ -572,12 +571,6 @@ public class MockAMQQueue implements AMQ
         _exclusiveOwner = exclusiveOwner;
     }
 
-
-    public String getResourceName()
-    {
-        return _name.toString();
-    }
-
     public boolean isOverfull()
     {
         return false;
@@ -625,7 +618,6 @@ public class MockAMQQueue implements AMQ
 
     public void setExclusive(boolean exclusive)
     {
-
     }
 
     public int getMaximumDeliveryCount()
@@ -649,4 +641,15 @@ public class MockAMQQueue implements AMQ
     public void setNotificationListener(NotificationListener listener)
     {
     }
+
+    @Override
+    public void setDescription(String description)
+    {
+    }
+
+    @Override
+    public String getDescription()
+    {
+        return null;
+    }
 }

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java Wed Jun 20 15:54:15 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
 package org.apache.qpid.server.store;
 
 import static org.mockito.Matchers.any;
@@ -78,7 +98,7 @@ public class DurableConfigurationStoreTe
         _exchangeId = UUIDGenerator.generateUUID();
 
         _storeName = getName();
-        _storePath = TMP_FOLDER + "/" + _storeName;
+        _storePath = TMP_FOLDER + File.separator + _storeName;
         FileUtils.delete(new File(_storePath), true);
         setTestSystemProperty("QPID_WORK", TMP_FOLDER);
         _configuration = mock(Configuration.class);

Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java?rev=1352172&r1=1352171&r2=1352172&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java (original)
+++ qpid/branches/java-config-and-management/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java Wed Jun 20 15:54:15 2012
@@ -99,7 +99,7 @@ public class MessageStoreTest extends In
     {
         super.setUp();
 
-        String storePath = System.getProperty("QPID_WORK") + "/" + getName();
+        String storePath = System.getProperty("QPID_WORK") + File.separator + getName();
         
         _config = new PropertiesConfiguration();
         _config.addProperty("store.class", getTestProfileMessageStoreClassName());
@@ -267,15 +267,9 @@ public class MessageStoreTest extends In
         //Validate normally expected properties of Queues/Topics
         validateDurableQueueProperties();
 
-        //Update the durable exclusive queue's exclusivity and verify it is persisted and recovered correctly
+        //Update the durable exclusive queue's exclusivity
         setQueueExclusivity(false);
         validateQueueExclusivityProperty(false);
-
-        //Reload the Virtualhost to recover the queues again
-        reloadVirtualHost();
-
-        //verify the change was persisted and recovered correctly
-        validateQueueExclusivityProperty(false);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org