Posts

Showing posts from January, 2012

Introduction to OSGi - 2 (OSGi Services)

There are so many OSGi tutorials, blogs, and samples. I am going to add another OSGi sample/tutorial with my OSGi leanings. Here is my previous article regarding OSGi ( Introduction to OSGi ). An OSGi Service is a java object instance which is registered with OSGi framework with set of attributes. Services can be accessed via service registry(performed via the class BundleContext). BundleActivator is to be invoked on start and stop. When BundleActivator call start method we are going to register our service. After that any bundle can access that service. Service Bundle: In service bundle you need to export your service and need to register it via service registry. When we are exporting service we export interface package only. As usual that is to hide the implementation from the other bundles. I have created a sample OSGi project called HelloServcie MANIFEST.MF Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: HelloService Bundle-SymbolicName: com.chandana