Difference between revisions of "Virgo/Design/QuasiFramework"

From Eclipsepedia

< Virgo‎ | Design
Jump to: navigation, search
m (Installation and Dependency Resolution)
m (Formatting tweak)
 
(33 intermediate revisions by one user not shown)
Line 1: Line 1:
The two main use cases for the [[Virgo/Concepts#Quasi_Framework | quasi framework]] are installing bundles into a "side state" (and automatically installing missing dependencies from the Virgo repository) and analysing a dump produced by a resolution failure.
+
{{Virgo}} [[Category:Virgo]] [[Category:EclipseRT]]
  
= Interfaces =
+
The purpose of the [[Virgo/Concepts#Quasi_Framework|quasi framework]] is to provide a [http://en.wikipedia.org/wiki/Facade_pattern façade] for inspecting and manipulating OSGi framework states without proliferating Equinox specific interfaces throughout Virgo.
  
The quasi framework supports the following interfaces:
+
The main use cases for the quasi framework are offline dependency resolution, dump analysis, and inspection of framework state.
  
* QuasiFrameworkFactory with methods to create a quasi framework based on:
+
= Offline Dependency Resolution  =
** a snapshot of the current OSGi framework state and the [[Virgo/Concepts#Regions | region digraph]], or
+
** a directory containing dumps of the OSGi framework state and the region digraph.
+
* QuasiFramework with methods to:
+
** install a bundle into the quasi framework (as a ''quasi bundle'', meaning it only exists in the quasi framework)
+
** inquire the quasi framework
+
** attempt to resolve the quasi bundles
+
** diagnose why a particular quasi bundle failed to resolve
+
** commit all the quasi bundles by installing corresponding bundles in the OSGi framework
+
** destroy the quasi framework by deleting any associated ''coregion'' (described below).
+
  
= Installation and Dependency Resolution =
+
Offline dependency resolution occurs when an application is installed into Virgo in order to ensure the application resolves and any missing dependencies are automatically installed or ''auto-installed''.
  
The installation use case is offline with respect to the OSGi framework state (unless and until the quasi framework state is committed to the OSGi framework) and is online with respect to the region digraph. In this case, the quasi framework contains a snapshot of the OSGi framework but refers to the "live" region digraph.
+
In this use case, the quasi framework is used to take a snapshot of the OSGi framework, install bundles into this ''side state'', attempt to resolve them, auto-install any missing dependencies from the Virgo repository, and repeat until no more progress can be made. If this process is successful, the bundles are then installed into the OSGi framework. If the process is unsuccessful, the quasi framework is dumped to disk for subsequent analysis and the OSGi framework is not "infected" with unresolvable bundles.  
  
The live region digraph is needed because the region digraph is implemented using OSGi framework hooks with global effects and so it is not possible to create a snapshot of the region digraph for use during offline resolution. Instead the quasi framework creates a temporary "coregion" to contain any quasi bundles installed into the quasi framework. The coregion is connected directly to and from the user region with all resources visible in both directions. Thus the coregion's contents are equivalent to user region contents, but can easily be cleaned up by deleting the coregion. Since the bundle ids of quasi bundles are not valid in the live OSGi framework, it is unlikely that the coregion could be abused even if some other part of the system noticed its existence and read its contents (i.e. the bundle ids in the coregion). The coregion is deleted when the quasi framework is destroyed.
+
The installation use case is offline with respect to the OSGi framework state (unless and until the quasi framework state is committed to the OSGi framework) and is online with respect to the [[Virgo/Concepts#Regions|region digraph]]. In this case, the quasi framework contains a snapshot of the OSGi framework, but refers to the "live" region digraph.<br>
  
= Dump Analysis =
+
[[Image:Quasi framework - live digraph with commit.png]]
  
The dump analysis use case is completely offline in the sense that live state is not affected. In this case, the quasi framework contains snapshots of the OSGi framework and of the region digraph that were dumped, e.g. on a resolution failure.
+
The live region digraph is used because the region digraph is implemented using OSGi framework hooks with global effects and so it was not thought to be possible to create a snapshot of the region digraph for use during offline resolution. Instead the quasi framework creates a temporary "coregion" to contain any quasi bundles installed into the quasi framework. In the region digraph, the coregion is connected directly to and from the user region with all resources visible in both directions. Thus the coregion's contents are equivalent to user region contents, but can easily be cleaned up by deleting the coregion. The downside of using the live region digraph is that the coregion will briefly be visible during offline dependency resolution. However, since the bundle ids of quasi bundles are not valid in the live OSGi framework, it is unlikely that the coregion could be abused even if some other part of the system noticed its existence and read its contents (i.e. the bundle ids in the coregion). The coregion is deleted when the quasi framework is destroyed.
 +
 
 +
(It may be possible to use a snapshot of the region digraph for offline dependency resolution by inquiring the snapshot's resolver hook factory and setting this into the snapshot of the OSGi framework state.)
 +
 
 +
= Dump Analysis  =
 +
 
 +
In this use case, the quasi framework is used to analyse the contents of a dump. The dump may have been generated when offline dependency resolution fails. Alternatively, the dump may have been generated by some other failure or on request by a user.
 +
 
 +
The dump analysis use case is completely offline in the sense that live state is not affected. In this case, the quasi framework contains snapshots of the OSGi framework and of the region digraph that were dumped, e.g. on a resolution failure.
 +
 
 +
[[Image:Quasi framework - digraph snapshot.png]]<br> The resolver hook factory is queried from the region digraph and set into the OSGi framework state so that resolution in the state respects the original region digraph.
 +
 
 +
= Framework State Inspection  =
 +
 
 +
In this use case, the quasi framework provides a framework neutral abstraction for inspecting the contents of the OSGi framework, for example from Virgo's command line shell. In this case, the quasi framework contains a snapshot of the OSGi framework, but refers to the "live" region digraph.
 +
 
 +
[[Image:Quasi framework - live digraph.png]]
 +
 
 +
= Interfaces  =
 +
 
 +
The quasi framework supports the following interfaces:
 +
 
 +
*'''<tt>QuasiFrameworkFactory</tt>''' with methods to create a quasi framework based on:
 +
**a snapshot of the current OSGi framework state and the region digraph, or
 +
**a directory containing dumps of the OSGi framework state and the region digraph.
 +
 
 +
*'''<tt>QuasiFramework</tt>''' with methods to:
 +
**install a bundle into the quasi framework (as a ''quasi bundle'', meaning it only exists in the quasi framework)
 +
**inquire the quasi framework
 +
**attempt to resolve the quasi bundles
 +
**diagnose why a particular quasi bundle failed to resolve
 +
**commit all the quasi bundles by installing corresponding bundles in the OSGi framework
 +
**destroy the quasi framework by deleting any associated ''coregion'' (described below).

Latest revision as of 11:07, 10 April 2013

The purpose of the quasi framework is to provide a façade for inspecting and manipulating OSGi framework states without proliferating Equinox specific interfaces throughout Virgo.

The main use cases for the quasi framework are offline dependency resolution, dump analysis, and inspection of framework state.

Contents

[edit] Offline Dependency Resolution

Offline dependency resolution occurs when an application is installed into Virgo in order to ensure the application resolves and any missing dependencies are automatically installed or auto-installed.

In this use case, the quasi framework is used to take a snapshot of the OSGi framework, install bundles into this side state, attempt to resolve them, auto-install any missing dependencies from the Virgo repository, and repeat until no more progress can be made. If this process is successful, the bundles are then installed into the OSGi framework. If the process is unsuccessful, the quasi framework is dumped to disk for subsequent analysis and the OSGi framework is not "infected" with unresolvable bundles.

The installation use case is offline with respect to the OSGi framework state (unless and until the quasi framework state is committed to the OSGi framework) and is online with respect to the region digraph. In this case, the quasi framework contains a snapshot of the OSGi framework, but refers to the "live" region digraph.

Quasi framework - live digraph with commit.png

The live region digraph is used because the region digraph is implemented using OSGi framework hooks with global effects and so it was not thought to be possible to create a snapshot of the region digraph for use during offline resolution. Instead the quasi framework creates a temporary "coregion" to contain any quasi bundles installed into the quasi framework. In the region digraph, the coregion is connected directly to and from the user region with all resources visible in both directions. Thus the coregion's contents are equivalent to user region contents, but can easily be cleaned up by deleting the coregion. The downside of using the live region digraph is that the coregion will briefly be visible during offline dependency resolution. However, since the bundle ids of quasi bundles are not valid in the live OSGi framework, it is unlikely that the coregion could be abused even if some other part of the system noticed its existence and read its contents (i.e. the bundle ids in the coregion). The coregion is deleted when the quasi framework is destroyed.

(It may be possible to use a snapshot of the region digraph for offline dependency resolution by inquiring the snapshot's resolver hook factory and setting this into the snapshot of the OSGi framework state.)

[edit] Dump Analysis

In this use case, the quasi framework is used to analyse the contents of a dump. The dump may have been generated when offline dependency resolution fails. Alternatively, the dump may have been generated by some other failure or on request by a user.

The dump analysis use case is completely offline in the sense that live state is not affected. In this case, the quasi framework contains snapshots of the OSGi framework and of the region digraph that were dumped, e.g. on a resolution failure.

Quasi framework - digraph snapshot.png
The resolver hook factory is queried from the region digraph and set into the OSGi framework state so that resolution in the state respects the original region digraph.

[edit] Framework State Inspection

In this use case, the quasi framework provides a framework neutral abstraction for inspecting the contents of the OSGi framework, for example from Virgo's command line shell. In this case, the quasi framework contains a snapshot of the OSGi framework, but refers to the "live" region digraph.

Quasi framework - live digraph.png

[edit] Interfaces

The quasi framework supports the following interfaces:

  • QuasiFrameworkFactory with methods to create a quasi framework based on:
    • a snapshot of the current OSGi framework state and the region digraph, or
    • a directory containing dumps of the OSGi framework state and the region digraph.
  • QuasiFramework with methods to:
    • install a bundle into the quasi framework (as a quasi bundle, meaning it only exists in the quasi framework)
    • inquire the quasi framework
    • attempt to resolve the quasi bundles
    • diagnose why a particular quasi bundle failed to resolve
    • commit all the quasi bundles by installing corresponding bundles in the OSGi framework
    • destroy the quasi framework by deleting any associated coregion (described below).