util/qos/storage/MsgUnitStoreProperty.cpp

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------------
00002 Name:      MsgUnitStoreProperty.cpp
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 ------------------------------------------------------------------------------*/
00006 
00014 #include <util/qos/storage/MsgUnitStoreProperty.h>
00015 #include <util/Constants.h>
00016 #include <util/lexical_cast.h>
00017 #include <util/Global.h>
00018 
00019 
00020 using namespace org::xmlBlaster::util;
00021 using namespace std;
00022 
00023 namespace org { namespace xmlBlaster { namespace util { namespace qos { namespace storage {
00024 
00025 MsgUnitStoreProperty::MsgUnitStoreProperty(Global& global, const string& nodeId)
00026    : QueuePropertyBase(global, nodeId)
00027 {
00028    ME = string("MsgUnitStoreProperty");
00029    relating_ = Constants::RELATING_MSGUNITSTORE;
00030    QueuePropertyBase::initialize(Constants::RELATING_MSGUNITSTORE);
00031 }
00032 
00033 MsgUnitStoreProperty::MsgUnitStoreProperty(const QueuePropertyBase& prop)
00034    : QueuePropertyBase(prop)
00035 {
00036 }
00037 
00038 MsgUnitStoreProperty& MsgUnitStoreProperty::operator =(const QueuePropertyBase& prop)
00039 {
00040    copy(prop);
00041    return *this;
00042 }
00043 
00044 
00045 bool MsgUnitStoreProperty::onOverflowDeadMessage()
00046 {
00047    if (Constants::ONOVERFLOW_DEADMESSAGE == getOnOverflow())
00048       return true;
00049    return false;
00050 }
00051 
00055 string MsgUnitStoreProperty::usage()
00056 {
00057    string text;
00058    text += "Control the MsgUnit storage properties:\n";
00059    text += "   -persistence/maxEntries       The maximum allowed number of messages in this storage [" + lexical_cast<std::string>(DEFAULT_maxEntriesDefault) + "].\n";
00060    text += "   -persistence/maxEntriesCache  The maximum allowed number of messages in the cache of this storage [" + lexical_cast<std::string>(DEFAULT_maxEntriesDefault) + "].\n";
00061    text += "   -persistence.maxBytes      The maximum size in bytes of this storage [" + lexical_cast<std::string>(DEFAULT_bytesDefault) + "].\n";
00062    text += "   -persistence.maxBytesCache The maximum size in bytes in the cache of this storage [" + lexical_cast<std::string>(DEFAULT_bytesCacheDefault) + "].\n";
00063  //text += "   -persistence.expires  If not otherwise noted a storage dies after these milliseconds [" + DEFAULT_expiresDefault + "].\n";
00064  //text += "   -persistence.onOverflow What happens if storage is full. " + Constants::ONOVERFLOW_BLOCK + " | " + Constants::ONOVERFLOW_DEADMESSAGE + " [" + DEFAULT_onOverflow + "]\n";
00065    text += "   -persistence.onOverflow What happens if storage is full [" + DEFAULT_onOverflow + "]\n";
00066    text += "   -persistence.onFailure  Error handling when history failed [" + DEFAULT_onFailure + "]\n";
00067    text += "   -persistence.type       The plugin type [" + DEFAULT_type + "]\n";
00068    text += "   -persistence.version    The plugin version [" + DEFAULT_version + "]\n";
00069    return text;
00070 }
00071 
00075 string MsgUnitStoreProperty::getRootTagName() const
00076 {
00077    return "persistence";
00078 }
00079 
00080 }}}}}
00081 
00082 #ifdef _XMLBLASTER_CLASSTEST
00083 
00084 
00085 using namespace std;
00086 using namespace org::xmlBlaster::util::qos::storage;
00087 
00088 int main(int args, char* argv[])
00089 {
00090    try {
00091 
00092       Global& glob = Global::getInstance();
00093       glob.initialize(args, argv);
00094       MsgUnitStoreProperty prop(glob, "");
00095 
00096       cout << prop.toXml() << endl;
00097    }
00098    catch (...) {
00099       cerr << "an exception occured in the main thread" << endl;
00100    }
00101 }
00102 
00103 #endif
00104 
00105