Package org.apache.sling.feature.cpconverter.features

## Class DefaultFeaturesManager

- java.lang.Object
- - org.apache.sling.feature.cpconverter.features.DefaultFeaturesManager

All Implemented Interfaces:
  `FeaturesManager`, `PackagesEventsEmitter`

    public class DefaultFeaturesManager
    extends Object
    implements FeaturesManager, PackagesEventsEmitter

### Nested Class Summary

Nested Classes
`static class` `DefaultFeaturesManager.ConfigurationHandling`

### Constructor Summary

Constructors
`DefaultFeaturesManager​(boolean mergeConfigurations, int bundlesStartOrder, @NotNull File featureModelsOutputDirectory, @Nullable String artifactIdOverride, @Nullable String prefix, @NotNull Map<String,​String> properties, @Nullable AclManager aclManager)`
`DefaultFeaturesManager​(@NotNull File tempDir)`
`DefaultFeaturesManager​(@NotNull DefaultFeaturesManager.ConfigurationHandling configurationHandling, int bundlesStartOrder, @NotNull File featureModelsOutputDirectory, @Nullable String artifactIdOverride, @Nullable String prefix, @NotNull Map<String,​String> properties, @Nullable AclManager aclManager)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addAPIRegionExport​(@Nullable String runMode, @NotNull String exportedPackage)`
`void` `addArtifact​(@Nullable String runMode, @NotNull org.apache.sling.feature.ArtifactId id)`
`void` `addArtifact​(@Nullable String runMode, @NotNull org.apache.sling.feature.Artifact artifact, @Nullable Integer startOrder)`
`void` `addConfiguration​(@Nullable String runMode, @NotNull org.apache.sling.feature.Configuration cfg, @NotNull String path, @NotNull Dictionary<String,​Object> configurationProperties)` Add a configuration
`void` `addOrAppendOakIndexDefinitionsExtension​(String source, String text)`
`void` `addOrAppendRepoInitExtension​(@NotNull String source, @NotNull String text, @Nullable String runMode)` Add repoinit instructions
`void` `addSeed​(@NotNull org.apache.sling.feature.Feature seed)`
`void` `end()` Package converter ends
`void` `endPackage​(@NotNull org.apache.jackrabbit.vault.packaging.PackageId originalPackageId, @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage convertedPackage)` Marks the end of the conversion of the package with `originalPackageId`.
`void` `endSubPackage​(@NotNull String path, @NotNull org.apache.jackrabbit.vault.packaging.PackageId originalPackageId, @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage convertedPackage)` Marks the end of the conversion of the sub package with `originalPackageId`.
`@NotNull Map<String,​String>` `getNamespaceUriByPrefix()`
`@NotNull org.apache.sling.feature.Feature` `getRunMode​(@Nullable String runMode)`
`@Nullable org.apache.sling.feature.Feature` `getTargetFeature()`
`void` `init​(@NotNull org.apache.sling.feature.ArtifactId packageId)`
`void` `serialize()`
`void` `setAclManager​(AclManager aclManager)`
`@NotNull DefaultFeaturesManager` `setAPIRegions​(@NotNull List<String> regions)`
`void` `setEnforceServiceMappingByPrincipal​(boolean enforceServiceMappingByPrincipal)`
`@NotNull DefaultFeaturesManager` `setExportToAPIRegion​(@NotNull String region)`
`void` `start()` Package converter starts
`void` `startPackage​(@NotNull org.apache.jackrabbit.vault.packaging.VaultPackage originalPackage)` Marks the start of the given original package.
`void` `startSubPackage​(@NotNull String path, @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage originalPackage)` Marks the start of the given sub package.

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

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

### Constructor Detail

#### DefaultFeaturesManager

    public DefaultFeaturesManager​(@NotNull
                                  @NotNull File tempDir)

#### DefaultFeaturesManager

    public DefaultFeaturesManager​(boolean mergeConfigurations,
                                  int bundlesStartOrder,
                                  @NotNull
                                  @NotNull File featureModelsOutputDirectory,
                                  @Nullable
                                  @Nullable String artifactIdOverride,
                                  @Nullable
                                  @Nullable String prefix,
                                  @NotNull
                                  @NotNull Map<String,​String> properties,
                                  @Nullable
                                  @Nullable AclManager aclManager)

#### DefaultFeaturesManager

    public DefaultFeaturesManager​(@NotNull
                                  @NotNull DefaultFeaturesManager.ConfigurationHandling configurationHandling,
                                  int bundlesStartOrder,
                                  @NotNull
                                  @NotNull File featureModelsOutputDirectory,
                                  @Nullable
                                  @Nullable String artifactIdOverride,
                                  @Nullable
                                  @Nullable String prefix,
                                  @NotNull
                                  @NotNull Map<String,​String> properties,
                                  @Nullable
                                  @Nullable AclManager aclManager)

### Method Detail

#### init

    public void init​(@NotNull
                     @NotNull org.apache.sling.feature.ArtifactId packageId)

Specified by:
  `init` in interface `FeaturesManager`

#### getTargetFeature

    @Nullable
    public @Nullable org.apache.sling.feature.Feature getTargetFeature()

Specified by:
  `getTargetFeature` in interface `FeaturesManager`

#### getRunMode

    @NotNull
    public @NotNull org.apache.sling.feature.Feature getRunMode​(@Nullable
                                                                @Nullable String runMode)

Specified by:
  `getRunMode` in interface `FeaturesManager`

#### addArtifact

    public void addArtifact​(@Nullable
                            @Nullable String runMode,
                            @NotNull
                            @NotNull org.apache.sling.feature.ArtifactId id)

Specified by:
  `addArtifact` in interface `FeaturesManager`

#### addArtifact

    public void addArtifact​(@Nullable
                            @Nullable String runMode,
                            @NotNull
                            @NotNull org.apache.sling.feature.Artifact artifact,
                            @Nullable
                            @Nullable Integer startOrder)

Specified by:
  `addArtifact` in interface `FeaturesManager`

#### addAPIRegionExport

    public void addAPIRegionExport​(@Nullable
                                   @Nullable String runMode,
                                   @NotNull
                                   @NotNull String exportedPackage)

Specified by:
  `addAPIRegionExport` in interface `FeaturesManager`

#### setEnforceServiceMappingByPrincipal

    public void setEnforceServiceMappingByPrincipal​(boolean enforceServiceMappingByPrincipal)

#### addSeed

    public void addSeed​(@NotNull
                        @NotNull org.apache.sling.feature.Feature seed)
                 throws IOException,
                        ConverterException

Throws:
  `IOException`
  `ConverterException`

#### getNamespaceUriByPrefix

    @NotNull
    public @NotNull Map<String,​String> getNamespaceUriByPrefix()

Specified by:
  `getNamespaceUriByPrefix` in interface `FeaturesManager`

#### setAclManager

    public void setAclManager​(AclManager aclManager)

#### addConfiguration

    public void addConfiguration​(@Nullable
                                 @Nullable String runMode,
                                 @NotNull
                                 @NotNull org.apache.sling.feature.Configuration cfg,
                                 @NotNull
                                 @NotNull String path,
                                 @NotNull
                                 @NotNull Dictionary<String,​Object> configurationProperties)
                          throws IOException,
                                 ConverterException

Description copied from interface: `FeaturesManager`
Add a configuration

Specified by:
  `addConfiguration` in interface `FeaturesManager`
Parameters:
  `runMode` - Optional runmode
  `cfg` - The configuration object for the pid and factory pid, name - no properties
  `path` - The path for the configuration
  `configurationProperties` - The configuration properties
Throws:
  `IOException` - if an error occurs
  `ConverterException` - if conversion fails

#### serialize

    public void serialize()
                   throws IOException

Specified by:
  `serialize` in interface `FeaturesManager`
Throws:
  `IOException`

#### setAPIRegions

    @NotNull
    public @NotNull DefaultFeaturesManager setAPIRegions​(@NotNull
                                                         @NotNull List<String> regions)

#### setExportToAPIRegion

    @NotNull
    public @NotNull DefaultFeaturesManager setExportToAPIRegion​(@NotNull
                                                                @NotNull String region)

#### addOrAppendRepoInitExtension

    public void addOrAppendRepoInitExtension​(@NotNull
                                             @NotNull String source,
                                             @NotNull
                                             @NotNull String text,
                                             @Nullable
                                             @Nullable String runMode)

Description copied from interface: `FeaturesManager`
Add repoinit instructions

Specified by:
  `addOrAppendRepoInitExtension` in interface `FeaturesManager`
Parameters:
  `source` - An identifier for the source, for example the configuration pid
  `text` - The repoinit instructions
  `runMode` - Optional runmode

#### addOrAppendOakIndexDefinitionsExtension

    public void addOrAppendOakIndexDefinitionsExtension​(String source,
                                                        String text)
                                                 throws IOException,
                                                        ConverterException

Specified by:
  `addOrAppendOakIndexDefinitionsExtension` in interface `FeaturesManager`
Throws:
  `IOException`
  `ConverterException`

#### start

    public void start()

Description copied from interface: `PackagesEventsEmitter`
Package converter starts

Specified by:
  `start` in interface `PackagesEventsEmitter`

#### end

    public void end()

Description copied from interface: `PackagesEventsEmitter`
Package converter ends

Specified by:
  `end` in interface `PackagesEventsEmitter`

#### startPackage

    public void startPackage​(@NotNull
                             @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage originalPackage)

Description copied from interface: `PackagesEventsEmitter`
Marks the start of the given original package.

Specified by:
  `startPackage` in interface `PackagesEventsEmitter`
Parameters:
  `originalPackage` - the package to be converted.

#### endPackage

    public void endPackage​(@NotNull
                           @NotNull org.apache.jackrabbit.vault.packaging.PackageId originalPackageId,
                           @NotNull
                           @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage convertedPackage)

Description copied from interface: `PackagesEventsEmitter`
Marks the end of the conversion of the package with `originalPackageId`.

Specified by:
  `endPackage` in interface `PackagesEventsEmitter`
Parameters:
  `originalPackageId` - The id of the original package as passed to `PackagesEventsEmitter.startPackage(VaultPackage)`.
  `convertedPackage` - the converted package.

#### startSubPackage

    public void startSubPackage​(@NotNull
                                @NotNull String path,
                                @NotNull
                                @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage originalPackage)

Description copied from interface: `PackagesEventsEmitter`
Marks the start of the given sub package.

Specified by:
  `startSubPackage` in interface `PackagesEventsEmitter`
Parameters:
  `path` - The path of the sub package in the original parent package
  `originalPackage` - the sub package to be converted.

#### endSubPackage

    public void endSubPackage​(@NotNull
                              @NotNull String path,
                              @NotNull
                              @NotNull org.apache.jackrabbit.vault.packaging.PackageId originalPackageId,
                              @NotNull
                              @NotNull org.apache.jackrabbit.vault.packaging.VaultPackage convertedPackage)

Description copied from interface: `PackagesEventsEmitter`
Marks the end of the conversion of the sub package with `originalPackageId`.

Specified by:
  `endSubPackage` in interface `PackagesEventsEmitter`
Parameters:
  `path` - The path of the original sub package in the parent package
  `originalPackageId` - The id of the original sub package as passed to `PackagesEventsEmitter.startSubPackage(String, VaultPackage)`.
  `convertedPackage` - the converted package