Interface PlatformPackageService

All Known Implementing Classes:
BasePlatformPackageService, BaseSolarPkgPlatformPackageService, NativeTarPlatformPackageService

public interface PlatformPackageService
API for a service that deals with platform packages.

Platform packages could be as simple as tar archives or some sort of native package like a .deb package on Debian based systems.

Since:
1.68
Version:
2.1
Author:
matt
  • Method Details

    • handlesPackage

      boolean handlesPackage(String archiveFileName)
      Test if this service handles packages with a given name.
      Parameters:
      archiveFileName - the name of the package archive file; a file extension might be used to determine the type of package the name represents
      Returns:
      true if the archive file name is supported by this service
    • installPackage

      <T> Future<PlatformPackageService.PlatformPackageResult<T>> installPackage(Path archive, Path baseDirectory, net.solarnetwork.service.ProgressListener<T> progressListener, T context)
      Install a package from an archive file.
      Type Parameters:
      T - the context object type
      Parameters:
      archive - the package to extract and install
      baseDirectory - a "base" directory to resolve relative file paths against
      progressListener - an optional listener of the progress of extracting the package
      context - a context object to pass to progressListener and provide in the result; may be null
      Returns:
      a future for the package installation results
      Throws:
      IllegalArgumentException - if archive is not a supported type (that is, the handlesPackage(String) does not return true for the archives name)
    • listNamedPackages

      Future<Iterable<PlatformPackageService.PlatformPackage>> listNamedPackages(String nameFilter, Boolean installedFilter)
      List named packages, optionally filtering by name and installed status.
      Parameters:
      nameFilter - a regular expression to filter packages by, or null to include everything
      installedFilter - true to include only installed packages, false to exclude installed packages, or null to include everything
      Returns:
      the matching packages, never null
    • listUpgradableNamedPackages

      Future<Iterable<PlatformPackageService.PlatformPackage>> listUpgradableNamedPackages()
      List upgradable named packages.
      Returns:
      the upgradable packages, never null
      Since:
      2.1
    • refreshNamedPackages

      Future<Boolean> refreshNamedPackages()
      Refresh named packages.
      Returns:
      the task completion status
    • cleanup

      Future<Boolean> cleanup()
      Cleanup any temporary or cached data.
      Returns:
      the task completion status
    • installNamedPackage

      <T> Future<PlatformPackageService.PlatformPackageResult<T>> installNamedPackage(String name, String version, Path baseDirectory, net.solarnetwork.service.ProgressListener<T> progressListener, T context)
      Install a package.

      This method is used to install named packages that are "available" to be installed, i.e. one that is returned from the listNamedPackages(String, Boolean) method when false is passed. The package might have to be downloaded from a remote package repository and then installed.

      Type Parameters:
      T - the context object type
      Parameters:
      name - the package name to install
      version - the package version to install, or null for the highest available version
      baseDirectory - a "base" directory to resolve relative file paths against
      progressListener - an optional listener of the progress of extracting the package
      context - a context object to pass to progressListener and provide in the result; may be null
      Returns:
      a future for the package installation results
    • removeNamedPackage

      <T> Future<PlatformPackageService.PlatformPackageResult<T>> removeNamedPackage(String name, net.solarnetwork.service.ProgressListener<T> progressListener, T context)
      Remove a named package.

      This method is used to remove named packages that are currently installed.

      Type Parameters:
      T - the context object type
      Parameters:
      name - the package name to install
      progressListener - an optional listener of the progress of extracting the package
      context - a context object to pass to progressListener and provide in the result; may be null
      Returns:
      a future for the package installation results
    • upgradeNamedPackages

      <T> Future<PlatformPackageService.PlatformPackageResult<T>> upgradeNamedPackages(net.solarnetwork.service.ProgressListener<T> progressListener, T context)
      Upgrade all installed packages.

      This method is used to upgrade named packages to the highest available versions.

      Type Parameters:
      T - the context object type
      Parameters:
      progressListener - an optional listener of the progress of extracting the package
      context - a context object to pass to progressListener and provide in the result; may be null
      Returns:
      a future for the package installation results