in src/main/java/org/apache/sling/feature/apiregions/impl/Activator.java [177:199]
public void frameworkEvent(FrameworkEvent event) {
if (event.getType() == FrameworkEvent.STARTED) {
bundleContext.removeFrameworkListener(this);
FrameworkWiring fw = bundleContext.getBundle().adapt(FrameworkWiring.class);
if (fw == null) {
LOG.log(Level.WARNING, "The API Regions runtime fragment is not attached to the system bundle.");
return;
}
Requirement cmReq = createCMPackageRequirement();
// Reflectively register a Configuration Admin ManagedService, if the Config Admin API is available.
// Because this fragment is a framework extension, we need to use the wiring API to find the CM API.
Collection<BundleCapability> providers = fw.findProviders(cmReq);
for (BundleCapability cap : providers) {
if (registerManagedService(cap)) {
return;
}
}
LOG.log(Level.INFO, "No Configuration Admin API available");
}
}