Featured

Adobe Experience Manager - Create an OSGI Configuration

 In this article, let's create an OSGi configuration, configure it and use it in AEM code. So now let's get started with the creation of an OSGi configuration.

Technical details and Assumptions:

All the following details are tested in AEM version 6.5.8, Java version 11.0.2

Creation of OSGi configuration:

To create an OSGi configuration we need to create an ObjectClassDefinition. I have included a sample OCD configuration, which can be used as a reference to create one.


The next step would be to create an interface and an implementation that can help fetch the OSGi configurations. 

Interface:

Implementation:

Let's try to use the OSGi configuration created so far in Models/Servlets. For demonstration purposes, I used AEM Models here, but the same can be implemented in Servlets too.

Now that we have created the OSGi configuration. Once building the code, we should be able to see the OSGi configuration in the web console (http://localhost:4502/system/console/configMgr)


Configuring the OSGi configuration can be done in four different ways, I am just showing the manual/simplest way as a part of this article. Do check my other article where I explain the different ways of configuring OSGi configurations here.
Here is an example to have configuration from the code base,

Now, let's write a simple component to use the Model and get the configuration.

Now check the output of the component,


To summarize we,
- created an OSGi configuration and validated the same in the web console, where we can edit it too
- used the created OSGi configuration in an AEM Model to take the configuration to the UI using a simple component

Hope this article helps in creating an OSGi configuration from scratch in AEM ❤️. Feel free to comment and suggestions/improvements :P

Thanks for reading :)

References:

1) https://computer-lords.blogspot.com/2021/12/adobe-experience-manager-configure-osgi.html


Comments

Popular Posts