Jump to: navigation, search

Orion/Documentation/Developer Guide/Architecture

< Orion‎ | Documentation‎ | Developer Guide
Revision as of 09:52, 11 January 2011 by John arthorne.ca.ibm.com (Talk | contribs) (New page: = Architecture Overview = Orion consists of loosely coupled components written in JavaScript, and server-side services exposed via REST-oriented HTTP APIs. These components and services ...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Architecture Overview

Orion consists of loosely coupled components written in JavaScript, and server-side services exposed via REST-oriented HTTP APIs. These components and services can be combined in many different ways to create various kinds of applications. The natural expression of the Orion vision is Browser-based tools written in JavaScript interacting with data in the cloud via REST APIs. However parts of Orion can also be used in traditional desktop clients as well as server side applications. The data being manipulated by such tools can reside either on a remote server or a local machine. The architecture of your Orion-based application will often be driven by other constraints. Operating on local data offers better performance and facilitates offline usage, but doesn't provide the always secure, always backed up nature of storing data on the server. Whether your tools run in a browser or a rich client may depend on what other development tools you need to work with.

The following are examples of architectural configurations that Orion components and services can be used in:

  1. Browser client / remote data. This is a pure web model. A browser-based client using Orion JavaScript client libraries and accessing remote Orion services via REST API.
  2. Mixed client / local data. A rich client (traditional Eclipse client), which contains a mixture of "legacy" components written in Java and web components written in JavaScript. The JavaScript components interact with JavaScript libraries and/or REST APIs, while Java components interact with the Eclipse Platform Java APIs.
  3. Rich client / remote data. Traditional Eclipse client components interacting with remote Orion services via REST API. This enables a mixture of rich client and browser-based tools to inter-operate against the same server-side data.
  4. Remote client / remote data. Server side tools written in Java, accessing local Orion services (for example a build server working against an Orion workspace server on the same machine).
Orion Architecture 1.jpg


Web Components

Orion aims to provide independently useful web components with minimal coupling between them, so that application developers can chose to deploy only the subsets of interest to their applications. Each component is represented by a JavaScript library (typically a single JavaScript file) and any directly associated resources like style sheets or images. With Orion we consciously do not mandate the use of a special packaging format or component library requirement so you can for example use your favorite DOM manipulation library as is.

For the moment “implementation-level” dependencies between components in Orion are managed using a limited and relatively manual form of dependency injection. At some point in the near-term future (and given recent events) we’re expecting to move our component model over to using some variant of CommonJS/AMD though as alluded to above web components are not forced into using this model. For more loosely coupled functional interactions Orion provides both a service registry and an extension registry (both described below) not unlike what we currently have in desktop Eclipse.


References between client library objects are directed through a service registry. Library objects are provided with a service registry object on construction, allowing a developer using the library to override what service implementations are used by any given library object. For example, while the default implementation of the Preferences object uses the remote preference service over HTTP, a client could provide an implementation that uses HTML5 local storage, cookies, etc.

Here is a simplified example of the Explorer object using a service to prompt the user to confirm a file deletion:

 function Explorer(serviceRegistry, treeRoot, breadcrumbParentId, searcher, parentId, navToolBarId) {
     this.registry = serviceRegistry;
  deleteFile: function(itemId) {
     var item = this.myTree.getItem(itemId);
     this.registry.callService("IDialogService", "confirm", null, 
       ["Are you sure you want to delete '" + item.Name + "'?", 

The format of the callService function is fairly straight-forward. The caller specifies the name of the library, the function to call, and the function arguments as an array. The additional parameter ('null' in the example above), allows a client to provide a callback function that receives the return value of the service invocation. One particularly important point to emphasize is that all service calls through the service registry are asynchronous. You cannot assume that the service function will have been executed by the time the callService method returns. This attribute allows the service implementation to employ a variety of long-running techniques to execute the service, such as calls to a remote web service, cross-domain postMessage, HTML5 web workers, etc.

The service object can also be obtained directly for clients that need to make more complex interactions with the service (such as invoking multiple functions against the service in sequence).


As a means of declarative contribution Orion will continue to promote the use of extensions and extension points. Extensions as used by Orion are conceptually very similar to what we currently use in the desktop and in particular will continue to have broad support in the UI and provide excellent lazy activation characteristics. One notable difference with the desktop is that code level functionality is always provided by a service reference instead of through class instantiation. Another difference is that Orion uses JSON instead of XML as a representation format for extensions.


Services and Extensions outside of the base platform are contributed to Orion by registering plugins. A plugin is declared via an HTML file, is opened in a "head-less" child IFrame and uses window.postMessage to advertise capabilities in the form of services and extensions back to Orion. Orion persists plugin information and at a later date when functionality is requested the plugin will be re-loaded either in an IFrame, in a Web Worker, or in-line as a web component based on security restrictions and functionality offered.

 <!DOCTYPE html>
   <!-- Dependencies -->
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <script type="text/javascript" src="/openajax/release/all/OpenAjaxManagedHub-all.js"></script>
   <script type="text/javascript" src="js/plugin.js"></script>
   <!-- Contributed Scripts -->
   <script type="text/javascript" src="js/jslintworker.js"></script>
   <script type="text/javascript" src="js/jslintPlugin.js"></script>

The corresponding JavaScript then contributes its services by using the ServiceProvider.extend function:

 eclipse.JSLintServiceProvider.prototype = eclipse.ServiceProvider.extend({
   checkSyntax: function(title, contents) {

Currently, plugins must be declared and started manually, but in the future we expect to simplify this. Here is a current example of starting a plugin programmatically. This example contributes one service library called IEditorSyntaxChecker, with a single method checkSyntax.

 var pluginData = {
   services : [{
     id : "JSLintEditorSyntaxChecker", 
     serviceType : {
       id: "IEditorSyntaxChecker", 
       interfaces : ["checkSyntax"]
     properties: {}
 var serviceProvider = new eclipse.JSLintServiceProvider();
 new eclipse.Plugin(pluginData, serviceProvider).start();


Server APIs

Orion defines a number of server APIs accessed via simple REST-oriented HTTP calls. These server APIs do not presuppose any particular server technology over straight HTTP, and JSON as the default representation format. Application developers are free to implement Orion server API with the server language and infrastructure of their choice. For a detailed listing of server APIs, see EclipseWeb/Server API.

Example Server

The current Orion server is written in Java, using Jetty and Equinox server infrastructure. This server does not currently define any Java API for extending or augmenting its behavior. Applications should be written against the HTTP server API, to allow for portability across server implementations. To avoid the perception of Orion providing a monolithic, definitive, extensible, irreplaceable server, the server is often referred to as an "example server".

The current server is structured into the following bundles(bundle names subject to change):

Provides common provisional server API used by other parts of the server
Defines servlets for the core Orion services: file, workspace, preferences
Search servlet implementation using Apache Solr/Lucene
Defines an application, and configures the server (registers servlets and static content, specifies authentication and authorization settings)
Bundles providing various kinds of authentication support.

The server is split up this way to allow the pieces to be used in other server containers. You can discard the configurator bundle, and create your own server using the provided servlets and common code. This allows you to completely control the server layout, authentication, etc, for your server.