Step 1 - Download and extract the Felix Framework Distribution. At this moment the current version is 5.0.1 and the folder structure looks like this:
![]() |
Apache Felix 5.0.1 - Folder Structure |
Step 2 - Open console window and navigate to the folder where you just unpacked the OSGi framework.
Step 3 - Execute the following command (Windows style):
java -jar .\bin\felix.jar
You should see the following result:
![]() |
Apache Felix 5.0.1 - Gogo Console |
First of all you'd like to try the help command:
![]() |
Apache Felix 5.0.1 - Gogo Help |
![]() |
Apache Felix 5.0.1 - ("felix:lb" or "lb") |
There are currently 5 available OSGi bundles with ID's form 0 to 4. When you create your own OSGi bundle and install it, your bundle will have its own ID. I'll write another article and explain how to develop a very simple OSGi bundle, how to install it, start it and stop it properly.
Here are some of the commands you can use:
help <command> - displays information about a specific command.
Example:
help headers
install <url> - installs new OSGi bundle.
Example:
install file:path/to/my-osgi-bundle.jar
start <id> - starts already installed and fully resolved OSGi bundle.
Example:
start 1
stop <id> - stops running OSGi bundle.
Example:
stop 0
The last command will end the Gogo session since we are stopping the OSGi application with ID=0 which is the system bundle and we are effectively stopping the whole OSGi engine. You can try to stop the "Gogo Shell" bundle with ID=4 and then start it again. See for yourself what's the result. You'll need to restart the OSGi engine in order to restore the functionality of the shell.
OK, that's all. This is not supposed to be a full OSGi tutorial - it's just a fast way to start with Apache Felix. In my next post I'll concentrate on developing a very simple OSGi bundle and how to make it run in Apache Felix. It'll be fun! :)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.