equinox
dynamic plugins > dynamic registry

 
The plugin registry is directed acyclic graph (DAG) structure where plugins form a well-known root set. Plugins are cross linked through prerequisite relationships (i.e., <require> statements) and extensions and extension-points.

Registry construction proceeds as follows:

  1. At startup time the plugin.xml file for each plugin is parsed and added to the raw registry.
  2. The raw registry is reconciled
    1. Plugin version constraints are satisfied
    2. Plugins with unsatisfied constraints are removed from the registry
    3. Extensions are added to their extension points
  3. The registry is locked

There are currently two proposals being developed to notify interested party of registry modification, however none of them propose an algorithm to incrementally solve the registry itself (reconciler). This last piece is the most central and challenging to implement. The reconciling mechanims involved is basically solving a constraint system, we should look at constraint algorithms which allow for incremental and batch addition of constraints (i.e., plugin version requirements)

  1. From a newly resolved registry the runtime should generate a registry delta which details the changes. This delta forms the basis for the registry life cycle event notification mechanism.
  2. The other approach is based on extending Plugin class, the details can be found here.

The registry resolver will have to work incrementally. To support incremental additions/removals, the RegistryResolver class will be changed to use the new dependencies API.

Initial resolution:

  1. create a corresponding dependency system, adding all valid plug-in descriptors as elements (plug-in ids are element set ids, pre-requisites are dependencies), and mark all plug-in descriptors as unresolved (disabled)
  2. resolve the dependency system
  3. the resulting delta will only contain resolved elements. Iterate through them, marking the corresponding plug-in descriptors as resolved (enabled)

Incremental resolution:

  1. for each new plug-in descriptor (disabled/unresolved), add a corresponding element to the dependency system
  2. for each plug-in descriptor to be removed, remove the corresponding element from the dependency system
  3. for each plug-in descriptor to be changed, remove the existing element definition and add the new one (we could do that automatically)
  4. resolve the dependency system
  5. the resulting delta will only contain all changed elementsresolved elements. Iterate through them, marking the corresponding plug-in descriptors as resolved (enabled)
  6. the resulting delta will contain resolved/unresolved/changed (dependencies changed) elements. Iterate through them and apply the changes to the corresponding plug-in descriptors/pre-requisites.