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 Connection;
00038 class LinkRegistry {
00039
00040
00041
00042 struct Periodic : public TimerTask
00043 {
00044 LinkRegistry& links;
00045
00046 Periodic(LinkRegistry& links);
00047 virtual ~Periodic() {};
00048 void fire();
00049 };
00050
00051 typedef std::map<std::string, Link::shared_ptr> LinkMap;
00052 typedef std::map<std::string, Bridge::shared_ptr> BridgeMap;
00053
00054 LinkMap links;
00055 LinkMap linksToDestroy;
00056 BridgeMap bridges;
00057 BridgeMap bridgesToDestroy;
00058
00059 qpid::sys::Mutex lock;
00060 Broker* broker;
00061 Timer timer;
00062 management::Manageable* parent;
00063 MessageStore* store;
00064
00065 void periodicMaintenance ();
00066
00067 public:
00068 LinkRegistry (Broker* _broker);
00069 std::pair<Link::shared_ptr, bool>
00070 declare(std::string& host,
00071 uint16_t port,
00072 std::string& transport,
00073 bool durable,
00074 std::string& authMechanism,
00075 std::string& username,
00076 std::string& password);
00077 std::pair<Bridge::shared_ptr, bool>
00078 declare(std::string& host,
00079 uint16_t port,
00080 bool durable,
00081 std::string& src,
00082 std::string& dest,
00083 std::string& key,
00084 bool isQueue,
00085 bool isLocal,
00086 std::string& id,
00087 std::string& excludes,
00088 bool dynamic);
00089
00090 void destroy(const std::string& host, const uint16_t port);
00091 void destroy(const std::string& host,
00092 const uint16_t port,
00093 const std::string& src,
00094 const std::string& dest,
00095 const std::string& key);
00096
00100 void setParent (management::Manageable* _parent) { parent = _parent; }
00101
00105 void setStore (MessageStore*);
00106
00110 MessageStore* getStore() const;
00111
00112 void notifyConnection (const std::string& key, Connection* c);
00113 void notifyClosed (const std::string& key);
00114 void notifyConnectionForced (const std::string& key, const std::string& text);
00115 std::string getAuthMechanism (const std::string& key);
00116 std::string getAuthCredentials (const std::string& key);
00117 std::string getAuthIdentity (const std::string& key);
00118 };
00119 }
00120 }
00121
00122
00123 #endif