Loading...
Searching...
No Matches
ConnectionProvider::ConnectionSchemeCache Class Reference

Connection provider type cache class. More...

`#include <ConnectionSchemeCache.qc.dox.h>`

## Static Public Member Functions

static *hash< ConnectionSchemeInfo > | deregisterScheme (string scheme)
| Removes a scheme.
static bool | empty ()
| Returns True if the cache is empty, False if not.
static hash< string, hash< ConnectionSchemeInfo > > | get ()
| Returns the entire cache.
static *hash< auto > | getDefaultOptionValues (hash< ConnectionSchemeInfo > scheme_info)
| Returns default option values for the given connection scheme.
static *hash< auto > | getDefaultOptionValues (string scheme)
| Returns default option values for the given connection scheme.
static hash< string, hash< ConnectionSchemeInfo > > | getLoadAll ()
| Loads all possible schemes and returns the entire cache.
static *hash< ConnectionSchemeInfo > | getScheme (string scheme)
| Returns info for the given connection scheme or nothing if not present.
static hash< ConnectionSchemeInfo > | getSchemeEx (string scheme)
| Returns info for the given connection scheme or throws an exception if not present.
static *hash< ConnectionSchemeInfo > | getSchemeImpl (string scheme, bool throw_exception, *code scheme_loader)
| Returns info for the given connection scheme; either throws an exception if not present or returns NOTHING.
static *list< string > | listSchemes ()
| Returns a list of all cached schemes.
static | registerPendingScheme (string scheme, code init)
| Registers a scheme for deferred initialization / initialization on demand.
static bool | registerScheme (string scheme, hash< ConnectionSchemeInfo > entry)
| Register a new connection provider in the cache.
static int | size ()
| Returns the number of types in the cache.
static hash< auto > | validateConnectionOptions (string conn_name, hash< ConnectionSchemeInfo > scheme_info, hash< auto > options, bool check_required=True)
| Checks and returns options.
static hash< auto > | validateConnectionOptions (string conn_name, string scheme, hash< auto > options, bool check_required=True)
| Checks and returns options.

## Public Attributes

const | SchemeMap = ...
| Map of known connection schemes to modules.

## Static Protected Member Functions

static Mutex | lck ()
| Connection provider cache lock.
static bool | tryLoadModule (string mod, bool throw_exception)
| Try to load the given module.

## Static Protected Attributes

static hash< string, hash< ConnectionSchemeInfo > > | cache
| Connection provider cache.
static hash< string, code > | initmap
| Pending connection provider init handler map: scheme -> init handler.
static bool | load_all
| Load all flag.

## Static Private Member Functions

static | deregisterSchemeIntern (string scheme)
| Deregisters a scheme in case module intiialization fails for the module that registered it.

## Detailed Description

Connection provider type cache class.

## Member Function Documentation

## deregisterScheme()

static *hash< ConnectionSchemeInfo > ConnectionProvider::ConnectionSchemeCache::deregisterScheme | ( | string | scheme | ) |

static

Removes a scheme.

Parameters

  scheme | the scheme name

Returns
  the scheme definition, if it was deregistered

The caller must not be restricted with Qore::PO_NO_PROCESS_CONTROL

Exceptions

  PERMISSION-DENIED | Caller is restricted with Qore::PO_NO_PROCESS_CONTROL

## deregisterSchemeIntern()

static ConnectionProvider::ConnectionSchemeCache::deregisterSchemeIntern | ( | string | scheme | ) |

staticprivate

Deregisters a scheme in case module intiialization fails for the module that registered it.

Parameters

  scheme | the scheme for the connection provider

## getDefaultOptionValues() [1/2]

static *hash< auto > ConnectionProvider::ConnectionSchemeCache::getDefaultOptionValues | ( | hash< ConnectionSchemeInfo > | scheme_info | ) |

static

Returns default option values for the given connection scheme.

Parameters

  scheme_info | The connection scheme

Returns
  A hash of default options

Since
  ConnectionProvider 2.0

## getDefaultOptionValues() [2/2]

static *hash< auto > ConnectionProvider::ConnectionSchemeCache::getDefaultOptionValues | ( | string | scheme | ) |

static

Returns default option values for the given connection scheme.

Parameters

  scheme | The connection scheme name

Returns
  A hash of default options

Exceptions

  SCHEME-ERROR | unknown / unsupported scheme

Since
  ConnectionProvider 2.0

## getScheme()

static *hash< ConnectionSchemeInfo > ConnectionProvider::ConnectionSchemeCache::getScheme | ( | string | scheme | ) |

static

Returns info for the given connection scheme or nothing if not present.

Parameters

  scheme | the scheme for the connection

Returns
  info for the given connection scheme; NOTHING is returned if the scheme is not registered

## getSchemeEx()

static hash< ConnectionSchemeInfo > ConnectionProvider::ConnectionSchemeCache::getSchemeEx | ( | string | scheme | ) |

static

Returns info for the given connection scheme or throws an exception if not present.

Parameters

  scheme | the scheme for the connection provider

Returns
  info for the given connection scheme; an exception is thrown if the scheme is unknown

Exceptions

  SCHEME-ERROR | the scheme is unknown

## getSchemeImpl()

static *hash< ConnectionSchemeInfo > ConnectionProvider::ConnectionSchemeCache::getSchemeImpl | ( | string | scheme,
|  | bool | throw_exception,
|  | *code | scheme_loader )

static

Returns info for the given connection scheme; either throws an exception if not present or returns NOTHING.

Parameters

  scheme | the scheme for the connection provider
  throw_exception | if True then an exception is thrown if the scheme cannot be resolved, otherwise NOTHING is returned
  scheme_loader | a closure taking a string scheme argument and returning `*hash<ConnectionSchemeInfo>`

Returns
  info for the given connection scheme or NOTHING is returned if the scheme cannot be resolved and the throw_exception argument is False

Exceptions

  SCHEME-ERROR | the scheme is unknown; only thrown if the throw_exception argument is True

## registerPendingScheme()

static ConnectionProvider::ConnectionSchemeCache::registerPendingScheme | ( | string | scheme,
|  | code | init )

static

Registers a scheme for deferred initialization / initialization on demand.

Parameters

  scheme | the scheme to register
  init | the initialization code that will register the scheme

## registerScheme()

static bool ConnectionProvider::ConnectionSchemeCache::registerScheme | ( | string | scheme,
|  | hash< ConnectionSchemeInfo > | entry )

static

Register a new connection provider in the cache.

Parameters

  scheme | the scheme for the connection provider
  entry | the new connection provider entry

Returns
  True if the connection was reigstered, False if there is already a registered connection with this scheme

## validateConnectionOptions() [1/2]

static hash< auto > ConnectionProvider::ConnectionSchemeCache::validateConnectionOptions | ( | string | conn_name,
|  | hash< ConnectionSchemeInfo > | scheme_info,
|  | hash< auto > | options,
|  | bool | check_required = True )

static

Checks and returns options.

Parameters

  conn_name | The connection name, for error reporting only
  scheme_info | The connection scheme
  options | The options to validate
  check_required | Check required options?

Returns
  Options after validation

Exceptions

  CONNECTION-OPTION-ERROR | missing or invalid connection option

Since
  ConnectionProvider 2.0

## validateConnectionOptions() [2/2]

static hash< auto > ConnectionProvider::ConnectionSchemeCache::validateConnectionOptions | ( | string | conn_name,
|  | string | scheme,
|  | hash< auto > | options,
|  | bool | check_required = True )

static

Checks and returns options.

Parameters

  conn_name | The connection name, for error reporting only
  scheme | The connection scheme name
  options | The options to validate
  check_required | Check required options?

Returns
  Options after validation

Exceptions

  CONNECTION-OPTION-ERROR | missing or invalid connection option

Since
  ConnectionProvider 2.0