public FileSystem newFileSystem()

in src/main/java/org/apache/sling/commons/jcr/file/internal/JcrFileSystemProvider.java [88:125]


    public FileSystem newFileSystem(final URI uri, final Map<String, ?> env) throws IOException {
        logger.info("new file system: {}, {}", uri, env);

        if (!getScheme().equalsIgnoreCase(uri.getScheme())) {
            throw new IllegalArgumentException("URI scheme is not " + getScheme());
        }

        if (env == null) {
            throw new IllegalArgumentException("env is null");
        }

        if (!env.containsKey(Session.class.getName())) {
            throw new IllegalArgumentException("no session in env");
        }

        final Object object = env.get(Session.class.getName());
        if (object == null) {
            throw new IllegalArgumentException("session in env is null");
        }

        if (!(object instanceof Session)) {
            throw new IllegalArgumentException("session in env is not a " + Session.class.getName());
        }

        final Session session = (Session) object;
        if (!session.isLive()) {
            throw new IllegalArgumentException("session in env is not live");
        }

        synchronized (lock) {
            if (isInCache(session)) {
                throw new IllegalArgumentException("session is already in use");
            }
            final JcrFileSystem fileSystem = new JcrFileSystem(this, uri, session);
            putIntoCache(fileSystem);
            return fileSystem;
        }
    }