Qore DataProvider Module Reference  2.5
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  "servicenowrest": "ServiceNowRestDataProvider",
48  "smtpclient": "SmtpClient",
49 
50  // provided by the xml module
51  "soap": "SoapDataProvider",
52 
53  "swagger": "SwaggerDataProvider",
54  "wsclient": "WebSocketClient",
55  };
56 
58  const TypeMap = {
59  "qore/ftp": "FtpPollerUtil",
60  "qore/sftp": "SftpPollerUtil",
61  "qore/fsevents": "FsEventPollerUtil",
62  };
63 
65  const FactoryModuleList = keys (map {$1: True}, FactoryMap.iterator());
66  // "map" is used above to ensure that the values only appear once in the final list
67 
68 protected:
70  static hash<string, AbstractDataProviderFactory> factory_cache;
71 
73  static hash<string, string> factory_module_map;
74 
76  static Mutex factory_cache_lock();
77 
80 
82  static hash<string, string> type_module_map;
83 
85 
87  static bool allow_env_config = False;
88 
90  static bool env_config_locked = False;
91 
93  static hash<string, bool> mod_map;
94 
95 public:
96 
98 
103 
105  static __7_ AbstractDataProviderFactory getFactory(string name);
106 
108 
115 
117 
122  static AbstractDataProvider getFactoryObject(string path, __7_ hash<auto> options);
123 
125 
136 
138 
149 
151 protected:
152  static hash<FactoryInfo> getFactoryInfoFromString(string name);
153 public:
154 
155 
157  static __7_ list<string> listFactories();
158 
161 
163 
172 
174 
181  static __7_ AbstractDataProviderType getType(string path);
182 
184 
193  static AbstractDataProviderType getTypeEx(string path);
194 
197 
199  static lockAllTypes();
200 
202 
206  static __7_ list<string> listTypes();
207 
210 
213 
216 
219 
222 
224 
227  static hash<auto> getInfoAsData(hash<auto> info0, __7_ bool with_type_info);
228 
230 
234  static setAutoConfig();
235 
237  static bool getAutoConfig();
238 
240  static list<string> getPathList(string path);
241 
243 protected:
244  static checkRequest();
245 public:
246 
247 
249 protected:
250  static __7_ string tryGetFactoryModuleName(string name);
251 public:
252 
253 
255 protected:
256  static __7_ string tryGetTypeModuleName(string name);
257 public:
258 
259 
261 protected:
262  static __7_ string tryGetModuleName(string name, string func, string type);
263 public:
264 
265 
267 protected:
268  static __7_ DataProviderTypeEntry tryLoadTypeFromPath(list<string> type_path);
269 public:
270 
271 
273 protected:
274  static bool tryLoad(string module_str, __7_ bool verbose);
275 public:
276 
277 
279 protected:
280  static __7_ object loadFromEnvironment(string func, string type, __7_ hash<SymbolInfo> info);
281 public:
282 
283 
285 protected:
286  static __7_ object checkSymbol(hash<SymbolInfo> info);
287 public:
288 
289 
291 protected:
292  static bool checkInjection(object obj, hash<string, string> module_map);
293 public:
294 
295 };
296 
297 // private hashdecls
298 hashdecl SymbolInfo {
299  // symbol type
300  string type;
301  # symbol name
302  string name;
303 }
304 hashdecl FactoryInfo {
305  // factory name
306  string name;
307  # path to final data provider in factory
308  list<string> path_list;
309  # factory options
310  auto options;
311 }
312 };
Data provider factory class.
Definition: AbstractDataProviderFactory.qc.dox.h:62
The AbstractDataProvider class.
Definition: AbstractDataProvider.qc.dox.h:692
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:187
static list< string > getPathList(string path)
Returns a list of strings in a path separated by "/" characters.
static __7_ 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 __7_ 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 __7_ list< string > listFactories()
Returns a list of registered data provider factories.
static registerFactory(AbstractDataProviderFactory factory)
Register a new data provider factory.
static __7_ 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 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 hash< FactoryInfo > getFactoryInfoFromString(string name)
Returns a hash of factory information from a string.
static __7_ 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:82
static __7_ list< string > listTypes()
Returns a list of registered data provider type paths.
static hash< auto > getInfoAsData(hash< auto > info0, __7_ bool with_type_info)
Converts an info hash with objects to a hash with string descriptions instead of the objects.
static loadTypesFromEnvironment()
Loads data types from the environment.
static hash< string, AbstractDataProviderFactory > factory_cache
data provider factory cache
Definition: DataProvider.qc.dox.h:70
static __7_ 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, __7_ bool verbose)
Try to load the given module.
static DataProviderTypeEntry getTypeRoot()
Returns the root type entry.
static registerKnownTypes()
Registers all known data provider types.
static lockAllTypes()
Locks all types.
static __7_ 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:93
static AbstractDataProvider getFactoryObject(string path, __7_ hash< auto > options)
Returns a data provider object from the given factory, created with the given constructor options.
static __7_ string tryGetTypeModuleName(string name)
Tries to load a module corresponding to the given factory.
static hash< string, string > factory_module_map
data provider factory module map
Definition: DataProvider.qc.dox.h:73
static bool getAutoConfig()
Returns the auto config flag.
static __7_ object loadFromEnvironment(string func, string type, __7_ hash< SymbolInfo > info)
Loads modules from the QORE_DATA_PROVIDERS environment variable.
static __7_ 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
const True
const False
string type(auto arg)
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:27