Hi All,
Is it really possible to access/invoke OSGI service from groovy console? I have been in situation where every time I needed to change/configure page along with some configuration - this becomes very tedious process to me just to access my service result. So I want to know if any possibilities which resolve my problem.
Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @shoib_I ,
Indeed! It is possible, I remember in my blog I used to demonstrate through groovy console to have it shown quickly.
Here I have one example.
Let's say we have a component in AEM as below
package com.training.osgi.core.stringgen; import org.osgi.service.component.annotations.Component; @Component(immediate = true, service = StringGenerator.class) public class StringGeneratorImpl implements StringGenerator { @Override public String generateString() { return "Version 1.1"; } }
You can then invoke it through groovy console as below
import com.training.osgi.core.stringgen.StringGenerator; def service = gerService(StringGenerator.class);
println service.generateString();
You must see below output
Version 1.1
For more details please watch my published video here: https://www.techinnovia.com/osgi-services-and-components/
Hope that helps!
Regards,
Santosh
Hi @shoib_I ,
Indeed! It is possible, I remember in my blog I used to demonstrate through groovy console to have it shown quickly.
Here I have one example.
Let's say we have a component in AEM as below
package com.training.osgi.core.stringgen; import org.osgi.service.component.annotations.Component; @Component(immediate = true, service = StringGenerator.class) public class StringGeneratorImpl implements StringGenerator { @Override public String generateString() { return "Version 1.1"; } }
You can then invoke it through groovy console as below
import com.training.osgi.core.stringgen.StringGenerator; def service = gerService(StringGenerator.class);
println service.generateString();
You must see below output
Version 1.1
For more details please watch my published video here: https://www.techinnovia.com/osgi-services-and-components/
Hope that helps!
Regards,
Santosh
Views
Likes
Replies