Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Bundle loading and adapters


Unfortunately there is not much documentation lying around with this information.  The Adaptor API should be well JavaDoc'ed but that does not mean it is easy to understand or get started with your own adaptor.  I hope to get a document written that explains the Adaptor API and overall architecture (which is still changing).  This will probably push me to start one.  Here is an overview of how the adaptor BundleClassLoaders and the BundleLoaders interact with each other in the Framework.

The FrameworkAdaptor API is located in the org.eclipse.osgi project under the source folder core/adaptor.  The FrameworkAdaptor is responsible for creating BundleData objects for the Framework.  There is one BundleData object per Bundle installed in the Framework.  BundleData objects provide the Framework with an API for access persistent data about a Bundle.  For example, it has methods to access a bundle's manifest information, install native code, get a bundle entry from a bundle, etc.  This data is used by the Framework to create Bundle object.  The BundleData object also has a method to create the BundleClassLoader for a bundle.  

When the Framework asks a BundleData object to create a BundleClassLoader it specifies a ClassLoaderDelegate.  A ClassLoaderDelegate is responsible for finding classes and resources that are imported from an exported package or from a package that is provided by a required bundle.  A BundleClassLoader must call the ClassLoaderDelegate to find a class or resource.  The ClassLoaderDelegate uses the delegating classloading model that is outlined in the OSGi specification.  For example, if it determines that a class or resource is imported from an exported packge then it will delegate the lookup to the BundleClassLoader of the Bundle that is exporting the package.  Similiarly, if the class or resource is provided by a required bundle then it will delegate the lookup to the BundleClassLoader of the required Bundle.  Finally if the class or resource is not found then it delegates back to the original BundleClassLoader that made the request to find the class or resource.

The ClassLoaderDelegate is an interface from the Adaptor API which is implemented by the Framework, not the FrameworkAdaptor.  The implementation behind the ClassLoaderDelegate is the BundleLoader class.  The BundleLoader has all the logic that determines what source (or bundle) will be used to load resources and classes from specific packages.

I hope this helps you get a start.

Thomas Watson



Glyn Normington <glyn_normington@xxxxxxxxxx>
Sent by: equinox-dev-admin@xxxxxxxxxxx

03/10/2004 11:03 AM
Please respond to equinox-dev

       
        To:        equinox-dev@xxxxxxxxxxx
        cc:        
        Subject:        [equinox-dev] Bundle loading and adapters







I'm new to navigating round the Eclipse codebase and am interested in the
way the default and Eclipse adapters mesh with the OSGi bundle loaders.
I've started reading the code, but I'd be really interested to know if
there are snippets of information lying around that might save me some
time. I tried searching the archive of this list but didn't find anything
relevant.

Glyn Normington

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/equinox-dev


Back to the top