...
No Format |
---|
Bundle-Name: Spell checker client Bundle-Description: A bundle that uses the spell checker service Bundle-Vendor: Richard Hall Bundle-Version: 1.0.0 Bundle-Activator: tutorial.example6example7.Activator Import-Package: org.osgi.framework, org.osgi.util.tracker, tutorial.example6.service |
We specify which class is used to activate the bundle via the Bundle-Activator
attribute and also specify that our bundle imports the OSGi core, OSGi Service Tracker, and spell checker service interface packages with the Import-Package
attribute. The OSGi framework will automatically handle the details of resolving import packages. (Note: Make sure your manifest file ends in a trailing carriage return or else the last line will be ignored.)
To compile our source code, we need to have the felix.jar
file (found in Felix' bin
directory) and the example6.jar
file in our class path. We compile the source file using a command like:
...
To run Felix, we follow the instructions described in usage.html. When we start Felix, it asks for a profile name, we will put all of our bundles in a profile named tutorial
. After running Felix, we should stop all tutorial bundles except for the service bundles. Use the ps
lb
command to make sure that only the bundles from Example 2, Example 2b, and Example 6 are active; use the start
and stop
commands as appropriate to start and stop the various tutorial bundles, respectively. (Note: Felix uses some bundles to provide its command shell, so do not stop these bundles.) Now we can install and start our spell checker client bundle. Assuming that we created our bundle in the directory c:\tutorial
, we can install and start it in Felix' shell using the following command:
No Format |
---|
start file:/c:/tutorial/example6example7.jar |
The above command installs and starts the bundle in a single step; it is also possible to install and start the bundle in two steps by using the Felix install
and start
shell commands. When we start the bundle, it will use the shell thread to prompt us for passages; a passage is a collection or words separate by spaces, commas, periods, exclamation points, question marks, colons, or semi-colons. Enter a passage and press the enter key to spell check the passage or enter a blank line to stop spell checking passages. To restart the bundle, we must use the Felix shell ps
lb
command to get the bundle identifier number for the bundle and first use the stop
command to stop the bundle, then the start
command to restart it.
...