[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Creating and Starting a BundleActivator when the framework launches

If you start the bundle with Bundle.start(), then the framework will 
persistently mark it started and will restart each time the framework is 

If you launch the framework with -console, you can follow that with 
"install some://bundle/url start" to install and start a bundle.

You can also mark it to be started in the configuration/config.ini file. 
See the osgi.bundles key:

# The comma-separated list of bundles which are automatically installed 
and optionally started
# once the system is up and running.  Each entry if of the form
#     <URL | simple bundle location>[@ [<startlevel>] [":start"]]
# If the startlevel is omitted then the framework will use the default 
start level for the bundle.
# If the "start" tag is added then the bundle will be marked as started 
after being installed.
# Simple bundle locations are interepreted as relative to the framework's 
parent directory.
# The startlevel indicates the OSGi start level at which the bundle should 
# If this value is not set, the system computes an appropriate default.
org.eclipse.update.configurator@3:start, org.eclipse.core.runtime@start

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
Office: +1 407 849 9117 Mobile: +1 386 848 3788

Simon J Archer/Raleigh/IBM@IBMUS 
Sent by: equinox-dev-bounces@xxxxxxxxxxx
2006-04-08 07:24 AM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>


[equinox-dev] Creating and Starting a BundleActivator when the  framework 

It is my understanding that simply having a BundleActivator class and a 
Bundle-Activator header in the MANIFEST.MF is not enough to force the 
bundle's activator to be created and started by Equinox when the framework 
is launched. 

I have learned that adding Eclipse-LazyStart: true to the MANIFEST.MF is 
the way ensure that the bundle's activator is started when one of its 
classes is first touched by another bundle. 

But how am I to create a bundle that has a BundleActivator that is created 
and started when the OSGi framework is launched?  I am aware of the 
org.eclipse.ui.startup extension point and accompanying IStartup class, 
but I do not want to use that when my bundle is "pure model", since they 
reside in an Eclipse UI plug-in.  I don't want to couple my model to 
anything UI related. 

I'm building plugins that will run in the Eclipse IDE rather than pure 
OSGi bundles, so I'm using an "Eclipse Application" launch configuration. 
It is curious that only the "Equinox OSGi Framework" launch configurations 
allow you to specify the default start level for a bundle and whether it 
will start automatically when the framework launches. 

While I understand that the early creation and starting of a bundle 
activator is considered a bad thing by many Eclipse developers, it should 
still be possible and should not be this hard. 


equinox-dev mailing list