CompositeConnectionResolver

Helper class that resolves connection and credential parameters, validates them and generates connection options.

Implements: IConfigurable, IReferenceable

Description

The CompositeConnectionResolver class allows you to resolve connection and credential parameters, validate them and generate connection options.

Configuration parameters

connection(s):

  • discovery_key: (optional) a key to retrieve the connection from IDiscovery
  • protocol: communication protocol
  • host: host name or IP address
  • port: port number
  • uri: resource URI or connection string with all parameters in it

credential(s):

  • store_key: (optional) a key to retrieve the credentials from ICredentialStore
  • username: user name
  • password: user password

References

  • *:discovery:*:*:1.0 - (optional) IDiscovery services to resolve connections
  • *:credential-store:*:*:1.0 - (optional) Credential stores to resolve credentials ICredentialStore

Fields

_options

The connection options

_options: ConfigParams

_connection_resolver

The connections resolver.

_connection_resolver: ConnectionResolver

_credential_resolver

The credentials resolver.

_credential_resolver: CredentialResolver

_cluster_supported

The cluster support (multiple connections)

_cluster_supported: bool

_default_protocol

The default protocol

_default_protocol: str

_default_port

The default port

_default_port: int

_supported_protocols

The list of supported protocols

_supported_protocols: List[str]

Instance methods

compose

Composes Composite connection options from connection and credential parameters.

compose(context: Optional[IContext], connections: List[ConnectionParams], credential: CredentialParams, parameters: ConfigParams): ConfigParams

_compose_options

A composite of several merger options

_compose_options(connections: List[ConnectionParams], credential: CredentialParams, parameters: ConfigParams): ConfigParams

configure

Configures component by passing configuration parameters.

configure(config: ConfigParams)

  • config: ConfigParams - configuration parameters to be set.

_finalize_options

Finalize merged options. This method can be overriden in child classes.

_finalize_options(options: ConfigParams): ConfigParams

_merge_connection

Merges connection options with connection parameters. This method can be overriden in child classes.

_merge_connection(options: ConfigParams, connection: ConnectionParams): ConfigParams

_merge_credential

Merges connection options with credential parameters. This method can be overriden in child classes.

_merge_credential(options: ConfigParams, credential: CredentialParams): ConfigParams

_merge_optional

Merges connection options with optional parameters. This method can be overriden in child classes.

_merge_optional(options: ConfigParams, parameters: ConfigParams): ConfigParams

resolve

Resolves connection options from connection and credential parameters.

resolve(context: Optional[IContext]): ConfigParams

  • context: IContext - (optional) a context to trace execution through a call chain.
  • returns: ConfigParams - resolved options or error

set_references

Sets references to dependent components.

set_references(references: IReferences)

  • references: IReferences - references to locate the component dependencies.

_validate_connection

Validates connection parameters. Throws error if validation failed. This method can be overriden in child classes.

_validate_connection(context: Optional[IContext], connection: ConnectionParams)

  • context: IContext - (optional) a context to trace execution through a call chain.
  • connection: ConnectionParams - connection parameters to be validated

_validate_credential

Validates credential parameters. This method can be overriden in child classes.

_validate_credential(context: Optional[IContext], credential: CredentialParams)

  • context: IContext - (optional) a context to trace execution through a call chain.
  • credential: CredentialParams - credential parameters to be validated