diff options
author | Carl C. Trieloff <cctrieloff@apache.org> | 2007-11-04 00:40:44 +0000 |
---|---|---|
committer | Carl C. Trieloff <cctrieloff@apache.org> | 2007-11-04 00:40:44 +0000 |
commit | e3a366af59b84b47b29edbb1d8d8b2f18cb3d9dc (patch) | |
tree | 08d3eda3b13c853fb35ac73f414308833f2eca20 /qpid | |
parent | 0de8704607f5f7101cbb5346c3f3d36f3868659f (diff) | |
download | qpid-python-e3a366af59b84b47b29edbb1d8d8b2f18cb3d9dc.tar.gz |
AMQP 670 This patch contains the following:
1) "using" clauses were removed from one header file. This required changes in other header and body files that were relying on that clause.
2) The object indexing scheme has been improved in the management schema. Objects now properly reference their parent/containing objects.
3) The framework for parsing management commands has been added.
4) The python management API has been improved and now includes an object-method call.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@591715 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
14 files changed, 133 insertions, 90 deletions
diff --git a/qpid/cpp/src/qpid/broker/Broker.cpp b/qpid/cpp/src/qpid/broker/Broker.cpp index 45f5be9cad..5896ce7947 100644 --- a/qpid/cpp/src/qpid/broker/Broker.cpp +++ b/qpid/cpp/src/qpid/broker/Broker.cpp @@ -113,7 +113,18 @@ Broker::Broker(const Broker::Options& conf) : { if(conf.enableMgmt){ managementAgent = ManagementAgent::shared_ptr (new ManagementAgent (conf.mgmtPubInterval)); - queues.setManagementAgent(managementAgent); + + mgmtObject = ManagementObjectBroker::shared_ptr (new ManagementObjectBroker (conf)); + managementAgent->addObject (dynamic_pointer_cast<ManagementObject>(mgmtObject)); + + // Since there is currently no support for virtual hosts, a management object + // representing the implied single virtual host is added here. + mgmtVhostObject = ManagementObjectVhost::shared_ptr + (new ManagementObjectVhost (mgmtObject->getObjectId (), conf)); + managementAgent->addObject (dynamic_pointer_cast<ManagementObject>(mgmtVhostObject)); + + queues.setManagementAgent (managementAgent); + queues.setManagementVhost (dynamic_pointer_cast<ManagementObject>(mgmtVhostObject)); } exchanges.declare(empty, DirectExchange::typeName); // Default exchange. @@ -128,14 +139,6 @@ Broker::Broker(const Broker::Options& conf) : Exchange::shared_ptr mExchange = exchanges.get (qpid_management); managementAgent->setExchange (mExchange); dynamic_pointer_cast<ManagementExchange>(mExchange)->setManagmentAgent (managementAgent); - - mgmtObject = ManagementObjectBroker::shared_ptr (new ManagementObjectBroker (conf)); - managementAgent->addObject (dynamic_pointer_cast<ManagementObject>(mgmtObject)); - - // Since there is currently no support for virtual hosts, a management object - // representing the implied single virtual host is added here. - mgmtVhostObject = ManagementObjectVhost::shared_ptr (new ManagementObjectVhost (conf)); - managementAgent->addObject (dynamic_pointer_cast<ManagementObject>(mgmtVhostObject)); } else QPID_LOG(info, "Management not enabled"); diff --git a/qpid/cpp/src/qpid/broker/QueueRegistry.cpp b/qpid/cpp/src/qpid/broker/QueueRegistry.cpp index 31eab33fe2..bc7f00c7ef 100644 --- a/qpid/cpp/src/qpid/broker/QueueRegistry.cpp +++ b/qpid/cpp/src/qpid/broker/QueueRegistry.cpp @@ -47,7 +47,8 @@ QueueRegistry::declare(const string& declareName, bool durable, queues[name] = queue; if (managementAgent){ - ManagementObjectQueue::shared_ptr mgmtObject(new ManagementObjectQueue (name, durable, autoDelete)); + ManagementObjectQueue::shared_ptr mgmtObject + (new ManagementObjectQueue (managementVhost->getObjectId (), name, durable, autoDelete)); queue->setMgmt (mgmtObject); managementAgent->addObject(dynamic_pointer_cast<ManagementObject>(mgmtObject)); @@ -115,3 +116,7 @@ ManagementAgent::shared_ptr QueueRegistry::getManagementAgent (void) return managementAgent; } +void QueueRegistry::setManagementVhost (ManagementObject::shared_ptr vhost) +{ + managementVhost = vhost; +} diff --git a/qpid/cpp/src/qpid/broker/QueueRegistry.h b/qpid/cpp/src/qpid/broker/QueueRegistry.h index 8dc5539051..6fc90a5527 100644 --- a/qpid/cpp/src/qpid/broker/QueueRegistry.h +++ b/qpid/cpp/src/qpid/broker/QueueRegistry.h @@ -95,6 +95,7 @@ class QueueRegistry{ */ void setManagementAgent (ManagementAgent::shared_ptr agent); ManagementAgent::shared_ptr getManagementAgent (void); + void setManagementVhost (ManagementObject::shared_ptr vhost); private: typedef std::map<string, Queue::shared_ptr> QueueMap; @@ -102,7 +103,8 @@ private: qpid::sys::RWlock lock; int counter; MessageStore* const store; - ManagementAgent::shared_ptr managementAgent; + ManagementAgent::shared_ptr managementAgent; + ManagementObject::shared_ptr managementVhost; }; diff --git a/qpid/cpp/src/qpid/broker/SessionHandler.cpp b/qpid/cpp/src/qpid/broker/SessionHandler.cpp index f72c52c809..280a843a0e 100644 --- a/qpid/cpp/src/qpid/broker/SessionHandler.cpp +++ b/qpid/cpp/src/qpid/broker/SessionHandler.cpp @@ -32,6 +32,7 @@ namespace qpid { namespace broker { using namespace framing; using namespace std; +using namespace qpid::sys; SessionHandler::SessionHandler(Connection& c, ChannelId ch) : InOutHandler(0, &c.getOutput()), diff --git a/qpid/cpp/src/qpid/broker/management/ManagementAgent.cpp b/qpid/cpp/src/qpid/broker/management/ManagementAgent.cpp index 1121b7bc6b..c52e330ff2 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementAgent.cpp +++ b/qpid/cpp/src/qpid/broker/management/ManagementAgent.cpp @@ -31,7 +31,7 @@ using namespace qpid::framing; using namespace qpid::broker; using namespace qpid::sys; -ManagementAgent::ManagementAgent (uint16_t _interval) : interval (_interval) +ManagementAgent::ManagementAgent (uint16_t _interval) : interval (_interval), nextObjectId(1) { timer.add (TimerTask::shared_ptr (new Periodic(*this, interval))); } @@ -43,6 +43,7 @@ void ManagementAgent::setExchange (Exchange::shared_ptr _exchange) void ManagementAgent::addObject (ManagementObject::shared_ptr object) { + object->setObjectId (nextObjectId++); managementObjects.push_back (object); QPID_LOG(info, "Management Object Added"); } @@ -197,8 +198,37 @@ void ManagementAgent::PeriodicProcessing (void) } void ManagementAgent::dispatchCommand (Deliverable& /*msg*/, - const string& /*routingKey*/, + const string& routingKey, const FieldTable* /*args*/) { + size_t pos, start; + + if (routingKey.compare (0, 7, "method.") != 0) + { + QPID_LOG (debug, "Illegal routing key for dispatch: " << routingKey); + return; + } + + start = 7; + if (routingKey.length () == start) + { + QPID_LOG (debug, "Missing class-key in routing key: " << routingKey); + return; + } + + pos = routingKey.find ('.', start); + if (pos == string::npos || routingKey.length () == pos + 1) + { + QPID_LOG (debug, "Missing method-key in routing key: " << routingKey); + return; + } + + string className = routingKey.substr (start, pos - start); + + start = pos + 1; + + string methodName = routingKey.substr (start, routingKey.length () - start); + + QPID_LOG (debug, "Dispatch class: " << className << ", method: " << methodName); } diff --git a/qpid/cpp/src/qpid/broker/management/ManagementAgent.h b/qpid/cpp/src/qpid/broker/management/ManagementAgent.h index c3cfa58291..e699228601 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementAgent.h +++ b/qpid/cpp/src/qpid/broker/management/ManagementAgent.h @@ -45,7 +45,7 @@ class ManagementAgent void clientAdded (void); void dispatchCommand (Deliverable& msg, const string& routingKey, - const FieldTable* args); + const qpid::framing::FieldTable* args); private: @@ -62,6 +62,7 @@ class ManagementAgent Timer timer; Exchange::shared_ptr exchange; uint16_t interval; + uint32_t nextObjectId; void PeriodicProcessing (void); }; diff --git a/qpid/cpp/src/qpid/broker/management/ManagementObject.cpp b/qpid/cpp/src/qpid/broker/management/ManagementObject.cpp index c536d96b1b..1c693d6b92 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementObject.cpp +++ b/qpid/cpp/src/qpid/broker/management/ManagementObject.cpp @@ -41,6 +41,11 @@ void ManagementObject::schemaItem (Buffer& buf, buf.putShortString (description); } +void ManagementObject::schemaListBegin (Buffer& buf) +{ + schemaItem (buf, TYPE_UINT32, "id", "Object ID", true, true); +} + void ManagementObject::schemaListEnd (Buffer& buf) { buf.putOctet (FLAG_END); @@ -51,4 +56,5 @@ void ManagementObject::writeTimestamps (Buffer& buf) buf.putLongLong (uint64_t (Duration (now ()))); buf.putLongLong (createTime); buf.putLongLong (destroyTime); + buf.putLong (objectId); } diff --git a/qpid/cpp/src/qpid/broker/management/ManagementObject.h b/qpid/cpp/src/qpid/broker/management/ManagementObject.h index 107da62e67..a39ae80c4f 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementObject.h +++ b/qpid/cpp/src/qpid/broker/management/ManagementObject.h @@ -30,9 +30,6 @@ namespace qpid { namespace broker { -using namespace qpid::framing; -using namespace qpid::sys; - const uint16_t OBJECT_SYSTEM = 1; const uint16_t OBJECT_BROKER = 2; const uint16_t OBJECT_VHOST = 3; @@ -52,6 +49,7 @@ class ManagementObject uint64_t createTime; uint64_t destroyTime; + uint32_t objectId; bool configChanged; bool instChanged; bool deleted; @@ -67,31 +65,34 @@ class ManagementObject static const uint8_t FLAG_INDEX = 0x02; static const uint8_t FLAG_END = 0x80; - void schemaItem (Buffer& buf, - uint8_t typeCode, - std::string name, - std::string description, - bool isConfig = false, - bool isIndex = false); - void schemaListEnd (Buffer& buf); - void writeTimestamps (Buffer& buf); + void schemaItem (qpid::framing::Buffer& buf, + uint8_t typeCode, + std::string name, + std::string description, + bool isConfig = false, + bool isIndex = false); + void schemaListBegin (qpid::framing::Buffer& buf); + void schemaListEnd (qpid::framing::Buffer& buf); + void writeTimestamps (qpid::framing::Buffer& buf); public: typedef boost::shared_ptr<ManagementObject> shared_ptr; - ManagementObject () : destroyTime(0), configChanged(true), + ManagementObject () : destroyTime(0), objectId (), configChanged(true), instChanged(true), deleted(false) - { createTime = uint64_t (Duration (now ())); } + { createTime = uint64_t (qpid::sys::Duration (qpid::sys::now ())); } virtual ~ManagementObject () {} - virtual uint16_t getObjectType (void) = 0; - virtual std::string getObjectName (void) = 0; - virtual void writeSchema (Buffer& buf) = 0; - virtual void writeConfig (Buffer& buf) = 0; - virtual void writeInstrumentation (Buffer& buf) = 0; - virtual bool getSchemaNeeded (void) = 0; - virtual void setSchemaNeeded (void) = 0; + virtual uint16_t getObjectType (void) = 0; + virtual std::string getObjectName (void) = 0; + virtual void writeSchema (qpid::framing::Buffer& buf) = 0; + virtual void writeConfig (qpid::framing::Buffer& buf) = 0; + virtual void writeInstrumentation (qpid::framing::Buffer& buf) = 0; + virtual bool getSchemaNeeded (void) = 0; + virtual void setSchemaNeeded (void) = 0; + void setObjectId (uint32_t oid) { objectId = oid; } + uint32_t getObjectId (void) { return objectId; } inline bool getConfigChanged (void) { return configChanged; } virtual bool getInstChanged (void) { return instChanged; } inline void setAllChanged (void) @@ -101,7 +102,7 @@ class ManagementObject } inline void resourceDestroy (void) { - destroyTime = uint64_t (Duration (now ())); + destroyTime = uint64_t (qpid::sys::Duration (qpid::sys::now ())); deleted = true; } bool isDeleted (void) { return deleted; } diff --git a/qpid/cpp/src/qpid/broker/management/ManagementObjectBroker.cpp b/qpid/cpp/src/qpid/broker/management/ManagementObjectBroker.cpp index 378017d5a8..139ea0acca 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementObjectBroker.cpp +++ b/qpid/cpp/src/qpid/broker/management/ManagementObjectBroker.cpp @@ -54,8 +54,9 @@ void ManagementObjectBroker::writeSchema (Buffer& buf) { schemaNeeded = false; - schemaItem (buf, TYPE_STRING, "sysId", "System ID", true, true); - schemaItem (buf, TYPE_UINT16, "port", "TCP Port for AMQP Service", true); + schemaListBegin (buf); + schemaItem (buf, TYPE_UINT32, "systemRef", "System ID", true, true); + schemaItem (buf, TYPE_UINT16, "port", "TCP Port for AMQP Service", true, true); schemaItem (buf, TYPE_UINT16, "workerThreads", "Thread pool size", true); schemaItem (buf, TYPE_UINT16, "maxConns", "Maximum allowed connections", true); schemaItem (buf, TYPE_UINT16, "connBacklog", @@ -72,7 +73,6 @@ void ManagementObjectBroker::writeSchema (Buffer& buf) schemaItem (buf, TYPE_STRING, "clusterName", "Name of cluster this server is a member of, zero-length for standalone server", true); schemaItem (buf, TYPE_STRING, "version", "Running software version", true); - schemaListEnd (buf); } @@ -81,7 +81,7 @@ void ManagementObjectBroker::writeConfig (Buffer& buf) configChanged = false; writeTimestamps (buf); - buf.putShortString (sysId); + buf.putLong (0); buf.putShort (port); buf.putShort (workerThreads); buf.putShort (maxConns); diff --git a/qpid/cpp/src/qpid/broker/management/ManagementObjectBroker.h b/qpid/cpp/src/qpid/broker/management/ManagementObjectBroker.h index f83df061af..25d6bf49b0 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementObjectBroker.h +++ b/qpid/cpp/src/qpid/broker/management/ManagementObjectBroker.h @@ -42,8 +42,6 @@ class ManagementObjectBroker : public ManagementObject static bool schemaNeeded; - std::string objectName; - std::string sysId; uint16_t port; uint16_t workerThreads; @@ -59,10 +57,10 @@ class ManagementObjectBroker : public ManagementObject std::string version; uint16_t getObjectType (void) { return OBJECT_BROKER; } - std::string getObjectName (void) { return objectName; } - void writeSchema (Buffer& buf); - void writeConfig (Buffer& buf); - void writeInstrumentation (Buffer& /*buf*/) {} + std::string getObjectName (void) { return "broker"; } + void writeSchema (qpid::framing::Buffer& buf); + void writeConfig (qpid::framing::Buffer& buf); + void writeInstrumentation (qpid::framing::Buffer& /*buf*/) {} bool getSchemaNeeded (void) { return schemaNeeded; } void setSchemaNeeded (void) { schemaNeeded = true; } diff --git a/qpid/cpp/src/qpid/broker/management/ManagementObjectQueue.cpp b/qpid/cpp/src/qpid/broker/management/ManagementObjectQueue.cpp index 70913ea910..8d8ff8cbf4 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementObjectQueue.cpp +++ b/qpid/cpp/src/qpid/broker/management/ManagementObjectQueue.cpp @@ -27,9 +27,9 @@ using namespace qpid::framing; bool ManagementObjectQueue::schemaNeeded = true; -ManagementObjectQueue::ManagementObjectQueue (std::string& _name, +ManagementObjectQueue::ManagementObjectQueue (uint32_t _vhostRef, std::string& _name, bool _durable, bool _autoDelete) : - vhostName("/"), name(_name), durable(_durable), autoDelete(_autoDelete) + vhostRef(_vhostRef), name(_name), durable(_durable), autoDelete(_autoDelete) { msgTotalEnqueues = 0; msgTotalDequeues = 0; @@ -79,15 +79,15 @@ void ManagementObjectQueue::writeSchema (Buffer& buf) { schemaNeeded = false; - schemaItem (buf, TYPE_STRING, "vhostRef", "Virtual Host Ref", true, true); - schemaItem (buf, TYPE_STRING, "name", "Queue Name", true, true); + schemaListBegin (buf); + schemaItem (buf, TYPE_UINT32, "vhostRef", "Virtual Host Ref", true); + schemaItem (buf, TYPE_STRING, "name", "Queue Name", true); schemaItem (buf, TYPE_BOOL, "durable", "Durable", true); schemaItem (buf, TYPE_BOOL, "autoDelete", "AutoDelete", true); - schemaItem (buf, TYPE_UINT64, "msgTotalEnqueues", "Total messages enqueued"); schemaItem (buf, TYPE_UINT64, "msgTotalDequeues", "Total messages dequeued"); - schemaItem (buf, TYPE_UINT64, "msgTxEnqueues", "Transactional messages enqueued"); - schemaItem (buf, TYPE_UINT64, "msgTxDequeues", "Transactional messages dequeued"); + schemaItem (buf, TYPE_UINT64, "msgTxnEnqueues", "Transactional messages enqueued"); + schemaItem (buf, TYPE_UINT64, "msgTxnDequeues", "Transactional messages dequeued"); schemaItem (buf, TYPE_UINT64, "msgPersistEnqueues", "Persistent messages enqueued"); schemaItem (buf, TYPE_UINT64, "msgPersistDequeues", "Persistent messages dequeued"); schemaItem (buf, TYPE_UINT32, "msgDepth", "Current size of queue in messages"); @@ -95,29 +95,28 @@ void ManagementObjectQueue::writeSchema (Buffer& buf) schemaItem (buf, TYPE_UINT32, "msgDepthHigh", "High-water queue size, this interval"); schemaItem (buf, TYPE_UINT64, "byteTotalEnqueues", "Total messages enqueued"); schemaItem (buf, TYPE_UINT64, "byteTotalDequeues", "Total messages dequeued"); - schemaItem (buf, TYPE_UINT64, "byteTxEnqueues", "Transactional messages enqueued"); - schemaItem (buf, TYPE_UINT64, "byteTxDequeues", "Transactional messages dequeued"); + schemaItem (buf, TYPE_UINT64, "byteTxnEnqueues", "Transactional messages enqueued"); + schemaItem (buf, TYPE_UINT64, "byteTxnDequeues", "Transactional messages dequeued"); schemaItem (buf, TYPE_UINT64, "bytePersistEnqueues", "Persistent messages enqueued"); schemaItem (buf, TYPE_UINT64, "bytePersistDequeues", "Persistent messages dequeued"); schemaItem (buf, TYPE_UINT32, "byteDepth", "Current size of queue in bytes"); schemaItem (buf, TYPE_UINT32, "byteDepthLow", "Low-water mark this interval"); schemaItem (buf, TYPE_UINT32, "byteDepthHigh", "High-water mark this interval"); - schemaItem (buf, TYPE_UINT64, "enqueueTxStarts", "Total enqueue transactions started "); - schemaItem (buf, TYPE_UINT64, "enqueueTxCommits", "Total enqueue transactions committed"); - schemaItem (buf, TYPE_UINT64, "enqueueTxRejects", "Total enqueue transactions rejected"); - schemaItem (buf, TYPE_UINT32, "enqueueTxCount", "Current pending enqueue transactions"); - schemaItem (buf, TYPE_UINT32, "enqueueTxCountLow", "Low water mark this interval"); - schemaItem (buf, TYPE_UINT32, "enqueueTxCountHigh", "High water mark this interval"); - schemaItem (buf, TYPE_UINT64, "dequeueTxStarts", "Total dequeue transactions started "); - schemaItem (buf, TYPE_UINT64, "dequeueTxCommits", "Total dequeue transactions committed"); - schemaItem (buf, TYPE_UINT64, "dequeueTxRejects", "Total dequeue transactions rejected"); - schemaItem (buf, TYPE_UINT32, "dequeueTxCount", "Current pending dequeue transactions"); - schemaItem (buf, TYPE_UINT32, "dequeueTxCountLow", "Transaction low water mark this interval"); - schemaItem (buf, TYPE_UINT32, "dequeueTxCountHigh", "Transaction high water mark this interval"); + schemaItem (buf, TYPE_UINT64, "enqueueTxnStarts", "Total enqueue transactions started "); + schemaItem (buf, TYPE_UINT64, "enqueueTxnCommits", "Total enqueue transactions committed"); + schemaItem (buf, TYPE_UINT64, "enqueueTxnRejects", "Total enqueue transactions rejected"); + schemaItem (buf, TYPE_UINT32, "enqueueTxnCount", "Current pending enqueue transactions"); + schemaItem (buf, TYPE_UINT32, "enqueueTxnCountLow", "Low water mark this interval"); + schemaItem (buf, TYPE_UINT32, "enqueueTxnCountHigh", "High water mark this interval"); + schemaItem (buf, TYPE_UINT64, "dequeueTxnStarts", "Total dequeue transactions started "); + schemaItem (buf, TYPE_UINT64, "dequeueTxnCommits", "Total dequeue transactions committed"); + schemaItem (buf, TYPE_UINT64, "dequeueTxnRejects", "Total dequeue transactions rejected"); + schemaItem (buf, TYPE_UINT32, "dequeueTxnCount", "Current pending dequeue transactions"); + schemaItem (buf, TYPE_UINT32, "dequeueTxnCountLow", "Transaction low water mark this interval"); + schemaItem (buf, TYPE_UINT32, "dequeueTxnCountHigh", "Transaction high water mark this interval"); schemaItem (buf, TYPE_UINT32, "consumers", "Current consumers on queue"); schemaItem (buf, TYPE_UINT32, "consumersLow", "Consumer low water mark this interval"); schemaItem (buf, TYPE_UINT32, "consumersHigh", "Consumer high water mark this interval"); - schemaListEnd (buf); } @@ -126,7 +125,7 @@ void ManagementObjectQueue::writeConfig (Buffer& buf) configChanged = false; writeTimestamps (buf); - buf.putShortString (vhostName); + buf.putLong (vhostRef); buf.putShortString (name); buf.putOctet (durable ? 1 : 0); buf.putOctet (autoDelete ? 1 : 0); @@ -137,8 +136,6 @@ void ManagementObjectQueue::writeInstrumentation (Buffer& buf) instChanged = false; writeTimestamps (buf); - buf.putShortString (vhostName); - buf.putShortString (name); buf.putLongLong (msgTotalEnqueues); buf.putLongLong (msgTotalDequeues); buf.putLongLong (msgTxEnqueues); diff --git a/qpid/cpp/src/qpid/broker/management/ManagementObjectQueue.h b/qpid/cpp/src/qpid/broker/management/ManagementObjectQueue.h index 4a0608c7d0..cedbf81809 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementObjectQueue.h +++ b/qpid/cpp/src/qpid/broker/management/ManagementObjectQueue.h @@ -36,8 +36,7 @@ class ManagementObjectQueue : public ManagementObject static bool schemaNeeded; - std::string objectName; - std::string vhostName; + uint32_t vhostRef; std::string name; bool durable; bool autoDelete; @@ -85,10 +84,10 @@ class ManagementObjectQueue : public ManagementObject uint32_t consumersHigh; // High water mark this interval uint16_t getObjectType (void) { return OBJECT_QUEUE; } - std::string getObjectName (void) { return objectName; } - void writeSchema (Buffer& buf); - void writeConfig (Buffer& buf); - void writeInstrumentation (Buffer& buf); + std::string getObjectName (void) { return "queue"; } + void writeSchema (qpid::framing::Buffer& buf); + void writeConfig (qpid::framing::Buffer& buf); + void writeInstrumentation (qpid::framing::Buffer& buf); bool getSchemaNeeded (void) { return schemaNeeded; } void setSchemaNeeded (void) { schemaNeeded = true; } @@ -119,7 +118,8 @@ class ManagementObjectQueue : public ManagementObject typedef boost::shared_ptr<ManagementObjectQueue> shared_ptr; - ManagementObjectQueue (std::string& name, bool durable, bool autoDelete); + ManagementObjectQueue (uint32_t _vhostRef, std::string& name, + bool durable, bool autoDelete); ~ManagementObjectQueue (void); // The following mask contents are used to describe enqueued or dequeued diff --git a/qpid/cpp/src/qpid/broker/management/ManagementObjectVhost.cpp b/qpid/cpp/src/qpid/broker/management/ManagementObjectVhost.cpp index 25a2200106..b5c8b3b0b7 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementObjectVhost.cpp +++ b/qpid/cpp/src/qpid/broker/management/ManagementObjectVhost.cpp @@ -28,10 +28,8 @@ using namespace qpid::framing; bool ManagementObjectVhost::schemaNeeded = true; -ManagementObjectVhost::ManagementObjectVhost (const Options& /*_conf*/) -{ - name = "/"; -} +ManagementObjectVhost::ManagementObjectVhost (uint32_t _sysRef, const Options& /*_conf*/) : + sysRef(_sysRef), name("/") {} ManagementObjectVhost::~ManagementObjectVhost () {} @@ -39,8 +37,9 @@ void ManagementObjectVhost::writeSchema (Buffer& buf) { schemaNeeded = false; - schemaItem (buf, TYPE_STRING, "name", "Name of virtual host", true, true); - + schemaListBegin (buf); + schemaItem (buf, TYPE_UINT32, "brokerRef", "Broker Reference" , true); + schemaItem (buf, TYPE_STRING, "name", "Name of virtual host", true); schemaListEnd (buf); } @@ -49,6 +48,7 @@ void ManagementObjectVhost::writeConfig (Buffer& buf) configChanged = false; writeTimestamps (buf); + buf.putLong (sysRef); buf.putShortString (name); } diff --git a/qpid/cpp/src/qpid/broker/management/ManagementObjectVhost.h b/qpid/cpp/src/qpid/broker/management/ManagementObjectVhost.h index 77ac4eea38..c36acb3487 100644 --- a/qpid/cpp/src/qpid/broker/management/ManagementObjectVhost.h +++ b/qpid/cpp/src/qpid/broker/management/ManagementObjectVhost.h @@ -35,22 +35,21 @@ class ManagementObjectVhost : public ManagementObject typedef boost::shared_ptr<ManagementObjectVhost> shared_ptr; - ManagementObjectVhost (const Options& conf); + ManagementObjectVhost (uint32_t sysRef, const Options& conf); ~ManagementObjectVhost (void); private: static bool schemaNeeded; - std::string objectName; - + uint32_t sysRef; std::string name; uint16_t getObjectType (void) { return OBJECT_VHOST; } - std::string getObjectName (void) { return objectName; } - void writeSchema (Buffer& buf); - void writeConfig (Buffer& buf); - void writeInstrumentation (Buffer& /*buf*/) {} + std::string getObjectName (void) { return "vhost"; } + void writeSchema (qpid::framing::Buffer& buf); + void writeConfig (qpid::framing::Buffer& buf); + void writeInstrumentation (qpid::framing::Buffer& /*buf*/) {} bool getSchemaNeeded (void) { return schemaNeeded; } void setSchemaNeeded (void) { schemaNeeded = true; } |