00001 #ifndef QPID_BROKER_PREVIEWSESSION_H
00002 #define QPID_BROKER_PREVIEWSESSION_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/framing/Uuid.h"
00026 #include "qpid/framing/FrameHandler.h"
00027 #include "qpid/framing/SessionState.h"
00028 #include "qpid/framing/ProtocolVersion.h"
00029 #include "qpid/sys/Mutex.h"
00030 #include "qpid/sys/Time.h"
00031 #include "qpid/management/Manageable.h"
00032 #include "qpid/management/Session.h"
00033 #include "SessionContext.h"
00034
00035 #include <boost/noncopyable.hpp>
00036 #include <boost/scoped_ptr.hpp>
00037
00038 #include <set>
00039 #include <vector>
00040 #include <ostream>
00041
00042 namespace qpid {
00043
00044 namespace framing {
00045 class AMQP_ClientProxy;
00046 }
00047
00048 namespace broker {
00049
00050 class SemanticHandler;
00051 class PreviewSessionHandler;
00052 class PreviewSessionManager;
00053 class Broker;
00054 class ConnectionState;
00055
00060 class PreviewSessionState : public framing::SessionState,
00061 public SessionContext,
00062 public framing::FrameHandler::Chains,
00063 public management::Manageable
00064 {
00065 public:
00066 ~PreviewSessionState();
00067 bool isAttached() const { return handler; }
00068
00069 void detach();
00070 void attach(PreviewSessionHandler& handler);
00071
00072
00073 PreviewSessionHandler* getHandler();
00074
00076 framing::AMQP_ClientProxy& getProxy();
00077
00079 ConnectionState& getConnection();
00080 bool isLocal(const ConnectionToken* t) const;
00081
00082 uint32_t getTimeout() const { return timeout; }
00083 Broker& getBroker() { return broker; }
00084 framing::ProtocolVersion getVersion() const { return version; }
00085
00087 void activateOutput();
00088
00089
00090 management::ManagementObject::shared_ptr GetManagementObject (void) const;
00091 management::Manageable::status_t
00092 ManagementMethod (uint32_t methodId, management::Args& args);
00093
00094
00095 PreviewSessionState(PreviewSessionManager*,
00096 PreviewSessionHandler* out,
00097 uint32_t timeout,
00098 uint32_t ackInterval);
00099
00100
00101 private:
00102 PreviewSessionManager* factory;
00103 PreviewSessionHandler* handler;
00104 framing::Uuid id;
00105 uint32_t timeout;
00106 sys::AbsTime expiry;
00107 Broker& broker;
00108 framing::ProtocolVersion version;
00109 sys::Mutex lock;
00110 boost::scoped_ptr<SemanticHandler> semanticHandler;
00111 management::Session::shared_ptr mgmtObject;
00112
00113 friend class PreviewSessionManager;
00114 };
00115
00116
00117 inline std::ostream& operator<<(std::ostream& out, const PreviewSessionState& session) {
00118 return out << session.getId();
00119 }
00120
00121 }}
00122
00123
00124
00125 #endif