Reading OSGi Configuration properties

 

 Having talking about different ways of managing OSGi configuration here, I would like to extend from there and talk about how to create the configuration properties for a service how to read the configuration values in the service. How to Create the configurable properties:

As shown in the above example, Use @Property annotation for […]

Read More

OSGI Services without annotation

 

 [code language=”java”] BundleContext bundleContext = FrameworkUtil.getBundle(YourClass.class).getBundleContext(); //alternate to @Reference private ResourceResolverFactory resolverFactory;ServiceReference factoryRef = bundleContext.getServiceReference(ResourceResolverFactory.class.getName()); resolverFactory = (ResourceResolverFactory) bundleContext.getService(factoryRef); //alternate to @Reference private CustomPageManager customPageManager ServiceReference articleRef = bundleContext.getServiceReference(CustomPageManager.class.getName()); customPageManager = (CustomPageManager.) bundleContext.getService(articleRef); [/code]

Read More