Qore DataProvider Module Reference 2.7.5
Loading...
Searching...
No Matches
DataProvider.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
27namespace DataProvider {
30
31public:
33 const FactoryMap = {
34 "cdsrest": "CdsRestDataProvider",
35 "csvread": "CsvUtil",
36 "csvwrite": "CsvUtil",
37 "db": "DbDataProvider",
38 "elasticsearch": "ElasticSearchDataProvider",
39 "empathicbuilding": "EmpathicBuildingDataProvider",
40 "file": "FileDataProvider",
41 "filepoller": "FilePoller",
42 "fixedlengthread": "FixedLengthUtil",
43 "fixedlengthwrite": "FixedLengthUtil",
44 "ftpclient": "FtpClientDataProvider",
45 "ftppoller": "FtpPoller",
46 "google": "GoogleDataProvider",
47 "httpclient": "HttpClientDataProvider",
48 "mqtt": "MqttDataProvider",
49 "restclient": "RestClientDataProvider",
50 "salesforcerest": "SalesforceRestDataProvider",
51 "sax": "SaxDataProvider",
52 "servicenowrest": "ServiceNowRestDataProvider",
53 "smtpclient": "SmtpClient",
54
55 // provided by the xml module
56 "soap": "SoapDataProvider",
57
58 "swagger": "SwaggerDataProvider",
59 "wsclient": "WebSocketClient",
60 };
61
63 const TypeMap = {
64 "qore/ftp": "FtpPollerUtil",
65 "qore/sftp": "SftpPollerUtil",
66 "qore/fsevents": "FsEventPollerUtil",
67 };
68
70 const FactoryModuleList = keys (map {$1: True}, FactoryMap.iterator());
71 // "map" is used above to ensure that the values only appear once in the final list
72
73protected:
75 static hash<string, AbstractDataProviderFactory> factory_cache;
76
78 static hash<string, string> factory_module_map;
79
81 static Mutex factory_cache_lock();
82
85
87 static hash<string, string> type_module_map;
88
90
92 static bool allow_env_config = False;
93
95 static bool env_config_locked = False;
96
98 static hash<string, bool> mod_map;
99
100public:
101
103
108
111
113
120
122
132 static AbstractDataProvider getFactoryObjectWithTemplate(string path, *hash<auto> template_options, *hash<auto> options);
133
135
143 static AbstractDataProvider getFactoryObjectFromExample(string path, data example, *hash<auto> options);
144
146
154 static AbstractDataProvider getFactoryObjectFromExample(string path, InputStream example, *hash<auto> options);
155
157
162 static AbstractDataProvider getFactoryObject(string path, *hash<auto> options);
163
165
176
178
189
191protected:
192 static hash<FactoryInfo> getFactoryInfoFromString(string name);
193public:
194
195
197 static *list<string> listFactories();
198
201
203
211 static registerType(string path, AbstractDataProviderType type);
212
214
221 static *AbstractDataProviderType getType(string path);
222
224
234
237
239 static lockAllTypes();
240
242
246 static *list<string> listTypes();
247
250
253
256
259
262
264
267 static hash<auto> getInfoAsData(hash<auto> info0, *bool with_type_info);
268
270
275
277 static bool getAutoConfig();
278
280 static list<string> getPathList(string path);
281
283protected:
284 static checkRequest();
285public:
286
287
289protected:
290 static *string tryGetFactoryModuleName(string name);
291public:
292
293
295protected:
296 static *string tryGetTypeModuleName(string name);
297public:
298
299
301protected:
302 static *string tryGetModuleName(string name, string func, string type);
303public:
304
305
307protected:
308 static *DataProviderTypeEntry tryLoadTypeFromPath(list<string> type_path);
309public:
310
311
313protected:
314 static bool tryLoad(string module_str, *bool verbose);
315public:
316
317
319protected:
320 static *object loadFromEnvironment(string func, string type, *hash<SymbolInfo> info);
321public:
322
323
325protected:
326 static *object checkSymbol(hash<SymbolInfo> info);
327public:
328
329
331protected:
332 static bool checkInjection(object obj, hash<string, string> module_map);
333public:
334
335};
336
337// private hashdecls
338hashdecl SymbolInfo {
339 // symbol type
340 string type;
341 # symbol name
342 string name;
343}
344hashdecl FactoryInfo {
345 // factory name
346 string name;
347 # path to final data provider in factory
348 list<string> path_list;
349 # factory options
350 auto options;
351}
352};
Data provider factory class.
Definition: AbstractDataProviderFactory.qc.dox.h:68
The AbstractDataProvider class.
Definition: AbstractDataProvider.qc.dox.h:742
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:206
static *AbstractDataProviderType getType(string path)
Returns the given data provider type or NOTHING if not present.
static AbstractDataProviderType getTypeEx(string path)
Returns the given data provider type or throws an exception if not present.
static registerKnownFactories()
Registers all known data provider factories.
static *DataProviderTypeEntry tryLoadTypeFromPath(list< string > type_path)
Tries to load the given type.
static setAutoConfig()
Sets the flag that allows for automatic configuration from environment variables.
static AbstractDataProvider getFactoryObjectFromString(string name)
Returns a data provider object from the given factory string.
static checkRequest()
Sets the env_config_locked variable if not already set.
static registerFactory(AbstractDataProviderFactory factory)
Register a new data provider factory.
static *AbstractDataProviderFactory getFactory(string name)
Returns the given data provider factory or NOTHING if not present.
static AbstractDataProviderFactory getFactoryEx(string name)
Returns the given data provider factory or throws an exception if not present.
static Mutex factory_cache_lock()
data provider factory cache lock
static AbstractDataProvider getFactoryObjectWithTemplate(string path, *hash< auto > template_options, *hash< auto > options)
Returns a data provider object from the given factory, created with the given constructor options.
static loadProvidersFromEnvironment()
Loads data providers from the environment.
static DataProviderTypeCache getTypeCache()
Returns the data provider cache.
static registerType(string path, AbstractDataProviderType type)
Register a new data provider type.
static AbstractDataProvider getFactoryObjectFromStringUseEnv(string name)
Returns a data provider object from the given factory string using environment variables to find the ...
static list< string > getPathList(string path)
Returns a list of strings in a path separated by "/" characters.
static *list< string > listTypes()
Returns a list of registered data provider type paths.
static *string tryGetModuleName(string name, string func, string type)
Tries to load a module corresponding to the given factory.
static bool checkInjection(object obj, hash< string, string > module_map)
Check if the object is from a module that has been subject to dependency injections.
static hash< string, string > type_module_map
data provider type module map
Definition: DataProvider.qc.dox.h:87
static AbstractDataProvider getFactoryObjectFromExample(string path, InputStream example, *hash< auto > options)
Returns a data provider object from the given factory, created with the given options and example dat...
static loadTypesFromEnvironment()
Loads data types from the environment.
static hash< string, AbstractDataProviderFactory > factory_cache
data provider factory cache
Definition: DataProvider.qc.dox.h:75
static *object checkSymbol(hash< SymbolInfo > info)
Returns True if an object of the given type has been loaded.
static DataProviderTypeCache type_cache()
data provider data type cache
static bool tryLoad(string module_str, *bool verbose)
Try to load the given module.
static AbstractDataProvider getFactoryObjectFromExample(string path, data example, *hash< auto > options)
Returns a data provider object from the given factory, created with the given options and example dat...
static *list< string > listFactories()
Returns a list of registered data provider factories.
static DataProviderTypeEntry getTypeRoot()
Returns the root type entry.
static registerKnownTypes()
Registers all known data provider types.
static hash< FactoryInfo > getFactoryInfoFromString(string name)
Returns a hash of factory information from a string.
static lockAllTypes()
Locks all types.
static *AbstractDataProvider tryLoadProviderForConnectionFromEnv(string name)
Tries to load a data provider from the environment from the connection name.
static hash< string, bool > mod_map
set of module already loaded
Definition: DataProvider.qc.dox.h:98
static AbstractDataProvider getFactoryObject(string path, *hash< auto > options)
Returns a data provider object from the given factory, created with the given constructor options.
static *string tryGetTypeModuleName(string name)
Tries to load a module corresponding to the given factory.
static hash< auto > getInfoAsData(hash< auto > info0, *bool with_type_info)
Converts an info hash with objects to a hash with string descriptions instead of the objects.
static hash< string, string > factory_module_map
data provider factory module map
Definition: DataProvider.qc.dox.h:78
static bool getAutoConfig()
Returns the auto config flag.
static *object loadFromEnvironment(string func, string type, *hash< SymbolInfo > info)
Loads modules from the QORE_DATA_PROVIDERS environment variable.
static *string tryGetFactoryModuleName(string name)
Tries to load a module corresponding to the given factory.
Data provider type cache class.
Definition: DataProviderTypeCache.qc.dox.h:29
the DataProviderTypeEntry class
Definition: DataProviderTypeEntry.qc.dox.h:58
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:27