Loading...
Searching...
No Matches
DataProvider::DataProviderActionCatalog Class Reference

DataProvider action and application catalog class. More...

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

## Static Public Member Functions

static hash< DataProviderActionInfo > | checkAppActionOptions (string app, string action)
| Check that the action has had its options initialized if necessary and return the possibly updated action info.
static *int | checkName (string name)
| Checks for a valid name.
static int | compareActions (hash< DataProviderActionInfo > act0, hash< DataProviderActionInfo > act1)
| Compares two actions for equality.
static int | compareBaseTypes (*Type t0, *Type t1)
| Compares two types for equality.
static int | compareOptions (*hash< string, hash< ActionOptionInfo > > opt0, *hash< string, hash< ActionOptionInfo > > opt1)
| Compares two option hashes for equality.
static *hash< DataProviderAppInfo > | deregisterDynamicApp (string name)
| Removes a dynamic data provider application.
static *hash< string, hash< DataProviderActionInfo > > | getActionHash (string app)
| Returns a hash of all actions for the given application.
static *hash< string, hash< DataProviderActionInfo > > | getActionHashEx (string app)
| Returns a hash of all actions for the given application.
static hash< string, hash< ActionOptionInfo > > | getActionOptionFromFields (hash< auto > fields, *hash< auto > additional_fields)
| Converts field definitions into option descriptions.
static *list< hash< DataProviderActionInfo > > | getActions (string app)
| Returns all actions for the given application.
static list< hash< DataProviderActionInfo > > | getActionsEx (string app)
| Returns all actions for the given application; throws an exception if the app is not registered.
static *list< hash< DataProviderActionInfo > > | getActionsForScheme (string scheme)
| Returns all actions for a particular connection scheme.
static *list< hash< DataProviderActionInfo > > | getAllActions ()
| Returns all actions in the cache.
static *list< hash< DataProviderAppInfo > > | getAllApps ()
| Returns all applications in the cache.
static *list< hash< DataProviderAppInfo > > | getAllAppsNoInit ()
| Returns all applications in the cache without initializing actions.
static *hash< DataProviderAppInfo > | getApp (string app)
| Returns the application definition for the given application name.
static *hash< DataProviderActionInfo > | getAppAction (string app, string action)
| Returns the action definition for the given application and action.
static hash< DataProviderActionInfo > | getAppActionEx (string app, string action)
| Returns the application definition for the given application name.
static hash< DataProviderAppInfo > | getAppEx (string app)
| Returns the application definition for the given application name.
static AbstractDataProvider | getDataProviderForAction (hash< DataProviderActionInfo > action, *reference< hash< auto > > options)
| Returns a data provider option for the given action and options.
static | registerAction (hash< DataProviderActionInfo > action)
| Registers a data provider action.
static | registerApp (hash< DataProviderAppInfo > app)
| Registers a data provider application.
static | registerPendingApp (string app, code init)
| Registers an app for deferred initialization / initialization on demand.
static | registerPendingAppAction (string app, string action, code init)
| Registers an app action for deferred initialization / initialization on demand.
static *list< hash< DataProviderActionInfo > > | searchActionRegex (string regex_pattern, int regex_options=RE_Caseless)
| Searches for actions whose descriptions match a regular expression pattern.
static *list< hash< DataProviderActionInfo > > | searchActionSubstr (string substr, bool ignore_case=True)
| Searches for actions whose descriptions match a substring.
static *list< hash< DataProviderActionInfo > > | searchAppActionRegex (string app, string regex_pattern, int regex_options=RE_Caseless)
| Searches for application actions whose descriptions match a regular expression pattern.
static *list< hash< DataProviderActionInfo > > | searchAppActionRegexEx (string app, string regex_pattern, int regex_options=RE_Caseless)
| Searches for application actions whose descriptions match a regular expression pattern.
static *list< hash< DataProviderActionInfo > > | searchAppActionSubstr (string app, string substr, bool ignore_case=True)
| Searches for application actions whose descriptions match a substring.
static *list< hash< DataProviderActionInfo > > | searchAppActionSubstrEx (string app, string substr, bool ignore_case=True)
| Searches for application actions whose descriptions match a substring.
static *list< hash< DataProviderAppInfo > > | searchAppRegex (string regex_pattern, int regex_options=RE_Caseless)
| Searches for applications whose names or descriptions match a regular expression pattern.
static *list< hash< DataProviderAppInfo > > | searchAppSubstr (string substr, bool ignore_case=True)
| Searches for applications whose names or descriptions match a substring.

## Public Attributes

const | RequiredActionKeys = ...
| Required action key set (without action_code and path_vars, which are checked separately)
const | RequiredAppKeys = ...
| Required application key set.

## Static Protected Member Functions

static | doInit (code init)
| Runs initialization and catches exceptions.
static Mutex | lck ()
| Mutex for atomic operations.
static string | normalizePath (string path)
| Returns a normalized path to ensure that comparisons always work.
static | resolveOutputTypes ()
| Resolves output fypes in actions.

## Protected Attributes

const | DefaultDescription = ""
| Default description.

## Static Protected Attributes

static hash< string, hash< string, hash< DataProviderActionInfo > > > | app_actionmap
| Action cache, the key is the application key, the second key is the action string.
static hash< string, hash< DataProviderAppInfo > > | appcache
| Top-level master application cache keyed by application name.
static hash< string, hash< string, code > > | initactionmap
| Pending application action init handler map: app -> action -> init handler.
static hash< string, code > | initmap
| Pending application init handler map: app -> init handler.
static hash< string, hash< string, bool > > | resolve_output_types
| Set of actions requiring output type resolution; app -> action -> True.
static hash< string, list< hash< DataProviderActionInfo > > > | smap
| Scheme map; keys are connection schemes.
static hash< string, hash< DataProviderActionInfo > > | top_actionmap
| Master action cache, the key <app>/<action>

## Static Private Member Functions

static *bool | deregisterApp (string name)
| Deregisters an app and all its actions if an exception occurs during the other module's initialization.
static *bool | deregisterAppIntern (string name)
| Deregisters an app and all its actions if an exception occurs during the other module's initialization.

## Detailed Description

DataProvider action and application catalog class.

## Member Function Documentation

## checkName()

static *int DataProvider::DataProviderActionCatalog::checkName | ( | string | name | ) |

static

Checks for a valid name.

Returns
  -1 if the name is invalid, meaning empty or containing invalid characters

## compareActions()

static int DataProvider::DataProviderActionCatalog::compareActions | ( | hash< DataProviderActionInfo > | act0,
|  | hash< DataProviderActionInfo > | act1 )

static

Compares two actions for equality.

Returns
  0 for equal, -1 for not equal

## compareOptions()

static int DataProvider::DataProviderActionCatalog::compareOptions | ( | *hash< string, hash< ActionOptionInfo > > | opt0,
|  | *hash< string, hash< ActionOptionInfo > > | opt1 )

static

Compares two option hashes for equality.

Returns
  0 for equal, -1 for not equal

## deregisterDynamicApp()

static *hash< DataProviderAppInfo > DataProvider::DataProviderActionCatalog::deregisterDynamicApp | ( | string | name | ) |

static

Removes a dynamic data provider application.

Parameters

  name | the name of the dynamic application to remove

Returns
  the app, if it was deregistered

The caller must not be restricted with Qore::PO_NO_PROCESS_CONTROL

Exceptions

  APP-ERROR | app not dynamic
  PERMISSION-DENIED | Caller is restricted with Qore::PO_NO_PROCESS_CONTROL

## getActionHash()

static *hash< string, hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::getActionHash | ( | string | app | ) |

static

Returns a hash of all actions for the given application.

Parameters

  app | the data provider application

Returns
  a hash of actions keyed by action name for the given application

See also
  getActionHashEx()

## getActionHashEx()

static *hash< string, hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::getActionHashEx | ( | string | app | ) |

static

Returns a hash of all actions for the given application.

Parameters

  app | the data provider application

Returns
  a hash of actions keyed by action name for the given application

Exceptions

  APP-ERROR | the given application is not registered

See also
  getActionHash()

## getActions()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::getActions | ( | string | app | ) |

static

Returns all actions for the given application.

Parameters

  app | the data provider application

Returns
  a list of actions for the given application

See also
  getActionsEx()

## getActionsEx()

static list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::getActionsEx | ( | string | app | ) |

static

Returns all actions for the given application; throws an exception if the app is not registered.

Parameters

  app | the data provider application

Returns
  a list of actions for the given application

Exceptions

  APP-ERROR | the given application is not registered

See also
  getActions()

## getActionsForScheme()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::getActionsForScheme | ( | string | scheme | ) |

static

Returns all actions for a particular connection scheme.

Parameters

  scheme | the connection scheme

Returns
  a list of actions associated with the given scheme

## getAllActions()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::getAllActions | ( |  | ) |

static

Returns all actions in the cache.

Returns
  all actions in the cache

## getAllApps()

static *list< hash< DataProviderAppInfo > > DataProvider::DataProviderActionCatalog::getAllApps | ( |  | ) |

static

Returns all applications in the cache.

Returns
  all applications in the cache

## getAllAppsNoInit()

static *list< hash< DataProviderAppInfo > > DataProvider::DataProviderActionCatalog::getAllAppsNoInit | ( |  | ) |

static

Returns all applications in the cache without initializing actions.

Returns
  all applications in the cache without initializing actions

## getApp()

static *hash< DataProviderAppInfo > DataProvider::DataProviderActionCatalog::getApp | ( | string | app | ) |

static

Returns the application definition for the given application name.

Parameters

  app | the app name

Returns
  the application definition for the given application name or nothing if not present

See also
  getAppEx()

## getAppAction()

static *hash< DataProviderActionInfo > DataProvider::DataProviderActionCatalog::getAppAction | ( | string | app,
|  | string | action )

static

Returns the action definition for the given application and action.

Parameters

  app | the app name
  action | the action name

Returns
  the action definition for the given application name and action or nothing if not present

See also
  getAppActionEx()

## getAppActionEx()

static hash< DataProviderActionInfo > DataProvider::DataProviderActionCatalog::getAppActionEx | ( | string | app,
|  | string | action )

static

Returns the application definition for the given application name.

Parameters

  app | the app name
  action | the action name

Returns
  the action definition for the given application name and action; throws an exception if the app is not registered

Exceptions

  APP-ERROR | the given application is not registered
  ACTION-ERROR | the given action is not registered

See also
  getAppAction()

## getAppEx()

static hash< DataProviderAppInfo > DataProvider::DataProviderActionCatalog::getAppEx | ( | string | app | ) |

static

Returns the application definition for the given application name.

Parameters

  app | the app name

Returns
  the application definition for the given application name; throws an exception if the app is not registered

Exceptions

  APP-ERROR | the given application is not registered

See also
  getApp()

## getDataProviderForAction()

static AbstractDataProvider DataProvider::DataProviderActionCatalog::getDataProviderForAction | ( | hash< DataProviderActionInfo > | action,
|  | *reference< hash< auto > > | options )

static

Returns a data provider option for the given action and options.

Parameters

  action | the action to use to return the data provider
  options | a reference to options where constructor options will be taken from

Returns
  a data provider option for the given action and options

## registerAction()

static DataProvider::DataProviderActionCatalog::registerAction | ( | hash< DataProviderActionInfo > | action | ) |

static

Registers a data provider action.

Parameters

  action | the action to register

Exceptions

  ACTION-ERROR | missing or invalid attributes, action already registered

The `app` and `action` attributes must be unique for every action registered

## registerApp()

static DataProvider::DataProviderActionCatalog::registerApp | ( | hash< DataProviderAppInfo > | app | ) |

static

Registers a data provider application.

Parameters

  app | the application to register

Exceptions

  APP-ERROR | missing or invalid attributes, app already registered

## registerPendingApp()

static DataProvider::DataProviderActionCatalog::registerPendingApp | ( | string | app,
|  | code | init )

static

Registers an app for deferred initialization / initialization on demand.

Parameters

  app | the application to register
  init | the initialization code that will register the app

Since
  DataProvider 3.0

## registerPendingAppAction()

static DataProvider::DataProviderActionCatalog::registerPendingAppAction | ( | string | app,
|  | string | action,
|  | code | init )

static

Registers an app action for deferred initialization / initialization on demand.

Parameters

  app | the application to register
  action | the action to register
  init | the initialization code that will register the app

Since
  DataProvider 3.0

## searchActionRegex()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::searchActionRegex | ( | string | regex_pattern,
|  | int | regex_options = RE_Caseless )

static

Searches for actions whose descriptions match a regular expression pattern.

Parameters

  regex_pattern | A regular expression pattern to match in the `short_desc` and `desc` fields
  regex_options | Regular expression options; a case-insensitive match is performed by default

Returns
  All actions that match the regular expression pattern in the `short_desc` or `desc` fields

## searchActionSubstr()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::searchActionSubstr | ( | string | substr,
|  | bool | ignore_case = True )

static

Searches for actions whose descriptions match a substring.

Parameters

  substr | A substring to match in the `short_desc` and `desc` fields
  ignore_case | Ignore case when searching

Returns
  All actions that match the substring argument in the `short_desc` or `desc` fields

## searchAppActionRegex()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::searchAppActionRegex | ( | string | app,
|  | string | regex_pattern,
|  | int | regex_options = RE_Caseless )

static

Searches for application actions whose descriptions match a regular expression pattern.

Parameters

  app | The application to search for actions in
  regex_pattern | A regular expression pattern to match in the `short_desc` and `desc` fields
  regex_options | Regular expression options; a case-insensitive match is performed by default

Returns
  All actions that match the regular expression pattern in the `short_desc` or `desc` fields

Note
  If the application does not exist, no results are returned

## searchAppActionRegexEx()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::searchAppActionRegexEx | ( | string | app,
|  | string | regex_pattern,
|  | int | regex_options = RE_Caseless )

static

Searches for application actions whose descriptions match a regular expression pattern.

Parameters

  app | The application to search for actions in
  regex_pattern | A regular expression pattern to match in the `short_desc` and `desc` fields
  regex_options | Regular expression options; a case-insensitive match is performed by default

Returns
  All actions that match the regular expression pattern in the `short_desc` or `desc` fields

Exceptions

  APP-ERROR | the given application is not registered

Note
  If the application does not exist, an exception is thrown

## searchAppActionSubstr()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::searchAppActionSubstr | ( | string | app,
|  | string | substr,
|  | bool | ignore_case = True )

static

Searches for application actions whose descriptions match a substring.

Parameters

  app | The application to search for actions in
  substr | A substring to match in the `short_desc` and `desc` fields
  ignore_case | Ignore case when searching

Returns
  All actions that match the substring argument in the `short_desc` or `desc` fields

Note
  If the application does not exist, no results are returned

## searchAppActionSubstrEx()

static *list< hash< DataProviderActionInfo > > DataProvider::DataProviderActionCatalog::searchAppActionSubstrEx | ( | string | app,
|  | string | substr,
|  | bool | ignore_case = True )

static

Searches for application actions whose descriptions match a substring.

Parameters

  app | The application to search for actions in
  substr | A substring to match in the `short_desc` and `desc` fields
  ignore_case | Ignore case when searching

Returns
  All actions that match the substring argument in the `short_desc` or `desc` fields

Exceptions

  APP-ERROR | the given application is not registered

Note
  If the application does not exist, an exception is thrown

## searchAppRegex()

static *list< hash< DataProviderAppInfo > > DataProvider::DataProviderActionCatalog::searchAppRegex | ( | string | regex_pattern,
|  | int | regex_options = RE_Caseless )

static

Searches for applications whose names or descriptions match a regular expression pattern.

Parameters

  regex_pattern | A regular expression pattern to match in the `name` and `desc` fields
  regex_options | Regular expression options; a case-insensitive match is performed by default

Returns
  All applications that match the regular expression pattern in the `name` or `desc` fields

## searchAppSubstr()

static *list< hash< DataProviderAppInfo > > DataProvider::DataProviderActionCatalog::searchAppSubstr | ( | string | substr,
|  | bool | ignore_case = True )

static

Searches for applications whose names or descriptions match a substring.

Parameters

  substr | A substring to match in the `name` and `desc` fields; pending apps only are matched with the name
  ignore_case | Ignore case when searching

Returns
  All applications that match the substring argument in the `name` or `desc` fields