Upload
christiancampo
View
1.619
Download
0
Embed Size (px)
DESCRIPTION
Riena on RAP talk from EclipseCon 2011
Citation preview
© 2002 IBM Corporation
Confidential | Date | Other Information, if necessary März 23, 2011 Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
1
Christian Campo EclipseCon 2011 – March 22nd
Riena/RCP Applications in the Web using RAP
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
What is Riena again ?
§ RCP based Framework § Client / Server Applications
§ Remote OSGi Service Support
§ End-user focused Navigation Concept
§ Promotes the separation of View and ViewController
2
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0 3
End-user focused Navigation Concept ?
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
RCP started as the Eclipse IDE
4
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
RCP – Apps
5
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
UI Concepts used in Riena
6
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
UI Concepts for Views (=Workarea)
7
• Model
• Data modeled in POJO or JavaBeans • View
• Widgets
• Layout
• Colors, Fonts
• ActionListener, SelectionListener, DoubleClickListener
• Databinding Calls
• use of Services (DI ?, OSGi Services)
• Model
• Data modeled in POJO or JavaBeans • View
• Widgets
• Layout
• Colors, Fonts
• Controller
• ActionListener, SelectionListener, DoubleClickListener
• Databinding Calls
• use of Services (DI ?, OSGi Services)
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Many implementation of the same concept
8
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Riena is also ...
§ Equinox Security Support for Client / Server Environment
§ Aimed at large Applications
§ Avoid Boilerplate Code § Make reoccurring tasks simple
§ Manage the overall UI structure of the application § Promotes the use of Dependency Injection for Services and
Extensions using Annotations and API
9
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
What is RAP again ?
§ RCP, JFace and Workbench for Webapplications
§ Goals § Any RCP App can be run in a Browser § Single-sourcing (same source for desktop and web)
§ By default a desktop client with a browser look
§ Themeable
§ API to convert Singletons into Session-Singletons
10
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
What is RAP again ?
11
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0 12
Bring Riena and RAP together
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Scalability – RCP/Riena
13
Browser Browser
Browser Browser RCP/Riena
Client
• one Session per JVM • many RCP Riena Clients • maintains Client state
Riena Server
stateless Services
• many worker threads • stateless Services • calls can take several
seconds
remote Service Calls
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Scalability – RCP/Riena + RAP
14
Browser Browser
Browser Browser
Browser
RAP Server
Session
• many Browser Clients
Session Session
Session Session
Riena Server
stateless Services
• one Session per User • short and quick calls • stateful • maintains Client state • runs RCP Client code
• many worker threads • stateless Services • calls can take several
seconds
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Moving Client Code to the Webcontainer
§ Identify all Singletons § Some are REAL Singletons (ImageCache)
§ Some need to become SessionSingletons
§ Create Fragments for RCP/RAP specific code § Create Facades to call one of the specific impl. at runtime
§ Local (Client) OSGi Services § should not maintain state
§ should be reentrant
§ If you are NOT on the UI Thread, its hard to get the correct Display instance i.e. in Jobs. (one Display instance per user)
§ The GOAL is to SingleSource ! (one source for RCP and RAP)
15
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
How to convert Singletons into SessionSingletons
16
public MySingleton { private static MySingleton instance = new MySingleton(); public static MySingleton getInstance() { return instance; } }
public MySingleton extends SessionSingletonBase { private static MySingleton instance; public static MySingleton getInstance() { return (MySingleton)super.getInstance(MySingleton.class); } }
RCP RAP
public MySingleton { private static SingletonProvider<MySingleton> ME = new SessionSingletonProvider<MySingleton>(MySingleton.class); public static MySingleton getInstance() { return ME.getInstance(MySingleton.class); } }
Riena
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Creating Facades
17
• Sometimes you need different code on RCP and RAP • Use a facade to abstract that • Put the platform specific code in a fragment
public class MyFacade { private static MyFacade instance = FacadeFactory.getFacade(MyFacade.class); public static MyFacade getInstance() { return instance; } public abstract String getText(Text text); }
Riena
public class MyFacadeRAP extends MyFacade { public String getText(Text text) { ...... } }
public class MyFacadeRCP extends MyFacade { public String getText(Text text) { .... } }
// your code using the facades MyFacade.getInstance().getText(myTextField);
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Moving Riena Client to a Webcontainer
§ Session -> SessionSingleton § NavigationTreeModel
§ Workarea (managing the Views attached to Navigation Tree Leafs)
§ Security (logged User, Permissions, Sessionid)
18
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0 19
One more thing....
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
UI Model Desktop -> Web
20
Riena Client
Riena + RAP Client
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Existing Web Application
21
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
Bring the two together
22
Navigation Tree
Menu
Subapplication Switcher
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
...even on the iPad thanks to RAP
23
Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0
§ If you want to move your Desktop Client to Web § Understand the problem areas
§ You need to possibly refactor and rework some of your code
§ SingleSourcing as much as possible
§ Contact § http://www.eclipse.org/riena
§ http://wiki.eclipse.org/Riena_Project
§ RT BoF TONIGHT(Tuesday) 8:30 pm