Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note that we do not need to unget or release the service in the stop() method, because the OSGi framework will automatically do so for us. We must create a manifest.mf file that contains the meta-data for our bundle; the manifest file contains the following:

Code Block
Bundle-Activator: tutorial.example3.Activator
Import-Package: tutorial.example2.service
Bundle-Name: Dictionary client
Bundle-Description: A bundle that uses the dictionary service if it finds it at startup
Bundle-Vendor: Apache Felix
Bundle-Version: 1.0.0
Bundle-Activator: tutorial.example3.Activator
Import-Package: org.osgi.framework,
 tutorial.example2.service

We specify the bundle's activator class via the Bundle-Activator attribute and also specify that our class imports the shared OSGi core framework package of and the dictionary service interface using package via the Import-Package attribute. This import clause The dictionary service interface package will be fulfilled by the bundle in Example 2, which exports the this package that this bundle is importing. The OSGi framework will automatically handle the details of resolving import packages.

...