Introducing eclipse rap
-
Upload
owen-ou -
Category
Technology
-
view
2.835 -
download
3
description
Transcript of Introducing eclipse rap
Introducing Eclipse RAPOwen Ou
@JingwenOwenOuhttp://owenou.com/blog/2010/07/08/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
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
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
Server-centric vs. Client centric
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??
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
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
Demo
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
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
Questions?