Using Same OSGI Service at Multiple Times | Community
Skip to main content
Singaiah_Chintalapudi
New Participant
April 26, 2016
Solved

Using Same OSGI Service at Multiple Times

  • April 26, 2016
  • 13 replies
  • 5596 views

I want to use the same OSGI service to read config values from run modes instead of developing multiple OSGI services. For example, we can click on "+" button to configure multiple DB's in felix console. Is there a way in AEM to do that?

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 leeasling
@Component(metatype = true, label = "Configuration Factory", description = "Configuration Factory", configurationFactory = true) @Service public class TestConfigurationFactory { @Property(label = "Property 1", propertyPrivate = false, description = "Property 1") private static final String PROPERTY_1 = "property.one"; @Property(label = "Property 2", propertyPrivate = false, description = "Property 2") private static final String PROPERTY_2 = "property.two"; private String property1; private String property2; @Activate protected void activate(ComponentContext context) throws RepositoryException { this.property1 = PropertiesUtil.toStringArray(context.getProperties().get(PROPERTY_1)); this.property2 = PropertiesUtil.toStringArray(context.getProperties().get(PROPERTY_2)); } }

13 replies

smacdonald2008
New Participant
April 26, 2016

API headers. I am not sure what you mean by this term . Do you mean a page header that is part of a web page?

Singaiah_Chintalapudi
New Participant
April 26, 2016

smacdonald2008 wrote...

AEM lets you write OSGi bundles that read Config values https://helpx.adobe.com/experience-manager/using/osgi_config.html. You can develop the code to perform different tasks based on config values read at run time.

 

Thanks Scott. This is not what I am looking for. Currently I have a OSGI service which I read some configuration values. Authors will go to configuration manager to author those values. For example, authors will come and configure the API headers.

I have a similar requirement but I have to configure the different API headers and also want to keep the old API headers. Instead of developing a new service, can I use this existing OSGI service?

smacdonald2008
New Participant
April 26, 2016

AEM lets you write OSGi bundles that read Config values https://helpx.adobe.com/experience-manager/using/osgi_config.html. You can develop the code to perform different tasks based on config values read at run time.