public static String getSystemPackages() {
        File cache;
        try {
            cache = Files.createTempDirectory("felix-cache").toAbsolutePath().toFile();
        } catch (IOException e) {
            throw new RuntimeException("Could not create temp bundle-cache.", e);
        }
        Framework framework = new Felix(felixCacheParams(cache.getAbsolutePath()));
        try {
            framework.init();
            framework.start();
            return framework.getHeaders().get(Constants.EXPORT_PACKAGE);
        } catch (BundleException e) {
            throw new RuntimeException("Failed retrieving exported system packages. ", e);
        } finally {
            try {
                framework.stop();
                framework.waitForStop(10000);
            } catch (BundleException | InterruptedException e) {
                log.warning("Failed to stop Felix framework:\n" + Exceptions.toMessageString(e));
            }
            if (! IOUtils.recursiveDeleteDir(cache)) {
                log.warning("Failed to delete temp dir, must be deleted manually: " + cache.getAbsolutePath());
            }
        }
    }
@author Simon Thoresen Hult
@author gjoranv
jdisc_core/src/main/java/com/yahoo/jdisc/core/ExportPackages.java