Package org.apache.sling.feature.cpconverter.vltpkg

## Class VaultPackageAssembler

- java.lang.Object
- - org.apache.sling.feature.cpconverter.vltpkg.VaultPackageAssembler

    public class VaultPackageAssembler
    extends Object

### Field Summary

Fields
`static String` `VERSION_SUFFIX`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addDependency​(@NotNull org.apache.jackrabbit.vault.packaging.Dependency dependency)`
`void` `addEntry​(@NotNull String path, @NotNull File file)`
`void` `addEntry​(@NotNull String path, @NotNull InputStream input)`
`void` `addEntry​(@NotNull String path, @NotNull org.apache.jackrabbit.vault.fs.io.Archive archive, @NotNull org.apache.jackrabbit.vault.fs.io.Archive.Entry entry)`
`static @NotNull VaultPackageAssembler` `create​(@NotNull File baseTempDir, @NotNull org.apache.jackrabbit.vault.packaging.PackageId packageId, String description)` Creates a new package assembler.
`static @NotNull VaultPackageAssembler` `create​(@NotNull File baseTempDir, @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage vaultPackage, boolean removeInstallHooks, boolean disablePackageTypeRecalculation)` Creates a new package assembler based on an existing package.
`@NotNull OutputStream` `createEntry​(@NotNull String path)`
`@NotNull File` `createPackage()`
`@NotNull File` `getFileEntry​(@NotNull String relativePath)` The incoming path must be relative, using slashes as separators, and start with a slash.
`org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter` `getFilter()`
`@NotNull Properties` `getPackageProperties()`
`void` `mergeFilters​(@NotNull org.apache.jackrabbit.vault.fs.api.WorkspaceFilter filter)`
`boolean` `recordEntryPath​(@NotNull String entryPath)` Records an entry path as it is processed by the `ContentPackage2FeatureModelConverter`.
`void` `updateDependencies​(@NotNull Map<org.apache.jackrabbit.vault.packaging.PackageId,​Set<org.apache.jackrabbit.vault.packaging.Dependency>> mutableContentsIds)`

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

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

### Field Detail

#### VERSION_SUFFIX

    public static final String VERSION_SUFFIX

See Also:
  Constant Field Values

### Method Detail

#### create

    @NotNull
    public static @NotNull VaultPackageAssembler create​(@NotNull
                                                        @NotNull File baseTempDir,
                                                        @NotNull
                                                        @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage vaultPackage,
                                                        boolean removeInstallHooks,
                                                        boolean disablePackageTypeRecalculation)

Creates a new package assembler based on an existing package. Takes over properties and filter rules from existing package.

Parameters:
  `baseTempDir` - the temp dir
  `vaultPackage` - the package to take as blueprint
  `removeInstallHooks` - whether to remove install hooks or not
  `disablePackageTypeRecalculation` - disables the package recalculation and uses the parent source type
Returns:
  the package assembler

#### create

    @NotNull
    public static @NotNull VaultPackageAssembler create​(@NotNull
                                                        @NotNull File baseTempDir,
                                                        @NotNull
                                                        @NotNull org.apache.jackrabbit.vault.packaging.PackageId packageId,
                                                        String description)

Creates a new package assembler.

Parameters:
  `baseTempDir` - the temp dir
  `packageId` - the package id from which to generate a minimal properties.xml
  `description` - the description which should end up in the package properties
Returns:
  the package assembler

#### getPackageProperties

    @NotNull
    public @NotNull Properties getPackageProperties()

#### mergeFilters

    public void mergeFilters​(@NotNull
                             @NotNull org.apache.jackrabbit.vault.fs.api.WorkspaceFilter filter)

#### getFilter

    public org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter getFilter()

#### addEntry

    public void addEntry​(@NotNull
                         @NotNull String path,
                         @NotNull
                         @NotNull org.apache.jackrabbit.vault.fs.io.Archive archive,
                         @NotNull
                         @NotNull org.apache.jackrabbit.vault.fs.io.Archive.Entry entry)
                  throws IOException

Throws:
  `IOException`

#### addEntry

    public void addEntry​(@NotNull
                         @NotNull String path,
                         @NotNull
                         @NotNull File file)
                  throws IOException

Throws:
  `IOException`

#### addEntry

    public void addEntry​(@NotNull
                         @NotNull String path,
                         @NotNull
                         @NotNull InputStream input)
                  throws IOException

Throws:
  `IOException`

#### createEntry

    @NotNull
    public @NotNull OutputStream createEntry​(@NotNull
                                             @NotNull String path)
                                      throws IOException

Throws:
  `IOException`

#### getFileEntry

    @NotNull
    public @NotNull File getFileEntry​(@NotNull
                                      @NotNull String relativePath)

The incoming path must be relative, using slashes as separators, and start with a slash. The parts of the relative path must use characters which work on every platform filesystem.

Parameters:
  `relativePath` - relative path
Returns:
  The file

#### recordEntryPath

    public boolean recordEntryPath​(@NotNull
                                   @NotNull String entryPath)

Records an entry path as it is processed by the `ContentPackage2FeatureModelConverter`. The path of all original entries that got processed will later be compared to the paths of those entries written back to this assembler to build the converted content package and generate an updated `WorkspaceFilter` that no longer refers to paths that got moved out to the feature model (see also https://issues.apache.org/jira/browse/SLING-10467)

Parameters:
  `entryPath` - The path of a content package entry processed by the converter.
Returns:
  `true` if the given path was successfully added to the internal set, `false` otherwise.

#### updateDependencies

    public void updateDependencies​(@NotNull
                                   @NotNull Map<org.apache.jackrabbit.vault.packaging.PackageId,​Set<org.apache.jackrabbit.vault.packaging.Dependency>> mutableContentsIds)

#### addDependency

    public void addDependency​(@NotNull
                              @NotNull org.apache.jackrabbit.vault.packaging.Dependency dependency)

#### createPackage

    @NotNull
    public @NotNull File createPackage()
                                throws IOException

Throws:
  `IOException`