util/Destination.h

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------------
00002 Name:      Destination.h
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 Comment:   Holding destination address attributes
00006 -----------------------------------------------------------------------------*/
00007 
00008 #ifndef _UTIL_DESTINATION_H
00009 #define _UTIL_DESTINATION_H
00010  
00011 #include <util/xmlBlasterDef.h>
00012 #include <util/SessionName.h>
00013 #include <util/I_Log.h>
00014 #include <string>
00015 
00016 namespace org { namespace xmlBlaster { namespace util {
00017 
00023 class Dll_Export Destination
00024 {
00025 
00026 private:
00027 
00028    std::string ME;
00029    org::xmlBlaster::util::Global& global_;
00030    org::xmlBlaster::util::I_Log& log_;
00031 
00033    org::xmlBlaster::util::SessionNameRef sessionName_;
00035    std::string queryType_;
00037    bool forceQueuing_;
00038 
00039    void copy(const Destination& dest)
00040    {
00041       SessionName *p = new SessionName(global_, dest.sessionName_->getAbsoluteName());
00042       SessionNameRef r(p);
00043       sessionName_ = r;
00044 
00045       queryType_    = dest.queryType_;
00046       forceQueuing_ = dest.forceQueuing_;
00047    }
00048 
00049 public:
00050 
00054    Destination(org::xmlBlaster::util::Global& global,
00055                const org::xmlBlaster::util::SessionName& sessionName,
00056                const std::string &queryType="EXACT",
00057                bool forceQueuing=false);
00058 
00059    Destination(org::xmlBlaster::util::Global& global,
00060                const std::string& address="",
00061                const std::string &queryType="EXACT",
00062                bool forceQueuing=false);
00063 
00064     Destination(const Destination& dest);
00065 
00066     Destination& operator =(const Destination& dest);
00067 
00071    bool isXPathQuery() const;
00072 
00076    bool isExactAddress() const;
00077 
00081    bool forceQueuing() const;
00082 
00091    void forceQueuing(bool forceQueuing);
00092 
00093    /*
00094     * Set the destination address or the destination query std::string.
00095     * @param destination The destination address or the query std::string
00096    void setDestination(const org::xmlBlaster::util::SessionName& sessionName);
00097     */
00098 
00102    org::xmlBlaster::util::SessionNameRef getDestination() const;
00103 
00107    void setQueryType(const std::string &queryType);
00108 
00115    std::string toXml(const std::string &extraOffset="") const;
00116 };
00117 
00118 }}} // namespace
00119 
00120 #endif