1 /*------------------------------------------------------------------------------
2 Name: DisconnectQos.cpp
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 Comment: Handling one xmlQoS
6 Version: $Id: DisconnectQos.cpp 16668 2007-12-13 07:38:41Z ruff $
7 ------------------------------------------------------------------------------*/
8
9 #include <util/qos/DisconnectQos.h>
10 #include <util/Global.h>
11
12 using namespace std;
13 using namespace org::xmlBlaster::util;
14
15 namespace org { namespace xmlBlaster { namespace util { namespace qos {
16
17 DisconnectQos::DisconnectQos(Global& global)
18 : ME("DisconnectQos"),
19 global_(global),
20 log_(global.getLog("org.xmlBlaster.util.qos")),
21 clientProperties_()
22 {
23 deleteSubjectQueue_ = true;
24 clearSessions_ = false;
25 clearClientQueue_ = false;
26 }
27
28 DisconnectQos::DisconnectQos(const DisconnectQos& qos)
29 : ME(qos.ME),
30 global_(qos.global_),
31 log_(qos.log_),
32 clientProperties_()
33 {
34 deleteSubjectQueue_ = qos.deleteSubjectQueue_;
35 clearSessions_ = qos.clearSessions_;
36 clientProperties_ = qos.clientProperties_;
37 }
38
39 DisconnectQos& DisconnectQos::operator =(const DisconnectQos& qos)
40 {
41 deleteSubjectQueue_ = qos.deleteSubjectQueue_;
42 clearSessions_ = qos.clearSessions_;
43 return *this;
44 }
45
46
47 bool DisconnectQos::getDeleteSubjectQueue() const
48 {
49 return deleteSubjectQueue_;
50 }
51
52 void DisconnectQos::setSubjectQueue(bool del)
53 {
54 deleteSubjectQueue_ = del;
55 }
56
57 bool DisconnectQos::getClearSessions() const
58 {
59 return clearSessions_;
60 }
61
62 void DisconnectQos::setClearSessions(bool del)
63 {
64 clearSessions_ = del;
65 }
66
67 void DisconnectQos::addClientProperty(const ClientProperty& clientProperty)
68 {
69 clientProperties_.insert(ClientPropertyMap::value_type(clientProperty.getName(), clientProperty));
70 }
71
72 void DisconnectQos::addClientProperty(const std::string& key, const std::string& value,
73 const std::string& type, const std::string& encoding, const std::string& charset)
74 {
75 org::xmlBlaster::util::qos::ClientProperty clientProperty(key, value, type, encoding, charset);
76 clientProperties_.insert(ClientPropertyMap::value_type(key, clientProperty));
77 }
78
79 const DisconnectQos::ClientPropertyMap& DisconnectQos::getClientProperties() const
80 {
81 return clientProperties_;
82 }
83
84 string DisconnectQos::toXml(const string& extraOffset) const
85 {
86 string ret;
87 string offset = "\n ";
88 offset += extraOffset;
89
90 ret += offset + "<qos>";
91 ret += offset + " <deleteSubjectQueue>" + global_.getBoolAsString(deleteSubjectQueue_) + "</deleteSubjectQueue>";
92 ret += offset + " <clearSessions>" + global_.getBoolAsString(clearSessions_) + "</clearSessions>";
93
94 const bool clearText=false;
95 QosData::ClientPropertyMap::const_iterator iter = clientProperties_.begin();
96 while (iter != clientProperties_.end()) {
97 const ClientProperty& cp = (*iter).second;
98 ret += cp.toXml(extraOffset, clearText);
99 iter++;
100 }
101
102 ret += offset + "</qos>";
103
104 return ret;
105 }
106
107 bool DisconnectQos::getClearClientQueue() const {
108 return clearClientQueue_;
109 }
110
111 void DisconnectQos::setClearClientQueue(bool clearClientQueue) {
112 clearClientQueue_ = clearClientQueue;
113 }
114
115
116 }}}}
syntax highlighted by Code2HTML, v. 0.9.1