Envisage Technical Note: How an Envisage Application Starts Up and Shuts Down
Last Edited: 2005.12.29


Starting Up
-----------

1) The start method is called on the application.

2) The application fires the starting event.

3) All plug-in definitions listed in the plugin_definitions trait of the
   application are imported and he extension points and extension points
   are added to the extension registry.

4) All plug-ins are started in the order identified by their requires lists.
   As each plug-in is started, the following occurs:

    * The plug-in activator fires a plugin_starting event. **
    * The plug-in's start method is called.
    * The plug-in activator fires a plugin_started event. **

        ** These events should be exposed via the application, I think.

5) The application fires the started event.

6) The core plug-in hooks the started event, gets all contributions to the
   Runnable extension point, and calls the run methods of those contributions.


Start-Up Order of Plug-ins
--------------------------

The start-up order is dependent on the requires clause of each plug-in. When
a plug-in wants to get any contributions to its extension points, there are
two calls to get them:

1) self.get_extensions, which just gets the extensions/contributions.

2) self.load_extensions, which gets the extensions and makes sure that the
   plug-in that contributed them has been started.

The plug-in making the contribution should decide whether or not it needs to
be started when the contribution is used, instead of the plug-in using the
contribution.


Shutting Down
-------------

1) The stop method is called on the application.

2) The application fires a stopping event.

3) Plug-ins are stopped in the reverse order that they were started in. As
   each plug-in is stopped, the following occurs:

    * The plug-in activator fires a plugin_stopping event. **
    * The plug-in's stop method is called (by default this just calls save
      preferences).
    * All services registered by the plug-in are unregistered automatically.
    * The plug-in activator fires a plugin_stopped event. **

4) The application fires a stopped event.

