Interface PackageRegistry
- All Known Subinterfaces:
InternalPackageRegistry
- All Known Implementing Classes:
AbstractPackageRegistry,CompositePackageRegistry,FSPackageRegistry,JcrPackageRegistry
@ProviderType
public interface PackageRegistry
The package registry is the next generation
PackageManager and
JcrPackageManager. It defines storage independent methods to
register (upload), enumerate and remove packages. The installation lifecycle of the packages is provided via
ExecutionPlans.-
Method Summary
Modifier and TypeMethodDescription@NotNull DependencyReportanalyzeDependencies(@NotNull PackageId id, boolean onlyInstalled) Creates a dependency report that lists the resolved and unresolved dependencies.booleanChecks if this registry contains the package with the given id.@NotNull ExecutionPlanBuilderCreates a new execution plan builder.@Nullable RegisteredPackageOpens the package with the given id.packages()Returns as set of all packages registered in this registry.@NotNull PackageIdRegisters a package provided via a file.@NotNull PackageIdregister(@NotNull InputStream in, boolean replace) Registers a package provided via an input stream.@NotNull PackageIdregisterExternal(@NotNull File file, boolean replace) Registers a package provided via an external file.voidRemoves the package from this registry.@Nullable PackageIdresolve(@NotNull Dependency dependency, boolean onlyInstalled) Tries to resolve the given dependency and returns the id of the package that matches the dependency filter best.@NotNull PackageId[]Returns the package ids of installed packages that depend on the given package.
-
Method Details
-
contains
Checks if this registry contains the package with the given id.- Parameters:
id- the package id.- Returns:
trueif the package is registered.- Throws:
IOException- if an I/O error occurs.
-
packages
Returns as set of all packages registered in this registry.- Returns:
- a set of package ids.
- Throws:
IOException- if an I/O error occurs.
-
open
Opens the package with the given id.- Parameters:
id- the package id- Returns:
- the package or
nullif it does not exists. - Throws:
IOException- if an I/O error occurs.
-
register
@NotNull @NotNull PackageId register(@NotNull @NotNull InputStream in, boolean replace) throws IOException, PackageExistsException Registers a package provided via an input stream. The method fails, if a package with the same id already exists, andreplaceis set tofalse. otherwise the existing package is replaced.- Parameters:
in- the input stream to the package datareplace-trueif existing package should be replaced.- Returns:
- the new package id.
- Throws:
IOException- if an I/O error occurs.PackageExistsException- if the package exists andreplaceisfalse.
-
register
@NotNull @NotNull PackageId register(@NotNull @NotNull File file, boolean replace) throws IOException, PackageExistsException Registers a package provided via a file. The method fails, if a package with the same id already exists, andreplaceis set tofalse; otherwise the existing package is replaced.- Parameters:
file- the file to the package datareplace-trueif existing package should be replaced.- Returns:
- the new package id.
- Throws:
IOException- if an I/O error occurrs.PackageExistsException- if the package exists andreplaceisfalse.
-
registerExternal
@NotNull @NotNull PackageId registerExternal(@NotNull @NotNull File file, boolean replace) throws IOException, PackageExistsException Registers a package provided via an external file. The binary data of the package will not be copied into the underlying persistence but only be referenced. Removing such a linked package afterwards will not delete the original file. The method fails, if a package with the same id already exists, andreplaceis set tofalse; otherwise the existing package is replaced.- Parameters:
file- the file to the package data.replace-trueif existing package should be replaced.- Returns:
- the new package id.
- Throws:
IOException- if an I/O error occurrs.PackageExistsException- if the package exists andreplaceisfalse.
-
remove
Removes the package from this registry.- Parameters:
id- the id of the package to remove- Throws:
IOException- if an I/O error occurrs.NoSuchPackageException- if the package does not exist
-
analyzeDependencies
@NotNull @NotNull DependencyReport analyzeDependencies(@NotNull @NotNull PackageId id, boolean onlyInstalled) throws IOException, NoSuchPackageException Creates a dependency report that lists the resolved and unresolved dependencies.- Parameters:
id- the package id.onlyInstalled- iftrueonly installed packages are used for resolution- Returns:
- the report
- Throws:
IOException- if an error accessing the repository occurrsNoSuchPackageException- if the package with the giveniddoes not exist.
-
resolve
@Nullable @Nullable PackageId resolve(@NotNull @NotNull Dependency dependency, boolean onlyInstalled) throws IOException Tries to resolve the given dependency and returns the id of the package that matches the dependency filter best.- Parameters:
dependency- the dependency to resolve against.onlyInstalled- iftrueonly installed packages are respected.- Returns:
- the package id or
null - Throws:
IOException- if an I/O error occurrs.
-
usage
Returns the package ids of installed packages that depend on the given package.- Parameters:
id- the package id to search for- Returns:
- the array of package ids.
- Throws:
IOException- if an I/O error occurs.
-
createExecutionPlan
Creates a new execution plan builder. The builder allows to create an execution plan for package installation related tasks.- Returns:
- a new builder
-