Allow individual bundles to be specified as being in a given region.

If you have a bundle that is not part of a feature it is now possible to
configure the apiregions runtime to make that bundle part of a specified
region. By default bundles that are not in a region can only see the
'global' region.
To make the bundle part of a different region, specify the following
framework property:
  sling.feature.apiregions.bundles=
    {bsn:version}={groupid:artifactId:version};{region},
    {bsn:version}={groupid:artifactId:version};{region}
So the Bundle-SymbolicName and version needs to be mapped to the
associated artifact ID for the bundle artifact and the region needs to
specified.
For example:
  org.foo.bar:1.2.3=org.foo:bar:1.2.3;myregion

The bundle will be added to a synthesized region.
9 files changed
tree: 2d42e3076643fe3349bbf667deae65b055277cec
  1. src/
  2. .gitignore
  3. CODE_OF_CONDUCT.md
  4. CONTRIBUTING.md
  5. Jenkinsfile
  6. LICENSE
  7. pom.xml
  8. README.md
README.md

Build Status Test Status License feature

Apache Sling API Regions runtime component

The API Regions runtime component is implemented as an OSGi Framework Extension bundle. This ensures that the runtime component is always present early in the startup process.

This component registers an OSGi resolver hook service which enforces the API regions at runtime. The component looks for properties files that provide the configuration of the API regions. The properties files are generated by the https://github.com/apache/sling-org-apache-sling-feature-extension-apiregions component during the extension post-processing.

As the component has no dependencies on any other component, the properties files are obtained via Framework Properties lookups:

  • sling.feature.apiregions.resource.idbsnver.properties - provides the location of the idbsnver.properties file.
  • sling.feature.apiregions.resource.bundles.properties - provides the location of the bundles.properties file.
  • sling.feature.apiregions.resource.features.properties - provides the location of the features.properties file.
  • sling.feature.apiregions.resource.regions.properties - provides the location of the regions.properties file.

Alternatively, the directory where all of the above files can be found can be specified using one Framework Property instead of using the above framework properties:

  • sling.feature.apiregions.location - provides the location where all properties file can be found. If this property is specified the above properties are not necessary. However if both are provided the file-specific properties take precedence.

File locations are either provided as an absolute file path or by URL. The URL handling mechanism supports one special pseudo-protocol: classloader://. URLs specified with this protocol are passed through the framework classloader's getResource() method to obtain the actual URL.

Enabling / disabling this component

The component is enabled by setting the following framework property:

org.apache.sling.feature.apiregions.regions=*

If this framework property is not set the component will be disabled.