Class AbstractEndpointClient

java.lang.Object
es.kukenan.smartfi.microservice.smartficore.service.api.AbstractEndpointClient
Direct Known Subclasses:
AbstractInternalEndpointClient

public class AbstractEndpointClient extends Object
Base class with core functionality for any endpoint implementation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private es.kukenan.smartfi.common.context.RequestContextManager
    Request context manager.
    private es.kukenan.smartfi.common.context.config.ContextPropagationProperties
    Context propagation properties.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected URI
    createUri(String uriPath)
    Create a URI object from the given Minstait relative endpoint path.
    protected URI
    createUri(String uriPath, String queryParams)
    Create a URI object from the given relative endpoint path.
    protected org.springframework.http.HttpHeaders
    Create the default request HTTP headers used in any API method.
    protected <T> T
    Performs the operation encapsulated in the supplier instance to handle connection exceptions.
    protected String
    message(org.springframework.web.client.ResourceAccessException e)
    Construct an error message from a given ResourceAccessException.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • properties

      @Autowired private es.kukenan.smartfi.common.context.config.ContextPropagationProperties properties
      Context propagation properties.
    • contextManager

      @Autowired private es.kukenan.smartfi.common.context.RequestContextManager contextManager
      Request context manager.
  • Constructor Details

    • AbstractEndpointClient

      public AbstractEndpointClient()
  • Method Details

    • createUri

      protected URI createUri(String uriPath)
      Create a URI object from the given Minstait relative endpoint path.
      Parameters:
      uriPath - Minstait relative endpoint path.
      Returns:
      URI object with absolute endpoint path.
    • createUri

      protected URI createUri(String uriPath, String queryParams)
      Create a URI object from the given relative endpoint path.
      Parameters:
      uriPath - relative endpoint path.
      queryParams - Query PArams to add at endpoint path.
      Returns:
      URI object with absolute endpoint path.
    • handleConnectionException

      protected <T> T handleConnectionException(Supplier<T> supplier)
      Performs the operation encapsulated in the supplier instance to handle connection exceptions.
      Type Parameters:
      T - the result type of the operation.
      Parameters:
      supplier - an operation encapsulated a the supplier instance.
      Returns:
      the result of the operation if no exception has been thrown.
    • message

      protected String message(org.springframework.web.client.ResourceAccessException e)
      Construct an error message from a given ResourceAccessException.
      Parameters:
      e - a ResourceAccessException.
      Returns:
      a message describing the exception reason.
    • defaultRequestHeaders

      protected org.springframework.http.HttpHeaders defaultRequestHeaders()
      Create the default request HTTP headers used in any API method.
      Returns:
      the default request HTTP headers