1 /*------------------------------------------------------------------------------
2 Name: UnSubscribeKey.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 ------------------------------------------------------------------------------*/
6
7 /**
8 * Wrap a XML key for an unSubscribe() invocation.
9 * <p>
10 * See QueryKeySaxFactory for a syntax description of the allowed xml structure
11 * </p>
12 * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.unSubscribe.html" target="others">the interface.unSubscribe requirement</a>
13 * @author <a href="mailto:xmlBlaster@marcelruff.info">Marcel Ruff</a>
14 * @author <a href="mailto:laghi@swissinfo.org">Michele Laghi</a>
15 */
16 #ifndef _CLIENT_KEY_UNSUBSCRIBEKEY_H
17 #define _CLIENT_KEY_UNSUBSCRIBEKEY_H
18
19 #include <util/key/QueryKeyData.h>
20 #include <util/Constants.h>
21
22 namespace org { namespace xmlBlaster { namespace client { namespace key {
23
24 class Dll_Export UnSubscribeKey
25 {
26 protected:
27 std::string ME;
28 org::xmlBlaster::util::Global& global_;
29 org::xmlBlaster::util::I_Log& log_;
30
31 /**
32 * subscribe(), get() and cluster configuration keys may contain a filter rule
33 */
34 org::xmlBlaster::util::key::QueryKeyData queryKeyData_;
35
36 public:
37
38 /**
39 * Minimal constructor.
40 */
41 UnSubscribeKey(org::xmlBlaster::util::Global& global);
42
43 UnSubscribeKey(org::xmlBlaster::util::Global& global, const std::string& query,
44 const std::string& queryType=org::xmlBlaster::util::Constants::EXACT);
45
46 UnSubscribeKey(org::xmlBlaster::util::Global& global, const org::xmlBlaster::util::key::QueryKeyData& data);
47
48 UnSubscribeKey(const UnSubscribeKey& key);
49
50 UnSubscribeKey& operator =(const UnSubscribeKey& key);
51
52 void setOid(const std::string& oid);
53
54 /**
55 * @return The key oid or "" if not set (see org::xmlBlaster::util::key::MsgKeyData.getOid() which generates the oid if it was "").
56 */
57 std::string getOid() const;
58
59 /**
60 * Access the query type "XPATH" or "EXACT"
61 * @return A queryType std::string or ""
62 */
63 std::string getQueryType() const;
64
65 /**
66 * Your XPath query std::string.
67 * @param str Your tags in ASCII XML syntax
68 */
69 void setQueryString(const std::string& tags);
70
71 std::string getQueryString() const;
72
73 /**
74 * Set the domain for this message, can be used for a simple grouping of
75 * messages to their master node with xmlBlaster clusters.
76 * @param The domain, any chosen std::string in your problem domain, e.g. "RUGBY" or "RADAR_TRACK"
77 * defaults to "" where the local xmlBlaster instance is the master of the message.
78 * @see <a href="http://www.xmlblaster.org/xmlBlaster/doc/requirements/cluster.html">The cluster requirement</a>
79 */
80 void setDomain(const std::string& domain);
81
82 /**
83 * Access the domain setting
84 * @return A domain std::string or null
85 */
86 std::string getDomain() const;
87
88 /**
89 * Access simplified URL like string.
90 *
91 * @return examples are "exact:hello", "xpath://key", "domain:sport"
92 */
93 std::string getUrl() const;
94
95 /**
96 * Dump state of this object into a XML ASCII std::string.
97 * <br>
98 * @param extraOffset indenting of tags for nice output
99 * @return internal state of the query as a XML ASCII std::string
100 */
101 std::string toXml(const std::string& extraOffset="") const;
102
103 /**
104 * May be used to integrate your application tags.
105 * @param str Your tags
106 * @return The ASCII XML key containing the key tag and your tags
107 */
108 std::string wrap(const std::string& str);
109
110 const org::xmlBlaster::util::key::QueryKeyData& getData() const;
111
112 };
113
114 }}}} // namespace
115
116 #endif
syntax highlighted by Code2HTML, v. 0.9.1