AEM osgiconfig node for different profile. | Community
Skip to main content
May 31, 2019
Solved

AEM osgiconfig node for different profile.

  • May 31, 2019
  • 4 replies
  • 1552 views

Hi Team,

As I have three Instances for aem one is author , publish and development, For this I have created three folders like config.author, config.publish and config.development and created three sling:osgiConfig node with the same name but multiple copies in each of the folder,

And now with the help of data-sly-use  I am able to use the node properties.

But the problem here is in data-sly-use i Have to give the complete path of the node which included config.author and so.

I have diff configuration for diff env for which i have to change the path in every env.

Please let me know how to use relative path and value of those propeties in my HTML.

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

You should never OSGI configuration explicitly, but you should let the container do this for you!


From what I understood you have these nodes:

* /apps/myapp/config.author/x.y.z (sling:osgiConfig)

* /apps/myapp/config.publish/x.y.z (sling:osgiConfig)

* /apps/myapp/config.development/x.y.z (sling:osgiConfig)

which is correct. Now you need to have a service with the PID x.y.z, which can be done the easiest way, if you "x.y" is the java package name and "z" is the classname of that service. Now you can read the configuration value as part of the service activation.

And as the next part you need to create a slingmodel, which is using your x.y.z service to do something useful, and embed that slingmodel into HTL.

This might sound overkill, but if it's really overkill, you are often trying to store parameters as OSGI configuration, which should not be OSGI configs at all.

HTH,

Jörg

4 replies

Mayank_Gandhi
Adobe Employee
Adobe Employee
June 3, 2019

kautuksahni​ Can you please move the thread to AEM.

kautuk_sahni
Community Manager
Community Manager
June 3, 2019

Done, thanks.

Kautuk Sahni
arunpatidar
Community Advisor
Community Advisor
June 3, 2019

use java api to read config.

Example :

aem63app-repo/GetFactoryConfigServlet.java at master · arunpatidar02/aem63app-repo · GitHub

If config is not factory you can use pid filter, example

private static final String filter = "(service.pid=com.abc.xxx.abc.def)";

Arun Patidar
joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
June 3, 2019

You should never OSGI configuration explicitly, but you should let the container do this for you!


From what I understood you have these nodes:

* /apps/myapp/config.author/x.y.z (sling:osgiConfig)

* /apps/myapp/config.publish/x.y.z (sling:osgiConfig)

* /apps/myapp/config.development/x.y.z (sling:osgiConfig)

which is correct. Now you need to have a service with the PID x.y.z, which can be done the easiest way, if you "x.y" is the java package name and "z" is the classname of that service. Now you can read the configuration value as part of the service activation.

And as the next part you need to create a slingmodel, which is using your x.y.z service to do something useful, and embed that slingmodel into HTL.

This might sound overkill, but if it's really overkill, you are often trying to store parameters as OSGI configuration, which should not be OSGI configs at all.

HTH,

Jörg