private void buildEquinoxConfiguration()

in plugins/org.apache.karaf.eik.ui/src/main/java/org/apache/karaf/eik/ui/KarafLaunchConfigurationDelegate.java [337:408]


    private void buildEquinoxConfiguration(final ILaunchConfiguration configuration) throws CoreException {

        final IPath rootDirectory = workingKarafPlatform.getRootDirectory();

        // Load config.ini
        final Properties equinoxProperties =
            KarafCorePluginUtils.loadProperties(rootDirectory.toFile(), ECLIPSE_CONFIG_INI_FILE);

        final List<KarafWorkbenchServiceFactory> list =
            WorkbenchServiceExtensions.getLaunchCustomizerFactories();

        for (final KarafWorkbenchServiceFactory f : list) {
            final Map<String, String> m =
                f.getWorkbenchService().getAdditionalEquinoxConfiguration(workingKarafPlatform, configuration);

            equinoxProperties.putAll(m);
        }

        final String currentBundles =
            (String) equinoxProperties.get(OSGI_BUNDLES_KEY);

        final String allBundles = mergeDeployedBundles(currentBundles, configuration);

        equinoxProperties.put(OSGI_BUNDLES_KEY, allBundles);

        /*
         * Set the following OSGi / Equinox properties:
         */
        if (!equinoxProperties.containsKey(OSGI_START_LEVEL_KEY)) {
	        final Integer defaultStartLevel =
	            configuration.getAttribute(
	                    IPDELauncherConstants.DEFAULT_START_LEVEL,
	                    new Integer(IKarafConstants.KARAF_DEFAULT_BUNDLE_START_LEVEL));

	        equinoxProperties.put(OSGI_START_LEVEL_KEY, defaultStartLevel.toString());
        }

        /*
         * Set the osgi.install.area to the runtime plugins directory or the
         * directory containing Equinox?
         *
         * "/org/eclipse/osgi/3.5.0.v20090429-1630"
         */
        final IPath frameworkPath =
            new Path(karafPlatform.getState().getBundle(SystemBundleNames.EQUINOX.toString(), null).getLocation());
        equinoxProperties.put(OSGI_INSTALL_AREA_KEY, frameworkPath.removeLastSegments(1).toString());

        final String javaSpecificationVersion = getJavaRuntimeSpecificationVersion(configuration);
        equinoxProperties.put(JAVA_SPECIFICATION_VERSION, javaSpecificationVersion);

        /*
         * This is very important as it allows the boot classpath entries to
         * present their classes to the framework. Without it NoClassDefFound
         * shows up for classes like org.apache.karaf.jaas.boot.ProxyLoginModule
         */
        equinoxProperties.put(OSGI_FRAMEWORK_PARENT_CLASSLOADER_KEY, OSGI_FRAMEWORK_PARENT_CLASSLOADER_APP);
        equinoxProperties.put(OSGI_CONTEXT_CLASSLOADER_PARENT_KEY, OSGI_FRAMEWORK_PARENT_CLASSLOADER_APP);
        equinoxProperties.put(OSGI_PARENT_CLASSLOADER_KEY, OSGI_FRAMEWORK_PARENT_CLASSLOADER_APP);

        /*
         * Eclipse 3.7 (Indigo) has a bug that does not ignore the empty
         * org.osgi.framework.system.packages.extra property
         */
        final String extraSystemPackages = (String) equinoxProperties.get(OSGI_EXTRA_SYSTEM_PACKAGES_KEY);
        if (extraSystemPackages != null && extraSystemPackages.trim().isEmpty()) {
            equinoxProperties.remove(OSGI_EXTRA_SYSTEM_PACKAGES_KEY);
        }

        PropertyUtils.interpolateVariables(equinoxProperties, equinoxProperties);

        KarafCorePluginUtils.save(new File(getConfigDir(configuration), ECLIPSE_CONFIG_INI_FILE), equinoxProperties);
    }