<commit_before>h1. Overview

Example for the "Karaf Tutorial 9 - CDI meet OSGi" 
that implements a very small application to manage a list of tasks or to dos like in tutorial 1. 
Originally I planned to use pax cdi and deltaspike jpa for this tutorial. 
Unfortunately deltaspike jpa does not yet work in OSGi. So I created a maven plugin that creates blueprint from CDI annotations.
See https://github.com/cschneider/blueprint-maven-plugin

This allows to build an example with JPA persistence, Transactions and a Servlet Ui using zero hand written blueprint xml.

It shows how to:

- Create bundles using maven and the maven bundle plugin
- Wire bundles using CDI annotations and OSGi services
- Write JPA DAO classes like in JEE using @PersistenceUnit and @Transactional
- Use the whiteboard pattern and the pax-web whiteboard extender to publish Servlets

h1. Structure

Module             | Description  
model              | Service interface and model classes shared between persistence and ui
persistence        | Full persistence implementation using JPA and hibernate
persistence-simple | Simple persistence implementation using an OSGi service and a in memory map
ui                 | Simple servlet based UI that connects to the persistence layer using an OSGi service reference and publishes a servlet 

h1. Build blueprint-maven-plugin

As there is no public release yet you have to build the plugin yourself

git clone https://github.com/cschneider/blueprint-maven-plugin
cd blueprint-maven-plugin
mvn clean install

h1. Build example

mvn clean install

h1. Installation

Download and start Karaf 3

feature:install jdbc
jdbc:create -t Derby derbyds 
feature:repo-add mvn:net.lr.tasklist.cdi/tasklist-features/1.0.0-SNAPSHOT/xml
feature:install example-tasklist-cdi-persistence example-tasklist-cdi-ui

h1. Test

Open the url below in your browser.
http://localhost:8181/tasklist<commit_msg>Note about exception when shutting down karaf<commit_after>h1. Overview

Example for the "Karaf Tutorial 9 - CDI meet OSGi" 
that implements a very small application to manage a list of tasks or to dos like in tutorial 1. 
Originally I planned to use pax cdi and deltaspike jpa for this tutorial. 
Unfortunately deltaspike jpa does not yet work in OSGi. So I created a maven plugin that creates blueprint from CDI annotations.
See https://github.com/cschneider/blueprint-maven-plugin

This allows to build an example with JPA persistence, Transactions and a Servlet Ui using zero hand written blueprint xml.

It shows how to:

- Create bundles using maven and the maven bundle plugin
- Wire bundles using CDI annotations and OSGi services
- Write JPA DAO classes like in JEE using @PersistenceUnit and @Transactional
- Use the whiteboard pattern and the pax-web whiteboard extender to publish Servlets

h1. Structure

Module             | Description  
model              | Service interface and model classes shared between persistence and ui
persistence        | Full persistence implementation using JPA and hibernate
persistence-simple | Simple persistence implementation using an OSGi service and a in memory map
ui                 | Simple servlet based UI that connects to the persistence layer using an OSGi service reference and publishes a servlet 

h1. Build blueprint-maven-plugin

As there is no public release yet you have to build the plugin yourself

git clone https://github.com/cschneider/blueprint-maven-plugin
cd blueprint-maven-plugin
mvn clean install

h1. Build example

mvn clean install

h1. Installation

Download and start Karaf 3

feature:install jdbc
jdbc:create -t Derby derbyds 
feature:repo-add mvn:net.lr.tasklist.cdi/tasklist-features/1.0.0-SNAPSHOT/xml
feature:install example-tasklist-cdi-persistence example-tasklist-cdi-ui

h1. Test

Open the url below in your browser.
http://localhost:8181/tasklist

Btw. When shutting down karaf 3.0.2 you will see an exception while stopping model. This is a known bug in aries jpa and will be fixed in the next
release. So hopefully karaf >= 3.0.3 will include it.
{'fraction_non_alphanumeric': 0.042511122095897184, 'fraction_numerical': 0.009391992090954029, 'mean_word_length': 3.9353658536585368, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2230818', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1083, 'n_words': 532}