<commit_before>h1. Overview

Template for OSGi training.
Use this as a starting point when solving the training tasks.

h1. Structure

features
  template for a feature file and project to deploy it

itest
  template for integration tests. Already contains the pax exam dependencies

h1. Build

mvn clean install

h1. Installation

features:addurl mvn:net.lr.training/training-features/1.0.0-SNAPSHOT/xml
features:install training

h1. Excercises

h2. 1. Create your first OSGi service

- Create a module named model that contains the service interface and the shared classes.
- Create a module named service that contains the service implementation and that uses blueprint to export the service impl as
an OSGi service
- Create a feature for your service
- Test your service in karaf. Install the feature and verify the OSGi service is published 

h2. 2. Create a servlet UI that uses the OSGi service

- Create a module ui that implements a HTTPServlet and that uses your OSGi service to display some informations about the service
- add a feature for the UI
- Test the UI and service in kataf. Install the features and verify that you can access the UI

h2. 3. Create an integration test using pax exam that tests your service

- Use the preexisting module itest
- Change the test class to install your service feature, call your service and check the result 
- Run the test and verify it works correctly

h2. 3. Create a CXF Rest endpoint that uses your service
 
- Create a module named endpoint that implements a CXF rest endpoint and exports it using blueprint and the cxf rest namespace
- Add a feature for the new module
- Test the feature in karaf and verify the rest endpoint is visible
- Call the rest endoint using e.g. poster or SOAP UI

h2. 4. Create a camel route thagt uses your service

- Create a module named route with a camel route
- The route starts with a file endpoint, extracts some information from the file, calls your service and stores the result in a new file.

h2. 5. Change the camel route to offer a rest service

- Change the module route to now listen to a cxfrs endpoint, call your service and returns the result
<commit_msg>Update exercises<commit_after>h1. Overview

Template for OSGi training.
Use this as a starting point when solving the training tasks.

h1. Structure

features
  template for a feature file and project to deploy it

itest
  template for integration tests. Already contains the pax exam dependencies

h1. Build

mvn clean install

h1. Installation

features:addurl mvn:net.lr.training/training-features/1.0.0-SNAPSHOT/xml
features:install training

h1. Excercises

h2. 1. Create your first OSGi service

- Create a module named model that contains the service interface and the shared classes.
- Create a module named service that contains the service implementation and that uses blueprint to export the service impl as
an OSGi service
- Create a feature for your service
- Test your service in karaf. Install the feature and verify the OSGi service is published 

h2. 2. Create a servlet UI that uses the OSGi service

- Create a module ui that implements a HTTPServlet and that uses your OSGi service to display some informations about the service
- add a feature for the UI
- Test the UI and service in kataf. Install the features and verify that you can access the UI

h2. 3. Create an integration test using pax exam that tests your service

- Use the preexisting module itest
- Change the test class to install your service feature, call your service and check the result 
- Run the test and verify it works correctly

h2. 4. Create a CXF Rest endpoint that uses your service
 
- Create a module named endpoint that implements a CXF rest endpoint and exports it using blueprint and the cxf rest namespace
- Add a feature for the new module
- Test the feature in karaf and verify the rest endpoint is visible
- Call the rest endoint using e.g. poster or SOAP UI

h2. 5. Create a camel route thagt uses your service

- Create a module named route with a camel route
- The route starts with a file endpoint, extracts some information from the file, calls your service and stores the result in a new file.

h2. 6. Change the camel route to offer a rest service

- Change the module route to now listen to a cxfrs endpoint, call your service and returns the result

h2. 7. Use jpa persistence inside your service

Make your service persist some data using jpa. Use the "Apache Karaf Tutorial Part 6 - Database Access" project db_examplejpa as an example for how to setup your project.
- Use openjpa and derby as jpa backend

h2. 8. Switch your persistence to hibernate

Same as above but now use hibernate as backend and use the hibernate Session instead of the EntityManager.
USe the hibernate project in the db tutorial source as an example how to swithc to hibernate and how to create a feature for hibernate.
{'fraction_non_alphanumeric': 0.027903159622486663, 'fraction_numerical': 0.009232663110381617, 'mean_word_length': 3.855577689243028, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3036753', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1228, 'n_words': 794}