protected final Repository getRepository()

in src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java [301:326]


    protected final Repository getRepository() {
        ServiceReference<RepositoryMount> ref = mountTracker != null ? mountTracker.getServiceReference() : null;

        Repository mountRepo = (ref != null ? mountTracker.getService(ref) : null);
        Object mounts = ref != null ? ref.getProperty(RepositoryMount.MOUNT_POINTS_KEY) : null;
        Set<String> mountPoints = new HashSet<>();

        if (mounts != null) {
            if (mounts instanceof String[]) {
                for (String mount : ((String[]) mounts)) {
                    mountPoints.add(mount);
                }
            }
            else {
                mountPoints.add(mounts.toString());
            }
        }
        else {
            mountPoints.add("/content/jcrmount");
        }
        return mountRepo != null ?
            repository instanceof JackrabbitRepository ?
                new ProxyJackrabbitRepository((JackrabbitRepository) repository, (JackrabbitRepository) mountRepo, mountPoints) :
                new ProxyRepository<>(repository, mountRepo, mountPoints) :
            repository;
    }