Java Code Examples for org.osgi.framework.startlevel.FrameworkStartLevel#getInitialBundleStartLevel()

The following examples show how to use org.osgi.framework.startlevel.FrameworkStartLevel#getInitialBundleStartLevel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void start ( final BundleContext bundleContext ) throws Exception
{
    this.context = bundleContext;

    final ServiceReference<FrameworkStartLevel> frameworkStartLevel = this.context.getServiceReference ( FrameworkStartLevel.class );
    if ( frameworkStartLevel != null )
    {
        final FrameworkStartLevel service = this.context.getService ( frameworkStartLevel );
        if ( service != null )
        {
            try
            {
                this.defaultStartLevel = service.getInitialBundleStartLevel ();
            }
            finally
            {
                this.context.ungetService ( frameworkStartLevel );
            }
        }
    }

    loadStartLevels ();

    for ( final Map.Entry<String, Integer> entry : this.bundleStartList.entrySet () )
    {
        setStartLevel ( entry.getKey (), entry.getValue () );
    }
}
 
Example 2
Source File: Config.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Ask the start level service for the default start level of bundles
 *
 * @return the initial start level.
 */
private int getFrameworkInitialStartLevel()
{
  int startLevel;
  //
  final FrameworkStartLevel fsl =
    Activator.bc.getBundle(0).adapt(FrameworkStartLevel.class);
  if (null != fsl) {
    startLevel = fsl.getInitialBundleStartLevel();
  } else {
    startLevel = 1; // Fallback to the default initial bundle start level
  }
  return startLevel;
}
 
Example 3
Source File: Config.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Ask the start level service for the default start level of bundles
 *
 * @return the initial start level.
 */
private int getFrameworkInitialStartLevel()
{
  int startLevel;
  //
  final FrameworkStartLevel fsl =
    Activator.bc.getBundle(0).adapt(FrameworkStartLevel.class);
  if (null != fsl) {
    startLevel = fsl.getInitialBundleStartLevel();
  } else {
    startLevel = 1; // Fallback to the default initial bundle start level
  }
  return startLevel;
}
 
Example 4
Source File: StartLevelImpl.java    From concierge with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public int getInitialBundleStartLevel() {
	FrameworkStartLevel fsl = getFrameworkStartLevel0();
	return fsl.getInitialBundleStartLevel();
}
 
Example 5
Source File: FrameworkStartLevelPojo.java    From concierge with Eclipse Public License 1.0 4 votes vote down vote up
public FrameworkStartLevelPojo(final FrameworkStartLevel fsl) {
	this.startLevel = fsl.getStartLevel();
	this.initialBundleStartLevel = fsl.getInitialBundleStartLevel();
}