public static void createConfiguratorBundle()

in src/main/java/org/apache/sling/feature/karaf/ConfigurationUtil.java [49:86]


    public static void createConfiguratorBundle(final OutputStream os,
            final Configurations configurations,
            final String symbolicName,
            final String version,
            final Map<String, String> additionalAttributes)
    throws IOException {

        final Manifest mf = new Manifest();
        mf.getMainAttributes().putValue("Manifest-Version", "1.0");
        mf.getMainAttributes().putValue(Constants.BUNDLE_MANIFESTVERSION, "2");
        mf.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, symbolicName);
        mf.getMainAttributes().putValue(Constants.BUNDLE_VERSION, version);
        mf.getMainAttributes().putValue(Constants.BUNDLE_VENDOR, "The Apache Software Foundation");
        mf.getMainAttributes().putValue(Constants.REQUIRE_CAPABILITY, REQUIRE_CONFIGURATOR_CAPABILITY);

        if ( additionalAttributes != null ) {
            for(final Map.Entry<String, String> entry : additionalAttributes.entrySet()) {
                if ( Constants.REQUIRE_CAPABILITY.equals(entry.getKey())
                    && !entry.getValue().contains("osgi.extender=osgi.configurator")) {
                    mf.getMainAttributes().putValue(entry.getKey(), entry.getValue() + "," + REQUIRE_CONFIGURATOR_CAPABILITY);
                } else {
                    mf.getMainAttributes().putValue(entry.getKey(), entry.getValue());
                }
            }
        }

        final JarOutputStream jos = new JarOutputStream(os, mf);

        final ZipEntry ze = new ZipEntry("OSGI-INF/configurator/configurations.json");
        jos.putNextEntry(ze);
        final Writer w = new OutputStreamWriter(jos, "UTF-8");
        ConfigurationJSONWriter.write(w, configurations);
        w.flush();
        jos.closeEntry();

        jos.flush();
        jos.finish();
    }