- Slides: 15
Java. Script and OSGi Simon Kaegi, Orion Project Co-lead IBM Canada @skaegi
What’s up with Java. Script …and why OSGi now? 2
2005 – Open Source AJAX Libraries Firefox and Webkit 2008 – Google Chrome and … V 8! WHATWG and HTML 5 Ecma. Script 5 (nee 3. 1) 2009 – Node. js 3
Java. Script 2013… Aging AJAX Frameworks Limited framework inter-op Cottage industry of micro libraries NPM Package Hell (Tools are still horrible) …victim of its own success 4
Java. Script is going through growing pains similar to what Java experienced ten years ago. OSGi concepts and experiences are universal and relevant to Java. Script. 5
“OSGI seems like overengineered Java stuff. I'm generally pretty skeptical of big frameworks that do everything for everyone. Usually they're a big pain. ” -Isaac Schlueter (emphasis is mine) 6
OSGi for Java. Script OSGi Focused, Lightweight, Open 7
Core Java. Script Problem Areas • Modularity • Common. JS “require” • AMD (Browser) – require(string. ID, callback) – async • Node (Server) – require(string. ID) – sync • ES 6 Module Loader • http: //wiki. ecmascript. org/doku. php? id=harmony: module_loaders • Closer to class-loading than bundle loading
Core Java. Script Problem Areas • Packages • NPM Packages • Closest thing to a bundle but more just project metadata • OSGi bundles can be NPM Packages and vice-versa • Useful work to be done right now!
Core Java. Script Problem Areas • Asynchronous API • Registered Callback Pattern (Node) • do. Service(params, callback) • Promises “A+” • do. Service(params). then(on. Success, on. Failure) • http: //promises-aplus. github. com/promises-spec/ • W 3 C Dom. Futures • ES 6 Generators / Co-routines • http: //wiki. ecmascript. org/doku. php? id=harmony: generators
Core Java. Script Problem Areas • Extensibility and Services • Open. Ajax / Open. Social • Web Intents (W 3 C Webapps WG) • No strong standards plays at the moment • Go OSGi!
Orion and OSGi • Micro Services • Complete implementation of OSGi Services API • Uses Promises for return types to decouple from async service implementation details • Data only / No transferable functions • Plugin. Registry • OSGi Lifecycle and Bundle State semantics used for Plugins • OSGi Framework startup • Preferences/Settings • Implementation of Configuration Admin and Metatype for Plugin Settings and Schema
Orion Core Retrospective • Orion core “strongly” OSGi influenced • Very small, fast, stable and predictable • Nearly all OSGi service specifications in the compendium are applicable in Java. Script. • Direct Service API use has poor usability characteristics • We need to find a simpler usage pattern to make OSGi Services more approachable to the Java. Script community.
Closing Thoughts • Java. Script is an increasingly reasonable choice as a systems language • Tons of innovation and tons of growing pains • OSGi can really be of help here however • We need to correct some invalid perceptions • We need to make our APIs easier to use and adopt