commit | 620a7e7466ba8de333cb4372c6a4dc01b9130585 | [log] [tgz] |
---|---|---|
author | Simo Tripodi <stripodi@adobe.com> | Mon Jul 15 23:52:59 2019 +0200 |
committer | Simo Tripodi <stripodi@adobe.com> | Mon Jul 15 23:52:59 2019 +0200 |
tree | 8d6d906e14db0df097d8c1e09fa010009ca2187f | |
parent | bc024e9e51cea2db06b9e551f67d6d5084fbcdd7 [diff] |
ConfigurationAdmin reference managed via OSGi declarative services, avoid to manually look for it in the BundleContext
This is a simple OSGi service which is able to convert, given a BundleContext
instance, a currently running OSGi container to an Apache Sling Feature Model definition.
APIs are really simple: it is necessary first to obtain the RuntimeEnvironment2FeatureModel
instance from the OSGi Service Registry, then
import org.apache.sling.feature.r2f.*; @Reference RuntimeEnvironment2FeatureModel generator; ... Feature runtimeFeature = generator.getRunningFeature();
Currently version will include in the generated Feature Model bundles
and configurations
only, which are the only informations that can be extracted from a BundleContext
instance.
The RuntimeEnvironment2FeatureModel
OSGi service is also able to retrieve the (assembled) Feature used to launch the platform:
import org.apache.sling.feature.r2f.*; @Reference RuntimeEnvironment2FeatureModel generator; ... Feature launchFeature = generator.getLaunchFeature();
## Upgrade Feature
The RuntimeEnvironment2FeatureModel
OSGi service is also able to compute the upgrade Feature which prototypes from the Feature used to launch the platform and that targets the runtime Feature:
import org.apache.sling.feature.r2f.*; @Reference RuntimeEnvironment2FeatureModel generator; ... Feature launchFeature = generator.getLaunch2RuntimeUpgradingFeature();
Finally, the RuntimeEnvironment2FeatureModel
OSGi service is also able to compute the real runtime Feature which is assembled from the Feature used to launch the platform and that targets the runtime Feature:
import org.apache.sling.feature.r2f.*; @Reference RuntimeEnvironment2FeatureModel generator; ... Feature launchFeature = generator.getLaunch2RuntimeUpgradingFeature();