Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 244443 - Implement SystemBundle (RFC 132)
Summary: Implement SystemBundle (RFC 132)
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL: http://www.osgi.org/download/osgi-4.2...
Whiteboard:
Keywords:
Depends on:
Blocks: 247354
  Show dependency tree
 
Reported: 2008-08-18 11:52 EDT by Thomas Watson CLA
Modified: 2009-07-14 10:02 EDT (History)
9 users (show)

See Also:


Attachments
initial implementation (93.45 KB, patch)
2008-08-18 16:58 EDT, Thomas Watson CLA
no flags Details | Diff
Updated patch (101.73 KB, patch)
2008-08-18 18:25 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2008-08-18 11:52:43 EDT
RFC 132 defines a new SystemBundle interface which Framework implementations must provide an implementation to.  This implementation can be used to launch an OSGi Framework in a standard way.

The SystemBundle extends the Bundle object and provides a configurator (boot strap code) with a specified way to control the lifecycle of the Framework through the use of the start/stop/update methods.  It also provides an init method which can be used to configure an instance of the framework.

Implementing this is pretty straight forward.  The sticky part comes when multiple framework instances are created using the same classloader.  In Equinox we have made lots of assumptions that only one instance of the framework is loaded with a given classloader.  In past releases Equinox has supported multiple frameworks loaded into the same VM by created isolated classloaders for each instance of the Framework.

In order to support RFC 132 and other enhancements coming in OSGi R4.2 we will need to figure out how allow for the SystemBundle implementation instances to share the same classloader.

One approach is to create a child first classloader that allows for the internal guts of the framework to be loaded by a separate classloader for each instance but allow all publich APIs (org.osgi.* etc.) to be loaded by a single parent class loader.
Comment 1 Thomas Watson CLA 2008-08-18 11:53:52 EDT
(In reply to comment #0)
> One approach is to create a child first classloader that allows for the
> internal guts of the framework to be loaded by a separate classloader for each
> instance but allow all publich APIs (org.osgi.* etc.) to be loaded by a single
> parent class loader.
> 

I have been working on this approach and plan to release something into M2.
Comment 2 Thomas Watson CLA 2008-08-18 16:58:43 EDT
Created attachment 110287 [details]
initial implementation

Work in progress.  Implementation of SystemBundle + testcases.
Comment 3 Thomas Watson CLA 2008-08-18 18:25:35 EDT
Created attachment 110297 [details]
Updated patch

Previous patch inadvertently added API to EclipseStarter.  I released this patch for M2.  I expect more changes to come from RFC 132 and RFC 138.  Leaving this bug open for now.
Comment 4 Thomas Watson CLA 2008-08-18 18:26:27 EDT
Note that I did not tag this for the I-Build tomorrow.  I would like to run an N-Build test pass first.
Comment 5 Jeff McAffer CLA 2008-08-18 20:41:58 EDT
Is there any correspondance between this and the framework admin stuff that we have worked on in Equinox?  Hopefully framework admin can at least in part be implemented in terms of this.
Comment 6 Thomas Watson CLA 2008-08-19 11:36:57 EDT
(In reply to comment #5)
> Is there any correspondance between this and the framework admin stuff that we
> have worked on in Equinox?  Hopefully framework admin can at least in part be
> implemented in terms of this.
> 

My high level understanding of framework admin is that it provides API that manipulates configuration data that gets used by a runtime.  Conceptually it manipulates two types of data:

- launcher and boot strap configurations:  Things like splash screen and installation of the "configurator" bundle.
- input data for the configurator bundle which describes the bundles that should be installed into the framework and the start information (start-level, persistent start etc.)

The manipulators in Framework Admin do not actually manipulate the framework directly.  Instead they manipulate data for which boot strap and configurator code uses to interact with the framework.

In RFC 132 (public draft will be available by the end of this week) OSGi is defining a standard way for launching an instance of an empty framework.  The design is very simple.  Framework Implementations must provide a public class which implements the SystemBundle interface.  The SystemBundle interface extends Bundle and provides an init method which takes a Properties object used to pass configuration properties to the framework (think of this as the content of the config.ini).  A SystemBundle implementation then could be used by boot strap code to install the "configurator" bundle (through the use of SystemBundle.getBundleContext()).

I think this is orthogonal to framework admin's main uses.  It looks like framework admin does have API to launch a framework but I'm not sure that is the main focus of framework admin.  Perhaps this portion of framework admin could use RFC 132 to launch an instance of a framework.

My goal is to update the launcher/EclipseStarter to use a standard way to launch a framework and install boot strap bundles instead of using internal classes of Equinox to construct the framework.

Also keep in mind that RFC 132 is a spring board to other, more involved, changes to the framework for specifying how to have embedded/peered/child framework instances.
Comment 7 Chris Aniszczyk CLA 2008-08-19 12:02:07 EDT
PDE is interested in any universal way to launch frameworks.
Comment 8 Jeff McAffer CLA 2008-08-21 09:58:09 EDT
thanks Tom.  We should definitely make framwork admin use the new API.  Does the new API talk about how to start an entire framework (e.g., Java, vm args, ...) or just how to start another framework in the currently running VM?
Comment 9 Thomas Watson CLA 2008-08-21 11:12:54 EDT
(In reply to comment #8)
> thanks Tom.  We should definitely make framwork admin use the new API.  Does
> the new API talk about how to start an entire framework (e.g., Java, vm args,
> ...) or just how to start another framework in the currently running VM?
> 

It only specifies how to launch a framework in a currently running VM from what I call "boot strap code".  This is something like EclipseStarter.  So in theory EclipseStarter could be abstracted out of the Framework and used to launch an Framework implementation that implements RFC 132.
Comment 10 Thomas Watson CLA 2008-08-21 17:41:57 EDT
See http://www.osgi.org/download/osgi-4.2-early-draft.pdf for early draft which
includes RFC 132.
Comment 11 Thomas Watson CLA 2008-09-11 16:37:14 EDT
No additional work is going to be done in M2.  The specification is being updated and the API will change.  We will update the implementation to be in line with the new draft spec in M3.
Comment 12 Thomas Watson CLA 2008-09-25 17:45:51 EDT
Marking as fixed.  I released the latest changes to be inline with the latest RFC.  New bugs will be opened if additional changes are needed.
Comment 13 Martin Thelian CLA 2009-07-12 11:31:43 EDT
Where can I find equinox with the new SystemBundle? Target Milestone of this issue was 3.5 M3. I've downloaded Equinox 3.5, but there is no such class. 

[1] http://download.eclipse.org/equinox/drops/R-3.5-200906111540/index.php
Comment 14 Thomas Watson CLA 2009-07-12 12:05:10 EDT
(In reply to comment #13)
> Where can I find equinox with the new SystemBundle? Target Milestone of this
> issue was 3.5 M3. I've downloaded Equinox 3.5, but there is no such class. 
> 
> [1] http://download.eclipse.org/equinox/drops/R-3.5-200906111540/index.php
> 

RFC 132 has undergone many changes leading up to the final version of the v4.2 OSGi specification.  You can find the interfaces related to this RFC in the org.osgi.framework.launch package.  You are looking for the org.osgi.framework.launch.Framework interface.
Comment 15 Martin Thelian CLA 2009-07-13 11:54:38 EDT
Thank you very much for your help!

Am I right that all the org.osgi.service.command stuff was also not included into the final version of the v4.2?

Comment 16 Thomas Watson CLA 2009-07-14 10:02:29 EDT
(In reply to comment #15)
> Thank you very much for your help!
> 
> Am I right that all the org.osgi.service.command stuff was also not included
> into the final version of the v4.2?
> 

Correct, the command stuff did not make it into the summer release of the compendium specification (r4.2).