Community
Participate
Working Groups
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.
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.
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.