diff options
author | Kim van der Riet <kpvdr@apache.org> | 2008-04-03 12:41:40 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2008-04-03 12:41:40 +0000 |
commit | 833239ec44ea87a1b619eef3de55afde56c7ee45 (patch) | |
tree | c4d51996de1f0b3c6b43f1dfab7a0e741458ba29 /cpp | |
parent | 799af7cedfce9deb22ce6390215aeda8d77c694c (diff) | |
download | qpid-python-833239ec44ea87a1b619eef3de55afde56c7ee45.tar.gz |
Patch from Ted Ross (see QPID-893): This patch enables management of plugged-in store modules.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@644287 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/broker/PersistableQueue.h | 9 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Queue.cpp | 12 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Queue.h | 7 | ||||
-rw-r--r-- | cpp/src/qpid/management/Manageable.cpp | 1 | ||||
-rw-r--r-- | cpp/src/qpid/management/Manageable.h | 9 |
5 files changed, 26 insertions, 12 deletions
diff --git a/cpp/src/qpid/broker/PersistableQueue.h b/cpp/src/qpid/broker/PersistableQueue.h index 2d30513884..9236814ae3 100644 --- a/cpp/src/qpid/broker/PersistableQueue.h +++ b/cpp/src/qpid/broker/PersistableQueue.h @@ -24,6 +24,7 @@ #include <string> #include "Persistable.h" +#include "qpid/management/Manageable.h" #include <boost/shared_ptr.hpp> namespace qpid { @@ -35,7 +36,7 @@ namespace broker { * persistableQueue */ -class ExternalQueueStore +class ExternalQueueStore : public management::Manageable { public: virtual ~ExternalQueueStore() {}; @@ -58,11 +59,7 @@ public: delete externalQueueStore; }; - inline void setExternalQueueStore(ExternalQueueStore* inst){ - if (externalQueueStore!=inst && externalQueueStore) - delete externalQueueStore; - externalQueueStore = inst; - }; + virtual void setExternalQueueStore(ExternalQueueStore* inst) = 0; inline ExternalQueueStore* getExternalQueueStore() const {return externalQueueStore;}; diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index 436431fce1..a405971805 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -632,6 +632,18 @@ bool Queue::hasExclusiveConsumer() const return exclusive; } +void Queue::setExternalQueueStore(ExternalQueueStore* inst) { + if (externalQueueStore!=inst && externalQueueStore) + delete externalQueueStore; + externalQueueStore = inst; + + if (inst) { + ManagementObject::shared_ptr childObj = inst->GetManagementObject(); + if (childObj.get() != 0) + mgmtObject->set_storeRef(childObj->getObjectId()); + } +} + ManagementObject::shared_ptr Queue::GetManagementObject (void) const { return dynamic_pointer_cast<ManagementObject> (mgmtObject); diff --git a/cpp/src/qpid/broker/Queue.h b/cpp/src/qpid/broker/Queue.h index 880b048103..8b92784b9a 100644 --- a/cpp/src/qpid/broker/Queue.h +++ b/cpp/src/qpid/broker/Queue.h @@ -60,7 +60,8 @@ namespace qpid { * registered consumers or be stored until dequeued or until one * or more consumers registers. */ - class Queue : public boost::enable_shared_from_this<Queue>, public PersistableQueue, public management::Manageable { + class Queue : public boost::enable_shared_from_this<Queue>, + public PersistableQueue, public management::Manageable { typedef std::set<Consumer*> Listeners; typedef std::deque<QueuedMessage> Messages; @@ -106,7 +107,7 @@ namespace qpid { Queue(const string& name, bool autodelete = false, MessageStore* const store = 0, const OwnershipToken* const owner = 0, - Manageable* parent = 0); + management::Manageable* parent = 0); ~Queue(); bool dispatch(Consumer&); @@ -183,6 +184,8 @@ namespace qpid { static Queue::shared_ptr decode(QueueRegistry& queues, framing::Buffer& buffer); static void tryAutoDelete(Broker& broker, Queue::shared_ptr); + virtual void setExternalQueueStore(ExternalQueueStore* inst); + // Manageable entry points management::ManagementObject::shared_ptr GetManagementObject (void) const; management::Manageable::status_t diff --git a/cpp/src/qpid/management/Manageable.cpp b/cpp/src/qpid/management/Manageable.cpp index c5adb22694..479cb4e0ce 100644 --- a/cpp/src/qpid/management/Manageable.cpp +++ b/cpp/src/qpid/management/Manageable.cpp @@ -29,6 +29,7 @@ std::string Manageable::StatusText (status_t status) case STATUS_UNKNOWN_OBJECT : return "UnknownObject"; case STATUS_UNKNOWN_METHOD : return "UnknownMethod"; case STATUS_NOT_IMPLEMENTED : return "NotImplemented"; + case STATUS_INVALID_PARAMETER : return "InvalidParameter"; } return "??"; diff --git a/cpp/src/qpid/management/Manageable.h b/cpp/src/qpid/management/Manageable.h index 1fb890c8c6..836ba03b23 100644 --- a/cpp/src/qpid/management/Manageable.h +++ b/cpp/src/qpid/management/Manageable.h @@ -39,10 +39,11 @@ class Manageable typedef uint32_t status_t; static std::string StatusText (status_t status); - static const status_t STATUS_OK = 0; - static const status_t STATUS_UNKNOWN_OBJECT = 1; - static const status_t STATUS_UNKNOWN_METHOD = 2; - static const status_t STATUS_NOT_IMPLEMENTED = 3; + static const status_t STATUS_OK = 0; + static const status_t STATUS_UNKNOWN_OBJECT = 1; + static const status_t STATUS_UNKNOWN_METHOD = 2; + static const status_t STATUS_NOT_IMPLEMENTED = 3; + static const status_t STATUS_INVALID_PARAMETER = 4; // Every "Manageable" object must hold a reference to exactly one // management object. This object is always of a class derived from |