µServices for the rest of us - karl pauls

3,458 views
3,392 views

Published on

Many people are drawn into OSGi because it provides class loaders on steroids, however, one of the often overlooked feature of OSGi is the Service Registry and the (µ)service model. µServices provide a much more powerful alternative to the traditional Java factories and listeners in your code or xml, which are the usual culprits for class loading headaches. Alas, you need to migrate your application to OSGi first in order to take advantage of µServices which would make it so much easier to migrate your application to OSGi in the first place. The idea of PojoSR (a.k.a OSGi Lite) is to remedy this situation by providing OSGi without the module layer. PojoSR is based on Apache Felix and runs in any standard Java environment: from the class path, inside a WAR, wherever your current Java runs because it never touches a class loader. It allows any application built in Java to reap the benefits of service-based modularity without first having to rid existing code of any class loader tricks. This approach also allows, many existing bundles work out of the box - just by adding them to the class path (PojoSR will detect bundles on the class path and execute their activators). It works so well that OSGi is thinking of standardizing this approach. This talk will show you how you can take advantage of µServices using PojoSR and present some examples where µServices and PojoSR wore used to modularize and OSGi'fy an existing application.

Published in: Business, News & Politics
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,458
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
125
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

µServices for the rest of us - karl pauls

  1. 1. µServices For the Rest of UsKarl PaulsLuminis21.09.2011, 12:40-13:30 OSGi Alliance Marketing © 2008-2010 . 1 PageCOPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved All Rights Reserved
  2. 2. Karl• Member Apache Software Foundation • PMC: Felix, Sling, Incubator • PPMC: Ace, Clerezza, Celix• Fellow at Luminis• Project Owner PojoSR• Co-Author of “OSGi in Action”• karl.pauls@luminis.eu• karlpauls@gmail.com Page 2 OSGi Alliance Community Event 2011© 2008-2011. All Rights Reserved
  3. 3. Luminis http://luminis.eu http://luminis-technologies.com Page 3 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  4. 4. HISTORY Page 4 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  5. 5. Agenda• OSGi bootcamp• OSGi µServices• µServices For the Rest of Us• Use Cases• Implementation / Demo• Closing Remarks Page 5 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  6. 6. OSGiBOOTCAMP Page 6 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  7. 7. OSGi bootcamp Page 7 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  8. 8. Define Modules ... Page 8 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  9. 9. ... Compose Modules ... Page 9 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  10. 10. ... with OSGi • L3 – Provides publish/find/bind service service model to decouple bundles • L2 – Manages the life cycle of life cycle bundle in a bundle cache without requiring restarts • L1 – Creates the concept of module bundles that use classes from each other in a controlled way Page 10 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  11. 11. OSGiµSERVICES Page 11 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  12. 12. Page 12 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  13. 13. Page 13 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  14. 14. Page 14 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  15. 15. Page 15 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  16. 16. Page 16 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  17. 17. Page 17 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  18. 18. WHITEBOARDPage 19 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  19. 19. EXTENDERPage 20 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  20. 20. SERVICE COMPONENTS Page 21 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  21. 21. OSGiµSERVICES FOR THE REST OF US Page 22 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  22. 22. Page 23 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  23. 23. Page 24 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  24. 24. Page 25 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  25. 25. Page 26 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  26. 26. Page 27 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  27. 27. OR CAN YOU? Page 28 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  28. 28. PojoSR (a.k.a OSGi Lite a.k.a lite a.k.a ???)• OSGi µServices For the Rest of Us • OSGi without the module layer • Based on Apache Felix • Runs in standard Java environment • Doesn‘t create class loaders • Apache License 2• Exposes Service Registry to normal Java • No need for bundles • But bundles are supported up to a point • Missing module layer Page 29 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  29. 29. USE CASES Page 30 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  30. 30. Common discovery (SPI) Page 31 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  31. 31. Page 32 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  32. 32. Migration Page 33 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  33. 33. Migration with and without PojoSR• Start using Service first! • Split into bundles later and work on trunk!• Without PojoSR • Turn application into one big bundle • Split into several bundles • Fix problems • Split even more bundles (goto split) • Eventually, start using services • Allows to remove ugly hacks and crazy meta-data needed to fix problems Page 34 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  34. 34. Use OSGi where you can‘t OSGi (lite) on Google App Engine using PojoSRPage 35 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  35. 35. USAGEPage 36 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  36. 36. Page 37 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  37. 37. As an OSGi „light“ framework Page 38 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  38. 38. Standalone Page 39 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  39. 39. IMPLEMENTATION Page 40 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  40. 40. • Classloader.getResources(META- INF/MANIFEST.MF) • Find bundle on the classpath• Provide Bundle Revision based on jar: and file: url schemas (extendable)• Use and expose Apache Felix service registry for the rest Page 41 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  41. 41. DEMOPage 42 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  42. 42. CLOSING REMARKS Page 43 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  43. 43. Benefits and Drawbacks• PojoSR provides part of the power of OSGi • In a non-intrusive way. • Allows to increase modularity • without first ridding an existing code base of class loader hacks• Drawbacks are • Does not enforce module boundaries • Does not allow multiple versions of the same package • and other module layer features (so some are supported) • Not support the Bundle-Classpath • But you can use µServices to get rid of class loading hacks over time, after which it will be easier to move to OSGi and get side by side versioning and real module boundaries. Page 44 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved
  44. 44. http://pojosr.googlecode.comQUESTIONS Page 45 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved

×