Interface Connector<Q extends ConnectorRequest<?>>

All Known Subinterfaces:
HttpConnector, SoapHttpConnector
All Known Implementing Classes:
AbstractConnector, AbstractHttpConnector, HttpConnectorImpl, SoapHttpConnectorImpl

public interface Connector<Q extends ConnectorRequest<?>>

A connector represents a way to interact with some system, library or technology. Examples of connectors are connectors for HTTP interaction, a connector to a third-party library like a rules engine or file system abstraction.

Once an instance of a connector is created, it is thread-safe, meaning that single connector instance my be used by multiple threads concurrently. Each thread will create new Requests which are not thread-safe and must not be shared among multiple threads.

Connectors support interceptors. Interceptors may be used for customizing connector behavior or for adding management aspects such as logging to a connector.

Author:
Daniel Meyer
  • Method Details

    • getId

      String getId()
      The unique Id for the connector.
      Returns:
      the unique connector id
    • createRequest

      Q createRequest()
      Create a request on the connector.
      Returns:
      the connector-specific request object.
    • getRequestInterceptors

      List<ConnectorRequestInterceptor> getRequestInterceptors()
      Returns the ConnectorRequestInterceptor chain for this connector. The implementation will return the actual list, modifications on the list will be reflected in the internal connector state. This means that you can use the returned list to modify the connector's ConnectorRequestInterceptor chain.
      Returns:
      the list of interceptors.
    • setRequestInterceptors

      void setRequestInterceptors(List<ConnectorRequestInterceptor> requestInterceptors)
      Sets the ConnectorRequestInterceptors of this connector. The interceptors are invoked for all requests created by the connector.
    • addRequestInterceptor

      Connector<Q> addRequestInterceptor(ConnectorRequestInterceptor interceptor)
      Adds a ConnectorRequestInterceptor to this connector. The interceptor is added at the end of the interceptor chain. The interceptor is invoked for all requests created by the connector.
    • addRequestInterceptors

      Connector<Q> addRequestInterceptors(Collection<ConnectorRequestInterceptor> interceptors)
      Adds a collection of ConnectorRequestInterceptor to this connector. The interceptors are added at the end of the interceptor chain. The interceptor is invoked for all requests created by the connector.
    • execute

      ConnectorResponse execute(Q request)
      Execute the request on the connector.
      Parameters:
      request - the request
      Returns:
      the result.