private void writeConfigProperties()

in plugins/org.apache.karaf.eik.felix/src/main/java/org/apache/karaf/eik/felix/FelixLaunchConfiguration.java [356:422]


    private void writeConfigProperties(ILaunchConfiguration configuration) throws CoreException {
        final File f = new File(getConfigDir(configuration), FELIX_CONFIG_PROPERTIES_FILE);

        final boolean defaultAutostart = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, DEFAULT_AUTOSTART);
        final int defaultStart = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, DEFAULT_START_LEVEL);

        final Properties properties = new Properties();

        properties.put("osgi.bundles.defaultStartLevel", Integer.toString(defaultStart)); //$NON-NLS-1$
        properties.put("org.osgi.framework.startlevel.beginning", Integer.toString(defaultStart)); //$NON-NLS-1$

        final Map<String, List<String>> startEntries = new HashMap<String, List<String>>();
        final Map<String, List<String>> installEntries = new HashMap<String, List<String>>();

        for (IPluginModelBase model : fModels.keySet()) {
            final String startString = fModels.get(model);

            final int colonPos = startString.indexOf(":");

            Integer startLevel;
            String s = startString.substring(0, colonPos);
            if ("default".equals(s)) {
                startLevel = defaultStart;
            } else {
                startLevel = new Integer(s);
            }

            boolean autostart;
            s = startString.substring(colonPos + 1);
            if ("default".equals(s)) {
                autostart = defaultAutostart;
            } else {
                autostart = new Boolean(s);
            }

            List<String> entries;
            if (autostart) {
                entries = startEntries.get(FELIX_AUTO_START_PREFIX + startLevel.toString());
                if (entries == null) {
                    entries = new ArrayList<String>();
                    startEntries.put(FELIX_AUTO_START_PREFIX + startLevel.toString(), entries);
                }
            } else {
                entries = startEntries.get(FELIX_AUTO_INSTALL_PREFIX + startLevel.toString());
                if (entries == null) {
                    entries = new ArrayList<String>();
                    installEntries.put(FELIX_AUTO_INSTALL_PREFIX + startLevel.toString(), entries);
                }
            }

            try {
                final File bundle = new File(model.getBundleDescription().getLocation());
                entries.add(bundle.toURI().toURL().toString());
            } catch (MalformedURLException e) {
            }
        }

        for (Map.Entry<String, List<String>> e : startEntries.entrySet()) {
            properties.put(e.getKey(), join(e.getValue(), " "));
        }

        for (Map.Entry<String, List<String>> e : installEntries.entrySet()) {
            properties.put(e.getKey(), join(e.getValue(), " "));
        }

        writeProperties(f.getAbsolutePath(), properties);
    }