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) 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) key to retrieve the credentials from ICredentialStore
  • username: username
  • password: user’s password

References

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

Fields

_options

Connection options

_options: ConfigParams?

_connectionResolver

Connections resolver.

_connectionResolver: ConnectionResolver

_credentialResolver

Credentials resolver.

_credentialResolver: CredentialResolver

_clusterSupported

Cluster support (multiple connections)

_clusterSupported: bool

_defaultProtocol

Default protocol

_defaultProtocol: String?

_defaultPort

Default port

_defaultPort: int

_supported_protocols

List of supported protocols

_supportedProtocols: List<String>?

Instance methods

compose

Composes composite connection options from connection and credential parameters.

ConfigParams compose(context: IContext, List<ConnectionParams> connections, CredentialParams credential, ConfigParams parameters)

composeOptions

A composite of several merger options

ConfigParams composeOptions(List<ConnectionParams> connections, CredentialParams credential, ConfigParams parameters)

configure

Configures a component by passing its configuration parameters.

@override

void configure(ConfigParams config)

  • config: ConfigParams - configuration parameters to be set.

finalizeOptions

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

ConfigParams finalizeOptions(ConfigParams options)

mergeConnection

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

ConfigParams mergeConnection(ConfigParams options, ConnectionParams connection)

mergeCredential

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

ConfigParams mergeCredential(ConfigParams options, CredentialParams credential)

mergeOptional

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

ConfigParams mergeOptional(ConfigParams options, ConfigParams parameters)

resolve

Resolves connection options from connection and credential parameters.

Future<ConfigParams> resolve(IContext? context)

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

setReferences

Sets references to dependent components.

@override

void setReferences(IReferences references)

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

validateConnection

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

void validateConnection(IContext? context, ConnectionParams? connection)

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

validateCredential

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

void validateCredential(IContext? context, CredentialParams? credential)

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