Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Cannot set osgi property using RAP launcher
Cannot set osgi property using RAP launcher [message #1107535] Thu, 12 September 2013 14:58 Go to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Member
I have a RAP app that implements a custom SettingStore. I implemented the SettingStore and its factory, and declared the factory using extension point org.eclipse.rap.ui.settingstores. All that's left to make it work is to set the OSGI property org.eclipse.rap.rwt.settingStoreFactory to point to the ID of my SettingStoreFactory.

But I can't find any way to set this OSGI property using the RAP launcher. I edited the config.ini file at the location indicated on the Settings tab of the RAP launcher, in the "Configuration Area" section. I tried using the default location and also specifying a custom location.

In either case, the config.ini file is blown away and re-created each time I launch the app (and I do not have selected the option to clear the configuration area before launching). The launched app uses the default SettingStore instead of the custom one, and when I look at the config.ini file after launching, the entry that I placed there for org.eclipse.rap.rwt.settingStoreFactory is gone.

So what is the right way to set an osgi property when using the RAP launcher?
Re: Cannot set osgi property using RAP launcher [message #1107676 is a reply to message #1107535] Thu, 12 September 2013 19:34 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Mark,
did you try to set it as "VM Arguments" like:
-Dorg.eclipse.rap.rwt.settingStoreFactory=<your id>
Best,
Ivan

On 9/12/2013 5:58 PM, Mark Leone wrote:
> I have a RAP app that implements a custom SettingStore. I implemented
> the SettingStore and its factory, and declared the factory using
> extension point org.eclipse.rap.ui.settingstores. All that's left to
> make it work is to set the OSGI property
> org.eclipse.rap.rwt.settingStoreFactory to point to the ID of my
> SettingStoreFactory.
>
> But I can't find any way to set this OSGI property using the RAP
> launcher. I edited the config.ini file at the location indicated on
> the Settings tab of the RAP launcher, in the "Configuration Area"
> section. I tried using the default location and also specifying a
> custom location.
>
> In either case, the config.ini file is blown away and re-created each
> time I launch the app (and I do not have selected the option to clear
> the configuration area before launching). The launched app uses the
> default SettingStore instead of the custom one, and when I look at the
> config.ini file after launching, the entry that I placed there for
> org.eclipse.rap.rwt.settingStoreFactory is gone.
>
> So what is the right way to set an osgi property when using the RAP
> launcher?

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Cannot set osgi property using RAP launcher [message #1107699 is a reply to message #1107676] Thu, 12 September 2013 20:19 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Member
Thanks, Ivan. I did try that, and it still seems to fail:

When I invoke
RWT.getSettingStore();
the object returned is an instance of FileSettingStore and cannot be cast to my custom SettingStore class.

Also, I have a breakpoint in the createSettingStore method of my SettingStoreFactory, and it does not execute.
Re: Cannot set osgi property using RAP launcher [message #1107716 is a reply to message #1107699] Thu, 12 September 2013 20:53 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Member
This seems to be a bug. Perhaps a way around it is to invoke Application#setSettingStoreFactory(). But how can I get a reference to the Application instance?
Re: Cannot set osgi property using RAP launcher [message #1107721 is a reply to message #1107535] Thu, 12 September 2013 21:00 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Mark,
which RAP version are you using? In RAP 2.1 the property was named
"org.eclipse.rwt.settingStoreFactory" (without "rap" segment). See bug:
409816: Rename "org.eclipse.rwt.settingStoreFactory" property
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409816
Setting "org.eclipse.rap.rwt.settingStoreFactory" as VM argument is
working for me with RAP from git master.
HTH,
Ivan

On 9/12/2013 5:58 PM, Mark Leone wrote:
> I have a RAP app that implements a custom SettingStore. I implemented
> the SettingStore and its factory, and declared the factory using
> extension point org.eclipse.rap.ui.settingstores. All that's left to
> make it work is to set the OSGI property
> org.eclipse.rap.rwt.settingStoreFactory to point to the ID of my
> SettingStoreFactory.
>
> But I can't find any way to set this OSGI property using the RAP
> launcher. I edited the config.ini file at the location indicated on
> the Settings tab of the RAP launcher, in the "Configuration Area"
> section. I tried using the default location and also specifying a
> custom location.
>
> In either case, the config.ini file is blown away and re-created each
> time I launch the app (and I do not have selected the option to clear
> the configuration area before launching). The launched app uses the
> default SettingStore instead of the custom one, and when I look at the
> config.ini file after launching, the entry that I placed there for
> org.eclipse.rap.rwt.settingStoreFactory is gone.
>
> So what is the right way to set an osgi property when using the RAP
> launcher?

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Cannot set osgi property using RAP launcher [message #1107742 is a reply to message #1107721] Thu, 12 September 2013 21:49 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Member
Thanks, Ivan. That was it! I should have mentioned that I'm using RAP 1.5 (I'm porting the app to RAP 2.1, but have to make some changes quickly to the current version before getting back to porting).

So did they add the "rap" component to the property name in RAP 2.0 and then remove it again in RAP 2.1? Or is it perhaps because I'm using RAP tooling 2.1? My RAP runtime is 1.5, but I have to use the property name without "rap" to get it to work.

As documented in a previous post, I installed the feature in Juno that upgraded RAP tooling to 2.1, and then I was not able to revert back to 1.5 Tooling when I switched my runtime from 2.1 back to 1.5. I'd have to remove a feature which contains the entire platform. Maybe I'm going to run into other problems using 2.1 Tooling with a 1.5 runtime?
Re: Cannot set osgi property using RAP launcher [message #1107951 is a reply to message #1107742] Fri, 13 September 2013 05:47 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Mark,
Somehow we forgot to rename the OSGi SettingStoreFactory property in RAP
2.0 (only documentation was wrongly updated).
RAP Tools version should match your RAP Runtime. Most of the changes in
RAP Tools correspond to changes in Runtime. Definitely, you will run
into problems when you are using RAP Tools 2.1 with RAP Runtime 1.5 (a
lot of properties/packages have been renamed).
Best,
Ivan

On 9/13/2013 12:49 AM, Mark Leone wrote:
> Thanks, Ivan. That was it! I should have mentioned that I'm using RAP
> 1.5 (I'm porting the app to RAP 2.1, but have to make some changes
> quickly to the current version before getting back to porting).
>
> So did they add the "rap" component to the property name in RAP 2.0
> and then remove it again in RAP 2.1? Or is it perhaps because I'm
> using RAP tooling 2.1? My RAP runtime is 1.5, but I have to use the
> property name without "rap" to get it to work.
>
> As documented in a
> http://www.eclipse.org/forums/index.php/mv/msg/505357/1086864/#msg_1086864,
> I installed the feature in Juno that upgraded RAP tooling to 2.1, and
> then I was not able to revert back to 1.5 Tooling when I switched my
> runtime from 2.1 back to 1.5. I'd have to remove a feature which
> contains the entire platform. Maybe I'm going to run into other
> problems using 2.1 Tooling with a 1.5 runtime?

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Cannot set osgi property using RAP launcher [message #1108464 is a reply to message #1107951] Fri, 13 September 2013 22:26 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Member
I downgraded my RAP tooling to match the runtime, and corrected the SettingStoreFactory property, and now the custom SettingStoreFactory is being loaded. I'm seeing something very strange when using it however.

I create a preference store as follows:

preferenceStore = new ScopedPreferenceStore(new SessionScope(), MyPlugin.getDefault().getBundle().getSymbolicName());


Looking at the code for ScopedPreferenceStore, I see that unless the IScopeContext passed as the first argument is an instance of SessionScope, the SettingStore will not be used. This is a non-API class, and the documentation says it can be instantiated. It seems there should be an API-compliant way to do this, but I see not other way to get an instance of SessionScope, and the SettingStore will not be used unless I pass an instance of SessionScope.

Whether my problem is related to the above or not, I don't know. But here's what's happening. I have a PreferencePage with FieldEditors. I set the PreferenceStore shown above as the PreferenceStore for the PreferencePage and for the FieldEditors. I call fieldEditor.load() to have the widget show the preference value, and I call fieldEditor.store() to persist the value set by the widget.

When I call fieldEditor.store() I see the values persisted in the data store that backs my SettingStore, as expected. But when I call fieldEditor.load(), with the same PreferenceStore set on fieldEditor as was set when I called store(), it returns null for the preference value. Stepping through the code in the debugger I see that the key by which the ScopedPreferenceStoreCore object is retrieved from the SessionStore (ScopedPreferenceStore line 164) is different when load() is called than when store() is called. For the former it is #session/<my plugin id>/<preference name>, and for the latter it is #store/<my plugin id>/<preference name>

I'm mystified why this would be different, when I call load() and store() on the same FieldEditor object with the same ScopedPreferenceStore backed by the same SettingStore.

Is there a better way to do this? Am I just doing it wrong?

[Updated on: Mon, 16 September 2013 21:15]

Report message to a moderator

Previous Topic:Could not delete rwt-resources on shutdown
Next Topic:RAP 2.1 War is not working
Goto Forum:
  


Current Time: Thu Apr 18 13:38:23 GMT 2024

Powered by FUDForum. Page generated in 0.02051 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top