1 /*------------------------------------------------------------------------------
  2 Name:      MsgQosSaxFactory.h
  3 Project:   xmlBlaster.org
  4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
  5 ------------------------------------------------------------------------------*/
  6 
  7 /**
  8  * Parsing xml QoS (quality of service) of publish() and update(). 
  9  * <p>
 10  * See REQ interface.publish for a XML markup description
 11  * </p>
 12  * @see org.xmlBlaster.test.classtest.qos.MsgQosFactoryTest
 13  * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.publish.html">The interface.publish requirement</a>
 14  * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/engine.qos.publish.destination.PtP.html">The engine.qos.publish.destination.PtP requirement</a>
 15  * @author xmlBlaster@marcelruff.info
 16  */
 17 
 18 #ifndef _UTIL_QOS_MSGQOSFACTORY_H
 19 #define _UTIL_QOS_MSGQOSFACTORY_H
 20 
 21 #include <util/parser/XmlHandlerBase.h>
 22 #include <util/Destination.h>
 23 #include <util/qos/MsgQosData.h>
 24 #include <util/SessionName.h>
 25 #include <util/cluster/RouteInfo.h>
 26 #include <string>
 27 #include <util/qos/storage/QueuePropertyFactory.h>
 28 
 29 
 30 
 31 namespace org { namespace xmlBlaster { namespace util { namespace qos {
 32 
 33 class Dll_Export MsgQosFactory : public parser::XmlHandlerBase
 34 {
 35 private:
 36    std::string          ME;
 37    MsgQosData*          msgQosDataP_;
 38    Destination          destination_;
 39    org::xmlBlaster::util::cluster::RouteInfo routeInfo_;
 40    org::xmlBlaster::util::qos::storage::QueuePropertyFactory queuePropertyFactory_;
 41 
 42    /** helper flag for SAX parsing: parsing inside <state> ? */
 43    bool inState_; // QosData
 44    bool inSubscribe_;
 45    bool inRedeliver_;
 46    bool inTopic_;
 47    bool inQueue_;
 48    bool inPersistence_;
 49    bool inDestination_;
 50    bool inSender_;
 51    bool inPriority_;
 52    bool inAdministrative_;
 53    bool inClientProperty_;
 54    bool inExpiration_;
 55    bool inRcvTimestamp_; // QosData
 56    bool inIsVolatile_;
 57    bool inIsPersistent_; // QosData
 58    bool inReadonly_;
 59    bool inRoute_;  // QosData
 60    bool sendRemainingLife_;
 61    bool inQos_;
 62 
 63    std::string LIFE_TIME;
 64    std::string FORCE_DESTROY;
 65    std::string REMAINING_LIFE;
 66    std::string READ_ONLY;
 67    std::string DESTROY_DELAY;
 68    std::string CREATE_DOM_ENTRY;
 69    std::string NANOS;
 70    std::string ID;
 71    std::string STRATUM;
 72    std::string TIMESTAMP;
 73    std::string DIRTY_READ;
 74    std::string INDEX;
 75    std::string SIZE;
 76 
 77    ClientProperty* clientProperty_;
 78 
 79    // Private copy ctor and assignement
 80    MsgQosFactory(const MsgQosFactory& data);
 81    MsgQosFactory& operator=(const MsgQosFactory& data);
 82 
 83 public:
 84    /**
 85     * Can be used as singleton. 
 86     */
 87    MsgQosFactory(org::xmlBlaster::util::Global& global);
 88 
 89    ~MsgQosFactory();
 90 
 91    /**
 92     * Parses the given xml Qos and returns a MsgQosData holding the data. 
 93     * Parsing of update() and publish() QoS is supported here.
 94     * @param the XML based ASCII std::string
 95     */
 96    MsgQosData readObject(const std::string& xmlQos);
 97 
 98    /**
 99     * Start element, event from SAX parser.
100     * <p />
101     * @param name Tag name
102     * @param attrs the attributes of the tag
103     */
104    void startElement(const std::string &name, const parser::AttributeMap& attrs);
105 
106    /**
107     * Characters.
108     * The text between two tags, in the following example 'Hello':
109     * <key>Hello</key>. This method is different from the java version
110     * since the c++ parser always starts at the first character, so you
111     * don't specify start.
112     */
113    void characters(const std::string &ch);
114 
115    /**
116     * End element, event from SAX parser.
117     * <p />
118     * @param name Tag name
119     */
120    void endElement(const std::string &name);
121 
122    /** Configure if remaingLife is sent in Qos (redesign approach to work with all QoS attributes */
123    void sendRemainingLife(bool sendRemainingLife);
124    
125    bool sendRemainingLife();
126 
127 };
128 
129 }}}}
130 
131 #endif


syntax highlighted by Code2HTML, v. 0.9.1