Package com.io7m.coffeepick.client.vanilla

# Class CoffeePickInventory

java.lang.Object
com.io7m.coffeepick.client.vanilla.CoffeePickInventory

All Implemented Interfaces:
  `CoffeePickInventoryType`

    public final class CoffeePickInventory
    extends java.lang.Object
    implements CoffeePickInventoryType

An inventory of downloaded runtimes.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface com.io7m.coffeepick.api.CoffeePickInventoryType

  `CoffeePickInventoryType.RuntimeCancellableArchiveWriterType, CoffeePickInventoryType.UnpackOption`

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `delete​(java.lang.String id)` | Delete the runtime with the given identifier.
  `io.reactivex.rxjava3.core.Observable<CoffeePickInventoryEventType>` | `events()` | Access the stream of events published by the inventory when the state of the inventory changes.
  `static CoffeePickInventoryType` | `open​(io.reactivex.rxjava3.subjects.Subject<CoffeePickInventoryEventType> events, java.nio.file.Path path)` | Open an inventory.
  `static CoffeePickInventoryType` | `open​(io.reactivex.rxjava3.subjects.Subject<CoffeePickInventoryEventType> events, org.apache.commons.compress.archivers.ArchiveStreamFactory archives, org.apache.commons.compress.compressors.CompressorStreamFactory compressors, java.nio.file.Path path)` | Open an inventory.
  `java.util.Optional<java.nio.file.Path>` | `pathOf​(java.lang.String id)` | Return the path of the given runtime in the inventory if it exists, or nothing if it does not.
  `java.util.Map<java.lang.String,​RuntimeDescription>` | `search​(CoffeePickSearch parameters)` | Search for all runtimes matching the given parameters.
  `java.util.Optional<RuntimeDescription>` | `searchExact​(java.lang.String id)` |
  `java.nio.file.Path` | `unpack​(java.lang.String id, java.nio.file.Path target_path, CoffeePickIsCancelledType cancelled, java.util.Set<CoffeePickInventoryType.UnpackOption> options)` | Unpack the runtime with the given ID to `path`.
  `CoffeePickVerification` | `verify​(java.lang.String id, CoffeePickIsCancelledType cancelled)` | Verify the archive of the runtime with the given ID.
  `java.nio.file.Path` | `write​(RuntimeDescription description, CoffeePickInventoryType.RuntimeCancellableArchiveWriterType writer)` | Save a runtime.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface com.io7m.coffeepick.api.CoffeePickInventoryType

  `searchAll, unpack, unpack, verify`

- ## Method Details

  - ### open

    public static CoffeePickInventoryType open​(io.reactivex.rxjava3.subjects.Subject<CoffeePickInventoryEventType> events, java.nio.file.Path path) throws java.io.IOException
    Open an inventory.
    Parameters:
      `events` - The receiver of events
      `path` - The path of the inventory
    Returns:
      An inventory
    Throws:
      `java.io.IOException` - On I/O errors

  - ### open

    public static CoffeePickInventoryType open​(io.reactivex.rxjava3.subjects.Subject<CoffeePickInventoryEventType> events, org.apache.commons.compress.archivers.ArchiveStreamFactory archives, org.apache.commons.compress.compressors.CompressorStreamFactory compressors, java.nio.file.Path path) throws java.io.IOException
    Open an inventory.
    Parameters:
      `events` - The receiver of events
      `archives` - A factory for archive streams
      `compressors` - A factory for compressors
      `path` - The path of the inventory
    Returns:
      An inventory
    Throws:
      `java.io.IOException` - On I/O errors

  - ### searchExact

    public java.util.Optional<RuntimeDescription> searchExact​(java.lang.String id)
    Specified by:
      `searchExact` in interface `CoffeePickInventoryType`
    Parameters:
      `id` - The ID of the runtime
    Returns:
      The runtime with the given ID

  - ### events

    public io.reactivex.rxjava3.core.Observable<CoffeePickInventoryEventType> events()
    Description copied from interface: `CoffeePickInventoryType`
    Access the stream of events published by the inventory when the state of the inventory changes.
    Specified by:
      `events` in interface `CoffeePickInventoryType`
    Returns:
      A stream of events

  - ### search

    public java.util.Map<java.lang.String,​RuntimeDescription> search​(CoffeePickSearch parameters)
    Description copied from interface: `CoffeePickInventoryType`
    Search for all runtimes matching the given parameters.
    Specified by:
      `search` in interface `CoffeePickInventoryType`
    Parameters:
      `parameters` - The parameters
    Returns:
      The matching runtimes

  - ### write

    public java.nio.file.Path write​(RuntimeDescription description, CoffeePickInventoryType.RuntimeCancellableArchiveWriterType writer) throws java.io.IOException
    Description copied from interface: `CoffeePickInventoryType`
    Save a runtime. The method calls the given writer method when it needs to write an archive of the runtime to disk.
    Specified by:
      `write` in interface `CoffeePickInventoryType`
    Parameters:
      `description` - The runtime runtimes
      `writer` - A function that will be called to write data
    Returns:
      The path of the saved archive
    Throws:
      `java.io.IOException` - On I/O errors

  - ### pathOf

    public java.util.Optional<java.nio.file.Path> pathOf​(java.lang.String id) throws java.io.IOException
    Description copied from interface: `CoffeePickInventoryType`
    Return the path of the given runtime in the inventory if it exists, or nothing if it does not.
    Specified by:
      `pathOf` in interface `CoffeePickInventoryType`
    Parameters:
      `id` - The identifier
    Returns:
      The path to the runtime if it is installed
    Throws:
      `java.io.IOException` - On I/O errors

  - ### unpack

    public java.nio.file.Path unpack​(java.lang.String id, java.nio.file.Path target_path, CoffeePickIsCancelledType cancelled, java.util.Set<CoffeePickInventoryType.UnpackOption> options) throws java.io.IOException
    Description copied from interface: `CoffeePickInventoryType`
    Unpack the runtime with the given ID to `path`. The method takes a function `cancelled` that will be evaluated repeatedly and, if the function returns `true` at any point, the operation will be cancelled.
    Specified by:
      `unpack` in interface `CoffeePickInventoryType`
    Parameters:
      `id` - The runtime ID
      `target_path` - The target path
      `cancelled` - A function that returns `true` if the operation should be cancelled
      `options` - The unpacking options
    Returns:
      The path of the unpacked archive
    Throws:
      `java.io.IOException` - On I/O errors

  - ### delete

    public void delete​(java.lang.String id) throws java.io.IOException
    Description copied from interface: `CoffeePickInventoryType`
    Delete the runtime with the given identifier. Does nothing if no runtime has the given identifier.
    Specified by:
      `delete` in interface `CoffeePickInventoryType`
    Parameters:
      `id` - The identifier
    Throws:
      `java.io.IOException` - On I/O errors

  - ### verify

    public CoffeePickVerification verify​(java.lang.String id, CoffeePickIsCancelledType cancelled) throws java.io.IOException
    Description copied from interface: `CoffeePickInventoryType`
    Verify the archive of the runtime with the given ID. The method takes a function `cancelled` that will be evaluated repeatedly and, if the function returns `true` at any point, the operation will be cancelled.
    Specified by:
      `verify` in interface `CoffeePickInventoryType`
    Parameters:
      `id` - The identifier
      `cancelled` - A function that returns `true` if the operation should be cancelled
    Returns:
      The verification results
    Throws:
      `java.io.IOException` - On I/O errors