00001 /*------------------------------------------------------------------------------ 00002 Name: MsgQosData.h 00003 Project: xmlBlaster.org 00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file 00005 ------------------------------------------------------------------------------*/ 00006 00031 #ifndef _XMLBLASTER_UTIL_QOS_MSGQOSDATA_H 00032 #define _XMLBLASTER_UTIL_QOS_MSGQOSDATA_H 00033 00034 #include <util/xmlBlasterDef.h> 00035 #include <util/qos/QosData.h> 00036 00037 #include <util/Destination.h> 00038 #include <util/qos/TopicProperty.h> 00039 #include <util/cluster/RouteInfo.h> 00040 #include <util/cluster/NodeId.h> 00041 #include <util/Prop.h> 00042 #include <vector> 00043 #include <string> 00044 00045 namespace org { namespace xmlBlaster { namespace util { namespace qos { 00046 00047 class Dll_Export MsgQosData : public QosData 00048 { 00049 private: 00050 00051 mutable bool isExpired_; // = false; // cache the expired state for performance reasons 00052 00053 org::xmlBlaster::util::qos::TopicProperty* topicProperty_; 00054 // TODO: Change to use glob instead of org::xmlBlaster::util::Global singleton! What about performance? Put variable into org::xmlBlaster::util::Global? 00062 long maxLifeTime_; 00063 00064 /* 00065 { 00066 return org::xmlBlaster::util::Global.instance().getProperty().get("message.maxLifeTime", -1L); 00067 } 00068 */ 00069 00071 std::string subscriptionId_; 00072 00073 Prop<bool> subscribable_; 00074 00076 int redeliver_; 00077 long queueIndex_; // = -1L; 00078 long queueSize_; // = -1L; 00079 00086 Prop<bool> forceUpdate_; // = DEFAULT_forceUpdate; 00087 Prop<bool> forceDestroy_; 00088 00094 long lifeTime_; // = -1; 00095 00096 long remainingLifeStatic_; // = -1; 00097 00098 void init(); 00099 00100 protected: 00104 std::vector<Destination> destinationList_; 00105 00106 00107 // TODO: Pass with client QoS!!! 00108 bool receiveTimestampHumanReadable_; // = org::xmlBlaster::util::Global.instance().getProperty().get("cb.receiveTimestampHumanReadable", false); 00109 00110 void copy(const MsgQosData& data); 00111 00112 public: 00117 // long size_; 00118 00119 MsgQosData(org::xmlBlaster::util::Global& global, const std::string& serialData=""); 00120 00121 MsgQosData(const MsgQosData& data); 00122 00123 MsgQosData& operator=(const MsgQosData& data); 00124 00125 virtual ~MsgQosData(); 00126 00132 void setSubscribable(const bool isSubcribeable); 00133 00139 bool isSubscribable() const; 00140 00147 bool isPtp() const; 00148 00152 void setVolatile(bool volatileFlag); 00153 00157 bool isVolatile() const; 00158 00162 bool isVolatileDefault() const; 00163 00168 void setSubscriptionId(const std::string& subscriptionId); 00169 00174 std::string getSubscriptionId() const; 00175 00180 void setForceUpdate(bool forceUpdate); 00181 00185 bool isForceUpdate() const; 00186 00190 void setReadonly(bool readonly); 00191 00195 bool isReadonly() const; 00196 00201 void setRedeliver(int redeliver); 00202 00206 void incrRedeliver(); 00207 00212 int getRedeliver() const; 00213 00217 void setQueueSize(long queueSize); 00218 00222 long getQueueSize() const; 00223 00227 void setQueueIndex(long queueIndex); 00228 00232 long getQueueIndex() const; 00233 00237 long getLifeTime()const; 00238 00242 void setLifeTime(long lifeTime); 00243 00248 long getRemainingLife() const; 00249 00258 long getRemainingLifeStatic() const; 00259 00260 void setRemainingLifeStatic(long remainingLifeStatic); 00261 00265 bool isExpired() const; 00266 00272 long getMaxLifeTime() const; 00273 00280 std::string getXmlRcvTimestamp(); 00281 00285 void touchRcvTimestamp(); 00286 00295 std::vector<Destination> getDestinations() const; 00296 00301 void addDestination(const Destination& destination); 00302 00310 virtual std::string toXml(bool clearText, const std::string& extraOffset="") const; 00311 00312 virtual std::string toXml(const std::string& extraOffset="") const; 00313 00318 virtual MsgQosData* getClone() const; 00319 00320 void setTopicProperty(const org::xmlBlaster::util::qos::TopicProperty& prop); 00321 00322 org::xmlBlaster::util::qos::TopicProperty getTopicProperty(); 00323 00324 bool hasTopicProperty() const; 00325 00332 void setForceDestroy(bool forceDestroy); 00333 00334 bool isForceDestroy() const; 00335 00336 }; 00337 00338 }}}} 00339 00340 #endif