| Qore ConnectionProvider Module Reference 1.5

AbstractConnection.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
2 // Qore AbstractConnection class definition
3
4 /* AbstractConnection.qc Copyright 2016 - 2021 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24
26 namespace ConnectionProvider {
28
32 class AbstractConnection : public Serializable {
33
34 public:
36 string name;
37
39 string desc;
40
42 string url;
43
45 string safe_url;
46
48 *hash<auto> orig_opts;
49
51 *hash<auto> opts;
52
54 hash<auto> urlh;
55
57 date last_check;
58
60 string status = "not checked";
61
63 bool up = False;
64
66 bool monitor;
67
69 date updated;
70
72 bool loopback = False;
73
75 static *code post_processing;
76
78 bool enabled = True;
79
81 bool locked = False;
82
84 bool debug_data = False;
85
87 hash<auto> tags = {};
88
90 hash<auto> internal_info;
91
93
102 deprecated
103 constructor(string n_name, string n_desc, string n_url, bool n_monitor, *hash n_opts, hash n_urlh, *string n_safe_url, *bool n_enabled);
104
105
107
124 constructor(string name, string description, string url, hash<auto> attributes = {}, hash<auto> options = {});
125
126
128
132 hash<PingInfo> ping(bool throw_exception = False);
133
134
136 protected:
137 hash<PingInfo> pingIntern(hash<PingInfo> rv);
138 public:
139
140
142
148 hash<ConnectionInfo> getInfo(bool with_password = False);
149
150
152
157 hash<ConnectionInfo> getInfo(*hash<auto> opts);
158
159
161
165 hash<auto> getExtendedInfo(*hash<auto> opts);
166
167
169
171 hash<ConfigInfo> getConfigHash();
172
173
175 hash<ConnectionSchemeInfo> getConnectionSchemeInfo();
176
177
179 *hash<auto> getOptions();
180
181
183 *hash<auto> getRuntimeOptions();
184
185
187 *hash<auto> getDefaultOptions();
188
189
191 *hash<auto> getRealOptions();
192
193
195
197 object get(bool connect = True, *hash<auto> rtopts);
198
199
201
203 parseTextOptions();
204
205
207 hash<auto> getTags();
208
209
211 auto getTag(string tag);
212
213
215
217 auto getTagEx(string tag);
218
219
221
232 AbstractDataProvider getDataProvider();
233
234
236
245 bool hasDataProvider();
246
247
249
257 protected:
258 hash<UrlInfo> parseUrl(string url);
259 public:
260
261
263
276 protected:
277 string getSafeUrl(hash<auto> urlh);
278 public:
279
280
282
289 protected:
290 hash<auto> validateOptions(hash<auto> options);
291 public:
292
293
295
298 private:
299 constructorInit(string name, string description, string url, hash<auto> attributes, hash<auto> options);
300 public:
301
302
304 abstract string getType();
305
307
312 protected:
313 abstract object getImpl(bool connect = True, *hash<auto> rtopts);
314 public:
315 };
316 }; // ConnectionProvider namespace
ConnectionProvider::AbstractConnection::parseTextOptions
parseTextOptions()
this method is called when parsing connection file definitions from text files when loading into the ...
ConnectionProvider::AbstractConnection::getTag
auto getTag(string tag)
returns the value of the given tag or NOTHING if not present
ConnectionProvider::AbstractConnection::monitor
bool monitor
monitoring flag
Definition: AbstractConnection.qc.dox.h:66
date
date date(date dt)
ConnectionProvider::AbstractConnection::getExtendedInfo
hash< auto > getExtendedInfo(*hash< auto > opts)
Returns connection info plus any extended information returned by the connection. ...
ConnectionProvider::AbstractConnection::internal_info
hash< auto > internal_info
internal tags
Definition: AbstractConnection.qc.dox.h:90
ConnectionProvider::AbstractConnection::last_check
date last_check
date/time of last check/ping
Definition: AbstractConnection.qc.dox.h:57
ConnectionProvider::AbstractConnection::locked
bool locked
locked/unlocked flag
Definition: AbstractConnection.qc.dox.h:81
ConnectionProvider::AbstractConnection::getInfo
hash< ConnectionInfo > getInfo(bool with_password=False)
returns a ConnectionInfo hash of information about the connection
ConnectionProvider::AbstractConnection::getSafeUrl
string getSafeUrl(hash< auto > urlh)
creates a "safe" URL string with password information removed
ConnectionProvider::AbstractConnection::getOptions
*hash< auto > getOptions()
returns static / initialization options
True
const True
ConnectionProvider::AbstractConnection::constructor
deprecated constructor(string n_name, string n_desc, string n_url, bool n_monitor, *hash n_opts, hash n_urlh, *string n_safe_url, *bool n_enabled)
creates the AbstractConnection object
ConnectionProvider::AbstractConnection::name
string name
connection name
Definition: AbstractConnection.qc.dox.h:36
ConnectionProvider::AbstractConnection::urlh
hash< auto > urlh
broken down URL hash (as returned by Qore::parse_url())
Definition: AbstractConnection.qc.dox.h:54
ConnectionProvider::AbstractConnection::getConnectionSchemeInfo
hash< ConnectionSchemeInfo > getConnectionSchemeInfo()
Returns a default ConnectionSchemeInfo hash.
ConnectionProvider::AbstractConnection::opts
*hash< auto > opts
connection options
Definition: AbstractConnection.qc.dox.h:51
ConnectionProvider::AbstractConnection::post_processing
static *code post_processing
optional code for default post-processing of objects created by getImpl(); must take the connection o...
Definition: AbstractConnection.qc.dox.h:75
ConnectionProvider::AbstractConnection::ping
hash< PingInfo > ping(bool throw_exception=False)
returns a hash with the results of the ping operation
False
const False
ConnectionProvider::AbstractConnection::status
string status
status string; in case of a connection error this string will be the error string ...
Definition: AbstractConnection.qc.dox.h:60
ConnectionProvider::AbstractConnection::tags
hash< auto > tags
connection tags; user-defined key-value pairs
Definition: AbstractConnection.qc.dox.h:87
ConnectionProvider::AbstractConnection::hasDataProvider
bool hasDataProvider()
returns True if the connection returns a data provider with the getDataProvider() method ...
ConnectionProvider::AbstractConnection
abstract base class for connections
Definition: AbstractConnection.qc.dox.h:32
ConnectionProvider::AbstractConnection::getDataProvider
AbstractDataProvider getDataProvider()
returns a data provider object for this connection, if supported
ConnectionProvider::AbstractConnection::safe_url
string safe_url
"safe" URL (password information removed)
Definition: AbstractConnection.qc.dox.h:45
ConnectionProvider::AbstractConnection::getRealOptions
*hash< auto > getRealOptions()
returns options for saving the connection&#39;s configuration information
ConnectionProvider::AbstractConnection::enabled
bool enabled
enabled/disabled indicator flag
Definition: AbstractConnection.qc.dox.h:78
ConnectionProvider::AbstractConnection::getTagEx
auto getTagEx(string tag)
returns the value of the given tag or throws an exception if the tag is not set with a value ...
ConnectionProvider::AbstractConnection::constructorInit
constructorInit(string name, string description, string url, hash< auto > attributes, hash< auto > options)
Common construtor implementation.
ConnectionProvider::AbstractConnection::getImpl
abstract object getImpl(bool connect=True, *hash< auto > rtopts)
this method must return the connection object corresponding to the object&#39;s configuration ...
ConnectionProvider::AbstractConnection::getType
abstract string getType()
returns the string type name for the connection object
ConnectionProvider::AbstractConnection::getConfigHash
hash< ConfigInfo > getConfigHash()
returns a ConfigInfo hash of static configuration information about the connection ...
ConnectionProvider::AbstractConnection::getTags
hash< auto > getTags()
returns all tags associated with the connection
ConnectionProvider::AbstractConnection::desc
string desc
connection description
Definition: AbstractConnection.qc.dox.h:39
hash
hash< auto > hash(object obj)
ConnectionProvider::AbstractConnection::updated
date updated
date/time of last update
Definition: AbstractConnection.qc.dox.h:69
ConnectionProvider::AbstractConnection::validateOptions
hash< auto > validateOptions(hash< auto > options)
performs options validation in the constructor
ConnectionProvider::AbstractConnection::parseUrl
hash< UrlInfo > parseUrl(string url)
Parse the URL to a hash.
ConnectionProvider::AbstractConnection::up
bool up
connection status flag; set by monitoring or explicit pings/connections
Definition: AbstractConnection.qc.dox.h:63
ConnectionProvider::AbstractConnection::getRuntimeOptions
*hash< auto > getRuntimeOptions()
returns runtime options
ConnectionProvider::AbstractConnection::url
string url
connection URL (potentially with password info)
Definition: AbstractConnection.qc.dox.h:42
ConnectionProvider::AbstractConnection::debug_data
bool debug_data
debug data flag; to be used an an indication for a higher-level implementation
Definition: AbstractConnection.qc.dox.h:84
ConnectionProvider::AbstractConnection::orig_opts
*hash< auto > orig_opts
original connection options
Definition: AbstractConnection.qc.dox.h:48
ConnectionProvider::AbstractConnection::pingIntern
hash< PingInfo > pingIntern(hash< PingInfo > rv)
performs the ping by executing get(); returns a PingInfo hash
ConnectionProvider::AbstractConnection::loopback
bool loopback
set to True for loopback connections
Definition: AbstractConnection.qc.dox.h:72
ConnectionProvider
the ConnectionProvider namespace. All classes used in the ConnectionProvider module should be inside ...
Definition: AbstractConnection.qc.dox.h:26
ConnectionProvider::AbstractConnection::getDefaultOptions
*hash< auto > getDefaultOptions()
returns default options