public MapEntries()

in src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java [115:153]


    public MapEntries(
            final MapConfigurationProvider factory,
            final BundleContext bundleContext,
            final EventAdmin eventAdmin,
            final StringInterpolationProvider stringInterpolationProvider,
            final Optional<ResourceResolverMetrics> metrics)
            throws LoginException, IOException {

        this.resolver = factory.getServiceResourceResolver(factory.getServiceUserAuthenticationInfo("mapping"));
        this.factory = factory;
        this.eventAdmin = eventAdmin;

        this.resolveMapsMap = new ConcurrentHashMap<>(Map.of(GLOBAL_LIST_KEY, List.of()));
        this.mapMaps = Collections.emptyList();
        this.stringInterpolationProvider = stringInterpolationProvider;

        this.ah = new AliasHandler(this.factory, this.initializing, this::doUpdateConfiguration, this::sendChangeEvent);
        this.ah.initializeAliases();

        this.registration = registerResourceChangeListener(bundleContext);

        this.vph = new VanityPathHandler(this.factory, this.resolveMapsMap, this.initializing, this::drainQueue);
        this.vph.initializeVanityPaths();

        if (metrics.isPresent()) {
            // aliases
            metrics.get().setNumberOfDetectedConflictingAliasesSupplier(ah.detectedConflictingAliases::get);
            metrics.get().setNumberOfDetectedInvalidAliasesSupplier(ah.detectedInvalidAliases::get);
            metrics.get().setNumberOfResourcesWithAliasedChildrenSupplier(() -> (long) ah.aliasMapsMap.size());
            metrics.get().setNumberOfResourcesWithAliasesOnStartupSupplier(ah.aliasResourcesOnStartup::get);

            // vanity paths
            metrics.get().setNumberOfResourcesWithVanityPathsOnStartupSupplier(vph.vanityResourcesOnStartup::get);
            metrics.get().setNumberOfVanityPathBloomFalsePositivesSupplier(vph.vanityPathBloomFalsePositives::get);
            metrics.get().setNumberOfVanityPathBloomNegativesSupplier(vph.vanityPathBloomNegatives::get);
            metrics.get().setNumberOfVanityPathLookupsSupplier(vph.vanityPathLookups::get);
            metrics.get().setNumberOfVanityPathsSupplier(vph.vanityCounter::get);
        }
    }