1 /*------------------------------------------------------------------------------
2 Name: DisconnectQos.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 Comment: Handling one xmlQoS
6 Version: $Id: DisconnectQos.h 16668 2007-12-13 07:38:41Z ruff $
7 ------------------------------------------------------------------------------*/
8
9 /**
10 * This class encapsulates the qos of a logout() or disconnect()
11 * <p />
12 * So you don't need to type the 'ugly' XML ASCII std::string by yourself.
13 * After construction access the ASCII-XML std::string with the toXml() method.
14 * <br />
15 * A typical <b>logout</b> qos could look like this:<br />
16 * <pre>
17 * <qos>
18 * <deleteSubjectQueue>true</deleteSubjectQueue>
19 * <clearSessions>false</clearSessions>
20 * </qos>
21 * </pre>
22 * <p />
23 * see xmlBlaster/src/dtd/XmlQoS.xml
24 * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.disconnect.html">The interface.disconnect requirement</a>
25 * @see org.xmlBlaster.test.classtest.DisconnectQosTest
26 */
27
28 #ifndef _UTIL_QOS_DISCONNECTQOS_H
29 #define _UTIL_QOS_DISCONNECTQOS_H
30
31 #include <util/xmlBlasterDef.h>
32 #include <util/I_Log.h>
33 #include <util/qos/ClientProperty.h>
34 #include <string>
35 #include <map>
36
37 namespace org { namespace xmlBlaster { namespace util { namespace qos {
38
39 class Dll_Export DisconnectQos
40 {
41 public:
42 typedef std::map<std::string, org::xmlBlaster::util::qos::ClientProperty> ClientPropertyMap;
43
44 private:
45 std::string ME; // = "DisconnectQos";
46 org::xmlBlaster::util::Global& global_;
47 org::xmlBlaster::util::I_Log& log_;
48 bool deleteSubjectQueue_; // = true;
49 bool clearSessions_; // = false;
50 bool clearClientQueue_;
51
52 protected:
53 ClientPropertyMap clientProperties_;
54
55 public:
56 /**
57 * Default constructor
58 */
59 DisconnectQos(org::xmlBlaster::util::Global& global);
60
61 /**
62 * copy constructor
63 */
64 DisconnectQos(const DisconnectQos& qos);
65
66 /**
67 * assignment operator
68 */
69 DisconnectQos& operator =(const DisconnectQos& qos);
70
71 /**
72 * Return true if subject queue shall be deleted with last user session
73 * @return true;
74 */
75 bool getDeleteSubjectQueue() const;
76
77 /**
78 * @param true if subject queue shall be deleted with last user session logout
79 */
80 void setSubjectQueue(bool del);
81
82 /**
83 * Return true if we shall kill all other sessions of this user on logout (defaults to false).
84 * @return false
85 */
86 bool getClearSessions() const;
87
88 /**
89 * Add a client property.
90 * @param clientProperty
91 * @see ClientProperty
92 */
93 void addClientProperty(const ClientProperty& clientProperty);
94 void addClientProperty(const std::string& key, const std::string& value, const std::string& type="", const std::string& encoding="", const std::string& charset="");
95
96 const ClientPropertyMap& getClientProperties() const;
97
98 /**
99 * @param true if we shall kill all other sessions of this user on logout (defaults to false).
100 */
101 void setClearSessions(bool del);
102
103 /**
104 * Dump state of this object into a XML ASCII std::string.
105 * <br>
106 * @param extraOffset indenting of tags for nice output
107 * @return internal state of the RequestBroker as a XML ASCII std::string
108 */
109 std::string toXml(const std::string& extraOffset="") const;
110
111 bool getClearClientQueue() const;
112
113 void setClearClientQueue(bool clearClientQueue);
114 };
115
116 }}}}
117
118 #endif
syntax highlighted by Code2HTML, v. 0.9.1