Class CompositePackageRegistry

  • All Implemented Interfaces:
    PackageRegistry

    public class CompositePackageRegistry
    extends Object
    implements PackageRegistry
    Package registry wrapping a number of PackageRegistry instances. This registry only works, if each package id contained in any of the registries is unique among all registries. In case duplicates are detected exceptions are thrown. The first given registry is used for registering new packages.
    • Method Detail

      • contains

        public boolean contains​(@NotNull
                                @NotNull PackageId id)
                         throws IOException
        Description copied from interface: PackageRegistry
        Checks if this registry contains the package with the given id.
        Specified by:
        contains in interface PackageRegistry
        Parameters:
        id - the package id.
        Returns:
        true if the package is registered.
        Throws:
        IOException - if an I/O error occurs.
      • register

        @NotNull
        public @NotNull PackageId register​(@NotNull
                                           @NotNull InputStream in,
                                           boolean replace)
                                    throws IOException,
                                           PackageExistsException
        Description copied from interface: PackageRegistry
        Registers a package provided via an input stream. The method fails, if a package with the same id already exists, and replace is set to false. otherwise the existing package is replaced.
        Specified by:
        register in interface PackageRegistry
        Parameters:
        in - the input stream to the package data
        replace - true if existing package should be replaced.
        Returns:
        the new package id.
        Throws:
        IOException - if an I/O error occurs.
        PackageExistsException - if the package exists and replace is false.
      • register

        @NotNull
        public @NotNull PackageId register​(@NotNull
                                           @NotNull File file,
                                           boolean replace)
                                    throws IOException,
                                           PackageExistsException
        Description copied from interface: PackageRegistry
        Registers a package provided via a file. The method fails, if a package with the same id already exists, and replace is set to false; otherwise the existing package is replaced.
        Specified by:
        register in interface PackageRegistry
        Parameters:
        file - the file to the package data
        replace - true if existing package should be replaced.
        Returns:
        the new package id.
        Throws:
        IOException - if an I/O error occurrs.
        PackageExistsException - if the package exists and replace is false.
      • registerExternal

        @NotNull
        public @NotNull PackageId registerExternal​(@NotNull
                                                   @NotNull File file,
                                                   boolean replace)
                                            throws IOException,
                                                   PackageExistsException
        Description copied from interface: PackageRegistry
        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, and replace is set to false; otherwise the existing package is replaced.
        Specified by:
        registerExternal in interface PackageRegistry
        Parameters:
        file - the file to the package data.
        replace - true if existing package should be replaced.
        Returns:
        the new package id.
        Throws:
        IOException - if an I/O error occurrs.
        PackageExistsException - if the package exists and replace is false.
      • resolve

        @Nullable
        public @Nullable PackageId resolve​(@NotNull
                                           @NotNull Dependency dependency,
                                           boolean onlyInstalled)
                                    throws IOException
        Description copied from interface: PackageRegistry
        Tries to resolve the given dependency and returns the id of the package that matches the dependency filter best.
        Specified by:
        resolve in interface PackageRegistry
        Parameters:
        dependency - the dependency to resolve against.
        onlyInstalled - if true only installed packages are respected.
        Returns:
        the package id or null
        Throws:
        IOException - if an I/O error occurrs.
      • usage

        @NotNull
        public @NotNull PackageId[] usage​(@NotNull
                                          @NotNull PackageId id)
                                   throws IOException
        Description copied from interface: PackageRegistry
        Returns the package ids of installed packages that depend on the given package.
        Specified by:
        usage in interface PackageRegistry
        Parameters:
        id - the package id to search for
        Returns:
        the array of package ids.
        Throws:
        IOException - if an I/O error occurs.
      • createExecutionPlan

        @NotNull
        public @NotNull ExecutionPlanBuilder createExecutionPlan()
        Description copied from interface: PackageRegistry
        Creates a new execution plan builder. The builder allows to create an execution plan for package installation related tasks.
        Specified by:
        createExecutionPlan in interface PackageRegistry
        Returns:
        a new builder