Go to the documentation of this file.00001 #ifndef _QPID_CONSOLE_SESSION_MANAGER_H
00002 #define _QPID_CONSOLE_SESSION_MANAGER_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 "qpid/console/ConsoleImportExport.h"
00026 #include "qpid/console/Broker.h"
00027 #include "qpid/console/Package.h"
00028 #include "qpid/console/SequenceManager.h"
00029 #include "qpid/console/ClassKey.h"
00030 #include "qpid/console/Schema.h"
00031 #include "qpid/console/Agent.h"
00032 #include "qpid/console/Object.h"
00033 #include "qpid/console/ObjectId.h"
00034 #include "qpid/console/Value.h"
00035 #include "qpid/sys/Mutex.h"
00036 #include "qpid/sys/Condition.h"
00037 #include "qpid/client/ConnectionSettings.h"
00038 #include <string>
00039 #include <vector>
00040
00041 namespace qpid {
00042 namespace console {
00043
00044 class ConsoleListener;
00045
00050 class SessionManager
00051 {
00052 public:
00053 typedef std::vector<std::string> NameVector;
00054 typedef std::vector<ClassKey> KeyVector;
00055 QPID_CONSOLE_EXTERN ~SessionManager();
00056
00057 struct Settings {
00058 bool rcvObjects;
00059 bool rcvEvents;
00060 bool rcvHeartbeats;
00061 bool userBindings;
00062 uint32_t methodTimeout;
00063 uint32_t getTimeout;
00064
00065 Settings() : rcvObjects(true), rcvEvents(true), rcvHeartbeats(true),
00066 userBindings(false), methodTimeout(20), getTimeout(20)
00067 {}
00068 };
00069
00084 QPID_CONSOLE_EXTERN SessionManager(ConsoleListener* listener = 0,
00085 Settings settings = Settings());
00086
00093 QPID_CONSOLE_EXTERN Broker* addBroker(client::ConnectionSettings& settings);
00094
00099 QPID_CONSOLE_EXTERN void delBroker(Broker* broker);
00100
00105 QPID_CONSOLE_EXTERN void getPackages(NameVector& packages);
00106
00112 QPID_CONSOLE_EXTERN void getClasses(KeyVector& classKeys,
00113 const std::string& packageName);
00114
00119 QPID_CONSOLE_EXTERN SchemaClass& getSchema(const ClassKey& classKey);
00120
00128 QPID_CONSOLE_EXTERN void bindPackage(const std::string& packageName);
00129
00137 QPID_CONSOLE_EXTERN void bindClass(const ClassKey& classKey);
00138 QPID_CONSOLE_EXTERN void bindClass(const std::string& packageName,
00139 const std::string& className);
00140
00150 QPID_CONSOLE_EXTERN void bindEvent(const ClassKey& classKey);
00151 QPID_CONSOLE_EXTERN void bindEvent(const std::string& packageName,
00152 const std::string& eventName="");
00153
00154
00161 QPID_CONSOLE_EXTERN void getAgents(Agent::Vector& agents,
00162 Broker* broker = 0);
00163
00174 QPID_CONSOLE_EXTERN void getObjects(Object::Vector& objects,
00175 const std::string& className,
00176 Broker* broker = 0,
00177 Agent* agent = 0);
00178
00179
00180
00181
00182
00183 private:
00184 friend class Broker;
00185 friend class Broker::ConnectionThread;
00186 friend class Object;
00187 sys::Mutex lock;
00188 sys::Mutex brokerListLock;
00189 ConsoleListener* listener;
00190 std::vector<Broker*> brokers;
00191 std::map<std::string, Package*> packages;
00192 SequenceManager sequenceManager;
00193 sys::Condition cv;
00194 SequenceManager::set syncSequenceList;
00195 Object::Vector getResult;
00196 std::string error;
00197 Settings settings;
00198 NameVector bindingKeyList;
00199
00200 void bindingKeys();
00201 void allBrokersStable();
00202 void startProtocol(Broker* broker);
00203 void handleBrokerResp(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence);
00204 void handlePackageInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence);
00205 void handleCommandComplete(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence);
00206 void handleClassInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence);
00207 void handleMethodResp(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence);
00208 void handleHeartbeatInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence);
00209 void handleEventInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence);
00210 void handleSchemaResp(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence);
00211 void handleContentInd(Broker* broker, framing::Buffer& inBuffer, uint32_t sequence, bool prop, bool stat);
00212 void handleBrokerConnect(Broker* broker);
00213 void handleBrokerDisconnect(Broker* broker);
00214
00215 };
00216
00217 }}
00218
00219 #endif