AEM Spark: OSGi Bundle States

05287_AEM Spark-OSGi Bundle States

In our AEM Spark on CRX DELite, we shared the JSON response of stopping and starting bundles via cURL. If you’re anything like me, you probably wondered what those values actually signified. Well, wonder no more-lifted directly from the OSGi Documentation, here’s a breakdown of the bundle states, and their associated values.

An OSGi bundle can be in one of six states:

Name Value stateRaw Description
UNINSTALLED 0x01 1 Only visible after a bundle is uninstalled; the bundle is in an unusable state but references to the bundle object may still be available and used for introspection.
INSTALLED 0x02 2 Visible if the bundle’s code dependencies are not resolved. The Framework may attempt to resolve an INSTALLED bundle’s code dependencies and move the bundle to the RESOLVED state.
RESOLVED 0x04 4 The Framework has successfully resolved the bundle’s code dependencies, but the bundle is not active. Dependencies include: the bundle’s classpath; the bundle’s package dependencies; the bundle’s required bundle dependencies;
STARTING 0x08 8 The bundle’s start method is active. A bundle must be in this state when the bundle’s BundleActivator.start(BundleContext) is called. If the BundleActivator.start method completes without exception, then the bundle has successfully started and must move to the ACTIVE state.
STOPPING 0x10 16 The bundle’s stop method is active. A bundle must be in this state when the bundle’s BundleActivator.stop(BundleContext) method is called. When the BundleActivator.stop method completes the bundle is stopped and must move to the RESOLVED state.
ACTIVE 0x20 32 The bundle has been successfully started and activated.

If you have a better solution to this problem that you’d like to share, contact us at info@aempodcast.com