DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
Note that we do not need to unregister the service in the stop() method, because the OSGi framework will automatically do so for us. The dictionary service that we have implemented is very simple; its dictionary is a static array of only five words, so this solution is not optimal and is only intended for educational purposes. We must create a manifest.mf file that contains the meta-data for our bundle; the manifest file contains the following:
| No Format |
|---|
Bundle-Activator: tutorial.example2.Activator Export-Package: tutorial.example2.service Bundle-Name: English dictionary Bundle-Description: A bundle that registers an English dictionary service Bundle-Vendor: Apache Felix Bundle-Version: 1.0.0 Bundle-Activator: tutorial.example2.Activator Export-Package: tutorial.example2.service Import-Package: org.osgi.framework |
As before, much of the meta-data in the manifest file above is for human consumption. We specify which class is used to activate our bundle via the Bundle-Activator attribute and also specify that our bundle exports a shared package using the Export-Package attribute. The Export-Package attribute makes it possible for other bundles to import our dictionary service interface. The Import-Package attribute informs the framework of the bundle's dependencies on external packages; all bundles with an activator must import org.osgi.framework since it contains the core OSGi class definitions. Any packages dependencies will be verified and resolved by the OSGi framework.
To compile our source code, we need the felix.jar file (found in Felix' bin directory) in our class path. We compile the source file using a command like:
...