Monday 27 May 2019

AEM - Osgi Config Dashboard

Apache Felix framework provides restful APIs to access OSGi bundle info over regular HTML and JSON format. if requests are sent with the .json extension; e.g. .../bundles/id.json. or .../bundle.json the JSON response of bundle will be returned. more info available at https://felix.apache.org/documentation/subprojects/apache-felix-web-console/web-console-restful-api.html

But for OSGi configs, there is no JSON API is available to fetch OSGi config as JSON response, though plain text representation of configuration can be seen at http://host:port/system/console/status-Configurations with web console access.


OSGi Configuration API

I created an API to return modified OSGi configurations as JSON response, available at https://github.com/arunpatidar02/osgi-config-api

OSGi Config Dashboard

I consume the above API and created a landing page in AEM, which shows the OSGi configs with filter and sorting options.
Note : This zip package contains only nodes and UI code but doesn't contain OSGi bunndle(Servlet and other Java class). These java classes can be copied for github and use.

Dashboard page url - http://host:port/osgiconfig

Osgi Configuration Dashboard Page


Filter

Results can be filtered using text and/or repository based configurations.
Text enter in 'Enter keyword' look for pid, factoryPid and Properties, if anyone of matches then result returns for that OSGi config.
Filter dropdown had two options All and Repository based.
if Repository based selected then all the repository based configs will be returned in the combination of text entered in 'Enter keyword' field otherwise all configs will be returned in the combination of text entered in 'Enter keyword' field.

Note: Result filtering is taking place at the client side, there is no request sent to the server to fetch new results.
OSGi configs only getting fetched once on page load and filtering/sorting is done at client side.


Filter section



Filtered Result - Repository based



Filtered Result - keyword + Repository based


Filtered Result - Keyword


Sorting

Results can be sorted either by pid or Repository based config.



Properties

When clicking on more info icon for OSGi config a popup will be shown which contains the following info:
  • Pid
  • factoryPid - if the config is a type of factory config
  • Change count
  • Repository Paths - if the config is repository based(sling: OsgiConfig)
  • Properties




Conclusion

This dashboard is an example of to consume API and can be used in non-prod instance to check OSGi configs if the users don't have access to the web console but the user should have read access at /apps, /conf and /libs (or alternatively sub-service session can be used in the servlet while executing query to fetch repository based config).

2 comments:

  1. This a wonderful article.
    Quick question Arun, what would limitation or security concern of using this in production in environment?

    Thanks!!

    ReplyDelete
  2. Hi Hemanth,
    tThere is no security issue, it is just a get response.
    You can put this inside /content/internal blocked from dispatcher, and if you want this has to be accessed only with login then put inside /apps/ folder.

    ReplyDelete

AEMaaCS - Core Component's Children Editor

If you are using core components, you should be familiar with the children-editor for Tabs, Accordion, and Carousel. These components are th...

About Me

My photo
https://www.linkedin.com/in/arunpatidar26/ https://experienceleaguecommunities.adobe.com/t5/user/viewprofilepage/user-id/6786635 https://community.adobe.com/t5/user/viewprofilepage/user-id/12372253 https://forums.adobe.com/people/Arun+Patidar