| Qore DataProvider Module Reference 2.7.1

DataProvider.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3
27 namespace DataProvider {
29 class DataProvider {
30
31 public:
33 const FactoryMap = {
34 "cdsrest": "CdsRestDataProvider",
35 "csvread": "CsvUtil",
36 "csvwrite": "CsvUtil",
37 "db": "DbDataProvider",
38 "file": "FileDataProvider",
39 "filepoller": "FilePoller",
40 "fixedlengthread": "FixedLengthUtil",
41 "fixedlengthwrite": "FixedLengthUtil",
42 "ftpclient": "FtpClientDataProvider",
43 "ftppoller": "FtpPoller",
44 "httpclient": "HttpClientDataProvider",
45 "restclient": "RestClientDataProvider",
46 "salesforcerest": "SalesforceRestDataProvider",
47 "sax": "SaxDataProvider",
48 "servicenowrest": "ServiceNowRestDataProvider",
49 "smtpclient": "SmtpClient",
50
51 // provided by the xml module
52 "soap": "SoapDataProvider",
53
54 "swagger": "SwaggerDataProvider",
55 "wsclient": "WebSocketClient",
56 };
57
59 const TypeMap = {
60 "qore/ftp": "FtpPollerUtil",
61 "qore/sftp": "SftpPollerUtil",
62 "qore/fsevents": "FsEventPollerUtil",
63 };
64
66 const FactoryModuleList = keys (map {$1: True}, FactoryMap.iterator());
67 // "map" is used above to ensure that the values only appear once in the final list
68
69 protected:
71 static hash<string, AbstractDataProviderFactory> factory_cache;
72
74 static hash<string, string> factory_module_map;
75
77 static Mutex factory_cache_lock();
78
80 static DataProviderTypeCache type_cache();
81
83 static hash<string, string> type_module_map;
84
86
88 static bool allow_env_config = False;
89
91 static bool env_config_locked = False;
92
94 static hash<string, bool> mod_map;
95
96 public:
97
99
103 static registerFactory(AbstractDataProviderFactory factory);
104
106 static *AbstractDataProviderFactory getFactory(string name);
107
109
115 static AbstractDataProviderFactory getFactoryEx(string name);
116
118
128 static AbstractDataProvider getFactoryObjectWithTemplate(string path, *hash<auto> template_options,
129 *hash<auto> options) {
130 AbstractDataProvider provider;
131 {
132 list<string> path_list = path.split("/");
133 provider = DataProvider::getFactoryEx(shift path_list).createWithTemplate(template_options, options);
134 map provider = provider.getChildProviderEx($1), path_list;
135 }
136 return provider;
137 }
138
140
148 static AbstractDataProvider getFactoryObjectFromExample(string path, data example, *hash<auto> options);
149
151
159 static AbstractDataProvider getFactoryObjectFromExample(string path, InputStream example, *hash<auto> options);
160
162
167 static AbstractDataProvider getFactoryObject(string path, *hash<auto> options);
168
170
180 static AbstractDataProvider getFactoryObjectFromString(string name);
181
183
193 static AbstractDataProvider getFactoryObjectFromStringUseEnv(string name);
194
196 protected:
197 static hash<FactoryInfo> getFactoryInfoFromString(string name);
198 public:
199
200
202 static *list<string> listFactories();
203
205 static DataProviderTypeCache getTypeCache();
206
208
216 static registerType(string path, AbstractDataProviderType type);
217
219
226 static *AbstractDataProviderType getType(string path);
227
229
238 static AbstractDataProviderType getTypeEx(string path);
239
241 static DataProviderTypeEntry getTypeRoot();
242
244 static lockAllTypes();
245
247
251 static *list<string> listTypes();
252
254 static registerKnownFactories();
255
257 static loadProvidersFromEnvironment();
258
260 static *AbstractDataProvider tryLoadProviderForConnectionFromEnv(string name);
261
263 static registerKnownTypes();
264
266 static loadTypesFromEnvironment();
267
269
272 static hash<auto> getInfoAsData(hash<auto> info0, *bool with_type_info);
273
275
279 static setAutoConfig();
280
282 static bool getAutoConfig();
283
285 static list<string> getPathList(string path);
286
288 protected:
289 static checkRequest();
290 public:
291
292
294 protected:
295 static *string tryGetFactoryModuleName(string name);
296 public:
297
298
300 protected:
301 static *string tryGetTypeModuleName(string name);
302 public:
303
304
306 protected:
307 static *string tryGetModuleName(string name, string func, string type);
308 public:
309
310
312 protected:
313 static *DataProviderTypeEntry tryLoadTypeFromPath(list<string> type_path);
314 public:
315
316
318 protected:
319 static bool tryLoad(string module_str, *bool verbose);
320 public:
321
322
324 protected:
325 static *object loadFromEnvironment(string func, string type, *hash<SymbolInfo> info);
326 public:
327
328
330 protected:
331 static *object checkSymbol(hash<SymbolInfo> info);
332 public:
333
334
336 protected:
337 static bool checkInjection(object obj, hash<string, string> module_map);
338 public:
339
340 };
341
342 // private hashdecls
343 hashdecl SymbolInfo {
344 // symbol type
345 string type;
346 # symbol name
347 string name;
348 }
349 hashdecl FactoryInfo {
350 // factory name
351 string name;
352 # path to final data provider in factory
353 list<string> path_list;
354 # factory options
355 auto options;
356 }
357 };
DataProvider::AbstractDataProviderFactory
Data provider factory class.
Definition: AbstractDataProviderFactory.qc.dox.h:64
DataProvider::AbstractDataProvider
The AbstractDataProvider class.
Definition: AbstractDataProvider.qc.dox.h:732
DataProvider::AbstractDataProvider::getChildProviderEx
AbstractDataProvider getChildProviderEx(string name)
Returns the given child provider or throws an exception if the given child is unknown.
DataProvider::AbstractDataProviderType
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:187
DataProvider::DataProvider::getPathList
static list< string > getPathList(string path)
Returns a list of strings in a path separated by "/" characters.
DataProvider::DataProvider::getType
static *AbstractDataProviderType getType(string path)
Returns the given data provider type or NOTHING if not present.
DataProvider::DataProvider::getTypeEx
static AbstractDataProviderType getTypeEx(string path)
Returns the given data provider type or throws an exception if not present.
DataProvider::DataProvider::registerKnownFactories
static registerKnownFactories()
Registers all known data provider factories.
DataProvider::DataProvider::tryLoadTypeFromPath
static *DataProviderTypeEntry tryLoadTypeFromPath(list< string > type_path)
Tries to load the given type.
DataProvider::DataProvider::setAutoConfig
static setAutoConfig()
Sets the flag that allows for automatic configuration from environment variables.
DataProvider::DataProvider::getFactoryObjectFromString
static AbstractDataProvider getFactoryObjectFromString(string name)
Returns a data provider object from the given factory string.
DataProvider::DataProvider::checkRequest
static checkRequest()
Sets the env_config_locked variable if not already set.
DataProvider::DataProvider::listFactories
static *list< string > listFactories()
Returns a list of registered data provider factories.
DataProvider::DataProvider::registerFactory
static registerFactory(AbstractDataProviderFactory factory)
Register a new data provider factory.
DataProvider::DataProvider::getFactory
static *AbstractDataProviderFactory getFactory(string name)
Returns the given data provider factory or NOTHING if not present.
DataProvider::DataProvider::getFactoryEx
static AbstractDataProviderFactory getFactoryEx(string name)
Returns the given data provider factory or throws an exception if not present.
DataProvider::DataProvider::factory_cache_lock
static Mutex factory_cache_lock()
data provider factory cache lock
DataProvider::DataProvider::getFactoryObjectWithTemplate
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:128
DataProvider::DataProvider::loadProvidersFromEnvironment
static loadProvidersFromEnvironment()
Loads data providers from the environment.
DataProvider::DataProvider::getTypeCache
static DataProviderTypeCache getTypeCache()
Returns the data provider cache.
DataProvider::DataProvider::registerType
static registerType(string path, AbstractDataProviderType type)
Register a new data provider type.
DataProvider::DataProvider::getFactoryObjectFromStringUseEnv
static AbstractDataProvider getFactoryObjectFromStringUseEnv(string name)
Returns a data provider object from the given factory string using environment variables to find the ...
DataProvider::DataProvider::getFactoryInfoFromString
static hash< FactoryInfo > getFactoryInfoFromString(string name)
Returns a hash of factory information from a string.
DataProvider::DataProvider::tryGetModuleName
static *string tryGetModuleName(string name, string func, string type)
Tries to load a module corresponding to the given factory.
DataProvider::DataProvider::checkInjection
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.
DataProvider::DataProvider::type_module_map
static hash< string, string > type_module_map
data provider type module map
Definition: DataProvider.qc.dox.h:83
DataProvider::DataProvider::getFactoryObjectFromExample
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...
DataProvider::DataProvider::listTypes
static *list< string > listTypes()
Returns a list of registered data provider type paths.
DataProvider::DataProvider::getInfoAsData
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.
DataProvider::DataProvider::loadTypesFromEnvironment
static loadTypesFromEnvironment()
Loads data types from the environment.
DataProvider::DataProvider::factory_cache
static hash< string, AbstractDataProviderFactory > factory_cache
data provider factory cache
Definition: DataProvider.qc.dox.h:71
DataProvider::DataProvider::checkSymbol
static *object checkSymbol(hash< SymbolInfo > info)
Returns True if an object of the given type has been loaded.
DataProvider::DataProvider::type_cache
static DataProviderTypeCache type_cache()
data provider data type cache
DataProvider::DataProvider::tryLoad
static bool tryLoad(string module_str, *bool verbose)
Try to load the given module.
DataProvider::DataProvider::getFactoryObjectFromExample
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...
DataProvider::DataProvider::getTypeRoot
static DataProviderTypeEntry getTypeRoot()
Returns the root type entry.
DataProvider::DataProvider::registerKnownTypes
static registerKnownTypes()
Registers all known data provider types.
DataProvider::DataProvider::lockAllTypes
static lockAllTypes()
Locks all types.
DataProvider::DataProvider::tryLoadProviderForConnectionFromEnv
static *AbstractDataProvider tryLoadProviderForConnectionFromEnv(string name)
Tries to load a data provider from the environment from the connection name.
DataProvider::DataProvider::mod_map
static hash< string, bool > mod_map
set of module already loaded
Definition: DataProvider.qc.dox.h:94
DataProvider::DataProvider::getFactoryObject
static AbstractDataProvider getFactoryObject(string path, *hash< auto > options)
Returns a data provider object from the given factory, created with the given constructor options.
DataProvider::DataProvider::tryGetTypeModuleName
static *string tryGetTypeModuleName(string name)
Tries to load a module corresponding to the given factory.
DataProvider::DataProvider::factory_module_map
static hash< string, string > factory_module_map
data provider factory module map
Definition: DataProvider.qc.dox.h:74
DataProvider::DataProvider::getAutoConfig
static bool getAutoConfig()
Returns the auto config flag.
DataProvider::DataProvider::loadFromEnvironment
static *object loadFromEnvironment(string func, string type, *hash< SymbolInfo > info)
Loads modules from the QORE_DATA_PROVIDERS environment variable.
DataProvider::DataProvider::tryGetFactoryModuleName
static *string tryGetFactoryModuleName(string name)
Tries to load a module corresponding to the given factory.
DataProvider::DataProviderTypeCache
Data provider type cache class.
Definition: DataProviderTypeCache.qc.dox.h:29
DataProvider::DataProviderTypeEntry
the DataProviderTypeEntry class
Definition: DataProviderTypeEntry.qc.dox.h:58
True
const True
False
const False
type
string type(auto arg)
DataProvider
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:27