eclipsecon org

Document Sample
eclipsecon org Powered By Docstoc
					JavaScript Micro Services

Simon Kaegi
27 March 2012
What are Micro Services?

• OSGi minus the modularity
… about software development in a browser
Orion and OSGi Modularity

• e4 – OSGi style modularity in JavaScript
{ "Bundle-SymbolicName":"sample.jsbundle",
    "Bundle-Version":"1.0",
    "Bundle-ScriptPath":"script.js",
    "Import-Package":"a.resource;version=[1.0.0,2.0.0)",
    "Export-Package":"sample.resource;version=1.0.0",
    "Require-Bundle:"some.other.bundle“
}

• AMD – RequireJS
define(["dojo", "orion/serviceregistry", "dojo/DeferredList"],
     function(dojo, mServiceregistry){… return exports});
Orion Plugins

• Orion applications are NOT made up of plugins


• Orion pages are designed to be 'extended' with plugins


• Orion plugins are 'separate' HTML pages hosted in non-visible IFrames


• Can be cross origin and communicate using HTML5 postMessage which is
  ASYNC


• Plugins are isolated and secure against direct modification of the hosting
  page
    Java Web Application / OSGi                        Proxy Server / Portal



                 Web Application                       Web Application
                 Front-end Client
                      Web                              Front-end Client
                                                            Web




                                                                               Web Application
                                                                               Front-end Service
                                                                                  Proxied

                                                       Web Application
    Web Application            Web Application
                                       Application
                                  Web Plugin           Front-end Server
                                                           Web
    Front-end Server
        Web                    Front-end
                                    Web Plugin
                                         Application
                                  Front-end                                    Web Application
                                    Front-end
                                           Plugin                              Front-end Service
                                                                                  Proxied




7
Orion way / Client-side Extension


Web Application                         Web Application
Front-end Client
     Web                                Front-end
                                               Plugin




                     Web Application
                     Front-end
                            Plugin




Web Application      Web Application     Web Application
Front-end Server
    Web              Front-end Server
                         Web             Front-end Server
                                             Web
Eclipse IDE Extensibility
Orion Extensibility

registerService(INTERFACE_NAME, IMPLEMENTATION, PROPERTIES)
   In-page




   Plugin
Comparing OSGi and Orion Service APIs

• Orion provides a nearly complete implementation of the Service API from
  OSGi BundleContext
   • ServiceReference, ServiceRegistration, …
   • service listeners, event types


• Use Strings instead of java.lang.class when referencing Service interfaces
• All Service calls return a “promise” – needed to abstract asynchronous
  service implementations


• No ServiceTracker currently
   • originally built into getService but this was a mistake
What’s next

• Declarative Services
  • wire.js – extends Asynchronous Module Definition

    define([“wire!aService", “wire!anotherService],
       function(aService, anotherService){…});


• Configuration Admin and Metatype Services

• Permission Policy and Admin
     http://eclipse.org/orion/




14

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:5
posted:6/27/2012
language:
pages:14