Qore DataProvider Module Reference 2.7.3
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 "httpclient": "HttpClientDataProvider",
47 "mqtt": "MqttDataProvider",
48 "restclient": "RestClientDataProvider",
49 "salesforcerest": "SalesforceRestDataProvider",
50 "sax": "SaxDataProvider",
51 "servicenowrest": "ServiceNowRestDataProvider",
52 "smtpclient": "SmtpClient",
53
54 // provided by the xml module
55 "soap": "SoapDataProvider",
56
57 "swagger": "SwaggerDataProvider",
58 "wsclient": "WebSocketClient",
59 };
60
62 const TypeMap = {
63 "qore/ftp": "FtpPollerUtil",
64 "qore/sftp": "SftpPollerUtil",
65 "qore/fsevents": "FsEventPollerUtil",
66 };
67
69 const FactoryModuleList = keys (map {$1: True}, FactoryMap.iterator());
70 // "map" is used above to ensure that the values only appear once in the final list
71
72protected:
74 static hash<string, AbstractDataProviderFactory> factory_cache;
75
77 static hash<string, string> factory_module_map;
78
80 static Mutex factory_cache_lock();
81
84
86 static hash<string, string> type_module_map;
87
89
91 static bool allow_env_config = False;
92
94 static bool env_config_locked = False;
95
97 static hash<string, bool> mod_map;
98
99public:
100
102
107
110
112
119
121
131 static AbstractDataProvider getFactoryObjectWithTemplate(string path, *hash<auto> template_options,
132 *hash<auto> options) {
133 AbstractDataProvider provider;
134 {
135 list<string> path_list = path.split("/");
136 provider = DataProvider::getFactoryEx(shift path_list).createWithTemplate(template_options, options);
137 map provider = provider.getChildProviderEx($1), path_list;
138 }
139 return provider;
140 }
141
143
151 static AbstractDataProvider getFactoryObjectFromExample(string path, data example, *hash<auto> options);
152
154
162 static AbstractDataProvider getFactoryObjectFromExample(string path, InputStream example, *hash<auto> options);
163
165
170 static AbstractDataProvider getFactoryObject(string path, *hash<auto> options);
171
173
184
186
197
199protected:
200 static hash<FactoryInfo> getFactoryInfoFromString(string name);
201public:
202
203
205 static *list<string> listFactories();
206
209
211
219 static registerType(string path, AbstractDataProviderType type);
220
222
229 static *AbstractDataProviderType getType(string path);
230
232
242
245
247 static lockAllTypes();
248
250
254 static *list<string> listTypes();
255
258
261
264
267
270
272
275 static hash<auto> getInfoAsData(hash<auto> info0, *bool with_type_info);
276
278
283
285 static bool getAutoConfig();
286
288 static list<string> getPathList(string path);
289
291protected:
292 static checkRequest();
293public:
294
295
297protected:
298 static *string tryGetFactoryModuleName(string name);
299public:
300
301
303protected:
304 static *string tryGetTypeModuleName(string name);
305public:
306
307
309protected:
310 static *string tryGetModuleName(string name, string func, string type);
311public:
312
313
315protected:
316 static *DataProviderTypeEntry tryLoadTypeFromPath(list<string> type_path);
317public:
318
319
321protected:
322 static bool tryLoad(string module_str, *bool verbose);
323public:
324
325
327protected:
328 static *object loadFromEnvironment(string func, string type, *hash<SymbolInfo> info);
329public:
330
331
333protected:
334 static *object checkSymbol(hash<SymbolInfo> info);
335public:
336
337
339protected:
340 static bool checkInjection(object obj, hash<string, string> module_map);
341public:
342
343};
344
345// private hashdecls
346hashdecl SymbolInfo {
347 // symbol type
348 string type;
349 # symbol name
350 string name;
351}
352hashdecl FactoryInfo {
353 // factory name
354 string name;
355 # path to final data provider in factory
356 list<string> path_list;
357 # factory options
358 auto options;
359}
360};
Data provider factory class.
Definition: AbstractDataProviderFactory.qc.dox.h:68
AbstractDataProvider createWithTemplate(*hash< auto > template_options, *hash< auto > options)
Creates an object from the given constructor options.
The AbstractDataProvider class.
Definition: AbstractDataProvider.qc.dox.h:742
AbstractDataProvider getChildProviderEx(string name)
Returns the given child provider or throws an exception if the given child is unknown.
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.
Definition: DataProvider.qc.dox.h:131
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:86
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:74
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:97
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:77
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