/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.vfs2.provider;

import java.util.Collection;

import org.apache.commons.vfs2.Capability;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemConfigBuilder;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemOptions;

A file provider. Each file provider is responsible for handling files for a particular URI scheme.

A file provider may also implement VfsComponent.

/** * A file provider. Each file provider is responsible for handling files for a particular URI scheme. * <p> * A file provider may also implement {@link VfsComponent}. * </p> */
public interface FileProvider {
Locates a file object, by absolute URI.
Params:
  • baseFile – The base file to use for resolving the individual parts of a compound URI.
  • uri – The absolute URI of the file to find.
  • fileSystemOptions – The FileSystemOptions
Throws:
Returns:The FileObject.
/** * Locates a file object, by absolute URI. * * @param baseFile The base file to use for resolving the individual parts of a compound URI. * @param uri The absolute URI of the file to find. * @param fileSystemOptions The FileSystemOptions * @return The FileObject. * @throws FileSystemException if an error occurs locating the file. */
FileObject findFile(final FileObject baseFile, final String uri, final FileSystemOptions fileSystemOptions) throws FileSystemException;
Creates a layered file system.
Params:
  • scheme – The URI scheme for the layered file system.
  • file – The file to build the file system on.
  • fileSystemOptions – The FileSystemOptions.
Throws:
Returns:A FileObject in the file system.
/** * Creates a layered file system. * * @param scheme The URI scheme for the layered file system. * @param file The file to build the file system on. * @param fileSystemOptions The FileSystemOptions. * @return A FileObject in the file system. * @throws FileSystemException if an error occurs. */
FileObject createFileSystem(String scheme, FileObject file, FileSystemOptions fileSystemOptions) throws FileSystemException;
Gets the configbuilder useable to collect the needed fileSystemOptions.
Returns:a FileSystemConfigBuilder for the particular file system.
/** * Gets the configbuilder useable to collect the needed fileSystemOptions. * * @return a FileSystemConfigBuilder for the particular file system. */
FileSystemConfigBuilder getConfigBuilder();
Gets the file system capabilities.

These are the same as on the file system, but available before the first file system was instanciated.

Returns:a Collection of the file systems Capabilities.
/** * Gets the file system capabilities. * <p> * These are the same as on the file system, but available before the first file system was instanciated. * </p> * * @return a Collection of the file systems Capabilities. */
Collection<Capability> getCapabilities();
Parses the URI into a FileName.
Params:
  • root – The base FileName.
  • uri – The file to be accessed.
Throws:
Returns:A FileName representing the target file.
/** * Parses the URI into a FileName. * * @param root The base FileName. * @param uri The file to be accessed. * @return A FileName representing the target file. * @throws FileSystemException if an error occurs. */
FileName parseUri(FileName root, String uri) throws FileSystemException; }