OSGi: Past, Present and Future

B3d3a2cce932eca144b8c13a63966404?s=47 alblue
September 21, 2011

OSGi: Past, Present and Future

Keynote delivered to the OSGi 2011 Community Event, which introduced "The Omega Problem".

See audio/movie recording at
http://www.youtube.com/watch?v=hKgRQVJh9FM

B3d3a2cce932eca144b8c13a63966404?s=128

alblue

September 21, 2011
Tweet

Transcript

  1. 1.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi Community Event 2011 OSGi Alliance Marketing © 2008-2010 . All Rights Reserved Page 1 Wednesday, 21 September 11
  2. 2.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi: Past, Present and Future Alex Blewitt @alblue Founder of Bandlem Limited Editor at Large at InfoQ 21st September 2011 OSGi Alliance Marketing © 2008-2010 . All Rights Reserved Page 1 Wednesday, 21 September 11
  3. 3.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Small Print • These opinions are my own and not of anyone else • Various trademarks, service marks, birth marks, Groucho Marx and DeutschMarks are properties of their respective owners • The quality of this presentation may go down as well as up Wednesday, 21 September 11
  4. 4.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Past OSGi Alliance Marketing © 2008-2010 . All Rights Reserved Page 1 Wednesday, 21 September 11
  5. 5.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt A Long, Long Time Ago • Back before OSGi was an acronym • ... when Java 1.2 had just been released • ... when people thought Swing was great • JSR 8 was proposed • Supported by IBM, Ericsson, Sybase • ... and Sun Microsystems This JSR is to develop the Open Services Gateway (OSG) Specification Wednesday, 21 September 11
  6. 6.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi Releases • JSR8 was created in March 1999 • Withdrawn May 1999 • OSGi R1 – May 2000 • OSGi R2 – October 2001 • OSGi R3 – March 2003 > WAIT You wait – time passes. | | | | Wednesday, 21 September 11
  7. 7.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt And Then ... Wednesday, 21 September 11
  8. 8.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Eclipse 3.0 Switched to OSGi • Eclipse replaced custom plugin runtime with OSGi • June 2004 ➡Just when you thought you were beginning to understand how the Eclipse kernel worked, those pesky Eclipse developers replaced it all for Eclipse 3.0. The kernel is now built on another Java component framework, the Open Services Gateway initiative (OSGi) [FAQ] ➡Rather than creating a derivative OSGi++, the Eclipse community is contributing a number of important Eclipse features back into the OSGi specification • First time many had heard of OSGi ... • ... including me [FAQ] http://wiki.eclipse.org/FAQ_How_does_OSGi_and_the_new_runtime_affect_me%3F Require-Bundle! Wednesday, 21 September 11
  9. 9.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi R4 releases • Since then, has been released every two years • 4.0 – October 2005 • Require-Bundle, Fragments, Singletons, Uses, Localisation • 4.0 Mobile – September 2006 (JSR 232) • 4.1 – May 2007 (JSR 291) • 4.2 – September 2009 • Framework Launching, Tracker • 4.2 Enterprise – March 2010, Blueprint, Remote Services • 4.3 – April 2011 • Generics, Weaving/Bundle/ServiceHooks, Capabilities • 4.3 Enterprise – first half of 2012, OBR Wednesday, 21 September 11
  10. 10.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Present OSGi Alliance Marketing © 2008-2010 . All Rights Reserved Page 1 Wednesday, 21 September 11
  11. 11.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi has wide adoption in ... • Eclipse-based IDEs • IBM WebSphere Studio, MyEclipse, Rational Software Architect • Eclipse-based RCPs • NASA Rover, Tasktop, BIRT designer, IBM Lotus • Enterprise Java Servers • GlassFish, WebSphere, JBoss, Spring DM/Virgo, JOnaS • Developer Tools • Atlassian Confluence, JIRA, Mylyn • Lights-out management • Vehicle telematics, Smart home systems (e.g. Smart Connect) Wednesday, 21 September 11
  12. 12.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt ... and yet, OSGi isn’t everywhere • IntelliJ has a custom plugin system • Netbeans modules proprietary plugin • Java 8 will have its own way of doing things • Why is everyone avoiding proven technology? • Lack of knowledge? • Lack of marketing? • Lack of support? • Lack of tools? Wednesday, 21 September 11
  13. 13.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt The Omega Problem Ω Wednesday, 21 September 11
  14. 14.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt The Omega Problem • What is The Omega Problem? • OSGi projects are named in greek by geeks • Names usually meaningless on their own • Often part of a set-of-names (e.g. Zodiac signs) • Usually impossible to remember which is which • Unnecessarily increases learning curve for new learners Wednesday, 21 September 11
  15. 15.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Good Names • Spring • Spring Data • Spring Web Services • Spring LDAP • Spring Social • Spring Batch • Apache • Commons Lang • Commons IO • Commons Collections • Directory Server • Regexp Wednesday, 21 September 11
  16. 16.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Bad Names • Eclipse • Eclipse [a-z][0-9] • Eclipse Epsilon • Eclipse Gemini • Eclipse Libra • Eclipse Virgo • Eclipse Orion • Eclipse Orbit • Eclipse Sphinx • Eclipse Papyrus • Eclipse Pheonix • Eclipse Sequoyah • Apache • Apache Aries • Apache Gogo • Apache Karaf • Apache Sigil • Apache Tuscany Wednesday, 21 September 11
  17. 17.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Five Levels of OSGi • Denial • Anger • Bargaining • Depression • Acceptance Wednesday, 21 September 11
  18. 18.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Five Levels of OSGi – Denial • OSGi can’t possibly work! • OSGi – that’s written by IBM, right? • I use IntelliJ • IntelliJ isn’t Eclipse • Eclipse uses OSGi • Therefore I don’t use OSGi • OSGi is too complex for mortals to understand Wednesday, 21 September 11
  19. 19.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Five Levels of OSGi – Anger • Why can’t this bundle see this class? • Why am I getting ClassNotFoundException? I can see it! • These two classes have the same name, but aren’t the same. What gives? • Why can’t I see javax.swing? Or com.sun.misc...? • Why doesn’t hibernate work? Wednesday, 21 September 11
  20. 20.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Five Levels of OSGi – Bargaining • Please tell me why this uses constraint fails! • If you can start up the services in this order... • Why does this work in Equinox but not Felix? • Please let there be a Stack Overflow answer for NoClassDefFoundError ... • If I put ;resolution:=optional, please just start Wednesday, 21 September 11
  21. 21.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Five Levels of OSGi – Depression • How do I load a JDBC driver? • How can I map JNDI references to data sources? • Why doesn’t my custom Log4J logger work? • Why do I have to write a Manifest manually? • Why can’t I find a bundle for Apache Beanutils? Wednesday, 21 September 11
  22. 22.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Five Levels of OSGi – Acceptance • Sudden dawn of understanding of bundles • See how services can be connected with DS • Remote services to other systems • Dynamically upgrade code in running servers • Evangelise OSGi to others • Tweet about OSGi • Give keynote at OSGi community event Wednesday, 21 September 11
  23. 23.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Where are module systems today? Level 1 Ad Hoc Level 2 Modules Level 3 Modularity Level 4 Loose Coupling Level 5 Devolution Level 6 Dynamism 7 PK → Charters Modularity Maturity Model™ Wednesday, 21 September 11
  24. 24.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Crossing the Chasm Wednesday, 21 September 11
  25. 25.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt µServices • Micro Services allow modular apps to be built • Essentially just OSGi services • Name used to distinguish from heavyweight SOA services • System as set of bundles → • System as set of interconnected services Wednesday, 21 September 11
  26. 26.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt µServices example Wednesday, 21 September 11
  27. 27.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt POJO Service Registry • Provides a µServices like view for non-OSGi Java • Allows you to use the same primitives for accessing services • All bundles use same classloader • So no issues with NoClassDefFoundError • Allows you to move to a µServices model incrementally • Doesn’t use the same namespace as OSGi • Trademark issues, not a standard OSGi spec • Can use Declarative Services for wiring up services • Goal would be to decompose app without code • Just use DS to build your system • http://code.google.com/p/pojosr/ Wednesday, 21 September 11
  28. 28.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Enterprise • Enterprise Specification come a long way • Database Drivers can be loaded in a modular fashion • Data Sources can be acquired from the factory • Objects can be mapped with Java Persistence API • Transactions can be managed with the Java Transaction API • Web applications can be hosted in an OSGi runtime • R4.2 Enterprise released March 2010 • R4.3 Enterprise scheduled for 2012 • Implementations progressing • Apache Aries • Eclipse Virgo/Gemini Wednesday, 21 September 11
  29. 29.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt EJBs in OSGi • Tim Ward demo’d a runtime of EJBs in OSGi • Standard EJB metadata (annotation or xml descriptor) • Provides OSGi enabled annotation scanner • Bundle wires up dependency graph for application classloader • Can see the OpenEJB classes which are required • JPA entities are mapped to databases • Databases wired up with JNDI references • Transactions and contexts • Managed by container automatically • Session EJBs (views) registered as OSGi services • Can use EJBs and straight OSGi clients to access the data • Work in progress (e.g. no Security module yet) • Implementation to appear in Apache Aries Wednesday, 21 September 11
  30. 30.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Repositories • OSGi is in bad need of a standard repository • More than anything, a repository is what makes modular systems • Maven provided the go-to place for Java code • De-facto standard • Replaced trees like Giant Java Tree • Perl has CPAN • Python has easy_install • Ruby has gems • Linux distributions have packaging sites • RPM, APT, Yum etc. • OSGi has ... Wednesday, 21 September 11
  31. 31.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi Repository Technologies • Eclipse P2 • Used to replace aging ‘site.xml’ update sites • Provides a metadata dump as well as contents of manifest • Very chatty network protocol • Files not optimised for network transmission • Non-trivial to mirror • OBR • Work in progress on Enterprise group • Not widely available • Single XML file • Uncompressed • Manual installation of bundles • install http://... p2 Wednesday, 21 September 11
  32. 32.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi Repositories • P2 • Eclipse p2 Update Sites • Eclipse Marketplace p2 Update Sites • OBR • Apache Felix OBR • OSGi OBR list • SpringSource OSGi Repository • Miscellaneous • Maven Central has some OSGi content • Nexus Professional hosts Maven repositories and exposes OBR • Nexus Bundle Maker wraps existing non-OSGi JARs • https://github.com/sonatype/nexus-bundle-maker-plugin Wednesday, 21 September 11
  33. 33.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Ops4J PAX utilities • Pax utilities should be more widely used • wrap: protocol handler • Allows installation of JARs and auto-wraps bundle headers • mvn: protocol handler (pax-mvn replaced with pax-aether) • Allows installation of bundles via existing Maven repository • exam • Automated test client for OSGi utilities • logging • Mediator between OSGi logging and Log4J/SLF4J clients • runner • Automated launcher for OSGi applications • Could this be start for a universal launcher? Wednesday, 21 September 11
  34. 34.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Future OSGi Alliance Marketing © 2008-2010 . All Rights Reserved Page 1 http://code.garron.us/css/BTTF_logo/ Wednesday, 21 September 11
  35. 35.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Future OSGi Repositories • Need to provide modular repositories • All-in-one download of metadata not scalable • Minor updates cause entire re-download of file • Need to provide efficient repositories • Index file size problems • p2 index contain multiple redundant copies of EPL License • 1/3 of total index size is repeated EPL • No need for pretty-printed XML • No reason not to use compression (GZip, BZip) • OBR standard due next year • Hopefully will address some of these problems before release Wednesday, 21 September 11
  36. 36.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Example p2 content file <?xml version='1.0' encoding='UTF-8'?>¶ <?metadataRepository version='1.1.0'?>¶ <repository name='&quot;Eclipse Project 3.7 p2 repo&quot;' type='org.eclipse.equinox.internal.p2.metadat a.repository.LocalMetadataRepository' version='1.0.0'>¶ ··<properties size='2'>¶ ····<property name='p2.timestamp' value='1308009855587'/>¶ ····<property name='p2.compressed' value='true'/>¶ ··</properties>¶ Wednesday, 21 September 11
  37. 37.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Example p2 content file ········<property name='df_LT.license' value='Eclipse Foundation Software User ... ········<property name='df_LT.license' value='Eclipse Foundation Software User ... ········<property name='df_LT.license' value='Eclipse Foundation Software User ... ········<property name='df_LT.license' value='Eclipse Foundation Software User ... ········<property name='df_LT.license' value='Eclipse Foundation Software User ... ········<property name='df_LT.license' value='Eclipse Foundation Software User ... <!-- EPL occurs 101 times in Eclipse 3.7 --> Wednesday, 21 September 11
  38. 38.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Size wasted in p2 Repositories 41% 35% 22% 1% Bundle License Whitespace Size=“...” Wednesday, 21 September 11
  39. 39.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Size wasted in p2 Repositories JAR GZ 59611 81303 127799 127388 143627 148666 Bundle License Whitespace Size=“...” Wednesday, 21 September 11
  40. 40.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Cloud • Cloud systems are increasingly important • Management of OSGi process across machines • Virtual Machine technology will be prevalent • But management of processes not well defined • One machine per system is very wasteful • Deploying and configuring bundles will be key • OSGi + Remote Services solves scalability • OSGi + Repository solves install on demand • Base VM should provide OSGi runtime • Bootstrap all necessary data and code • Need a universal OSGi bootstrap process • Provision, deploy, configure Wednesday, 21 September 11
  41. 41.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Interoperability with legacy systems • OSGi Remote Services will be increasingly used • If you have OSGi on both sides, makes the most sense • What happens if you don’t have OSGi on both sides? • What happens if there are legacy APIs? • OSGi Remote Services needs interoperability • RMI for exposing OSGi service as RMI endpoint • RMI for consuming remote RMI as OSGi service • REST based API for non-Java clients (e.g. JavaScript) • JMS endpoint for message-based services • Often can’t upgrade both endpoints at once • Need to replace one at a time Wednesday, 21 September 11
  42. 42.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Enterprise improvements • Databases should be available under jdbc/DS • Most non-OSGi code will use jndi.lookup(“jdbc/DS”) • Not only osgi:service/javax.sql.DataSource • JPA should bind to DataSource services directly • Having Username and Password in JPA bundle is a layer violation • Prevents easy reusability if needing to use different accounts • Test/Production • Should not have any database-specific config in JPA bundles • Implementations should adapt dynamically • OpenEJB/Aries will make migration easier • Migrate existing code without changing • Map to existing databases and transaction structure Wednesday, 21 September 11
  43. 43.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Features, Apps, Bundles - oh my! • Better organisation of groups of bundles • Standardised means of representing • Subsystems • Features • Applications • Groups of bundles for single download • Will make management of large systems easier • May be integrated into OBR as capabilities • Part of Enterprise Expert Group work Wednesday, 21 September 11
  44. 44.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Tooling • Tooling still has room for growth • BndTools for creating OSGi-specific code • Maven Tycho replacing PDE/Ant builds for Eclipse • Manifest-first versus Manifest-last still being debated • Computer assisted development • Management of semantic versions automatically • Several proposals (including OSGi community event 2011) • PDE API baseline analysis • What if bundle hasn’t changed? Should it be rebuilt? • µService oriented design • Can we abstract bundles away and concentrate on services? • Scope for model driven design? Wednesday, 21 September 11
  45. 45.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Bridging the gap • Dependency Injection can wire up to services • Eclipse Sisu (based on Google Guice) provides JSR330 • Many developers familiar with JSR330 injection/annotations • Sisu used in Tycho, Maven and Hudson • Supports both OSGi and non-OSGi runtimes • Candidate for POJO SR hosting? • Migration recommendations • Hibernate -> JPA (EclipseLink, Aries) • JAXB -> Restlet • Spring -> Virgo -> Vanilla OSGi services Wednesday, 21 September 11
  46. 46.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt Conclusion OSGi Alliance Marketing © 2008-2010 . All Rights Reserved Page 1 Wednesday, 21 September 11
  47. 47.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi Evolution • OSGi is still evolving • Core modularity is well understood • µServices becoming popular for system design • Enterprise Java support good starting point • Standard Repositories are a concern • Need to focus on higher level abstractions • Features, Subsystems, Applications • Need to focus on ease of use • OSGi mostly defines programmer APIs • Needs OSGi management applications Wednesday, 21 September 11
  48. 48.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi Community • OSGi Alliance has work cut out • Defining specifications, moving forwards • Many jobs still need to be done • Education, Education, Education • Advocacy (Books, Blogs, Tweets) • OSGi in Practice/OSGi in Action/Patterns of Modular Architecture • Innovative solutions (PAX, PojoSR) • Population of OSGi wiki @ http://wiki.osgi.org/wiki/ • You can make this happen Wednesday, 21 September 11
  49. 49.

    COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex

    Blewitt OSGi: Past, Present and Future Alex Blewitt @alblue Founder of Bandlem Limited Editor at Large at InfoQ 21st September 2011 OSGi Alliance Marketing © 2008-2010 . All Rights Reserved Page 1 Wednesday, 21 September 11