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 "restclient": "RestClientDataProvider",
48 "salesforcerest": "SalesforceRestDataProvider",
49 "sax": "SaxDataProvider",
50 "servicenowrest": "ServiceNowRestDataProvider",
51 "smtpclient": "SmtpClient",
52
53 // provided by the xml module
54 "soap": "SoapDataProvider",
55
56 "swagger": "SwaggerDataProvider",
57 "wsclient": "WebSocketClient",
58 };
59
61 const TypeMap = {
62 "qore/ftp": "FtpPollerUtil",
63 "qore/sftp": "SftpPollerUtil",
64 "qore/fsevents": "FsEventPollerUtil",
65 };
66
68 const FactoryModuleList = keys (map {$1: True}, FactoryMap.iterator());
69 // "map" is used above to ensure that the values only appear once in the final list
70
71protected:
73 static hash<string, AbstractDataProviderFactory> factory_cache;
74
76 static hash<string, string> factory_module_map;
77
79 static Mutex factory_cache_lock();
80
83
85 static hash<string, string> type_module_map;
86
88
90 static bool allow_env_config = False;
91
93 static bool env_config_locked = False;
94
96 static hash<string, bool> mod_map;
97
98public:
99
101
106
109
111
118
120
130 static AbstractDataProvider getFactoryObjectWithTemplate(string path, *hash<auto> template_options,
131 *hash<auto> options) {
132 AbstractDataProvider provider;
133 {
134 list<string> path_list = path.split("/");
135 provider = DataProvider::getFactoryEx(shift path_list).createWithTemplate(template_options, options);
136 map provider = provider.getChildProviderEx($1), path_list;
137 }
138 return provider;
139 }
140
142
150 static AbstractDataProvider getFactoryObjectFromExample(string path, data example, *hash<auto> options);
151
153
161 static AbstractDataProvider getFactoryObjectFromExample(string path, InputStream example, *hash<auto> options);
162
164
169 static AbstractDataProvider getFactoryObject(string path, *hash<auto> options);
170
172
183
185
196
198protected:
199 static hash<FactoryInfo> getFactoryInfoFromString(string name);
200public:
201
202
204 static *list<string> listFactories();
205
208
210
218 static registerType(string path, AbstractDataProviderType type);
219
221
228 static *AbstractDataProviderType getType(string path);
229
231
241
244
246 static lockAllTypes();
247
249
253 static *list<string> listTypes();
254
257
260
263
266
269
271
274 static hash<auto> getInfoAsData(hash<auto> info0, *bool with_type_info);
275
277
282
284 static bool getAutoConfig();
285
287 static list<string> getPathList(string path);
288
290protected:
291 static checkRequest();
292public:
293
294
296protected:
297 static *string tryGetFactoryModuleName(string name);
298public:
299
300
302protected:
303 static *string tryGetTypeModuleName(string name);
304public:
305
306
308protected:
309 static *string tryGetModuleName(string name, string func, string type);
310public:
311
312
314protected:
315 static *DataProviderTypeEntry tryLoadTypeFromPath(list<string> type_path);
316public:
317
318
320protected:
321 static bool tryLoad(string module_str, *bool verbose);
322public:
323
324
326protected:
327 static *object loadFromEnvironment(string func, string type, *hash<SymbolInfo> info);
328public:
329
330
332protected:
333 static *object checkSymbol(hash<SymbolInfo> info);
334public:
335
336
338protected:
339 static bool checkInjection(object obj, hash<string, string> module_map);
340public:
341
342};
343
344// private hashdecls
345hashdecl SymbolInfo {
346 // symbol type
347 string type;
348 # symbol name
349 string name;
350}
351hashdecl FactoryInfo {
352 // factory name
353 string name;
354 # path to final data provider in factory
355 list<string> path_list;
356 # factory options
357 auto options;
358}
359};
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:130
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:85
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:73
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:96
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:76
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