Java Code Examples for org.osgi.framework.startlevel.BundleStartLevel#setStartLevel()

The following examples show how to use org.osgi.framework.startlevel.BundleStartLevel#setStartLevel() . 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 6 votes vote down vote up
private void setStartLevel ( final String symbolicName, final int startLevel ) throws BundleException
{
    final Bundle bundle = findBundle ( symbolicName );
    if ( bundle == null )
    {
        return;
    }
    final BundleStartLevel bundleStartLevel = bundle.adapt ( BundleStartLevel.class );
    if ( bundleStartLevel == null )
    {
        return;
    }

    bundleStartLevel.setStartLevel ( startLevel < 0 ? this.defaultStartLevel : startLevel );
    bundle.start ();
}
 
Example 2
Source File: BundleStartLevelResource.java    From concierge with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Representation put(final Representation value,
		final Variant variant) {
	try {
		final Bundle bundle = getBundleFromKeys(RestService.BUNDLE_ID_KEY);
		if (bundle == null) {
			return ERROR(Status.CLIENT_ERROR_NOT_FOUND);
		}
		final BundleStartLevelPojo sl = fromRepresentation(value, value.getMediaType());
		final BundleStartLevel bsl = bundle.adapt(BundleStartLevel.class);
		bsl.setStartLevel(sl.getStartLevel());

		return getRepresentation(new BundleStartLevelPojo(bsl), variant);
	} catch (final Exception e) {
		return ERROR(e, variant);
	}
}
 
Example 3
Source File: FrameworkNodeImpl.java    From concierge with Eclipse Public License 1.0 5 votes vote down vote up
public void setBundleStartLevel(long id, int startLevel) {
	Bundle b = context.getBundle(id);
	if(b == null)
		return;
	
	BundleStartLevel bsl = b.adapt(BundleStartLevel.class);
	bsl.setStartLevel(startLevel);
}
 
Example 4
Source File: StartLevelImpl.java    From concierge with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setBundleStartLevel(Bundle bundle, int startlevel) {
	BundleStartLevel bsl = getBundleStartLevel0(bundle);
	bsl.setStartLevel(startlevel);
}