CompositeConnectionResolver

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

Inherits: 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

protected _options: ConfigParams

_connectionResolver

Connections resolver.

protected _connectionResolver: ConnectionResolver

_credentialResolver

Credentials resolver.

protected _credentialResolver: CredentialResolver

_clusterSupported

Cluster support (multiple connections)

protected _clusterSupported: bool

_defaultProtocol

Default protocol

protected _defaultProtocol: string

_defaultPort

Default port

protected _defaultPort: int

_supported_protocols

List of supported protocols

protected _supportedProtocols: IList<string>

Instance methods

Compose

Composes composite connection options from connection and credential parameters.

public ConfigParams Compose(string correlationId, IList<ConnectionParams> connections, CredentialParams credential, ConfigParams parameters)

  • correlationId: string - (optional) transaction id used to trace execution through the call chain.
  • connections: IList<ConnectionParams> - connection parameters
  • credential: CredentialParams - credential parameters
  • parameters: ConfigParams - optional parameters
  • returns: ConfigParams - resolved options or error.

ComposeOptions

Composite of several merger options

protected ConfigParams ComposeOptions(IList<ConnectionParams> connections, CredentialParams credential, ConfigParams parameters)

Configure

Configures component by passing configuration parameters.

public void Configure(ConfigParams config)

  • config: ConfigParams - configuration parameters to be set.

FinalizeOptions

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

protected ConfigParams FinalizeOptions(ConfigParams options)

MergeConnection

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

protected ConfigParams MergeConnection(ConfigParams options, ConnectionParams connection)

MergeCredential

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

protected ConfigParams MergeCredential(ConfigParams options, CredentialParams credential)

MergeOptional

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

protected ConfigParams MergeOptional(ConfigParams options, ConfigParams parameters)

ResolveAsync

Resolves connection options from connection and credential parameters.

public Task<ConfigParams> ResolveAsync(string correlationId):

  • correlationId: string - (optional) transaction id used to trace execution through the call chain.
  • returns: Task<ConfigParams> - resolved options or error

SetReferences

Sets references to dependent components.

public void SetReferences(references: IReferences)

  • 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.

protected void ValidateConnection(string correlationId, ConnectionParams) connection)

  • correlationId: string - (optional) transaction id used to trace execution through the call chain.
  • connection: ConnectionParams - connection parameters to be validated

ValidateCredential

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

protected void ValidateCredential(string correlationId, CredentialParams credential)

  • correlationId: string - (optional) transaction id used to trace execution through the call chain.
  • credential: CredentialParams - credential parameters to be validated