Class ConansEntityV2.PkgBinFile

java.lang.Object
com.artipie.conan.http.ConansEntityV2.PkgBinFile
All Implemented Interfaces:
com.artipie.http.Slice
Enclosing class:
ConansEntityV2

public static final class ConansEntityV2.PkgBinFile extends Object
Provides requested file for package binary.
Since:
0.1
  • Constructor Details

    • PkgBinFile

      public PkgBinFile(Storage storage)
      Ctor.
      Parameters:
      storage - Current Artipie storage instance.
  • Method Details

    • getResult

      public CompletableFuture<com.artipie.conan.http.BaseConanSlice.RequestResult> getResult(com.artipie.http.rq.RequestLineFrom request, String hostname, Matcher matcher)
      Processess the request and returns result data for this request.
      Parameters:
      request - Artipie request line helper object instance.
      hostname - Current server host name string to construct and process URLs.
      matcher - Matched pattern matcher object for the current path wrapper.
      Returns:
      Future object, providing request result data.
    • response

      public com.artipie.http.Response response(String line, Iterable<Map.Entry<String,String>> headers, org.reactivestreams.Publisher<ByteBuffer> body)
      Specified by:
      response in interface com.artipie.http.Slice
    • getStorage

      protected Storage getStorage()
      Returns current Artipie storage instance.
      Returns:
      Storage object instance.
    • generateMDhash

      protected CompletableFuture<String> generateMDhash(Key key)
      Generates An md5 hash for package file.
      Parameters:
      key - Storage key for package file.
      Returns:
      An md5 hash string for file content.
    • generateJson

      protected static <T> CompletableFuture<com.artipie.conan.http.BaseConanSlice.RequestResult> generateJson(String[] keys, Function<String,io.vavr.Tuple2<Key,CompletableFuture<T>>> mapper, Function<io.vavr.Tuple2<String,T>,Optional<String>> generator, Function<javax.json.JsonObjectBuilder,String> ctor)
      Generate RequestResult based on array of keys (files) and several handlers.
      Type Parameters:
      T - Generators result type.
      Parameters:
      keys - Array of keys to process.
      mapper - Mapper of key to the tuple with key invalid input: '&' completable future.
      generator - Filters and generates value for json.
      ctor - Constructs resulting json string.
      Returns:
      Json RequestResult in CompletableFuture.