Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] How do I dynamically install and attach a fragment?


Hi,

Simon is correct, you need to use either PackageAdmin.resolveBundles(...) or PackageAdmin.refreshPackages(...) to force a fragment to resolve.  When launching from PDE, the update configurator bundle uses PackageAdmin to force all possible bundles to resolve.  When you install a bundle yourself you must do something to force it to resolve.  For fragment bundles the only way to force them to resolve is to use PackageAdmin.

The two PackageAdmin methods (resolveBundles(...) and refreshPackages(...)) have different usecases.

-  If you have a fragment which you would like to resolve and attach to an existing host bundle which is already resolved then you must use PackageAdmin.resolveBundles(...).  This method will attempt to attach a fragment to any available host bundles.  If the host bundle is already in the RESOLVED state then a fragment can only be attached dynamically if it does not add any new constraints to the host.

-  If you have a fragment which adds new constraints (i.e. new Import-Package or Require-Bundle headers), then you must use PackageAdmin.refreshPackages to force the host bundle to re-resolve.  This is because we cannot dynamically add new constraints to an already RESOLVED host bundle from fragment bundles.

Tom





"Simon Kaegi" <simon.kaegi@xxxxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx

12/29/2006 11:58 AM

Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>

To
"Equinox development mailing list" <equinox-dev@xxxxxxxxxxx>
cc
Subject
Re: [equinox-dev] How do I dynamically install and attach a fragment?





Hi Matthew,
 
What you're doing sounds right to me.
Is the fragment showing up as UNRESOLVED in the console?
If you installed the fragment first, you might need to use PackageAdmin.resolveBundles(...) and possibly refreshPackages(...) to get everything set correctly.
 
-Simon
----- Original Message -----
From: Matthew Webster
To: Equinox development mailing list
Sent: Friday, December 29, 2006 6:32 AM
Subject: [equinox-dev] How do I dynamically install and attach a fragment?


I am trying to use BundleContext.installBundle() to install a fragment and its host. However when I use Bundle.loadClass() (for the host) I cannot resolve any classes in the fragment. If use PDE (JUnit Plug-in Test) it works. I notice that in the failing case querying the fragments gives no host and vice versa for the host. Is there an additional API I must call to attach the fragment? Is the order in which I install the bundles important?


Thanks in advance.


Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/


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


Back to the top