Qore DataProvider Module Reference 3.1
Loading...
Searching...
No Matches
DataProvider.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
27namespace DataProvider {
38
41const DPO_EnableServers = (1 << 0);
42
44
48
50const DPO_AllOptions = ...;
51
53
56
57public:
59 const FactoryMap = ...;
60
61
63 const TypeMap = ...;
64
65
67 const FactoryModuleList = keys (map {$1: True}, FactoryMap.iterator());
68 // "map" is used above to ensure that the values only appear once in the final list
69
71 const NoApp = "$NO_APP";
72
73protected:
75 static hash<string, AbstractDataProviderFactory> factory_cache;
76
78 static hash<string, string> factory_module_map;
79
81 static Gate 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
101 static list<code> ilist;
102
104 static list<*list<code>> ilist_save;
105
107 static hash<string, code> smap;
108
110 static int options = 0;
111
113 static *LoggerInterface logger;
114
115public:
116
118
122 static setGlobalLogger(*LoggerInterface logger);
123
125
129 static *LoggerInterface getGlobalLogger();
130
132
138 static addOptions(int options);
139
141
147 static removeOptions(int options);
148
150
154 static int getOptions();
155
157
163 static setOptions(int options);
164
166
170 static checkOptions(int options);
171
173
178
181
183
190
192
202 static AbstractDataProvider getFactoryObjectWithTemplate(string path, *hash<auto> template_options, *hash<auto> options);
203
205
213 static AbstractDataProvider getFactoryObjectFromExample(string path, data example, *hash<auto> options);
214
216
224 static AbstractDataProvider getFactoryObjectFromExample(string path, InputStream example, *hash<auto> options);
225
227
232 static AbstractDataProvider getFactoryObject(string path, *hash<auto> options);
233
235
246
248
259
261protected:
262 static hash<FactoryInfo> getFactoryInfoFromString(string name);
263public:
264
265
267 static *list<string> listFactories();
268
271
273
281 static registerType(string path, AbstractDataProviderType type);
282
284
291 static *AbstractDataProviderType getType(string path);
292
294
304
307
309 static lockAllTypes();
310
312
316 static *list<string> listTypes();
317
320
322 static loadProvidersFromEnvironment(*LoggerInterface logger);
323
325 static *AbstractDataProvider tryLoadProviderForConnectionFromEnv(string name, *string subtype, *LoggerInterface logger);
326
329
331 static loadTypesFromEnvironment(*LoggerInterface logger);
332
334
337 static hash<auto> getInfoAsData(hash<auto> info0, *bool with_type_info);
338
340
345
347 static bool getAutoConfig();
348
350 static list<string> getPathList(string path);
351
353 static list<string> getPathList(reference<string> path);
354
356
358 static registerStaticInitializer(code init);
359
361
364
366
369
371
374
376protected:
377 synchronized static checkStaticInitIntern();
378public:
379
380
382
384 static shutdown();
385
387
392 static registerShutdownHandler(string key, code handler);
393
395
401 static bool deregisterShutdownHandler(string key);
402
404protected:
405 static checkRequest();
406public:
407
408
410protected:
411 static *string tryGetFactoryModuleName(string name);
412public:
413
414
416protected:
417 static *string tryGetTypeModuleName(string name);
418public:
419
420
422protected:
423 static *string tryGetModuleName(string name, string func, string type);
424public:
425
426
428protected:
429 static *DataProviderTypeEntry tryLoadTypeFromPath(list<string> type_path);
430public:
431
432
434protected:
435 static bool tryLoad(string module_str, *bool init);
436public:
437
438
440protected:
441 static *object loadFromEnvironment(string func, string type, *hash<SymbolInfo> info, *LoggerInterface logger);
442public:
443
444
446protected:
447 static *object checkSymbol(hash<SymbolInfo> info, *LoggerInterface logger);
448public:
449
450
452protected:
453 static bool checkInjection(object obj, hash<string, string> module_map);
454public:
455
456
458protected:
459 static deregisterFactory(string name);
460public:
461
462};
463
464// private hashdecls
465hashdecl SymbolInfo {
466 // symbol type
467 string type;
468 // symbol name
469 string name;
470 // subtype, if any
471 *string subtype;
472}
473hashdecl FactoryInfo {
474 // factory name
475 string name;
476 // path to final data provider in factory
477 list<string> path_list;
478 // factory options
479 auto options;
480}
481}
Data provider factory class.
Definition AbstractDataProviderFactory.qc.dox.h:68
The AbstractDataProvider class.
Definition AbstractDataProvider.qc.dox.h:917
describes a data type
Definition AbstractDataProviderType.qc.dox.h:139
static list< string > getPathList(reference< string > path)
Returns a list of strings in a path separated by "/" characters, normalizes the argument.
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 int getOptions()
Returns global data provider options.
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 *LoggerInterface logger
Global logger.
Definition DataProvider.qc.dox.h:113
static deferStaticInitialization()
Defers static initialization until restoreStaticInitialization() is called.
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 deregisterFactory(string name)
Deregisters a factory if an exception occurs during the other module's initialization.
static checkStaticInit()
Checks for static initialization.
static *object loadFromEnvironment(string func, string type, *hash< SymbolInfo > info, *LoggerInterface logger)
Loads modules from the QORE_DATA_PROVIDERS environment variable.
static Gate factory_cache_lock()
data provider factory cache lock
static AbstractDataProviderFactory getFactoryEx(string name)
Returns the given data provider factory or throws an exception if not present.
static list< code > ilist
Static initializer list.
Definition DataProvider.qc.dox.h:101
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 DataProviderTypeCache getTypeCache()
Returns the data provider cache.
static registerShutdownHandler(string key, code handler)
Registers a handler to run when shutting down data provider services.
static registerType(string path, AbstractDataProviderType type)
Register a new data provider type.
static checkOptions(int options)
Checks for valid global data provider options.
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 *LoggerInterface getGlobalLogger()
Returns the global data provider logger.
static *list< string > listTypes()
Returns a list of registered data provider type paths.
static restoreStaticInitialization()
Restores static initialization deferred by deferStaticInitialization()
static shutdown()
Shuts down background services related to data providers.
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 list< *list< code > > ilist_save
Deferred static initializers.
Definition DataProvider.qc.dox.h:104
static removeOptions(int options)
Removes the given global data provider options.
static hash< string, string > type_module_map
data provider type module map
Definition DataProvider.qc.dox.h:87
static addOptions(int options)
Adds the given global data provider options.
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 hash< string, code > smap
Shutdown handlers; key -> handler.
Definition DataProvider.qc.dox.h:107
static hash< string, AbstractDataProviderFactory > factory_cache
data provider factory cache
Definition DataProvider.qc.dox.h:75
static DataProviderTypeCache type_cache()
data provider data type cache
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 *AbstractDataProvider tryLoadProviderForConnectionFromEnv(string name, *string subtype, *LoggerInterface logger)
Tries to load a data provider from the environment from the connection name.
static *object checkSymbol(hash< SymbolInfo > info, *LoggerInterface logger)
Returns True if an object of the given type has been loaded.
static bool deregisterShutdownHandler(string key)
Deregisters a shutdown handler.
static registerKnownTypes()
Registers all known data provider types.
static hash< FactoryInfo > getFactoryInfoFromString(string name)
Returns a hash of factory information from a string.
static loadProvidersFromEnvironment(*LoggerInterface logger)
Loads data providers from the environment.
static lockAllTypes()
Locks all types.
static bool tryLoad(string module_str, *bool init)
Try to load the given module.
static setOptions(int options)
Replaces data provider global options with the value provided.
static loadTypesFromEnvironment(*LoggerInterface logger)
Loads data types from the environment.
static hash< string, bool > mod_map
set of module already loaded
Definition DataProvider.qc.dox.h:98
static registerStaticInitializer(code init)
Registers a static initializer.
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 setGlobalLogger(*LoggerInterface logger)
Sets or clears the global logger.
static bool getAutoConfig()
Returns the auto config flag.
static synchronized checkStaticInitIntern()
Checks for static initialization.
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:67
const DPO_EnableServers
Definition DataProvider.qc.dox.h:41
const DPO_DisableOnDemandInitialization
Disable on-demand initialization.
Definition DataProvider.qc.dox.h:47
const DPO_AllOptions
The mask of all data provider options.
Definition DataProvider.qc.dox.h:50
Qore AbstractDataField class definition.
Definition AbstractDataField.qc.dox.h:27