Example for the Karaf Tutorial part 1 that implements a very small application to manage a list of tasks or todo items.
It shows how to:
- Create bundles using maven and the maven bundle plugin
- Wire bundles using blueprint and OSGi services
- Define blueprint beans using annotations
- Define Felix gogo shell commands
- Use the whiteboard pattern and the pax-web whiteboard extender to publish Servlets
Module | Description |
---|---|
tasklist-model | Service interface and model classes shared between persistence and ui |
tasklist-persistence | Persistence implementation using an OSGi service and a in memory map |
tasklist-ui | Servlet based UI that connects to the persistence layer using an OSGi service |
tasklist-command | Felix gogo command to interact with tasks from the shell |
mvn clean install
Download and start karaf >= 4.1. If you want to use karaf 4.0.x you need to switch the way the http servlet is published. See the comment in TaskListServlet.
feature:repo-add mvn:net.lr.tasklist/tasklist-features/1.0.0-SNAPSHOT/xml
feature:install example-tasklist
http:list
This should show the servlet we expose.
task:list
Will list the tasks currently managed by the service
Open the URL below in your browser http://localhost:8181/tasklist. It should show the pre defined tasks.