fetching properties of OSGi service in java class | Community
Skip to main content
October 16, 2015
Solved

fetching properties of OSGi service in java class

  • October 16, 2015
  • 1 reply
  • 1263 views

Hi,

I have created a node of type sling:OsgiConfig and have inserted a property 'propertyPath' which is of type String[]. I can access this in my component JSP using:

Configuration conf = sling.getService(org.osgi.service.cm.ConfigurationAdmin.class).getConfiguration("Name of the config"); String[] myProp = (String[]) conf.getProperties().get("propertyPath");

How can I do the same in a java class. I want to make a method in java class that I would call from my JSP.  I am doing this using taglib. How can I achieve the same thing in the method that I am going to write.

Thanks in advance, 
Ankit

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 smacdonald2008

We have many articles that show  how to write a Java method that contain app logic, use Sling annotations in the Java class,  embed the Java class within an OSGi bundle, and call operations of that OSGi from an AEM JSP. See:

http://scottsdigitalcommunity.blogspot.ca/2013/01/persisting-cq-data-in-java-content.html

http://scottsdigitalcommunity.blogspot.ca/2013/12/creating-html-parser-service-for-adobe.html

as a few examples.

For a listing of more AEM articles and help content - see this page:

http://helpx.adobe.com/marketing-cloud/experience-manager.html 

1 reply

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

We have many articles that show  how to write a Java method that contain app logic, use Sling annotations in the Java class,  embed the Java class within an OSGi bundle, and call operations of that OSGi from an AEM JSP. See:

http://scottsdigitalcommunity.blogspot.ca/2013/01/persisting-cq-data-in-java-content.html

http://scottsdigitalcommunity.blogspot.ca/2013/12/creating-html-parser-service-for-adobe.html

as a few examples.

For a listing of more AEM articles and help content - see this page:

http://helpx.adobe.com/marketing-cloud/experience-manager.html