Community
Participate
Working Groups
Created attachment 126035 [details] ProfilePreferences This patch adds preferences which are saved in the data directory of a profile.
Created attachment 126036 [details] Test case for ProfilePreferences
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.
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.
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.
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.
I have released the latest code to HEAD. Let's open new bug reports for any remaining issues thta come up.
People updating to these changes may need to check out org.eclipse.equinox.preferences to avoid compile errors until their target is updated.
*** Bug 267086 has been marked as a duplicate of this bug. ***