Class RegionSupport
java.lang.Object
org.apache.sling.feature.maven.mojos.apis.RegionSupport
-
Constructor Summary
ConstructorDescriptionRegionSupport
(org.apache.maven.plugin.logging.Log logger, boolean incrementalApis, boolean toggleApiOnly, Set<String> includeRegions, Set<String> excludeRegions) -
Method Summary
Modifier and TypeMethodDescriptioncalculateOmitDependenciesFlag
(org.apache.sling.feature.extension.apiregions.api.ApiRegion region, org.apache.felix.utils.manifest.Clause[] exportedPackageClauses, Set<org.apache.felix.utils.manifest.Clause> usedExportedPackagesPerRegion) Calculate whether the artifact can be omitted and a dependency can be used insteadcomputeAllUsedExportPackages
(org.apache.sling.feature.extension.apiregions.api.ApiRegions apiRegions, Set<String> enabledToggles, org.apache.felix.utils.manifest.Clause[] exportedPackages, org.apache.sling.feature.Artifact bundle) Compute exports based on all regionsSet<org.apache.felix.utils.manifest.Clause>
computeUsedExportPackagesPerRegion
(org.apache.sling.feature.extension.apiregions.api.ApiRegion apiRegion, org.apache.felix.utils.manifest.Clause[] exportedPackages, Set<String> allPackages) Compute exports based on a single regionList<org.apache.sling.feature.extension.apiregions.api.ApiExport>
getAllExports
(org.apache.sling.feature.extension.apiregions.api.ApiRegion region, Set<String> enabledToggles) Set<org.apache.felix.utils.manifest.Clause>
getAllPublicPackages
(ApisJarContext ctx, org.apache.sling.feature.Artifact artifact, File artifactFile) Get all packages for an artifact.org.apache.sling.feature.extension.apiregions.api.ApiRegions
getApiRegions
(org.apache.sling.feature.Feature feature) Get the api regions for a feature If the feature does not have an api region an artificial global region is returned.org.apache.felix.utils.manifest.Clause[]
getExportedPackages
(Manifest manifest) getManifest
(org.apache.sling.feature.ArtifactId artifactId, File bundleFile)
-
Constructor Details
-
RegionSupport
-
-
Method Details
-
getApiRegions
public org.apache.sling.feature.extension.apiregions.api.ApiRegions getApiRegions(org.apache.sling.feature.Feature feature) throws org.apache.maven.plugin.MojoExecutionException Get the api regions for a feature If the feature does not have an api region an artificial global region is returned.- Parameters:
feature
- The feature- Returns:
- The api regions or
null
if the feature is wrongly configured or all regions are excluded - Throws:
org.apache.maven.plugin.MojoExecutionException
- If an error occurs
-
getAllExports
-
computeAllUsedExportPackages
public Set<String> computeAllUsedExportPackages(org.apache.sling.feature.extension.apiregions.api.ApiRegions apiRegions, Set<String> enabledToggles, org.apache.felix.utils.manifest.Clause[] exportedPackages, org.apache.sling.feature.Artifact bundle) throws org.apache.maven.plugin.MojoExecutionException Compute exports based on all regions- Parameters:
apiRegions
- The API Regions to useenabledToggles
- The enabled togglesexportedPackages
- The exported packagesbundle
- The bundle- Returns:
- Set of packages exported by this bundle and used in any region
- Throws:
org.apache.maven.plugin.MojoExecutionException
- when the calculation cannot be made
-
computeUsedExportPackagesPerRegion
public Set<org.apache.felix.utils.manifest.Clause> computeUsedExportPackagesPerRegion(org.apache.sling.feature.extension.apiregions.api.ApiRegion apiRegion, org.apache.felix.utils.manifest.Clause[] exportedPackages, Set<String> allPackages) throws org.apache.maven.plugin.MojoExecutionException Compute exports based on a single region- Parameters:
apiRegion
- The API Region to useexportedPackages
- The exported packagesallPackages
- All the packages- Returns:
- List of packages exported by this bundle and used in the region
- Throws:
org.apache.maven.plugin.MojoExecutionException
- When the computation cannot be done.
-
getExportedPackages
-
getManifest
public Manifest getManifest(org.apache.sling.feature.ArtifactId artifactId, File bundleFile) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getAllPublicPackages
public Set<org.apache.felix.utils.manifest.Clause> getAllPublicPackages(ApisJarContext ctx, org.apache.sling.feature.Artifact artifact, File artifactFile) throws org.apache.maven.plugin.MojoExecutionException Get all packages for an artifact. If the artifact is a bundle use the export header, otherwise scan contents- Parameters:
ctx
- The generation contextartifact
- The artifactartifactFile
- The file- Returns:
- A set of clauses
- Throws:
org.apache.maven.plugin.MojoExecutionException
- If processing fails
-
calculateOmitDependenciesFlag
public String calculateOmitDependenciesFlag(org.apache.sling.feature.extension.apiregions.api.ApiRegion region, org.apache.felix.utils.manifest.Clause[] exportedPackageClauses, Set<org.apache.felix.utils.manifest.Clause> usedExportedPackagesPerRegion) Calculate whether the artifact can be omitted and a dependency can be used instead- Parameters:
region
- The api regionexportedPackageClauses
- All exported packagesusedExportedPackagesPerRegion
- Used exported packages- Returns:
null
if the artifact can be used as a dependency
-