Class RegionSupport

java.lang.Object
org.apache.sling.feature.maven.mojos.apis.RegionSupport

public class RegionSupport extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    RegionSupport(org.apache.maven.plugin.logging.Log logger, boolean incrementalApis, boolean toggleApiOnly, Set<String> includeRegions, Set<String> excludeRegions)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    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)
    Compute exports based on all regions
    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)
    Compute exports based on a single region
    List<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[]
     
    getManifest(org.apache.sling.feature.ArtifactId artifactId, File bundleFile)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RegionSupport

      public RegionSupport(org.apache.maven.plugin.logging.Log logger, boolean incrementalApis, boolean toggleApiOnly, Set<String> includeRegions, Set<String> excludeRegions)
  • 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

      public List<org.apache.sling.feature.extension.apiregions.api.ApiExport> getAllExports(org.apache.sling.feature.extension.apiregions.api.ApiRegion region, Set<String> enabledToggles)
    • 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 use
      enabledToggles - The enabled toggles
      exportedPackages - The exported packages
      bundle - 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 use
      exportedPackages - The exported packages
      allPackages - 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

      public org.apache.felix.utils.manifest.Clause[] getExportedPackages(Manifest manifest)
    • 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 context
      artifact - The artifact
      artifactFile - 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 region
      exportedPackageClauses - All exported packages
      usedExportedPackagesPerRegion - Used exported packages
      Returns:
      null if the artifact can be used as a dependency