util/qos/DisconnectQos.cpp

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------------
00002 Name:      DisconnectQos.cpp
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 Comment:   Handling one xmlQoS
00006 Version:   $Id: DisconnectQos.cpp 12915 2004-11-18 14:55:05Z ruff $
00007 ------------------------------------------------------------------------------*/
00008 
00009 #include <util/qos/DisconnectQos.h>
00010 #include <util/Global.h>
00011 
00012 using namespace std;
00013 using namespace org::xmlBlaster::util;
00014 
00015 namespace org { namespace xmlBlaster { namespace util { namespace qos {
00016 
00017 DisconnectQos::DisconnectQos(Global& global)
00018    : ME("DisconnectQos"), 
00019      global_(global), 
00020      log_(global.getLog("org.xmlBlaster.util.qos")),
00021      clientProperties_()
00022 {
00023    deleteSubjectQueue_ = true;
00024    clearSessions_      = false;
00025    clearClientQueue_   = false;
00026 }
00027 
00028 DisconnectQos::DisconnectQos(const DisconnectQos& qos)
00029    : ME(qos.ME), 
00030      global_(qos.global_), 
00031      log_(qos.log_),
00032      clientProperties_()
00033 {
00034    deleteSubjectQueue_ = qos.deleteSubjectQueue_;
00035    clearSessions_      = qos.clearSessions_;
00036    clientProperties_ = qos.clientProperties_;
00037 }
00038 
00039 DisconnectQos& DisconnectQos::operator =(const DisconnectQos& qos)
00040 {
00041    deleteSubjectQueue_ = qos.deleteSubjectQueue_;
00042    clearSessions_      = qos.clearSessions_;
00043    return *this;
00044 }
00045 
00046 
00047 bool DisconnectQos::getDeleteSubjectQueue() const
00048 {
00049    return deleteSubjectQueue_;
00050 }
00051 
00052 void DisconnectQos::setSubjectQueue(bool del)
00053 {
00054    deleteSubjectQueue_ = del;
00055 }
00056 
00057 bool DisconnectQos::getClearSessions() const
00058 {
00059    return clearSessions_;
00060 }
00061 
00062 void DisconnectQos::setClearSessions(bool del)
00063 {
00064    clearSessions_ = del;
00065 }
00066 
00067 void DisconnectQos::addClientProperty(const std::string& key, const std::string& value,
00068             const std::string& /*type*/, const std::string& /*encoding*/)
00069 {
00070    clientProperties_.insert(ClientPropertyMap::value_type(key, value)); // TODO: Port to ClientProperty, type, encoding
00071 }
00072         
00073 const DisconnectQos::ClientPropertyMap& DisconnectQos::getClientProperties() const
00074 {
00075    return clientProperties_;
00076 }
00077 
00078 string DisconnectQos::toXml(const string& extraOffset) const
00079 {
00080    string ret;
00081    string offset = "\n   ";
00082    offset += extraOffset;
00083 
00084    ret += offset + "<qos>";
00085    ret += offset + "  <deleteSubjectQueue>" + global_.getBoolAsString(deleteSubjectQueue_) + "</deleteSubjectQueue>";
00086    ret += offset + "  <clearSessions>" + global_.getBoolAsString(clearSessions_) + "</clearSessions>";
00087 
00088    DisconnectQos::ClientPropertyMap::const_iterator 
00089       iter = clientProperties_.begin();
00090    while (iter != clientProperties_.end()) {
00091       offset + "   <clientProperty name='" + (*iter).first + "'>" + (*iter).second + "</clientProperty>";
00092       iter++;
00093    }
00094 
00095    ret += offset + "</qos>";
00096 
00097    return ret;
00098 }
00099 
00100    bool DisconnectQos::getClearClientQueue() const {
00101       return clearClientQueue_;
00102    }
00103 
00104    void DisconnectQos::setClearClientQueue(bool clearClientQueue) {
00105       clearClientQueue_ = clearClientQueue;
00106    }
00107 
00108 
00109 }}}}
00110 
00111