OSGi is a fundamental element in the technology
stack of AEM. It is used to control the composite bundles of AEM and
their configuration. OSGi “provides the standardized primitives that allow
applications to be constructed from small, reusable and collaborative
components.
OSGi
OSGi is a Java framework for developing and deploying modular software
programs and libraries. OSGi has two parts.
- Bundles or Plug-in
- Java Virtual Machine (JVM)-level service registry.
In this article, we
will focus on bundle states only.
A Bundle object is the access point to define the lifecycle of
an installed bundle. Each bundle installed in the OSGi environment must have an
associated Bundle object.
A bundle must have a unique identity, a long, chosen by the Framework. This
identity must not change during the lifecycle of a bundle, even when the bundle
is updated. Uninstalling and then reinstalling the bundle must create a new
unique identity.
A bundle can be in one of six states:
Name |
Value |
Description |
UNINSTALLED |
0x00000001 |
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 |
0x00000002 |
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 |
0x00000004 |
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 |
0x00000008 |
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 |
0x00000010 |
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 |
0x00000020 |
The bundle has been
successfully started and activated. |
References:
https://docs.osgi.org/javadoc/r6/core/org/osgi/framework/Bundle.html
good article.. to the point.
ReplyDelete