Package net.solarnetwork.node.service
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA platform package.static interfaceThe results of performing an action on a package. -
Method Summary
Modifier and TypeMethodDescriptioncleanup()Cleanup any temporary or cached data.booleanhandlesPackage(String archiveFileName) Test if this service handles packages with a given name.installNamedPackage(String name, String version, Path baseDirectory, net.solarnetwork.service.ProgressListener<T> progressListener, T context) Install a package.installPackage(Path archive, Path baseDirectory, net.solarnetwork.service.ProgressListener<T> progressListener, T context) Install a package from an archive file.listNamedPackages(String nameFilter, Boolean installedFilter) List named packages, optionally filtering by name and installed status.List upgradable named packages.Refresh named packages.removeNamedPackage(String name, net.solarnetwork.service.ProgressListener<T> progressListener, T context) Remove a named package.upgradeNamedPackages(net.solarnetwork.service.ProgressListener<T> progressListener, T context) Upgrade all installed packages.
-
Method Details
-
handlesPackage
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 installbaseDirectory- a "base" directory to resolve relative file paths againstprogressListener- an optional listener of the progress of extracting the packagecontext- a context object to pass toprogressListenerand provide in the result; may be null- Returns:
- a future for the package installation results
- Throws:
IllegalArgumentException- ifarchiveis not a supported type (that is, thehandlesPackage(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 everythinginstalledFilter- 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
Refresh named packages.- Returns:
- the task completion status
-
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 installversion- the package version to install, or null for the highest available versionbaseDirectory- a "base" directory to resolve relative file paths againstprogressListener- an optional listener of the progress of extracting the packagecontext- a context object to pass toprogressListenerand 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 installprogressListener- an optional listener of the progress of extracting the packagecontext- a context object to pass toprogressListenerand 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 packagecontext- a context object to pass toprogressListenerand provide in the result; may be null- Returns:
- a future for the package installation results
-