W-JAX 2011: OSGi with Apache Karaf

1,969 views

Published on

I gave this presentation at W-JAX 2011 ( http://jax.de/wjax2011/ ).

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,969
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
58
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

W-JAX 2011: OSGi with Apache Karaf

  1. 1. <ul>OSGI with Apache Karaf </ul>
  2. 2. <ul>Introduction </ul><ul></ul><ul><li>Gerald Preissler
  3. 3. Talend Professional Services
  4. 4. Consultant & Architect </li><ul><li>Talend ESB </li><ul><li>CXF
  5. 5. Camel
  6. 6. Karaf
  7. 7. ActiveMQ
  8. 8. Talend Open Studio </li></ul></ul><li>[email_address] </li></ul><ul>Document Identifier </ul>
  9. 9. <ul>Agenda </ul><ul><li>Why OSGI?
  10. 10. What is Apache Karaf?
  11. 11. How can I develop for Apache Karaf?
  12. 12. What are the advanced features?
  13. 13. What is coming? </li></ul><ul></ul><ul>Document Identifier </ul>
  14. 14. <ul>Why OSGI? </ul><ul></ul><ul><li>Component-based modularity
  15. 15. SOA in the small
  16. 16. Standard services </li></ul><ul>Document Identifier </ul>
  17. 17. <ul>Component-based modularity </ul><ul></ul>An individual component is a bundle A bundle is a jar file with additional metadata Imports Exports Dependency management is enabled through metadata Imports Exports Bundle lifecycle is controlled by the OSGI container Classloading environments are separated between bundles Multiple bundles can be combined into a feature Feature <ul>Document Identifier </ul>Bundle Classes & Ressources Metadata Classes & Ressources Metadata
  18. 18. <ul>Component-based modularity </ul>Metadata is located in MANIFEST.MF Can be created manually Peter Krien's bnd tools and derived utilities provide a convenient way to create it automagically Manifest­Version: 1.0 Bundle­ManifestVersion: 2 Bundle­Version: 2.1.6 Bundle­Name: Talend Logger Bundle­SymbolicName: t_logger Export­Package: org.talend.osgi.logger;version=2.1 Import­Package: org.apache.log4j;version=”[1.2,2)” Private­Package: org.talend.osgi.logger.internal <ul>Document Identifier </ul>
  19. 19. <ul>SOA in the small </ul>● OSGi Service Registry allows a bundle to expose or use services ● A service is specified by an interface ● A provider bundle registers an interface implementation Service Registry Bundle Bundle register get listen ● A consumer bundle searches and uses a service <ul>Document Identifier </ul>B A Interface Impl Interface
  20. 20. <ul>Standardized Utility Services </ul><ul></ul>Service Description Configuration Admin set and get the configuration information of deployed bundles Logging receives log entries and then dispatches these entries to other bundles Event Admin inter-bundle communication mechanism based on a publish-and-subscribe model User Admin database with user information (private and public) for authentication and authorization purposes ... <ul><li>Source : Wikipedia </li></ul>
  21. 21. <ul>What is Karaf? </ul><ul></ul>- Sits “on top” of an OSGI container - Adds additional functionality via add-on features - Control of container via direct shell, ssh or web console - Provisioning and deployment via filesystem, Maven repository, archive, OBR - Administration and management via JMX - Configuration via filesystem, web console, JMX - Dependency injection with Spring DM or Blueprint <ul>Document Identifier </ul>OSGI Container Console Provisioning & Deployment Admin Management Configuration Blueprint ….
  22. 22. How can I develop for Apache Karaf? <ul></ul><ul>Document Identifier </ul>
  23. 23. <ul>Use the standard Maven project structure </ul><ul></ul><ul><li>Organize sources and resources as usual
  24. 24. No OSGI-specific configuration required </li></ul>For OSGI-services use Blueprint configuration Use the Maven Bundle plugin to generate your OSGI configuration <ul>Document Identifier </ul>
  25. 25. <ul>Deploy locally </ul><ul></ul>Container Repository mvn package mvn install bundle:install file:// ... bundle:install mvn: ... <ul>Document Identifier </ul>
  26. 26. <ul>Get your dependencies </ul><ul>Bundles for 3rd party dependencies are easily available <ul><li>Use a pre-packaged bundle </li><ul><li>Maven Central
  27. 27. Apache ServiceMix Bundle Repository
  28. 28. SpringSource Enterprise Bundle Repository </li></ul><li>Wrap an existing JAR file </li><ul><li>By adding the MANIFEST.MF
  29. 29. Using bnd or other tools </li></ul></ul></ul><ul>Document Identifier </ul>
  30. 30. <ul>Use Karaf WebConsole to control your container </ul><ul>Provides a remote admin gui with similar capabilities like the local shell <ul><li>View and control bundles and features
  31. 31. View and edit bundle configuration
  32. 32. Access logs
  33. 33. Use a web-based shell
  34. 34. ... </li></ul></ul><ul>Document Identifier </ul>
  35. 35. <ul>Dynamically configure your application </ul><ul></ul><ul></ul>Imports Exports Configuration source ConfigAdmin service monitor inject <ul>Document Identifier </ul>Bundle Classes & Ressources Metadata Container
  36. 36. <ul>Package your feature for deployment </ul><ul></ul><ul></ul>Container mvn package deploy <ul>Document Identifier </ul>Karaf Archive (KAR)
  37. 37. <ul>Integrate Karaf with CXF and Camel </ul><ul></ul><ul></ul><ul>CXF </ul><ul><li>Provide WebService based applications as OSGi bundles
  38. 38. Simple deployment for Camel routes
  39. 39. Some configuration required
  40. 40. Or use pre-packaged distribution, e.g., Talend ESB </li></ul><ul>Document Identifier </ul>Container
  41. 41. <ul>Advanced features </ul><ul></ul><ul></ul><ul><li>Child instances </li><ul><li>Provide multiple container instances from one installation </li></ul><li>Karaf Cellar </li><ul><li>Clustering for Karaf </li></ul><li>Karaf Cave (incubation) </li><ul><li>Better support for OSGi Bundle Repository </li></ul><li>... </li></ul><ul>Document Identifier </ul>
  42. 42. <ul>Where to go from here? </ul><ul></ul>Karaf homepage karaf.apache.org Blogs Christian Schneider www.liquid-reality.de/ Dan Kulp www.dankulp.com/blog/ Jean-Baptiste Onofre blog.nanthrax.net/ Talend Forum www.talendforge.org/forum/ <ul>Document Identifier </ul>

×