The OSGi specification describes a modular system and a service platform for the Java programming language that implements a complete and dynamic component model, something that does not exist in standalone Java/VM environments. Applications or components, coming in the form of bundles for deployment, can be remotely installed, started, stopped, updated, and uninstalled without requiring a reboot; management of Java packages/classes is specified in great detail. Application life cycle management is implemented via APIs that allow for remote downloading of management policies. The service registry allows bundles to detect the addition of new services, or the removal of services, and adapt accordingly.
The API’s of most bundles are well documented but the implementation details are often hidden. In some cases you might want to take a look inside them to find out what is actually happening, IntelliJ makes this process very easy. In our example we’ll be looking at the Day Communique 5 WCM Multi Site Management Corecom.day.cq.wcm.cq-msm-core bundle.
In order to debug the code within the bundle, you will need the ID, in this case, it’s 347. You can find a list of all bundles at YOUR_AEM_INSTANCE_HERE/system/console/bundles. Inside you AEM installation folder navigate to /crx-quickstart/launchpad/felix, here you will see all bundles appended with the ID of the bundle.