Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 247338 - service model configuration should be saved when modified
Summary: service model configuration should be saved when modified
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: RDT (show other bugs)
Version: 2.1M2   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: 2.1M4   Edit
Assignee: Mike Kucera CLA
QA Contact: Greg Watson CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-15 15:28 EDT by Mike Kucera CLA
Modified: 2008-09-22 21:07 EDT (History)
1 user (show)

See Also:


Attachments
proposed patch (57.20 KB, patch)
2008-09-19 11:41 EDT, Mike Kucera CLA
recoskie: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kucera CLA 2008-09-15 15:28:54 EDT
Currently the service model configuration is saved using a workspace save participant. This has caused us problems in the past (bug 246143) and continues to be flaky even now.

Perhaps the service model should be saved immediately whenever it is modified, rather than from workspace save events.
Comment 1 Mike Kucera CLA 2008-09-19 11:41:45 EDT
Created attachment 113019 [details]
proposed patch

This patch does the following:

- Removes ServiceModelSaveParticipant. The service model is now saved immediately whenever it is modified, for example when a project is created or when the service model is changed using the properties page. Note that currently projects are not removed from the model when they are deleted, that is a separate bug (bug 247890).

- Fixes the service providers so that they store their connection name even when the connection isn't established yet. With this fix the model can now be saved at any time. I think this is what was causing the random NPEs.

- Fixes the build service provider so that it doesn't try to create a connection in restoreState(). This was a big problem because if RSE wasn't initialized yet an exception was thrown during activation of the services plugin and the plugin wouldn't load.

- Tightens up the API for IServiceModelManager. The API is now clear as to the behavior when you pass invalid arguments to a method. Added ProjectNotConfiguredException which is thrown when an attempt is made to access the configuration for a project that ServiceModelManager is unaware of.

- Fixes another bug in the manager, there was a configurations map of type Map<String, IServiceConfiguration>. The problem is that different projects are likely to have configurations of the same name (eg "Default") so it was easy for configurations to get overwritten.

- Replaces the projectConfigurations and configurations maps with one variable of type Map<IProject, Map<String, IServiceConfiguration>>. I believe this type correctly captures the relationship that is being managed.

- Removes the equals() and hashCode() methods from ServiceConfiguration, because they are no longer needed (because I removed the Set), and because their implementation was awkward.

- Fixes the ServiceModelManagerTests so they now pass. The tests were trying to save the model for a project that didn't exist, which doesn't work. Documented this in the ServiceModelManager API.

- Adds an action to the service model test plugin that creates a toolbar button, when pressed it prints the current service model to the console. I found this very useful for debugging.


Phew! Hopefully this clears up all the problems with the ServiceModelManager. Everything seems to be working fine now on my machine with this patch.
Comment 2 Chris Recoskie CLA 2008-09-22 15:45:56 EDT
Applied to HEAD.  Thanks.

I'm a bit unclear as to what to set the target milestone to given that M3 was built contrary to the official schedule, so I will set the target milestone to M4 to be safe.