public Object addingBundle()

in src/main/java/org/apache/sling/graphql/schema/aggregator/impl/ProviderBundleTracker.java [70:95]


    public Object addingBundle(Bundle bundle, BundleEvent event) {
        BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
        Bundle us = bundleContext.getBundle();
        if (bundleWiring.getRequiredWires(ExtenderNamespace.EXTENDER_NAMESPACE).stream().map(BundleWire::getProvider)
                .map(BundleRevision::getBundle).anyMatch(us::equals)) {
            final String providersPath = bundle.getHeaders().get(SCHEMA_PATH_HEADER);
            if (providersPath == null) {
                log.debug("Bundle {} has no {} header, ignored", bundle.getSymbolicName(), SCHEMA_PATH_HEADER);
            } else {
                // For now we only support file entries which are directly under providersPath
                final Enumeration<String> paths = bundle.getEntryPaths(providersPath);
                if (paths != null) {
                    while (paths.hasMoreElements()) {
                        final String path = paths.nextElement();
                        try {
                            addIfNotPresent(BundleEntryPartial.forBundle(bundle, path));
                        } catch (IOException ioe) {
                            // TODO save errors and refuse to work if any happended?
                            log.error("Error reading partial " + path, ioe);
                        }
                    }
                }
            }
        }
        return bundle;
    }