1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.commons.vfs2.provider; 18 19 import java.util.Collection; 20 21 import org.apache.commons.vfs2.Capability; 22 import org.apache.commons.vfs2.FileName; 23 import org.apache.commons.vfs2.FileObject; 24 import org.apache.commons.vfs2.FileSystemConfigBuilder; 25 import org.apache.commons.vfs2.FileSystemException; 26 import org.apache.commons.vfs2.FileSystemOptions; 27 28 /** 29 * A file provider. Each file provider is responsible for handling files for a particular URI scheme. 30 * <p> 31 * A file provider may also implement {@link VfsComponent}. 32 * </p> 33 */ 34 public interface FileProvider { 35 36 /** 37 * Locates a file object, by absolute URI. 38 * 39 * @param baseFile The base file to use for resolving the individual parts of a compound URI. 40 * @param uri The absolute URI of the file to find. 41 * @param fileSystemOptions The FileSystemOptions 42 * @return The FileObject. 43 * @throws FileSystemException if an error occurs locating the file. 44 */ 45 FileObjectect.html#FileObject">FileObject findFile(final FileObject baseFile, final String uri, final FileSystemOptions fileSystemOptions) 46 throws FileSystemException; 47 48 /** 49 * Creates a layered file system. 50 * 51 * @param scheme The URI scheme for the layered file system. 52 * @param file The file to build the file system on. 53 * @param fileSystemOptions The FileSystemOptions. 54 * @return A FileObject in the file system. 55 * @throws FileSystemException if an error occurs. 56 */ 57 FileObjectcommons/vfs2/FileObject.html#FileObject">FileObject createFileSystem(String scheme, FileObject file, FileSystemOptions fileSystemOptions) 58 throws FileSystemException; 59 60 /** 61 * Gets the configbuilder useable to collect the needed fileSystemOptions. 62 * 63 * @return a FileSystemConfigBuilder for the particular file system. 64 */ 65 FileSystemConfigBuilder getConfigBuilder(); 66 67 /** 68 * Gets the file system capabilities. 69 * <p> 70 * These are the same as on the file system, but available before the first file system was instanciated. 71 * </p> 72 * 73 * @return a Collection of the file systems Capabilities. 74 */ 75 Collection<Capability> getCapabilities(); 76 77 /** 78 * Parses the URI into a FileName. 79 * 80 * @param root The base FileName. 81 * @param uri The file to be accessed. 82 * @return A FileName representing the target file. 83 * @throws FileSystemException if an error occurs. 84 */ 85 FileName./../../../../org/apache/commons/vfs2/FileName.html#FileName">FileName parseUri(FileName root, String uri) throws FileSystemException; 86 }