private int getLowestStartLevel()

in src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java [761:786]


    private int getLowestStartLevel(final SortedSet<InstallTask> tasks, final StartLevel startLevel) {
        final int currentStartLevel = startLevel.getStartLevel();
        int startLevelToTarget = currentStartLevel;
        for(final InstallTask task : tasks) {
            if (task instanceof BundleUpdateTask){
                final Bundle b = ((BundleUpdateTask) task).getBundle();
                if (b != null) {
                    try {
                        final int bundleStartLevel = startLevel.getBundleStartLevel(b) - 1;
                        if (bundleStartLevel < startLevelToTarget){
                            startLevelToTarget = bundleStartLevel;
                        }
                    } catch ( final IllegalArgumentException iae) {
                        // ignore - bundle is uninstalled
                    }
                }
            }
        }
        // check installer start level
        final int ownStartLevel = startLevel.getBundleStartLevel(ctx.getBundle());
        if ( ownStartLevel > startLevelToTarget ) {
            // we don't want to disable ourselves
            startLevelToTarget = ownStartLevel;
        }
        return startLevelToTarget;
    }