001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.vfs2.provider; 018 019import java.util.Collection; 020 021import org.apache.commons.vfs2.Capability; 022import org.apache.commons.vfs2.FileName; 023import org.apache.commons.vfs2.FileObject; 024import org.apache.commons.vfs2.FileSystemConfigBuilder; 025import org.apache.commons.vfs2.FileSystemException; 026import org.apache.commons.vfs2.FileSystemOptions; 027 028/** 029 * A file provider. Each file provider is responsible for handling files for a particular URI scheme. 030 * <p> 031 * A file provider may also implement {@link VfsComponent}. 032 * </p> 033 */ 034public interface FileProvider { 035 036 /** 037 * Creates a layered file system. 038 * 039 * @param scheme The URI scheme for the layered file system. 040 * @param file The file to build the file system on. 041 * @param fileSystemOptions The FileSystemOptions. 042 * @return A FileObject in the file system. 043 * @throws FileSystemException if an error occurs. 044 */ 045 FileObject createFileSystem(String scheme, FileObject file, FileSystemOptions fileSystemOptions) throws FileSystemException; 046 047 /** 048 * Locates a file object, by absolute URI. 049 * 050 * @param baseFile The base file to use for resolving the individual parts of a compound URI. 051 * @param uri The absolute URI of the file to find. 052 * @param fileSystemOptions The FileSystemOptions 053 * @return The FileObject. 054 * @throws FileSystemException if an error occurs locating the file. 055 */ 056 FileObject findFile(FileObject baseFile, String uri, FileSystemOptions fileSystemOptions) throws FileSystemException; 057 058 /** 059 * Gets the file system capabilities. 060 * <p> 061 * These are the same as on the file system, but available before the first file system was instantiated. 062 * </p> 063 * 064 * @return a Collection of the file systems Capabilities. 065 */ 066 Collection<Capability> getCapabilities(); 067 068 /** 069 * Gets the configbuilder usable to collect the needed fileSystemOptions. 070 * 071 * @return a FileSystemConfigBuilder for the particular file system. 072 */ 073 FileSystemConfigBuilder getConfigBuilder(); 074 075 /** 076 * Parses the URI into a FileName. 077 * 078 * @param root The base FileName. 079 * @param uri The file to be accessed. 080 * @return A FileName representing the target file. 081 * @throws FileSystemException if an error occurs. 082 */ 083 FileName parseUri(FileName root, String uri) throws FileSystemException; 084}