introducing eclipse rap

12
Introducing Eclipse RAP Owen Ou @JingwenOwenOu http://owenou.com/blog/2010/07/08/introducing-eclipse-ra p/

Upload: owen-ou

Post on 22-Apr-2015

2.838 views

Category:

Technology


3 download

DESCRIPTION

Introducing eclipse rap

TRANSCRIPT

Page 1: Introducing eclipse rap

Introducing Eclipse RAPOwen Ou

@JingwenOwenOuhttp://owenou.com/blog/2010/07/08/introducing-eclipse-rap/

Page 2: Introducing eclipse rap

What’s RAP?

•Eclipse Rich Ajax Platform (RAP)

•build rich web clients “the Eclipse way”

•RAP to the web as RCP to the desktop

•extension point model, event-driven SWT/JFace APIs, componentized OSGi design

•RAP tooling is a default component of the RCP bundle

Page 3: Introducing eclipse rap

Architecture

• only difference is the implementation of SWT/RWT

• RWT is a bundle providing web-specific implementation of SWT, e.g., Display.getDefault() returns a session-based Display

• same APIs as SWT

• not a patch fragment to SWT

Page 4: Introducing eclipse rap

RWT

• client bases on qooxdoo (http://qooxdoo.org/)

• Static JavaScript library downloaded by client (server-centric)

• server bases on server-side Equinox :-), e.g., restful web service

• Java code entirely runs on server

Page 5: Introducing eclipse rap

Server-centric vs. Client centric

Page 6: Introducing eclipse rap

Benefits of RAP

• bringing RCP apps to the web with a single code base -> single sourcing

• OSGi & Equinox!!

• a process of building plug-ins and bundles

• UI side: contributing widget plugins

• Server side: contributing servlet plugins (server-side equinox)

• Others, for example, dynamically enabling/disabling bundles, zero downtime upgrade??

Page 7: Introducing eclipse rap

More about RAP• UI Testing: RAPTestCase, SWT testing tools

can be reused, e.g., Selenium, SWTBot

• Performance: minor drop down due to more frequent communications with the server (http://eclipsesource.com/blogs/2008/09/17/the-new-eclipse-download-wizard-and-rap-performance/)

• Deployment: Spring dm Server :-); embedded Jetty; need “Servlet Bridge” to run on a J2EE container

Page 8: Introducing eclipse rap

RAP in practice: CodeFaces

• Use case: an IDE way to explore codes from multiple source control systems on your browser (http://codefaces.org)

• @JingwenOwenOu & @nondeterminism

• Ages: 7 weeks, 10 - 15 hours per week

• RAP, Ruby/JRuby, Tomcat (Plans: Spring dm, Eclipse Link)

• load balancing on Rackspace cloud

• an IDE way, explore codes, multiple source control systems, browser

• the OSGi pattern: extensible system - the ability to add/remove implementations in a system

Page 9: Introducing eclipse rap

Demo

Page 10: Introducing eclipse rap

Example: refactoring to extension points

• Keys: small steps, no rush to make it an extension point upfront, gradually

• Identify your extension points (code smell), for example exists in places with a strategy pattern.

• For the first implementation, leave your strategy in the code (YAGNAEP): SCMConnector connector = new GitHubConnector();

• At some point, you realize you need a second strategy, adjust the interface if necessary, create a factory, refer to the strategy by a String, e.g., an ID: SCMConnector connector = SCMConnectorFactory.create(“GitHub”);SCMConnector connector = SCMConnectorFactory.create(“Subversion”);

• Build up the extension point schema, put extensions in plugin.xml, and in the factory, use Platform.getExtensionRegistry() to read extension point implementations.

• Refactor the extensions out to a new project if necessary. Control is already inverted. Highly decoupled system is achieved! org.codefaces.coreorg.codefaces.core.githuborg.codefaces.core.subversion

Page 11: Introducing eclipse rap

RAP in practice: Lessons Learnt

• RAP is not bug-free: Bug 317685 - Images loaded from ext. points don't work behind session based load balancersBug 319224 - [UICallback] Hanging UICallback request at startup

• Building customized widget is not easy: qooxdoo to build the widget + how to communicate between the widget and the server

• Documentation is unclear for some parts, e.g., the CSS theming, have to use Firebug

Page 12: Introducing eclipse rap

Questions?