Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 265315 - Profile Scoped Preferences
Summary: Profile Scoped Preferences
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 267086 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-18 10:56 EST by Matthew Piggott CLA
Modified: 2009-03-04 15:34 EST (History)
4 users (show)

See Also:


Attachments
ProfilePreferences (14.80 KB, patch)
2009-02-18 10:56 EST, Matthew Piggott CLA
no flags Details | Diff
Test case for ProfilePreferences (4.85 KB, patch)
2009-02-18 10:56 EST, Matthew Piggott CLA
no flags Details | Diff
Updated patch (48.93 KB, patch)
2009-02-19 17:19 EST, John Arthorne CLA
no flags Details | Diff
Another combined updated patch (44.45 KB, patch)
2009-02-19 18:17 EST, Matthew Piggott CLA
no flags Details | Diff
Updated Patch (44.44 KB, patch)
2009-02-20 10:44 EST, Matthew Piggott CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Piggott CLA 2009-02-18 10:56:03 EST
Created attachment 126035 [details]
ProfilePreferences

This patch adds preferences which are saved in the data directory of a profile.
Comment 1 Matthew Piggott CLA 2009-02-18 10:56:33 EST
Created attachment 126036 [details]
Test case for ProfilePreferences
Comment 2 John Arthorne CLA 2009-02-19 17:19:58 EST
Created attachment 126233 [details]
Updated patch

This updated patch contains both code and tests, and replaces the previous patch. This new code handles the case where there is no self profile, as I believe we can hit this when using the installer, director, etc. This patch also replaces the patches in bug 262964 - keeping the patches separate was becoming too much work.
Comment 3 Matthew Piggott CLA 2009-02-19 18:17:09 EST
Created attachment 126238 [details]
Another combined updated patch

The update removes a few instances in tests where self profiles were created, or nodes removed.
The save() method of ProfilePreferences is also synchronized to prevent simultaneous use.
Comment 4 Simon Kaegi CLA 2009-02-19 23:51:15 EST
For the bits in the engine I like the approach. I have once concern around caching the profile. The "profile" is timestamped and the engine will throw an exception if you try and execute with an old profile property. I'm not sure what the consequences are however we might consider instead we just holding on to the profile id and the regetting the profile from the profile registry immediately prior to save/load.
Comment 5 Matthew Piggott CLA 2009-02-20 10:44:21 EST
Created attachment 126308 [details]
Updated Patch

I've removed the profile caching from the preferences, it will still attempt to obtain the relevant Profile to ensure it exists, but discards it and we request the profile by name each time we load, or save.

It also occurred to me that synchronizing the save method would only prevent simultaneous attempts to save the same file, not prevent ProfilePreferences from attempting to read/write to different files in the same profile data area simultaneously (I believe the Engine would fail to obtain a lock on the Profile leading to a failed load/save).  So I've added a lock object at the profile level and synchronize with it when we attempt to load or save, though it still won't prevent a failure when the profile is locked otherwise.
Comment 6 John Arthorne CLA 2009-02-20 17:44:54 EST
I have released the latest code to HEAD. Let's open new bug reports for any remaining issues thta come up.
Comment 7 Andrew Niefer CLA 2009-02-20 19:08:08 EST
People updating to these changes may need to check out org.eclipse.equinox.preferences to avoid compile errors until their target is updated.
Comment 8 John Arthorne CLA 2009-03-04 15:34:20 EST
*** Bug 267086 has been marked as a duplicate of this bug. ***