Interface ChunkedFileQueryBuilder


public interface ChunkedFileQueryBuilder
A builder that can be used to query a file from a remote network component.
Since:
4.0
  • Method Details

    • create

      Constructs a new default implementation of this builder.
      Returns:
      a new default implementation of this builder.
    • chunkSize

      @NonNull @NonNull ChunkedFileQueryBuilder chunkSize(int chunkSize)
      The size of the chunks in bytes that will be transferred from the remote to the caller.
      Parameters:
      chunkSize - the size of the chunks that should be transferred from the remote to the caller.
      Returns:
      this builder, for chaining.
      Throws:
      IllegalArgumentException - if the given chunk size is not positive.
    • dataIdentifier

      The identifier for the data should be transferred from the remote to the caller.
      Parameters:
      dataIdentifier - the identifier of the data that should be transferred.
      Returns:
      this builder, for chaining.
      Throws:
      NullPointerException - if the given identifier is null.
      IllegalArgumentException - if the given identifier is empty.
    • requestFromNode

      Sets that the file data should be requested from the node with the given id. Note: the source must be directly available to the caller, else the data will never reach the caller.
      Parameters:
      nodeId - the id of the node to request the data from.
      Returns:
      this builder, for chaining.
      Throws:
      NullPointerException - if the given node id is null.
    • requestFromService

      Sets that the file data should be requested from the service with the given name. Note: the source must be directly available to the caller, else the data will never reach the caller.
      Parameters:
      serviceName - the name of the service to request the data from.
      Returns:
      this builder, for chaining.
      Throws:
      NullPointerException - if the given service name is null.
    • configureMessageBuffer

      A consumer that is called when the actual request is sent to the data source. The consumer can append additional information to the buffer that is relevant for the remote side to identify the data to transmit.
      Parameters:
      bufferConfigurer - the configurator for additional transmitted information about the request.
      Returns:
      this builder, for chaining.
      Throws:
      NullPointerException - if the given buffer configurator is null.
    • query

      Queries the data from the remote and completes with an input stream when the transmission was successful.
      Returns:
      a future completed with an input stream of the transmitted data.
    • queryToTempFile

      Queries the data from the remote and redirects it into a temporary file. The path to the file is wrapped in the returned future.
      Returns:
      a future completed with the path to which the transmitted contents were written.
    • queryToPath

      Queries the data from the remote and redirects it into the given file path.
      Parameters:
      target - the path to the file into which the response data should be written.
      Returns:
      a future completed with the path to which the transmitted contents were written.
      Throws:
      NullPointerException - if the given target path is null.