Cracking the Code: How Apache Felix Search Web Console Plugin Simplifies AEM Development
The Apache Felix Search Web Console Plugin is a must-have plugin for the Adobe Experience Manager development workflow. It provides powerful search capabilities that allow AEM developers to quickly locate and debug issues within their AEM codebase andan easy-to-use web console for searching bundles and services registered in the OSGi framework.
Additionally, this powerful plugin helps diagnose problems in OSGi applications and discover what components are available. The plugin also provides access to bundle and service properties as well as the ability to inspect classes loaded by bundles. Users can quickly find what they are looking for without having to look through all of the source code and be more productive while dealing with complex OSGi applications.
Let’s say you are working on a project that involves the Core WCM Components bundle, and you need to locate a specific class within that bundle. You can use the Apache Felix Search Web Console Plugin to search for the bundle and decompile the required class with the help of below mentioned steps.
How to Configure the Apache Felix Search Web Console Plugin
To install and configure this plugin and start using the above features, please go through the directions here. Once the setup is done, you are ready to explore features of this plugin.
Apache Felix Search Web Console Plugin Features
The plugin can be accessed by navigating here and selecting the search option from the OSGi dropdown menu, as shown below.
Look for the search console on the plugin page, as seen in the following screenshot:
To see the results specific to bundles, enter the phrase in the search bar and select the appropriate filter from bundle, class, configuration, and service. Let's use the Core WCM Components Bundle as an example of an OOTB bundle. The screenshot below displays the results for the search term "Adobe Experience Manager Core WCM Components Core Bundle," with the first result being the bundle we needed.
You can notice three options on the right side of the screenshot below that will assist you in downloading a selected bundle, getting that bundle's details, and browsing the classes contained within it.
The action will trigger the immediate download of that bundle.
The action will direct you to the real bundle path, which will display all of the bundle's specifics.
Show Class Tree
As shown in the screenshot below, the action will open a pop-up window displaying the packages and classes contained within that bundle:
Now that we are aware of the location of the bundle (WCM CORE), let's decompile any classes that are contained there in. To show all the classes in the WCM core bundle that are currently available, search using the package path. Additionally, you might observe certain other results from the utilization of that bundle.
The screenshot above shows the results of wcm core classes, which may be readily decompiled using the action "Decompile class" highlighted in the screenshot. Let's decompile an instance of "com.adobe.cq.wcm.core.components.models.Page".
The decompiled class can be seen in the screenshot below.
Generate Source Code
By choosing the required class or bundle and clicking on "Generate sources," as shown in the screenshot below, you can easily generate and download the source code for any bundle or class.
The action will open up the model giving you the option to download the source code zip file.
Decompile & Search
The action highlighted in the below screenshot provides the ability to decompile and search any words in that respective class. This is very helpful when you want to see occurrences of functions in the same class without scrolling from top to bottom.
Let’s search for @JsonIgnore within the com.adobe.cq.wcm.core.components.models.Page class, and it will show the results with all the occurrences of that function along with the pagination option.
Similarly you can also search for configuration and services with the help of available filters.
The Apache Felix Search Web Console Plugin is a valuable tool for AEM developers to debug problems in OSGi applications and discover available components. It provides an easy-to-use web console for searching bundles and services registered in the OSGi framework. The plugin enables developers to quickly find what they are looking for without going through all of the source code, making them more productive while dealing with complex OSGi applications. The plugin provides bundle search capabilities and various actions such as downloading a selected bundle, showing bundle details, browsing classes, decompiling classes, generating source code, and searching within a decompiled class. However, developers should only use the plugin for local debugging and not deploy it on an actual instance.