1 /*------------------------------------------------------------------------------
2 Name: I_XmlBlasterConnection.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 Comment: Interface (virtual class)
6 ------------------------------------------------------------------------------*/
7
8 /**
9 * Interface for XmlBlaster, the supported methods on c++ client side. This is
10 * a pure virtual class.
11 * <p />
12 * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>
13 */
14 #ifndef _CLIENT_PROTOCOL_I_XMLBLASTERCONNECTION_H
15 #define _CLIENT_PROTOCOL_I_XMLBLASTERCONNECTION_H
16
17 #include <string>
18 #include <vector>
19 #include <util/xmlBlasterDef.h>
20 #include <util/MessageUnit.h>
21 #include <util/qos/ConnectQos.h>
22 #include <util/qos/DisconnectQos.h>
23 #include <client/qos/EraseQos.h>
24 #include <client/qos/EraseReturnQos.h>
25 #include <client/qos/GetQos.h>
26 #include <client/qos/GetReturnQos.h>
27 #include <client/qos/PublishQos.h>
28 #include <client/qos/PublishReturnQos.h>
29 #include <client/qos/SubscribeQos.h>
30 #include <client/qos/SubscribeReturnQos.h>
31 #include <client/qos/UnSubscribeQos.h>
32 #include <client/qos/UnSubscribeReturnQos.h>
33 #include <client/key/EraseKey.h>
34 #include <client/key/GetKey.h>
35 #include <client/key/GetReturnKey.h>
36 #include <client/key/PublishKey.h>
37 #include <client/key/SubscribeKey.h>
38 #include <client/key/UnSubscribeKey.h>
39
40 /* Would be nicer to declare only instead of including them all:
41 namespace org { namespace xmlBlaster { namespace util {
42 class MessageUnit;
43 }}}
44
45 namespace org { namespace xmlBlaster { namespace client { namespace qos {
46 class EraseQos;
47 class EraseReturnQos;
48 class GetQos;
49 class GetReturnQos;
50 class PublishQos;
51 class PublishReturnQos;
52 class SubscribeQos;
53 class SubscribeReturnQos;
54 class UnSubscribeQos;
55 class UnSubscribeReturnQos; // is a typedef -> would all compilers eat it?
56 }}}}
57
58 namespace org { namespace xmlBlaster { namespace client { namespace key {
59 class EraseKey;
60 class GetKey;
61 class GetReturnKey;
62 class PublishKey;
63 class SubscribeKey;
64 class UnSubscribeKey;
65 }}}}
66 */
67
68 namespace org { namespace xmlBlaster { namespace client { namespace protocol {
69
70 class Dll_Export I_XmlBlasterConnection
71 {
72 public:
73 virtual ~I_XmlBlasterConnection() {}
74
75 /**
76 * connect() is a login or authentication as well, the authentication schema
77 * is transported in the qos.
78 *
79 * @param qos The authentication and other informations
80 * @param client A handle to your callback if desired or null
81 * @return org::xmlBlaster::util::qos::ConnectReturnQos
82 */
83 virtual org::xmlBlaster::util::qos::ConnectReturnQosRef connect(const org::xmlBlaster::util::qos::ConnectQosRef& qos) = 0;
84
85 /**
86 * Logout from xmlBlaster.
87 * @param qos The QoS or null
88 */
89 virtual bool disconnect(const org::xmlBlaster::util::qos::DisconnectQos& qos) = 0;
90
91 // Could make sense to the SOCKET driver, returns new SocketCallbackImpl
92 //public org::xmlBlaster::client::I_CallbackServer getCbServerInstance() throws org::xmlBlaster::util::XmlBlasterException;
93
94 /**
95 * @return The connection protocol name "IOR" or "SOCKET" etc.
96 */
97 virtual std::string getProtocol() = 0;
98
99 /**
100 * Is called when we disconnect or automatically when
101 * are going to POLLING mode.
102 */
103 virtual bool shutdown() = 0;
104
105 virtual std::string getLoginName() = 0;
106
107 virtual bool isLoggedIn() = 0;
108
109 virtual std::string ping(const std::string& qos) = 0;
110
111 virtual org::xmlBlaster::client::qos::SubscribeReturnQos subscribe(const org::xmlBlaster::client::key::SubscribeKey& key, const org::xmlBlaster::client::qos::SubscribeQos& qos) = 0;
112
113 virtual std::vector<org::xmlBlaster::util::MessageUnit> get(const org::xmlBlaster::client::key::GetKey& key, const org::xmlBlaster::client::qos::GetQos& qos) = 0;
114
115 virtual std::vector<org::xmlBlaster::client::qos::UnSubscribeReturnQos>
116 unSubscribe(const org::xmlBlaster::client::key::UnSubscribeKey& key, const org::xmlBlaster::client::qos::UnSubscribeQos& qos) = 0;
117
118 virtual org::xmlBlaster::client::qos::PublishReturnQos publish(const org::xmlBlaster::util::MessageUnit& msgUnit) = 0;
119
120 virtual void publishOneway(const std::vector<org::xmlBlaster::util::MessageUnit> &msgUnitArr) = 0;
121
122 virtual std::vector<org::xmlBlaster::client::qos::PublishReturnQos> publishArr(const std::vector<org::xmlBlaster::util::MessageUnit> &msgUnitArr) = 0;
123
124 virtual std::vector<org::xmlBlaster::client::qos::EraseReturnQos> erase(const org::xmlBlaster::client::key::EraseKey& key, const org::xmlBlaster::client::qos::EraseQos& qos) = 0;
125 };
126
127 }}}} // namespaces
128
129 #endif
syntax highlighted by Code2HTML, v. 0.9.1