"Richard S. Hall" <[EMAIL PROTECTED]> writes:

> The Felix.start() method accepts a list of BundleActivator
> instances. These passed in activator instances effectively become
> part of the system bundle and their start()/stop() methods will be
> given the system bundle's context so that they can install bundles,
> register services, etc.

Oh, I completely missed that. Thanks for pointing it out. Now Felix
makes a lot more sense to me, especially from the point of view of
embedding it in an application.

On the topic of providing an activator list to Felix.start(), I notice
that SystemBundleActivator's start() method starts up all the
BundleActivators in the order they fall in the m_activatorList list.

In SystemBundle's constructor, it /appends/ activators for
PackageAdmin, StartLevel, and URLHandler services to the list provided
by the caller to Felix.start(). This means that
SystemBundleActivator.start() starts up the user-provided bundles (or
just BundleActivators) before these three (for now) system-provided
BundleActivators.

While I understand that bundles must expect services they rely on to
come and go, it might make for an easier start up if the user-provided
BundleActivators were started /after/ the system-provided ones. That
is assuming that any user-provided bundles would rely on services or
capabilities provided by the PackageAdmin, StartLevel, or URLHandler
BundleActivators.

In code, prepending in reverse order:

,----[ SystemBundle.SystemBundle(Felix, BundleInfo, List) ]
|         // Add the bundle activator for the URL Handlers service.
|         activatorList.add(0, new URLHandlersActivator(felix));
| 
|         // Add the bundle activator for the start level service.
|         activatorList.add(0, new StartLevelActivator(felix));
| 
|         // Add the bundle activator for the package admin service.
|         activatorList.add(0, new PackageAdminActivator(felix));
`----

Or, if the shuffling around of array elements is onerous, one could
use a LinkedList or write it this way, appending the provided list to
the system-built list:

,----[ SystemBundle.SystemBundle(Felix, BundleInfo, List) ]
|         m_activatorList = new ArrayList(3 +
|                                         null == activatorList ? 0 :
|                                         activatorList.length);
| 
|         // Add the bundle activator for the package admin service.
|         m_activatorList.add(new PackageAdminActivator(felix));
| 
|         // Add the bundle activator for the start level service.
|         m_activatorList.add(new StartLevelActivator(felix));
| 
|         // Add the bundle activator for the URL Handlers service.
|         m_activatorList.add(new URLHandlersActivator(felix));
| 
|         if (activatorList != null)
|             m_activatorList.addAll(activatorList);
`----

-- 
Steven E. Harris

Reply via email to