00001 #ifndef _broker_LinkRegistry_h
00002 #define _broker_LinkRegistry_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <map>
00026 #include "Link.h"
00027 #include "Bridge.h"
00028 #include "MessageStore.h"
00029 #include "Timer.h"
00030 #include "qpid/sys/Mutex.h"
00031 #include "qpid/management/Manageable.h"
00032
00033 namespace qpid {
00034 namespace broker {
00035
00036 class Broker;
00037 class LinkRegistry {
00038
00039
00040
00041 struct Periodic : public TimerTask
00042 {
00043 LinkRegistry& links;
00044
00045 Periodic(LinkRegistry& links);
00046 virtual ~Periodic() {};
00047 void fire();
00048 };
00049
00050 typedef std::map<std::string, Link::shared_ptr> LinkMap;
00051 typedef std::map<std::string, Bridge::shared_ptr> BridgeMap;
00052
00053 LinkMap links;
00054 LinkMap linksToDestroy;
00055 BridgeMap bridges;
00056 BridgeMap bridgesToDestroy;
00057
00058 qpid::sys::Mutex lock;
00059 Broker* broker;
00060 Timer timer;
00061 management::Manageable* parent;
00062 MessageStore* store;
00063
00064 void periodicMaintenance ();
00065
00066 public:
00067 LinkRegistry (Broker* _broker);
00068 std::pair<Link::shared_ptr, bool>
00069 declare(std::string& host,
00070 uint16_t port,
00071 bool useSsl,
00072 bool durable,
00073 std::string& authMechanism,
00074 std::string& username,
00075 std::string& password);
00076 std::pair<Bridge::shared_ptr, bool>
00077 declare(std::string& host,
00078 uint16_t port,
00079 bool durable,
00080 std::string& src,
00081 std::string& dest,
00082 std::string& key,
00083 bool is_queue,
00084 bool is_local,
00085 std::string& id,
00086 std::string& excludes);
00087
00088 void destroy(const std::string& host, const uint16_t port);
00089 void destroy(const std::string& host,
00090 const uint16_t port,
00091 const std::string& src,
00092 const std::string& dest,
00093 const std::string& key);
00094
00098 void setParent (management::Manageable* _parent) { parent = _parent; }
00099
00103 void setStore (MessageStore*);
00104
00108 MessageStore* getStore() const;
00109 };
00110 }
00111 }
00112
00113
00114 #endif