1 /*------------------------------------------------------------------------------
 2 Name:      HistoryQueueProperty.cpp
 3 Project:   xmlBlaster.org
 4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
 5 ------------------------------------------------------------------------------*/
 6 
 7 /**
 8  * Helper class holding history queue properties.
 9  * <p />
10  * See ConnectQos for XML sysntax.
11  * @see org.xmlBlaster.client.qos.ConnectQos
12  */
13 
14 #include <util/qos/storage/HistoryQueueProperty.h>
15 #include <util/lexical_cast.h>
16 #include <util/Constants.h>
17 #include <util/Global.h>
18 
19 
20 
21 using namespace org::xmlBlaster::util;
22 using namespace std;
23 
24 namespace org { namespace xmlBlaster { namespace util { namespace qos { namespace storage {
25 
26 HistoryQueueProperty::HistoryQueueProperty(Global& global, const string& nodeId)
27    : QueuePropertyBase(global, nodeId)
28 {
29    ME = "HistoryQueueProperty";
30    setRelating(Constants::RELATING_HISTORY);
31    QueuePropertyBase::initialize(Constants::RELATING_HISTORY);
32 }
33 
34 HistoryQueueProperty::HistoryQueueProperty(const QueuePropertyBase& prop)
35    : QueuePropertyBase(prop)
36 {
37 }
38 
39 HistoryQueueProperty& HistoryQueueProperty::operator =(const QueuePropertyBase& prop)
40 {
41    copy(prop);
42    return *this;
43 }
44 
45 string HistoryQueueProperty::getSettings()
46 {
47    string ret;
48    ret += "type=" + getType() + " onOverflow=" + getOnOverflow() + " onFailure=" + getOnFailure() + " maxEntries=" + lexical_cast<std::string>(getMaxEntries());
49    return ret;
50 }
51 
52 bool HistoryQueueProperty::onOverflowDeadMessage()
53 {
54    if (Constants::ONOVERFLOW_DEADMESSAGE == getOnOverflow())
55       return true;
56    return false;
57 }
58 
59 }}}}} // namespace
60 
61 #ifdef _XMLBLASTER_CLASSTEST
62 
63 
64 using namespace std;
65 using namespace org::xmlBlaster::util::qos::storage;
66 
67 int main(int args, char* argv[])
68 {
69    try {
70 
71       Global& glob = Global::getInstance();
72       glob.initialize(args, argv);
73       HistoryQueueProperty prop(glob, "");
74 
75       cout << prop.toXml() << endl;
76    }
77    catch (...) {
78       cerr << "an exception occured in the main thread" << endl;
79    }
80 }
81 
82 #endif


syntax highlighted by Code2HTML, v. 0.9.1