1 /*------------------------------------------------------------------------------
  2 Name:      PublishReturnQos.h
  3 Project:   xmlBlaster.org
  4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
  5 ------------------------------------------------------------------------------*/
  6 
  7 /**
  8  * Handling the returned QoS (quality of service) of a publish() call.
  9  * <p />
 10  * If you are a Java client and use the XmlBlasterConnection helper class
 11  * you get this object as the publish() return value.
 12  * <p />
 13  * Example:
 14  * <pre>
 15  *   &lt;qos>
 16  *     &lt;state id='OK' info='QUEUED[bilbo]'/>
 17  *     &lt;key oid='HelloWorld'/>
 18  *  &lt;/qos>
 19  * </pre>
 20  * @see org.xmlBlaster.test.classtest.qos.StatusQosFactoryTest
 21  * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.publish.html" target="others">the interface.publish requirement</a>
 22  */
 23 
 24 #ifndef _CLIENT_QOS_PUBLISHRETURNQOS_H
 25 #define _CLIENT_QOS_PUBLISHRETURNQOS_H
 26 
 27 #include <util/qos/StatusQosData.h>
 28 
 29 namespace org { namespace xmlBlaster { namespace client { namespace qos {
 30 
 31 class Dll_Export PublishReturnQos
 32 {
 33 private:
 34    std::string        ME;
 35    org::xmlBlaster::util::Global&       global_;
 36    org::xmlBlaster::util::qos::StatusQosData data_;
 37 
 38 public:
 39 
 40    /**
 41     * Constructs the specialized quality of service object for status informations,
 42     * e.g. for a return of a subscribe() call
 43     * <p>
 44     * The state defaults to Constants::STATE_OK
 45     * </p>
 46     * @param The factory which knows how to serialize and parse me
 47     */
 48    PublishReturnQos(org::xmlBlaster::util::Global& global, const org::xmlBlaster::util::qos::StatusQosData& data);
 49 
 50    PublishReturnQos(org::xmlBlaster::util::Global& global);
 51 
 52    PublishReturnQos(const PublishReturnQos& data);
 53 
 54    PublishReturnQos operator =(const PublishReturnQos& data);
 55 
 56    /**
 57     * Access state of message on update().
 58     * @return "OK", "ERROR" etc. See Constants::java
 59     */
 60    std::string getState() const;
 61 
 62    /**
 63     * Sets the state (used when queuing messages and giving back the status to the client
 64     */
 65     void setState(const std::string& state);
 66 
 67    /**
 68     * Access state of message on update().
 69     * @return The human readable info text
 70     */
 71    std::string getStateInfo() const;
 72 
 73    /**
 74     * Access key oid. 
 75     * @return The unique identifier of a message
 76     */
 77    std::string getKeyOid() const;
 78 
 79    /**
 80     * Sets the soid (used when queuing messages and giving back the status to the client
 81     */
 82     void setKeyOid(const std::string& oid);
 83 
 84    /** 
 85     * The approximate receive timestamp (UTC time),
 86     * when message arrived in requestBroker.publish() method.<br />
 87     * In milliseconds elapsed since midnight, January 1, 1970 UTC
 88     */
 89    org::xmlBlaster::util::Timestamp getRcvTimestamp() const;
 90 
 91    /**
 92     * Dump state of this object into a XML ASCII std::string.
 93     * <br>
 94     * @param extraOffset indenting of tags for nice output
 95     * @return internal state of the status as a XML ASCII std::string
 96     */
 97    std::string toXml(const std::string& extraOffset="") const;
 98 
 99    org::xmlBlaster::util::qos::StatusQosData& getData();
100 };
101 
102 }}}} // namespace
103 
104 #endif


syntax highlighted by Code2HTML, v. 0.9.1