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:
- At startup time the plugin.xml file for each plugin is parsed and added to the raw registry.
- The raw registry is reconciled
- Plugin version constraints are satisfied
- Plugins with unsatisfied constraints are removed from the registry
- Extensions are added to their extension points
- 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)
- 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.
- 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:
- 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)
- resolve the dependency system
- the resulting delta will only contain resolved elements. Iterate through
them, marking the corresponding plug-in descriptors as resolved (enabled)
Incremental resolution:
- for each new plug-in descriptor (disabled/unresolved), add a corresponding
element to the dependency system
- for each plug-in descriptor to be removed, remove the corresponding element
from the dependency system
- for each plug-in descriptor to be changed, remove the existing element definition
and add the new one (we could do that automatically)
- resolve the dependency system
- the resulting delta will only contain all changed elementsresolved elements.
Iterate through them, marking the corresponding plug-in descriptors as resolved
(enabled)
- 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.