Interface DistributionPackageBuilder

    • Method Detail

      • getType

        String getType()
        returns the type of a package. Only packages of this type will be accepted by the package builder.
        Returns:
        the package type.
      • createPackage

        @Nullable
        @Nullable DistributionPackage createPackage​(@NotNull
                                                    @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                    @NotNull
                                                    @NotNull org.apache.sling.distribution.DistributionRequest request)
                                             throws DistributionException
        creates a DistributionPackage for a specific DistributionRequest
        Parameters:
        resourceResolver - the resource resolver used to access the resources to be packaged
        request - the DistributionRequest to create the package for
        Returns:
        a DistributionPackage or null if it could not be created
        Throws:
        DistributionException - if any error occurs while creating the package, or if the resource resolver is not authorized to do that
      • getPackage

        @Nullable
        @Nullable DistributionPackage getPackage​(@NotNull
                                                 @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                 @NotNull
                                                 @NotNull String id)
                                          throws DistributionException
        get an already created (and saved into the repository) DistributionPackage by its id
        Parameters:
        resourceResolver - resource resolver used to access the package with the given id
        id - the unique identifier of an already created DistributionPackage
        Returns:
        a DistributionPackage if one with such an id exists, null otherwise
        Throws:
        DistributionException - when the stream the package with that id cannot be retrieved
      • installPackage

        boolean installPackage​(@NotNull
                               @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver,
                               @NotNull
                               @NotNull DistributionPackage distributionPackage)
                        throws DistributionException
        Installs the given distributionPackage into the repository
        Parameters:
        resourceResolver - the resource resolver used to install the packaged resources
        distributionPackage - the distribution package to install
        Returns:
        true if the package was installed successfully
        Throws:
        DistributionException - when installation fails