Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » default autostart
default autostart [message #125415] Tue, 03 February 2009 13:47 Go to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
There is a setting in the equinox launcher to set the default autostart to
true.
Is there a matching setting which can be placed in the config.ini file?

I found osgi.bundles.defaultStartLevel,
but osgi.bundles.defaultAutoStart does not work.

Is this an osgi param, or does the equinox launcher do this on its own?
Re: default autostart [message #125457 is a reply to message #125415] Tue, 03 February 2009 15:29 Go to previous messageGo to next message
Benjamin Cabé is currently offline Benjamin CabéFriend
Messages: 201
Registered: July 2009
Location: Toulouse, France
Senior Member

Erdal,

A known workaround is to have a bundle (which must be autostarted, of
course) listening to new RESOLVED bundle and automagically starting
them. See the code below (from the Toast project ;-)).

However, you may want to check if your problem couldn't be solved
autostarting only a very few strategic bundles (e.g.
org.eclipse.equinox.ds, even if PDE will now automatically set it to
autostart), and have dependencies automatically handle the starting of
other bundles....

Cheers,
Ben

Erdal Karaca a écrit :
> There is a setting in the equinox launcher to set the default autostart
> to true.
> Is there a matching setting which can be placed in the config.ini file?
>
> I found osgi.bundles.defaultStartLevel,
> but osgi.bundles.defaultAutoStart does not work.
>
> Is this an osgi param, or does the equinox launcher do this on its own?
>
















/*********************************************************** ********************
* Copyright (c) 2008 Paul Vanderlei, Simon Archer, Jeff McAffer and
others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Toast is an Equinox/OSGi system developed for the book
* Eclipse, Equinox and OSGi -
* Creating Highly Modular Java Applications
* See http://equinoxosgi.org
*
* Contributors:
* Paul Vanderlei, Simon Archer and Jeff McAffer - initial API and
implementation

************************************************************ *******************/
package org.eclipse.equinox.internal.autostart;

import org.osgi.framework.*;

public class Autostarter implements BundleActivator, BundleListener {

public void start(BundleContext context) throws Exception {
context.addBundleListener(this);
Bundle[] bundles = context.getBundles();
for (int i = 0; i < bundles.length; i++)
start(bundles[i]);
}

private void start(Bundle bundle) {
boolean isFragment = bundle.getHeaders().get(Constants.FRAGMENT_HOST)
!= null;
if (!isFragment && bundle.getState() == Bundle.RESOLVED)
try {
bundle.start();
} catch (BundleException e) {
// TODO do nothing for now
}
}

public void stop(BundleContext context) throws Exception {
context.removeBundleListener(this);
}

public void bundleChanged(BundleEvent event) {
if (event.getType() == BundleEvent.RESOLVED)
start(event.getBundle());
}
}


Re: default autostart [message #125528 is a reply to message #125457] Wed, 04 February 2009 06:46 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
Thanks for the hints! Of course osgi.bundles.defaultAutoStart would be
more convenient ;-)
Previous Topic:Unwanted Contributions
Next Topic:Overriding IExtensionRegistry / IExtensionPoint / IExtension
Goto Forum:
  


Current Time: Mon Dec 09 01:02:30 GMT 2024

Powered by FUDForum. Page generated in 0.03088 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top