Package org.apache.sling.distribution.serialization.impl.vlt

## Class VaultDistributionPackageBuilderFactory

- java.lang.Object
- - org.apache.sling.distribution.serialization.impl.vlt.VaultDistributionPackageBuilderFactory

All Implemented Interfaces:
  `DistributionPackageBuilder`

    public class VaultDistributionPackageBuilderFactory
    extends Object
    implements DistributionPackageBuilder

A package builder for Apache Jackrabbit FileVault based implementations.

### Nested Class Summary

Nested Classes
`static interface` `VaultDistributionPackageBuilderFactory.Config`

### Constructor Summary

Constructors
`VaultDistributionPackageBuilderFactory()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `activate​(org.osgi.framework.BundleContext context, VaultDistributionPackageBuilderFactory.Config conf)`
`@NotNull DistributionPackage` `createPackage​(@NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull org.apache.sling.distribution.DistributionRequest request)` creates a `DistributionPackage` for a specific `DistributionRequest`
`void` `deactivate()`
`@Nullable DistributionPackage` `getPackage​(@NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull String id)` get an already created (and saved into the repository) `DistributionPackage` by its id
`String` `getType()` returns the type of a package.
`@NotNull DistributionPackageInfo` `installPackage​(@NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull InputStream stream)` install a stream and returns the associated to a `DistributionPackageInfo` this provider can read and install
`boolean` `installPackage​(@NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull DistributionPackage distributionPackage)` Installs the given distributionPackage into the repository
`@NotNull DistributionPackage` `readPackage​(@NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull InputStream stream)` reads a stream and tries to convert it to a `DistributionPackage` this provider can read and install

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### VaultDistributionPackageBuilderFactory

    public VaultDistributionPackageBuilderFactory()

### Method Detail

#### activate

    public void activate​(org.osgi.framework.BundleContext context,
                         VaultDistributionPackageBuilderFactory.Config conf)

#### deactivate

    public void deactivate()

#### getType

    public String getType()

Description copied from interface: `DistributionPackageBuilder`
returns the type of a package. Only packages of this type will be accepted by the package builder.

Specified by:
  `getType` in interface `DistributionPackageBuilder`
Returns:
  the package type.

#### createPackage

    @NotNull
    public @NotNull DistributionPackage createPackage​(@NotNull
                                                      @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                      @NotNull
                                                      @NotNull org.apache.sling.distribution.DistributionRequest request)
                                               throws DistributionException

Description copied from interface: `DistributionPackageBuilder`
creates a `DistributionPackage` for a specific `DistributionRequest`

Specified by:
  `createPackage` in interface `DistributionPackageBuilder`
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

#### readPackage

    @NotNull
    public @NotNull DistributionPackage readPackage​(@NotNull
                                                    @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                    @NotNull
                                                    @NotNull InputStream stream)
                                             throws DistributionException

Description copied from interface: `DistributionPackageBuilder`
reads a stream and tries to convert it to a `DistributionPackage` this provider can read and install

Specified by:
  `readPackage` in interface `DistributionPackageBuilder`
Parameters:
  `resourceResolver` - resource resolver used to store the eventually created package
  `stream` - the `InputStream` of the package to read
Returns:
  a `DistributionPackage` if it can read it from the stream
Throws:
  `DistributionException` - when the stream cannot be read as a `DistributionPackage`

#### getPackage

    @Nullable
    public @Nullable DistributionPackage getPackage​(@NotNull
                                                    @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                    @NotNull
                                                    @NotNull String id)
                                             throws DistributionException

Description copied from interface: `DistributionPackageBuilder`
get an already created (and saved into the repository) `DistributionPackage` by its id

Specified by:
  `getPackage` in interface `DistributionPackageBuilder`
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

    public boolean installPackage​(@NotNull
                                  @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                  @NotNull
                                  @NotNull DistributionPackage distributionPackage)
                           throws DistributionException

Description copied from interface: `DistributionPackageBuilder`
Installs the given distributionPackage into the repository

Specified by:
  `installPackage` in interface `DistributionPackageBuilder`
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

#### installPackage

    @NotNull
    public @NotNull DistributionPackageInfo installPackage​(@NotNull
                                                           @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                           @NotNull
                                                           @NotNull InputStream stream)
                                                    throws DistributionException

Description copied from interface: `DistributionPackageBuilder`
install a stream and returns the associated to a `DistributionPackageInfo` this provider can read and install

Specified by:
  `installPackage` in interface `DistributionPackageBuilder`
Parameters:
  `resourceResolver` - resource resolver used to store the eventually created package
  `stream` - the `InputStream` of the package to read
Returns:
  a `DistributionPackage` if it can read it from the stream
Throws:
  `DistributionException` - when the stream cannot be read as a `DistributionPackage`