RAP and OSGi Services [message #986932] |
Thu, 22 November 2012 12:17 |
|
Hi,
We have a large number of layered osgi components (stateless "singleton" services) that do not have the notion of sessions.
From the RAP ui there is a call to say "ItemService", ItemService is dynamically bound with a UserAdmin service.
When ItemService is called to receive items, it calls a method in UserAdminService to see if the user is authorized.
In the RCP environment UserAdminService uses a static UserProfile.getLoggedinUser() method but this approach will obviously not work in RAP.
Is there a way to get to the RAP session information from UserAdminService without changing the method signatures?
so in short
RAP UI (1..*) --> ItemService (1) --> UserAdmin (1) --> ?session?
Thanks for helping,
Wim
|
|
|
|
Re: RAP and OSGi Services [message #987079 is a reply to message #987077] |
Fri, 23 November 2012 11:11 |
|
Thanks for replying Ralf.
In a RAP environment, aren't there multiple UI threads?
RAP UI (1..*) --> ItemService (1) --> UserAdmin (1) --> ?session?
If I consume the ItemService "singleton" from OSGi and make a call to it from a RAP UI thread, how can the ItemService know from what UI thread the call was made?
Do you think it can be done without passing some kind of information to the OSGi service?
Best regards,
Wim
|
|
|
|
|
|
|
Re: RAP and OSGi Services [message #987344 is a reply to message #987306] |
Mon, 26 November 2012 08:52 |
|
Right, you *can* access session-scoped data from a background thread if
you have a reference to the user's display. I was hesitating to make
this statement in the first place because this API is under revision for
2.0.
As Chris states, in RAP 1.x, you can use
UICallBack.runNonUIThreadWithFakeContext(Display, Runnable).
For 2.0, stay tuned on the New & Noteworthy pages.
Regards, Ralf
--
Ralf Sternberg
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Powered by
FUDForum. Page generated in 0.03599 seconds