Bug 177332 - [api] Need API to wait until the RSE model is fully restored
Summary: [api] Need API to wait until the RSE model is fully restored
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 1.0.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 2.0   Edit
Assignee: David Dykstal CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 181479 197167
  Show dependency tree
 
Reported: 2007-03-14 09:45 EDT by Martin Oberhuber CLA
Modified: 2008-08-13 13:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2007-03-14 09:45:20 EDT
When RSE starts up, a SystemProfileManager singleton is created (either by the RSEUIPlugin or, in case of headless, some Core classes). Creation of the Singleton leads to restoring profiles in SystemProfileManager.getSystemProfileManager().

Due to fixing bug 177155, this initialization can take some time and can be done deferred. Clients who want to do something automatically right after startup (for instance, automatically add some default nodes like the "Local" connection) need to wait until the profiles in the SystemProfileManger are fully restored.

It is currently not clear when this "complete" flag can be set: is it right after the restore operation is complete, or is it only after the default "Local" system type has been added automatically? Can clients get the default "Local" connection lazily? Or is this just another connection which just happens to be created automatically at some time?

We need API to 
 - detect if SystemProfileManager is already initialized, 
 - OR wait until it is fully initialized,
 - OR register for a callback to occur after it is initialized.
Perhaps it would also make sense to define an Event that is fired when the 
Persistence Manager has finished restoring profiles into the SystemProfileManager.

Please give ideas or comments.
Comment 1 David Dykstal CLA 2007-05-11 00:07:05 EDT
API added to test if a particular persistence provider has completed loading profiles.
Comment 2 Martin Oberhuber CLA 2007-05-11 03:20:56 EDT
Perhaps I'm missing something, but I cannot see how a client can use this API.

What the client needs to do, is wait on early startup of RSE until the persistence provider is fully initialized. Since any number of persistence providers can be registered, the client has no concept of what particular persistence provider it should wait for.

The API you added might make sense for some client, but I think we need another method that can tell us whether ALL registered persistence providers are fully initialized (and thus the SystemProfileManager is ready to use).
Comment 3 Uwe Stieber CLA 2007-05-11 04:01:16 EDT
Martin, perhaps I missed something, but isn't it what Dave had asked in the committer meeting? There can be only one active (default) persistence provider, correct? So we do know exactly which persistence provider would be used, don't we?
Comment 4 David Dykstal CLA 2007-05-11 08:39:53 EDT
We can have multiple active persistence providers, but there are currently two restore methods. One restores all profiles, but at the cost of activating all the plugins associated with all providers. The other method restores those profiles assigned to a particular provider. If we restrict the API to just restoring all profiles, then we can have an API that determines if all profiles have been restored.

How about if we remove the provider id argument and return a multistatus instead of a boolean? Each status would contain a provider id (its message) and whether or not it was complete, in progress, not started, or not requested (its code). The multistatus itself would be complete only if all were complete.
Comment 5 Martin Oberhuber CLA 2007-05-11 09:34:41 EDT
Hm, multistatus seems flexible but hard to handle for clients.

My understanding was that when RSE starts up (some or all?) persistence providers start looking at the workspace or wherever they want to look for existing persisted profiles, and read them in.

Not all persistence providers may be configured with an "autostart" property to do this, but some may.

So, from a client's view, the RSE SystemView is fully populated if and only if all those persistence providers that are configured to "autostart" have done their job. Autostarting requires activating their plugins anyways. Clients would like to know when they can assume that the RSE Models are fully populated with the stuff that should have been read from disk (or elsewhere).
Comment 6 David Dykstal CLA 2007-05-11 10:25:37 EDT
As it stands today, the startup sequence loads all profiles. Adding an "autostart" option to the providers is a great idea, but it currently does not exist. However, it should be very easy to add. Lets do this.
1) add an autostart=<boolean> attribute to the provider extension point, default is false.
2) the default provider is assumed to be autostart.
3) the startup sequence functions as it does now, but only loads and restores autostart providers
4) the query will return a boolean and take no argument. It will be false if any autostart provider is incomplete.
Comment 7 Martin Oberhuber CLA 2007-05-11 10:48:47 EDT
Sounds great for me.
Comment 8 David Dykstal CLA 2007-05-11 14:51:04 EDT
Implemented as described above
Comment 9 Martin Oberhuber CLA 2007-06-27 11:41:42 EDT
(In reply to comment #6)
So, when I understand (4) above right, the solution for clients is to do

RSECorePlugin.getThePersistenceManager().isRestoreComplete()
Comment 10 Martin Oberhuber CLA 2008-08-13 13:18:43 EDT
[target cleanup] 2.0 M7 was the original target milestone for this bug