1 /*------------------------------------------------------------------------------
2 Name: MsgKeyData.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 ------------------------------------------------------------------------------*/
6
7 /**
8 * This class encapsulates the Message meta data and unique identifier (key)
9 * of a publish()/update() or get()-return message.
10 * <p />
11 * A typical key could look like this:<br />
12 * <pre>
13 * <key oid='4711' contentMime='text/xml'>
14 * <AGENT id='192.168.124.20' subId='1' type='generic'>
15 * <DRIVER id='FileProof' pollingFreq='10'>
16 * </DRIVER>
17 * </AGENT>
18 * </key>
19 * </pre>
20 * <br />
21 * Note that the AGENT and DRIVER tags are application know how, which you have
22 * to supply to the setClientTags() method.<br />
23 * A well designed xml hierarchy of your problem domain is essential for a proper working xmlBlaster
24 * <p />
25 * <p>
26 * If you haven't specified a key oid, there will be generated one automatically.
27 * </p>
28 * <p>
29 * NOTE: Message oid starting with "__" is reserved for internal usage.
30 * </p>
31 * <p>
32 * NOTE: Message oid starting with "_" is reserved for xmlBlaster plugins.
33 * </p>
34 * @see org.xmlBlaster.util.key.MsgKeySaxFactory
35 */
36
37 #ifndef _UTIL_KEY_MSGKEYDATA_H
38 #define _UTIL_KEY_MSGKEYDATA_H
39
40 #include <util/key/KeyData.h>
41 #include <string>
42
43 namespace org { namespace xmlBlaster { namespace util { namespace key {
44
45 class Dll_Export MsgKeyData : public KeyData
46 {
47 private:
48 std::string clientTags_;
49
50 public:
51
52 /**
53 * Minimal constructor.
54 */
55 MsgKeyData(org::xmlBlaster::util::Global& global);
56
57 MsgKeyData(const MsgKeyData& key);
58
59 MsgKeyData& operator =(const MsgKeyData& key);
60
61 /**
62 * @return never '' (empty), an oid is generated if it was empty.
63 */
64 std::string getOid() const;
65
66 /**
67 * Set client specific meta informations.
68 * <p />
69 * May be used to integrate your application tags, for example:
70 * <p />
71 * <pre>
72 *<key oid='4711' contentMime='text/xml'>
73 * <AGENT id='192.168.124.20' subId='1' type='generic'>
74 * <DRIVER id='FileProof' pollingFreq='10'>
75 * </DRIVER>
76 * </AGENT>
77 *</key>
78 * </pre>
79 * @param str Your tags in ASCII XML syntax
80 */
81 void setClientTags(const std::string& tags);
82
83 std::string getClientTags() const;
84
85 /**
86 * Dump state of this object into a XML ASCII std::string.
87 * <br>
88 * @param extraOffset indenting of tags for nice output
89 * @return internal state of the query as a XML ASCII std::string
90 */
91 std::string toXml(const std::string& extraOffset) const;
92 std::string toXml() const;
93
94 /**
95 * Allocate a clone.
96 * @return The caller needs to free it with 'delete'.
97 */
98 MsgKeyData* getClone() const;
99 };
100
101 }}}} // namespace
102
103 #endif
syntax highlighted by Code2HTML, v. 0.9.1