Weitere ähnliche Inhalte Ähnlich wie Keynote: OSGi Past, Present and Future - Alex Blewitt (20) Kürzlich hochgeladen (20) Keynote: OSGi Past, Present and Future - Alex Blewitt1. OSGi Community Event 2011
OSGi Alliance Marketing © 2008-2010 . All1
Page
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Rights Reserved
Wednesday, 21 September 11
2. 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 . All1
Page
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Rights Reserved
Wednesday, 21 September 11
3. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
4. Past
OSGi Alliance Marketing © 2008-2010 . All1
Page
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Rights Reserved
Wednesday, 21 September 11
5. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
6. 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.|
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
7. And Then ...
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
8. 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 Require-Bundle!
• 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
9. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
10. Present
OSGi Alliance Marketing © 2008-2010 . All1
Page
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Rights Reserved
Wednesday, 21 September 11
11. 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)
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
12. ... 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?
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
13. The Omega Problem
Ω
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
14. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
15. Good Names
• Spring
• Spring Data
• Spring Web Services
• Spring LDAP
• Spring Social
• Spring Batch
• Apache
• Commons Lang
• Commons IO
• Commons Collections
• Directory Server
• Regexp
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
16. Bad Names
• Eclipse • Apache
• Eclipse [a-z][0-9] • Apache Aries
• Eclipse Epsilon • Apache Gogo
• Eclipse Gemini • Apache Karaf
• Eclipse Libra • Apache Sigil
• Eclipse Virgo • Apache Tuscany
• Eclipse Orion
• Eclipse Orbit
• Eclipse Sphinx
• Eclipse Papyrus
• Eclipse Pheonix
• Eclipse Sequoyah
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
17. Five Levels of OSGi
• Denial
• Anger
• Bargaining
• Depression
• Acceptance
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
18. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
19. 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?
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
20. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
21. 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?
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
22. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
23. Where are module systems today?
Charters Modularity Maturity Model™
Level 1 Level 2 Level 3 Level 4 Level 5 Level 6 7
Ad Hoc Modules Modularity Loose Devolution Dynamism PK
Coupling →
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
24. Crossing the Chasm
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
25. µ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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
26. µServices example
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
27. 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/
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
28. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
29. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
30. 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 ...
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
31. OSGi Repository Technologies
• Eclipse P2 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://...
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
32. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
33. 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?
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
34. Future
http://code.garron.us/css/BTTF_logo/
OSGi Alliance Marketing © 2008-2010 . All1
Page
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Rights Reserved
Wednesday, 21 September 11
35. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
36. Example p2 content file
<?xml version='1.0' encoding='UTF-8'?>¶
<?metadataRepository version='1.1.0'?>¶
<repository name='"Eclipse Project 3.7
p2 repo"'
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>¶
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
37. 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 -->
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
38. Size wasted in p2 Repositories
Bundle License Whitespace Size=“...”
1%
22%
41%
35%
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
39. Size wasted in p2 Repositories
Bundle License Whitespace Size=“...”
JAR 148666 127388 81303
GZ 143627 127799 59611
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
40. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
41. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
42. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
43. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
44. 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?
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
45. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
46. Conclusion
OSGi Alliance Marketing © 2008-2010 . All1
Page
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Rights Reserved
Wednesday, 21 September 11
47. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
48. 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
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Wednesday, 21 September 11
49. 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 . All1
Page
COPYRIGHT © 2008-2011 OSGi Alliance. All Rights Reserved - Alex Blewitt
Rights Reserved
Wednesday, 21 September 11