Author: kpvdr
Date: Tue Apr  8 12:29:08 2008
New Revision: 646045

URL: http://svn.apache.org/viewvc?rev=646045&view=rev
Log:
Patch from Ted Ross: QPID-907: Management Improvements for C++ Broker and Store

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DirectExchange.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/FanOutExchange.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h
    incubator/qpid/trunk/qpid/python/commands/qpid-config
    incubator/qpid/trunk/qpid/python/mgmt-cli/managementdata.py
    incubator/qpid/trunk/qpid/python/qpid/management.py
    incubator/qpid/trunk/qpid/specs/management-schema.xml
    incubator/qpid/trunk/qpid/specs/management-types.xml

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Tue Apr  8 
12:29:08 2008
@@ -196,7 +196,7 @@
     bool storeEnabled = store != NULL;
     std::pair<Exchange::shared_ptr, bool> status = exchanges.declare(name, 
type, storeEnabled);
     if (status.second && storeEnabled) {
-        store->create(*status.first);
+        store->create(*status.first, framing::FieldTable ());
     }
 }
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp Tue Apr  8 
12:29:08 2008
@@ -65,7 +65,7 @@
             std::pair<Exchange::shared_ptr, bool> response = 
getBroker().getExchanges().declare(exchange, type, durable, args);
             if (response.second) {
                 if (durable) {
-                    getBroker().getStore().create(*response.first);
+                    getBroker().getStore().create(*response.first, args);
                 }
                 if (alternate) {
                     response.first->setAlternate(alternate);

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DirectExchange.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DirectExchange.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DirectExchange.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DirectExchange.cpp Tue Apr  8 
12:29:08 2008
@@ -54,7 +54,8 @@
         Binding::shared_ptr binding (new Binding (routingKey, queue, this));
         bindings[routingKey].push_back(binding);
         if (mgmtExchange.get() != 0) {
-            mgmtExchange->inc_bindings ();
+            mgmtExchange->inc_bindings();
+            
dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->inc_bindings();
         }
         return true;
     } else{
@@ -78,6 +79,7 @@
         }
         if (mgmtExchange.get() != 0) {
             mgmtExchange->dec_bindings ();
+            
dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->dec_bindings();
         }
         return true;
     } else {

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp Tue Apr  8 
12:29:08 2008
@@ -103,8 +103,9 @@
     return dynamic_pointer_cast<ManagementObject> (mgmtExchange);
 }
 
-Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, 
Exchange* parent)
-    : queue(_queue), key(_key)
+Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, 
Exchange* parent,
+                           FieldTable _args)
+    : queue(_queue), key(_key), args(_args)
 {
     if (parent != 0)
     {
@@ -116,7 +117,7 @@
             {
                 uint64_t queueId = mo->getObjectId();
                 mgmtBinding = management::Binding::shared_ptr
-                    (new management::Binding (this, (Manageable*) parent, 
queueId, key));
+                    (new management::Binding (this, (Manageable*) parent, 
queueId, key, args));
                 agent->addObject (mgmtBinding);
             }
         }

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.h Tue Apr  8 
12:29:08 2008
@@ -51,12 +51,13 @@
                 typedef boost::shared_ptr<Binding>       shared_ptr;
                 typedef std::vector<Binding::shared_ptr> vector;
 
-                Queue::shared_ptr               queue;
-                const std::string               key;
-                const qpid::framing::FieldTable args;
+                Queue::shared_ptr         queue;
+                const std::string         key;
+                const framing::FieldTable args;
                 management::Binding::shared_ptr mgmtBinding;
 
-                Binding(const std::string& key, const Queue::shared_ptr queue, 
Exchange* parent = 0);
+                Binding(const std::string& key, const Queue::shared_ptr queue, 
Exchange* parent = 0,
+                        framing::FieldTable args = framing::FieldTable ());
                 ~Binding ();
                 management::ManagementObject::shared_ptr GetManagementObject 
() const;
                 management::Manageable::status_t ManagementMethod (uint32_t 
methodId, management::Args& args);

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/FanOutExchange.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/FanOutExchange.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/FanOutExchange.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/FanOutExchange.cpp Tue Apr  8 
12:29:08 2008
@@ -54,6 +54,7 @@
         bindings.push_back(binding);
         if (mgmtExchange.get() != 0) {
             mgmtExchange->inc_bindings ();
+            
dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->inc_bindings();
         }
         return true;
     } else {
@@ -73,6 +74,7 @@
         bindings.erase(i);
         if (mgmtExchange.get() != 0) {
             mgmtExchange->dec_bindings ();
+            
dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->dec_bindings();
         }
         return true;
     } else {

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/HeadersExchange.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/HeadersExchange.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/HeadersExchange.cpp Tue Apr  
8 12:29:08 2008
@@ -85,12 +85,13 @@
             break;
 
     if (i == bindings.end()) {
-        Binding::shared_ptr binding (new Binding (bindingKey, queue, this));
+        Binding::shared_ptr binding (new Binding (bindingKey, queue, this, 
*args));
         HeaderMap headerMap(*args, binding);
 
         bindings.push_back(headerMap);
         if (mgmtExchange.get() != 0) {
             mgmtExchange->inc_bindings ();
+            
dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->inc_bindings();
         }
         return true;
     } else {
@@ -115,6 +116,7 @@
         bindings.erase(i);
         if (mgmtExchange.get() != 0) {
             mgmtExchange->dec_bindings ();
+            
dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->dec_bindings();
         }
         return true;
     } else {

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h Tue Apr  8 
12:29:08 2008
@@ -26,6 +26,7 @@
 #include "PersistableQueue.h"
 #include "RecoveryManager.h"
 #include "TransactionalStore.h"
+#include "qpid/framing/FieldTable.h"
 
 #include <qpid/Options.h>
 
@@ -56,7 +57,8 @@
     /**
      * Record the existence of a durable queue
      */
-    virtual void create(PersistableQueue& queue) = 0;
+    virtual void create(PersistableQueue& queue,
+                        const framing::FieldTable& args) = 0;
     /**
      * Destroy a durable queue
      */
@@ -65,7 +67,8 @@
     /**
      * Record the existence of a durable exchange
      */
-    virtual void create(const PersistableExchange& exchange) = 0;
+    virtual void create(const PersistableExchange& exchange,
+                        const framing::FieldTable& args) = 0;
     /**
      * Destroy a durable exchange
      */

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp 
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp Tue 
Apr  8 12:29:08 2008
@@ -27,6 +27,7 @@
 
 using boost::intrusive_ptr;
 using namespace qpid::broker;
+using qpid::framing::FieldTable;
 
 MessageStoreModule::MessageStoreModule(MessageStore* _store) : store(_store) {}
 
@@ -37,9 +38,9 @@
 
 bool MessageStoreModule::init(const Options*) { return true; }
 
-void MessageStoreModule::create(PersistableQueue& queue)
+void MessageStoreModule::create(PersistableQueue& queue, const FieldTable& 
args)
 {
-    TRANSFER_EXCEPTION(store->create(queue));
+    TRANSFER_EXCEPTION(store->create(queue, args));
 }
 
 void MessageStoreModule::destroy(PersistableQueue& queue)
@@ -47,9 +48,9 @@
     TRANSFER_EXCEPTION(store->destroy(queue));
 }
 
-void MessageStoreModule::create(const PersistableExchange& exchange)
+void MessageStoreModule::create(const PersistableExchange& exchange, const 
FieldTable& args)
 {
-    TRANSFER_EXCEPTION(store->create(exchange));
+    TRANSFER_EXCEPTION(store->create(exchange, args));
 }
 
 void MessageStoreModule::destroy(const PersistableExchange& exchange)

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h 
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h Tue Apr  
8 12:29:08 2008
@@ -49,9 +49,9 @@
     void abort(TransactionContext& txn);
     void collectPreparedXids(std::set<std::string>& xids);
 
-    void create(PersistableQueue& queue);
+    void create(PersistableQueue& queue, const framing::FieldTable& args);
     void destroy(PersistableQueue& queue);
-    void create(const PersistableExchange& exchange);
+    void create(const PersistableExchange& exchange, const 
framing::FieldTable& args);
     void destroy(const PersistableExchange& exchange);
     void bind(const PersistableExchange& exchange, const PersistableQueue& 
queue, 
               const std::string& key, const framing::FieldTable& args);

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp 
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp Tue Apr  
8 12:29:08 2008
@@ -53,7 +53,7 @@
 
 bool NullMessageStore::init(const Options* /*options*/) {return true;}
 
-void NullMessageStore::create(PersistableQueue& queue)
+void NullMessageStore::create(PersistableQueue& queue, const 
framing::FieldTable& /*args*/)
 {
     QPID_LOG(info, "Queue '" << queue.getName() 
              << "' will not be durable. Persistence not enabled.");
@@ -63,7 +63,7 @@
 {
 }
 
-void NullMessageStore::create(const PersistableExchange& exchange)
+void NullMessageStore::create(const PersistableExchange& exchange, const 
framing::FieldTable& /*args*/)
 {
     QPID_LOG(info, "Exchange'" << exchange.getName() 
              << "' will not be durable. Persistence not enabled.");

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h Tue Apr  8 
12:29:08 2008
@@ -48,9 +48,9 @@
     virtual void abort(TransactionContext& txn);
     virtual void collectPreparedXids(std::set<std::string>& xids);
 
-    virtual void create(PersistableQueue& queue);
+    virtual void create(PersistableQueue& queue, const framing::FieldTable& 
args);
     virtual void destroy(PersistableQueue& queue);
-    virtual void create(const PersistableExchange& exchange);
+    virtual void create(const PersistableExchange& exchange, const 
framing::FieldTable& args);
     virtual void destroy(const PersistableExchange& exchange);
 
     virtual void bind(const PersistableExchange& exchange, const 
PersistableQueue& queue, 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Tue Apr  8 12:29:08 
2008
@@ -474,7 +474,7 @@
 {
     settings = _settings;
     if (store) {
-        store->create(*this);
+        store->create(*this, _settings);
     }
     configure(_settings);
 }
@@ -484,11 +484,13 @@
     std::auto_ptr<QueuePolicy> _policy(new QueuePolicy(_settings));
     if (_policy->getMaxCount() || _policy->getMaxSize()) {
         setPolicy(_policy);
-    }    
+    }
     if (owner) {
         noLocal = _settings.get(qpidNoLocal);
         QPID_LOG(debug, "Configured queue with no-local=" << noLocal);
     }
+    if (mgmtObject.get() != 0)
+        mgmtObject->set_arguments (_settings);
 }
 
 void Queue::destroy()

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp Tue Apr  8 
12:29:08 2008
@@ -66,7 +66,7 @@
             std::pair<Exchange::shared_ptr, bool> response = 
getBroker().getExchanges().declare(exchange, type, durable, args);
             if (response.second) {
                 if (durable) {
-                    getBroker().getStore().create(*response.first);
+                    getBroker().getStore().create(*response.first, args);
                 }
                 if (alternate) {
                     response.first->setAlternate(alternate);

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp Tue Apr  8 
12:29:08 2008
@@ -139,6 +139,7 @@
         bindings[routingPattern].push_back(binding);
         if (mgmtExchange.get() != 0) {
             mgmtExchange->inc_bindings ();
+            
dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->inc_bindings();
         }
         return true;
     }
@@ -159,6 +160,7 @@
     if(qv.empty()) bindings.erase(bi);
     if (mgmtExchange.get() != 0) {
         mgmtExchange->dec_bindings ();
+        
dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->dec_bindings();
     }
     return true;
 }

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h 
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h Tue 
Apr  8 12:29:08 2008
@@ -60,6 +60,7 @@
     static const uint8_t TYPE_FLOAT     = 12;
     static const uint8_t TYPE_DOUBLE    = 13;
     static const uint8_t TYPE_UUID      = 14;
+    static const uint8_t TYPE_FTABLE    = 15;
 
     static const uint8_t ACCESS_RC = 1;
     static const uint8_t ACCESS_RW = 2;

Modified: incubator/qpid/trunk/qpid/python/commands/qpid-config
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/commands/qpid-config?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/commands/qpid-config (original)
+++ incubator/qpid/trunk/qpid/python/commands/qpid-config Tue Apr  8 12:29:08 
2008
@@ -30,28 +30,43 @@
 from qpid.client     import Client
 from time            import sleep
 
-defspecpath  = "/usr/share/amqp/amqp.0-10-preview.xml"
-specpath     = defspecpath
-recursive    = False
-host         = "localhost"
+_defspecpath  = "/usr/share/amqp/amqp.0-10-preview.xml"
+_specpath     = _defspecpath
+_recursive    = False
+_host         = "localhost"
+_durable      = False
+_fileCount    = 8
+_fileSize     = 24
+
+FILECOUNT = "qpid.file_count"
+FILESIZE  = "qpid.file_size"
 
 def Usage ():
     print "Usage:  qpid-config [OPTIONS]"
     print "        qpid-config [OPTIONS] exchanges [filter-string]"
     print "        qpid-config [OPTIONS] queues    [filter-string]"
-    print "        qpid-config [OPTIONS] add exchange <type> <name> [durable]"
+    print "        qpid-config [OPTIONS] add exchange <type> <name> 
[AddExchangeOptions]"
     print "        qpid-config [OPTIONS] del exchange <name>"
-    print "        qpid-config [OPTIONS] add queue <name> [durable]"
+    print "        qpid-config [OPTIONS] add queue <name> [AddQueueOptions]"
     print "        qpid-config [OPTIONS] del queue <name>"
     print "        qpid-config [OPTIONS] bind   <exchange-name> <queue-name> 
[binding-key]"
     print "        qpid-config [OPTIONS] unbind <exchange-name> <queue-name> 
[binding-key]"
     print
     print "Options:"
-    print "    -b                   show bindings"
-    print "    -a <broker-addr>     default: localhost"
+    print "    -b [ --bindings ]                         Show bindings in 
queue or exchange list"
+    print "    -a [ --broker-addr ] Address (localhost)  Address of qpidd 
broker"
     print "         broker-addr is in the form:   hostname | ip-address 
[:<port>]"
     print "         ex:  localhost, 10.1.1.7:10000, broker-host:10000"
-    print "    -s <amqp-spec-file>  default:", defspecpath
+    print "    -s [ --spec-file] Path (" + _defspecpath + ")"
+    print "                                              AMQP specification 
file"
+    print
+    print "Add Queue Options:"
+    print "    --durable           Queue is durable"
+    print "    --file-count N (8)  Number of files in queue's persistence 
journal"
+    print "    --file-size  N (24) File size in pages (64Kib/page)"
+    print
+    print "Add Exchange Options:"
+    print "    --durable           Exchange is durable"
     print
     sys.exit (1)
 
@@ -80,7 +95,7 @@
 
     def ConnectToBroker (self):
         try:
-            self.spec     = qpid.spec.load (specpath)
+            self.spec     = qpid.spec.load (_specpath)
             self.client   = Client (self.broker.host, self.broker.port, 
self.spec)
             self.client.start ({"LOGIN":"guest","PASSWORD":"guest"})
             self.channel  = self.client.channel (1)
@@ -109,12 +124,12 @@
 
         print
         print "   Total Queues: %d" % len (queues)
-        durable = 0
+        _durable = 0
         for queue in queues:
             if queue.durable:
-                durable = durable + 1
-        print "        durable: %d" % durable
-        print "    non-durable: %d" % (len (queues) - durable)
+                _durable = _durable + 1
+        print "        durable: %d" % _durable
+        print "    non-durable: %d" % (len (queues) - _durable)
 
     def ExchangeList (self, filter):
         self.ConnectToBroker ()
@@ -153,13 +168,25 @@
         mc  = self.mclient
         mch = self.mchannel
         mc.syncWaitForStable (mch)
-        queues = mc.syncGetObjects (mch, "queue")
-        print "Durable  AutoDel  Excl  Bindings  Queue Name"
-        print "==============================================================="
+        queues   = mc.syncGetObjects (mch, "queue")
+        journals = mc.syncGetObjects (mch, "journal")
+        print "                                      Store Size"
+        print "Durable  AutoDel  Excl  Bindings  (files x file pages)  Queue 
Name"
+        print 
"==========================================================================================="
         for q in queues:
             if self.match (q.name, filter):
-                print "%4c%9c%7c%10d    %s" % (tf (q.durable), tf 
(q.autoDelete), tf (q.exclusive),
-                                               q.bindings, q.name)
+                args = q.arguments
+                if q.durable and FILESIZE in args and FILECOUNT in args:
+                    fs = int (args[FILESIZE])
+                    fc = int (args[FILECOUNT])
+                    print "%4c%9c%7c%10d%11dx%-14d%s" % \
+                        (YN (q.durable), YN (q.autoDelete),
+                         YN (q.exclusive), q.bindings, fc, fs, q.name)
+                else:
+                    if not _durable:
+                        print "%4c%9c%7c%10d                          %s" % \
+                            (YN (q.durable), YN (q.autoDelete),
+                             YN (q.exclusive), q.bindings, q.name)
 
     def QueueListRecurse (self, filter):
         self.ConnectToBroker ()
@@ -188,9 +215,6 @@
         self.ConnectToBroker ()
         etype = args[0]
         ename = args[1]
-        _durable = False
-        if len (args) > 2 and args[2] == "durable":
-            _durable = True
 
         try:
             self.channel.exchange_declare (exchange=ename, type=etype, 
durable=_durable)
@@ -212,13 +236,14 @@
         if len (args) < 1:
             Usage ()
         self.ConnectToBroker ()
-        qname = args[0]
-        _durable = False
-        if len (args) > 1 and args[1] == "durable":
-            _durable = True
+        qname    = args[0]
+        declArgs = {}
+        if _durable:
+            declArgs[FILECOUNT] = _fileCount
+            declArgs[FILESIZE]  = _fileSize
 
         try:
-            self.channel.queue_declare (queue=qname, durable=_durable)
+            self.channel.queue_declare (queue=qname, durable=_durable, 
arguments=declArgs)
         except Closed, e:
             print "Failed:", e
 
@@ -276,7 +301,7 @@
             return False
         return True
 
-def tf (bool):
+def YN (bool):
     if bool:
         return 'Y'
     return 'N'
@@ -286,21 +311,28 @@
 ##
 
 try:
-    (optlist, cargs) = getopt.getopt (sys.argv[1:], "s:a:b")
+    longOpts = ("durable", "spec-file=", "bindings", "broker-addr=", 
"file-count=", "file-size=")
+    (optlist, cargs) = getopt.gnu_getopt (sys.argv[1:], "s:a:b", longOpts)
 except:
     Usage ()
 
 for opt in optlist:
-    if opt[0] == "-s":
-        specpath = opt[1]
-    if opt[0] == "-b":
-        recursive = True
-    if opt[0] == "-a":
-        host = opt[1]
+    if opt[0] == "-s" or opt[0] == "--spec-file":
+        _specpath = opt[1]
+    if opt[0] == "-b" or opt[0] == "--bindings":
+        _recursive = True
+    if opt[0] == "-a" or opt[0] == "--broker-addr":
+        _host = opt[1]
+    if opt[0] == "--durable":
+        _durable = True
+    if opt[0] == "--file-count":
+        _fileCount = int (opt[1])
+    if opt[0] == "--file-size":
+        _fileSize = int (opt[1])
 
 nargs = len (cargs)
-bm  = BrokerManager ()
-bm.SetBroker (Broker (host))
+bm    = BrokerManager ()
+bm.SetBroker (Broker (_host))
 
 if nargs == 0:
     bm.Overview ()
@@ -310,12 +342,12 @@
     if nargs > 1:
         modifier = cargs[1]
     if cmd[0] == 'e':
-        if recursive:
+        if _recursive:
             bm.ExchangeListRecurse (modifier)
         else:
             bm.ExchangeList (modifier)
     elif cmd[0] == 'q':
-        if recursive:
+        if _recursive:
             bm.QueueListRecurse (modifier)
         else:
             bm.QueueList (modifier)

Modified: incubator/qpid/trunk/qpid/python/mgmt-cli/managementdata.py
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/mgmt-cli/managementdata.py?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/mgmt-cli/managementdata.py (original)
+++ incubator/qpid/trunk/qpid/python/mgmt-cli/managementdata.py Tue Apr  8 
12:29:08 2008
@@ -199,6 +199,8 @@
               return "True"
           elif typecode == 14:
             return str (UUID (bytes=value))
+          elif typecode == 15:
+            return str (value)
     return "*type-error*"
 
   def getObjIndex (self, className, config):
@@ -268,6 +270,10 @@
       return "float"
     elif typecode == 13:
       return "double"
+    elif typecode == 14:
+      return "uuid"
+    elif typecode == 15:
+      return "field-table"
     else:
       raise ValueError ("Invalid type code: %d" % typecode)
 

Modified: incubator/qpid/trunk/qpid/python/qpid/management.py
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/management.py?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/management.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/management.py Tue Apr  8 12:29:08 2008
@@ -351,6 +351,8 @@
       codec.encode_double   (double (value))
     elif typecode == 14: # UUID
       codec.encode_uuid     (value)
+    elif typecode == 15: # FTABLE
+      codec.encode_table    (value)
     else:
       raise ValueError ("Invalid type code: %d" % typecode)
 
@@ -384,6 +386,8 @@
       data = codec.decode_double ()
     elif typecode == 14: # UUID
       data = codec.decode_uuid ()
+    elif typecode == 15: # FTABLE
+      data = codec.decode_table ()
     else:
       raise ValueError ("Invalid type code: %d" % typecode)
     return data

Modified: incubator/qpid/trunk/qpid/specs/management-schema.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/specs/management-schema.xml?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/specs/management-schema.xml (original)
+++ incubator/qpid/trunk/qpid/specs/management-schema.xml Tue Apr  8 12:29:08 
2008
@@ -122,6 +122,7 @@
     <configElement name="durable"         type="bool"   access="RC"/>
     <configElement name="autoDelete"      type="bool"   access="RC"/>
     <configElement name="exclusive"       type="bool"   access="RC"/>
+    <configElement name="arguments"       type="ftable" access="RO" 
desc="Arguments supplied in queue.declare"/>
     <configElement name="storeRef"        type="objId"  access="RO" 
desc="Reference to persistent queue (if durable)"/>
 
     <instElement name="msgTotalEnqueues"    type="count64" unit="message"     
desc="Total messages enqueued"/>
@@ -180,10 +181,10 @@
   ===============================================================
   -->
   <class name="binding">
-    <configElement name="exchangeRef" type="objId" access="RC" index="y" 
parentRef="y"/>
-    <configElement name="queueRef"    type="objId" access="RC" index="y"/>
-    <configElement name="bindingKey"  type="sstr"  access="RC" index="y"/>
-<!--<configElement name="arguments"   type="fieldTable" access="RC"/> -->
+    <configElement name="exchangeRef" type="objId"  access="RC" index="y" 
parentRef="y"/>
+    <configElement name="queueRef"    type="objId"  access="RC" index="y"/>
+    <configElement name="bindingKey"  type="sstr"   access="RC" index="y"/>
+    <configElement name="arguments"   type="ftable" access="RC"/>
 
     <instElement name="msgMatched" type="count64"/>
   </class>

Modified: incubator/qpid/trunk/qpid/specs/management-types.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/specs/management-types.xml?rev=646045&r1=646044&r2=646045&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/specs/management-types.xml (original)
+++ incubator/qpid/trunk/qpid/specs/management-types.xml Tue Apr  8 12:29:08 
2008
@@ -32,6 +32,7 @@
 <type name="float"     base="FLOAT"     cpp="float"         encode="@.putFloat 
(#)"       decode="# = @.getFloat ()"     accessor="direct" init="0."/>
 <type name="double"    base="DOUBLE"    cpp="double"        
encode="@.putDouble (#)"      decode="# = @.getDouble ()"    accessor="direct" 
init="0."/>
 <type name="uuid"      base="UUID"      cpp="framing::Uuid" encode="#.encode 
(@)"         decode="#.decode (@)"          accessor="direct"/>
+<type name="ftable"    base="FTABLE"    cpp="framing::FieldTable" 
encode="#.encode (@)"   decode="#.decode (@)"          accessor="direct"/>
 
 <type name="hilo8"   base="U8"   cpp="uint8_t"  encode="@.putOctet (#)"    
decode="# = @.getOctet ()"    style="wm" accessor="counter" init="0"/>
 <type name="hilo16"  base="U16"  cpp="uint16_t" encode="@.putShort (#)"    
decode="# = @.getShort ()"    style="wm" accessor="counter" init="0"/>


Reply via email to