Expand my Community achievements bar.

SOLVED

fetching properties of OSGi service in java class

Avatar

Former Community Member

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

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