24
© 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

Riena onrap econ-2011

Embed Size (px)

DESCRIPTION

Riena on RAP talk from EclipseCon 2011

Citation preview

Page 1: Riena onrap econ-2011

© 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

Page 2: Riena onrap econ-2011

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

Page 3: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0 3

End-user focused Navigation Concept ?

Page 4: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

RCP started as the Eclipse IDE

4

Page 5: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

RCP – Apps

5

Page 6: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

UI Concepts used in Riena

6

Page 7: Riena onrap econ-2011

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)

Page 8: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

Many implementation of the same concept

8

Page 9: Riena onrap econ-2011

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

Page 10: Riena onrap econ-2011

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

Page 11: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

What is RAP again ?

11

Page 12: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0 12

Bring Riena and RAP together

Page 13: Riena onrap econ-2011

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

Page 14: Riena onrap econ-2011

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

Page 15: Riena onrap econ-2011

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

Page 16: Riena onrap econ-2011

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

Page 17: Riena onrap econ-2011

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);

Page 18: Riena onrap econ-2011

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

Page 19: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0 19

One more thing....

Page 20: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

UI Model Desktop -> Web

20

Riena Client

Riena + RAP Client

Page 21: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

Existing Web Application

21

Page 22: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

Bring the two together

22

Navigation Tree

Menu

Subapplication Switcher

Page 23: Riena onrap econ-2011

Copyright © 2011 compeople AG, Made available under the Eclipse Public License v 1.0

...even on the iPad thanks to RAP

23

Page 24: Riena onrap econ-2011

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

§  [email protected]

§  RT BoF TONIGHT(Tuesday) 8:30 pm