Difference between revisions of "Tutorial OSGi avec Apache Felix - Partie 4"
Jump to navigation
Jump to search
(Created page with "Revenir au sommaire <pre> Requirements - Felix framework distribution - Eclipse - PDE - iPOJO Nature - API overview I. Activator 1. Create …") |
|||
Line 1: | Line 1: | ||
[[Tutorial OSGi avec Apache Felix|Revenir au sommaire]] |
[[Tutorial OSGi avec Apache Felix|Revenir au sommaire]] |
||
⚫ | |||
<pre> |
<pre> |
||
⚫ | |||
- Felix framework distribution |
- Felix framework distribution |
||
- Eclipse |
- Eclipse |
||
Line 8: | Line 8: | ||
- iPOJO Nature |
- iPOJO Nature |
||
- API overview |
- API overview |
||
⚫ | |||
− | I. Activator |
+ | =I. Activator= |
+ | <pre> |
||
1. Create Eclipse Project "bundle.1" |
1. Create Eclipse Project "bundle.1" |
||
Line 31: | Line 33: | ||
- install the bundle |
- install the bundle |
||
- start / stop / update |
- start / stop / update |
||
+ | </pre> |
||
− | II. Pure-OSGi service |
+ | =II. Pure-OSGi service= |
+ | <pre> |
||
1. Create the API bundle "bundle.api" |
1. Create the API bundle "bundle.api" |
||
Line 64: | Line 68: | ||
8. Test the bundles |
8. Test the bundles |
||
+ | </pre> |
||
− | II. iPOJO: provide and consume with iPOJO |
+ | =II. iPOJO: provide and consume with iPOJO= |
+ | <pre> |
||
1. Either use new projects or rewrite existing ones |
1. Either use new projects or rewrite existing ones |
||
-> Import package API |
-> Import package API |
||
Line 74: | Line 80: | ||
4. Test |
4. Test |
||
+ | </pre> |
||
− | III. Whiteboard pattern |
+ | =III. Whiteboard pattern= |
+ | <pre> |
||
1. Create interface IJobListener in package API (onJobCreation, onJobDeletion) |
1. Create interface IJobListener in package API (onJobCreation, onJobDeletion) |
||
2. Create a new bundle, with iPOJO annoations |
2. Create a new bundle, with iPOJO annoations |
||
Line 82: | Line 90: | ||
5. Modify the schedule component to require the listeners, as optional requirement, and notify them on job creation/deletion |
5. Modify the schedule component to require the listeners, as optional requirement, and notify them on job creation/deletion |
||
6. Test |
6. Test |
||
+ | </pre> |
||
+ | =IV. Config Admin with iPOJO= |
||
+ | =V. JMX MBean with iPOJO= |
||
⚫ | |||
+ | 1. Create a new bundle, with iPOJO annotations to list current jobs status |
||
+ | |||
⚫ | |||
+ | =VI. Gogo Command with iPOJO= |
||
+ | 1. Create a new bundle, with iPOJO annotations to list current jobs status |
||
+ | |||
+ | =VII. Event Admin with iPOJO= |
||
+ | 1. Create a new bundle, with iPOJO annotations to send events on jobs status changes |
||
+ | |||
+ | =IX. Extender with iPOJO= |
||
+ | ?? |
||
+ | |||
⚫ |
Revision as of 11:10, 19 December 2012
Requirements
- Felix framework distribution - Eclipse - PDE - iPOJO Nature - API overview
I. Activator
1. Create Eclipse Project "bundle.1" New > Plug-in project - "Target Platform" > "an OSGi framework" > "standard" - Next - Check "Generate an activator" - Finish 2. Print Hello/Bye in the activator 3. Export bundle Right clic on project > Export > iPOJO Bundle - choose an output folder (the felix framework folder) - finish (note: discuss about Eclipse plug-in export and iPOJO Nature export) 4. Test bundle - start felix - install the bundle - start / stop / update
II. Pure-OSGi service
1. Create the API bundle "bundle.api" - "Target Platform" > "an OSGi framework" > "standard" - Next - Uncheck "Generate an activator" - Finish 2. Create the IScheduleService interface in the package fr.erods.tp.api 3. Export the API package - Open Manifest.mf of bundle.api - Runtime > "exported packages" > Add 4. Import the API package in bundle 1 - Open Manifest.mf of bundle.api - Dependencies > Imported Packages > Add 5. Implement the service in bundle 1 - Create class ScheduleImpl implementing IScheduleService in a package in bundle 1 6. Export the service in the Activator - regSvc -> start() - unregSvc -> stop() 7. Implement the client in bundle 2 - Create project bundle.2 (with activator) - Import package API - Implement a Consumer class, implementing ServiceListener - Print a message when a service is bound/unbound 8. Test the bundles
II. iPOJO: provide and consume with iPOJO
1. Either use new projects or rewrite existing ones -> Import package API 2. Set iPOJO Nature to the project, with annotations 3. Implement ConsumerIpojo and ProviderIpojo 4. Test
III. Whiteboard pattern
1. Create interface IJobListener in package API (onJobCreation, onJobDeletion) 2. Create a new bundle, with iPOJO annoations 3. Import package API 4. Create a component providing IJobListener 5. Modify the schedule component to require the listeners, as optional requirement, and notify them on job creation/deletion 6. Test
IV. Config Admin with iPOJO
V. JMX MBean with iPOJO
1. Create a new bundle, with iPOJO annotations to list current jobs status
VI. Gogo Command with iPOJO
1. Create a new bundle, with iPOJO annotations to list current jobs status
VII. Event Admin with iPOJO
1. Create a new bundle, with iPOJO annotations to send events on jobs status changes
IX. Extender with iPOJO
??