Interface Connector<Q extends ConnectorRequest<?>>

  • All Known Implementing Classes:
    AbstractConnector

    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 Detail

      • getId

        java.lang.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

        java.util.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.
      • addRequestInterceptors

        Connector<Q> addRequestInterceptors​(java.util.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.