Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to create osgi config node for Factory services

Avatar

Level 7

Hi Team,

I have to set a system user (serviceuser) for my project so I tried to create osgi config node for org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl with the name org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-myproject

I have added the below properties -

service.ranking which is set to empty and later tried with 0 & 75000

user.mapping which is set to com.mycompany.myproject-bundle:writeService=serviceuser

I followed discussion there in https://forums.adobe.com/thread/2329678

I created org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl as well but in web console, I'm unable to see my configuration.

Is it mandatory to create org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl config node as well along with amended config?

I tried by creating the node names as -

org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended.config

org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended.config-myproject.

But still, my configuration is not available in OSGi configuration.

Can you please help me in this by providing any steps? Am I missing anything? I'm using AEM 6.2

Thanks,

AryA.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Dinu

    I have faced the exact same situation recently. Let me guide you through what my observations are on this . For creating system user config for your project don't use the amended one , always use the org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl-<uniqueid>.

1351020_pastedImage_0.png

View solution in original post

8 Replies

Avatar

Level 10

If you want to read values on Config nodes within an OSGi bundle - see this article that shows you this use case:

Scott's Digital Community: Reading AEM OSGi Configuration Values

See the Java logic in ConfigurationServiceImpl

Avatar

Level 7

Hi Scott,

Whatever I have added in the osgi config node, they are not reflecting in web console.

Avatar

Correct answer by
Community Advisor

Hi Dinu

    I have faced the exact same situation recently. Let me guide you through what my observations are on this . For creating system user config for your project don't use the amended one , always use the org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl-<uniqueid>.

1351020_pastedImage_0.png

Avatar

Level 10

Hi Dinu,

We got it working on AEM 6.3. We have to update the dependencies in pom.xml file.

We will post the HELPX article on OSGI config values on AEM 6.3. See this thread for more updates!!

Thanks,

Ratna.

Avatar

Level 10

Correct - we are working on this article for 6.3

ACONF.png

Avatar

Community Advisor

I am having doubts on this one now. Because the other day when I installed this code to DEV server , the amended one picked up and not this one .. Can someone have a more clear understanding on how this works ?

edubeysmacdonald2008Ratna Kumar​ ?

Avatar

Level 10

AFAIK, org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl is not a factory configuration but it accepts mapping as multiple properties defined in array

But for factory configs like ACS Commons Named Image transformers, having a <unique> identifies holds true