00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _QueueRegistry_
00022 #define _QueueRegistry_
00023
00024 #include <map>
00025 #include "qpid/sys/Mutex.h"
00026 #include "Queue.h"
00027 #include "qpid/management/Manageable.h"
00028
00029 namespace qpid {
00030 namespace broker {
00031
00039 class QueueRegistry{
00040 public:
00041 QueueRegistry();
00042 ~QueueRegistry();
00043
00050 std::pair<Queue::shared_ptr, bool> declare(const string& name, bool durable = false, bool autodelete = false,
00051 const OwnershipToken* const owner = 0);
00052
00065 void destroy (const string& name);
00066 template <class Test> bool destroyIf(const string& name, Test test)
00067 {
00068 qpid::sys::RWlock::ScopedWlock locker(lock);
00069 if (test()) {
00070 destroyLH (name);
00071 return true;
00072 } else {
00073 return false;
00074 }
00075 }
00076
00080 Queue::shared_ptr find(const string& name);
00081
00085 string generateName();
00086
00090 void setStore (MessageStore*);
00091
00095 MessageStore* getStore() const;
00096
00100 void setParent (management::Manageable* _parent) { parent = _parent; }
00101
00102 private:
00103 typedef std::map<string, Queue::shared_ptr> QueueMap;
00104 QueueMap queues;
00105 qpid::sys::RWlock lock;
00106 int counter;
00107 MessageStore* store;
00108 management::Manageable* parent;
00109
00110
00111 void destroyLH (const string& name);
00112 };
00113
00114
00115 }
00116 }
00117
00118
00119 #endif