Connection - the generic type of the connections to be handledpublic interface ConnectionProvider<Connection>
Connection type, which are created from a
configuration object of the generic type Config.
Providers centralize the logic and parametrization to provision and release connection, while remaining abstracted from the concerns of actually manage those connections.
Implementations are expected to be reusable and thread-safe.
It is valid for implementations to implement any of the lifecycle interfaces or to request external dependencies through any of the JSR-330 annotations. However, implementations are not propagate lifecycle or to perform dependency injection into the generated connections. The runtime will do that automatically at the proper time.
| Modifier and Type | Method and Description |
|---|---|
Connection |
connect()
Creates a new connection.
|
void |
disconnect(Connection connection)
Disposes the given
connection, freeing all its allocated resources |
ConnectionHandlingStrategy<Connection> |
getHandlingStrategy(ConnectionHandlingStrategyFactory<Connection> handlingStrategyFactory)
Specifies the
ConnectionHandlingStrategy that should be use to manage
the connections generated through the connect() method. |
ConnectionValidationResult |
validate(Connection connection)
Validates the given
Connection. |
Connection connect() throws ConnectionException
The returned connection is expected to be ready to use
ConnectionConnectionExceptionvoid disconnect(Connection connection)
connection, freeing all its allocated resourcesconnection - a non null Connection.ConnectionValidationResult validate(Connection connection)
Connection.
In invalid connection case, the ConnectionValidationResult should also return a valid
message ConnectionValidationResult.getMessage(), exception ConnectionValidationResult.getException()
and code ConnectionValidationResult.getCode()connection - a non null Connection.ConnectionValidationResult indicating if the connection
is valid or not.ConnectionHandlingStrategy<Connection> getHandlingStrategy(ConnectionHandlingStrategyFactory<Connection> handlingStrategyFactory)
ConnectionHandlingStrategy that should be use to manage
the connections generated through the connect() method.
Implementations MUST return instances created through the provided
handlingStrategyFactory. Those instances are not to be wrapped,
decorated, or by any other means tampered with.
This method must also function correctly without dependencies or preconditions.
That means that although it is valid for this provider to have lifecycle
or external dependencies injected, this particular method must behave correctly
on every possible state.
handlingStrategyFactory - the ConnectionHandlingStrategyFactory to be used to generate the response valuenull ConnectionHandlingStrategyCopyright © 2016 MuleSoft, Inc.. All rights reserved.