protected void activate()

in src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java [195:219]


    protected void activate(final BundleContext context, final Config config) {
        context.addBundleListener(this);

        // register core and default sling mime types
        Bundle bundle = context.getBundle();
        registerMimeType(bundle.getEntry(CORE_MIME_TYPES));
        registerMimeType(bundle.getEntry(MIME_TYPES));

        // register maps of existing bundles
        Bundle[] bundles = context.getBundles();
        for (int i = 0; i < bundles.length; i++) {
            if ((bundles[i].getState() & (Bundle.RESOLVED | Bundle.STARTING
                | Bundle.ACTIVE | Bundle.STOPPING)) != 0
                && bundles[i].getBundleId() != bundle.getBundleId()) {
                this.registerMimeType(bundles[i].getEntry(MIME_TYPES));
            }
        }

        // register configuration properties
        if (config.mime_types() != null) {
            for (final String configType : config.mime_types()) {
                registerMimeType(configType);
            }
        }
    }