This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
The following commit(s) were added to refs/heads/master by this push: new 1b0b0cc Sort methods. 1b0b0cc is described below commit 1b0b0ccf7b39511e5bbf2026d0c8d1f80724be56 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Tue May 7 13:30:09 2019 -0400 Sort methods. --- .../org/apache/commons/vfs2/FileSystemManager.java | 288 ++++++++++----------- 1 file changed, 144 insertions(+), 144 deletions(-) diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java index 8662cd1..1eba57d 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java @@ -51,102 +51,37 @@ import org.apache.commons.vfs2.operations.FileOperationProvider; */ public interface FileSystemManager { + // -- OPERATIONS -- /** - * Returns the base file used to resolve relative paths. - * - * @return The base FileObject. - * @throws FileSystemException if an error occurs. - */ - FileObject getBaseFile() throws FileSystemException; - - /** - * Locates a file by name. Equivalent to calling {@code resolveFile(getBaseFile(), name)}. - * - * @param name The name of the file. - * @return The file. Never returns null. - * @throws FileSystemException On error parsing the file name. - */ - FileObject resolveFile(String name) throws FileSystemException; - - /** - * Locates a file by name. Equivalent to calling {@code resolveFile(getBaseFile(), name)}. - * - * @param name The name of the file. - * @param fileSystemOptions The FileSystemOptions used for FileSystem creation. All files that are later resolved - * relative to the returned {@code FileObject} share the options. - * @return The file. Never returns null. - * @throws FileSystemException On error parsing the file name. - */ - FileObject resolveFile(String name, FileSystemOptions fileSystemOptions) throws FileSystemException; - - /** - * Locates a file by name. The name is resolved as described <a href="#naming">above</a>. That is, the name can be - * either an absolute URI, an absolute file name, or a relative path to be resolved against {@code baseFile}. + * Adds the specified FileOperationProvider for the specified scheme. * <p> - * Note that the file does not have to exist when this method is called. + * Several FileOperationProvider's might be registered for the same scheme. For example, for {@code "file"} scheme + * we can register {@code SvnWsOperationProvider} and {@code CvsOperationProvider.} * </p> * - * @param baseFile The base file to use to resolve relative paths. May be null if the name is an absolute file name. - * @param name The name of the file. - * @return The file. Never returns null. - * @throws FileSystemException On error parsing the file name. - */ - FileObject resolveFile(FileObject baseFile, String name) throws FileSystemException; - - /** - * Locates a file by name. See {@link #resolveFile(FileObject, String)} for details. - * - * @param baseFile The base file to use to resolve relative paths. Must not be {@code null}, not even if the - * <i>name</i> is absolute. - * @param name The name of the file. - * @return The file. Never returns null. - * @throws FileSystemException On error parsing the file name. - */ - FileObject resolveFile(File baseFile, String name) throws FileSystemException; - - /** - * Resolves a name, relative to this file name. Equivalent to calling - * {@code resolveName( path, NameScope.FILE_SYSTEM )}. - * - * @param root the base filename - * @param name The name to resolve. - * @return A {@link FileName} object representing the resolved file name. - * @throws FileSystemException If the name is invalid. - */ - FileName resolveName(FileName root, String name) throws FileSystemException; - - /** - * Resolves a name, relative to the "root" file name. Refer to {@link NameScope} for a description of how names are - * resolved. - * - * @param root the base filename - * @param name The name to resolve. - * @param scope The {@link NameScope} to use when resolving the name. - * @return A {@link FileName} object representing the resolved file name. - * @throws FileSystemException If the name is invalid. + * @param scheme The scheme assoicated with this provider. + * @param operationProvider The FileOperationProvider to add. + * @throws FileSystemException if an error occurs. */ - FileName resolveName(FileName root, String name, NameScope scope) throws FileSystemException; + void addOperationProvider(String scheme, FileOperationProvider operationProvider) throws FileSystemException; /** - * Converts a local file into a {@link FileObject}. + * @see FileSystemManager#addOperationProvider(String, org.apache.commons.vfs2.operations.FileOperationProvider) * - * @param file The file to convert. - * @return The {@link FileObject} that represents the local file. Never returns null. - * @throws FileSystemException On error converting the file. + * @param schemes The schemes that will be associated with the provider. + * @param operationProvider The FileOperationProvider to add. + * @throws FileSystemException if an error occurs. */ - FileObject toFileObject(File file) throws FileSystemException; + void addOperationProvider(String[] schemes, FileOperationProvider operationProvider) throws FileSystemException; /** - * Creates a layered file system. A layered file system is a file system that is created from the contents of a - * file, such as a zip or tar file. + * Determines if a layered file system can be created for a given file. * - * @param provider The name of the file system provider to use. This name is the same as the scheme used in URI to - * identify the provider. - * @param file The file to use to create the file system. - * @return The root file of the new file system. - * @throws FileSystemException On error creating the file system. + * @param file The file to check for. + * @return true if the FileSystem can be created. + * @throws FileSystemException if an error occurs. */ - FileObject createFileSystem(String provider, FileObject file) throws FileSystemException; + boolean canCreateFileSystem(FileObject file) throws FileSystemException; /** * Closes the given filesystem. @@ -169,13 +104,16 @@ public interface FileSystemManager { FileObject createFileSystem(FileObject file) throws FileSystemException; /** - * Creates an empty virtual file system. Can be populated by adding junctions to it. + * Creates a layered file system. A layered file system is a file system that is created from the contents of a + * file, such as a zip or tar file. * - * @param rootUri The root URI to use for the new file system. Can be null. + * @param provider The name of the file system provider to use. This name is the same as the scheme used in URI to + * identify the provider. + * @param file The file to use to create the file system. * @return The root file of the new file system. - * @throws FileSystemException if an error occurs creating the VirtualFileSystem. + * @throws FileSystemException On error creating the file system. */ - FileObject createVirtualFileSystem(String rootUri) throws FileSystemException; + FileObject createFileSystem(String provider, FileObject file) throws FileSystemException; /** * Creates a virtual file system. The file system will contain a junction at the fs root to the supplied root file. @@ -187,34 +125,35 @@ public interface FileSystemManager { FileObject createVirtualFileSystem(FileObject rootFile) throws FileSystemException; /** - * Returns a stream handler factory to enable URL lookup using this FileSystemManager. + * Creates an empty virtual file system. Can be populated by adding junctions to it. * - * @return the URLStreamHandlerFactory. + * @param rootUri The root URI to use for the new file system. Can be null. + * @return The root file of the new file system. + * @throws FileSystemException if an error occurs creating the VirtualFileSystem. */ - URLStreamHandlerFactory getURLStreamHandlerFactory(); + FileObject createVirtualFileSystem(String rootUri) throws FileSystemException; /** - * Determines if a layered file system can be created for a given file. + * Returns the base file used to resolve relative paths. * - * @param file The file to check for. - * @return true if the FileSystem can be created. + * @return The base FileObject. * @throws FileSystemException if an error occurs. */ - boolean canCreateFileSystem(FileObject file) throws FileSystemException; + FileObject getBaseFile() throws FileSystemException; /** - * Gets the cache used to cache file objects. + * Gets the cache strategy used. * - * @return The FilesCache. + * @return the CacheStrategy. */ - FilesCache getFilesCache(); + CacheStrategy getCacheStrategy(); /** - * Gets the cache strategy used. + * Gets the class to use to determine the content-type (mime-type). * - * @return the CacheStrategy. + * @return the FileContentInfoFactory. */ - CacheStrategy getCacheStrategy(); + FileContentInfoFactory getFileContentInfoFactory(); /** * Gets the file object decorator used. @@ -231,26 +170,32 @@ public interface FileSystemManager { Constructor<?> getFileObjectDecoratorConst(); /** - * Gets the class to use to determine the content-type (mime-type). + * Gets the cache used to cache file objects. * - * @return the FileContentInfoFactory. + * @return The FilesCache. */ - FileContentInfoFactory getFileContentInfoFactory(); + FilesCache getFilesCache(); /** - * Returns true if this manager has a provider for a particular scheme. + * Get the configuration builder for the given scheme. * - * @param scheme The scheme for which a provider should be checked. - * @return true if a provider for the scheme is available. + * @param scheme The schem to use to obtain the FileSystemConfigBuidler. + * @return A FileSystemConfigBuilder appropriate for the given scheme. + * @throws FileSystemException if the given scheme is not konwn. */ - boolean hasProvider(String scheme); + FileSystemConfigBuilder getFileSystemConfigBuilder(String scheme) throws FileSystemException; /** - * Gets the schemes currently available. + * Gets Providers for file operations. * - * @return An array of available scheme names that are supported. + * @param scheme the scheme for wich we want to get the list af registered providers. + * + * @return the registered FileOperationProviders for the specified scheme. If there were no providers registered for + * the scheme, it returns null. + * + * @throws FileSystemException if an error occurs. */ - String[] getSchemes(); + FileOperationProvider[] getOperationProviders(String scheme) throws FileSystemException; /** * Gets the capabilities for a given scheme. @@ -262,64 +207,71 @@ public interface FileSystemManager { Collection<Capability> getProviderCapabilities(String scheme) throws FileSystemException; /** - * Sets the logger to use. + * Gets the schemes currently available. * - * @param log The logger to use. + * @return An array of available scheme names that are supported. */ - void setLogger(Log log); + String[] getSchemes(); /** - * Get the configuration builder for the given scheme. + * Returns a stream handler factory to enable URL lookup using this FileSystemManager. * - * @param scheme The schem to use to obtain the FileSystemConfigBuidler. - * @return A FileSystemConfigBuilder appropriate for the given scheme. - * @throws FileSystemException if the given scheme is not konwn. + * @return the URLStreamHandlerFactory. */ - FileSystemConfigBuilder getFileSystemConfigBuilder(String scheme) throws FileSystemException; + URLStreamHandlerFactory getURLStreamHandlerFactory(); /** - * Resolves the uri to a filename. + * Returns true if this manager has a provider for a particular scheme. * - * @param uri The uri to resolve. - * @return A FileName that matches the uri. - * @throws FileSystemException if this is not possible. + * @param scheme The scheme for which a provider should be checked. + * @return true if a provider for the scheme is available. */ - FileName resolveURI(String uri) throws FileSystemException; + boolean hasProvider(String scheme); - // -- OPERATIONS -- /** - * Adds the specified FileOperationProvider for the specified scheme. + * Locates a file by name. See {@link #resolveFile(FileObject, String)} for details. + * + * @param baseFile The base file to use to resolve relative paths. Must not be {@code null}, not even if the + * <i>name</i> is absolute. + * @param name The name of the file. + * @return The file. Never returns null. + * @throws FileSystemException On error parsing the file name. + */ + FileObject resolveFile(File baseFile, String name) throws FileSystemException; + + /** + * Locates a file by name. The name is resolved as described <a href="#naming">above</a>. That is, the name can be + * either an absolute URI, an absolute file name, or a relative path to be resolved against {@code baseFile}. * <p> - * Several FileOperationProvider's might be registered for the same scheme. For example, for {@code "file"} scheme - * we can register {@code SvnWsOperationProvider} and {@code CvsOperationProvider.} + * Note that the file does not have to exist when this method is called. * </p> * - * @param scheme The scheme assoicated with this provider. - * @param operationProvider The FileOperationProvider to add. - * @throws FileSystemException if an error occurs. + * @param baseFile The base file to use to resolve relative paths. May be null if the name is an absolute file name. + * @param name The name of the file. + * @return The file. Never returns null. + * @throws FileSystemException On error parsing the file name. */ - void addOperationProvider(String scheme, FileOperationProvider operationProvider) throws FileSystemException; + FileObject resolveFile(FileObject baseFile, String name) throws FileSystemException; /** - * @see FileSystemManager#addOperationProvider(String, org.apache.commons.vfs2.operations.FileOperationProvider) + * Locates a file by name. Equivalent to calling {@code resolveFile(getBaseFile(), name)}. * - * @param schemes The schemes that will be associated with the provider. - * @param operationProvider The FileOperationProvider to add. - * @throws FileSystemException if an error occurs. + * @param name The name of the file. + * @return The file. Never returns null. + * @throws FileSystemException On error parsing the file name. */ - void addOperationProvider(String[] schemes, FileOperationProvider operationProvider) throws FileSystemException; + FileObject resolveFile(String name) throws FileSystemException; /** - * Gets Providers for file operations. - * - * @param scheme the scheme for wich we want to get the list af registered providers. - * - * @return the registered FileOperationProviders for the specified scheme. If there were no providers registered for - * the scheme, it returns null. + * Locates a file by name. Equivalent to calling {@code resolveFile(getBaseFile(), name)}. * - * @throws FileSystemException if an error occurs. + * @param name The name of the file. + * @param fileSystemOptions The FileSystemOptions used for FileSystem creation. All files that are later resolved + * relative to the returned {@code FileObject} share the options. + * @return The file. Never returns null. + * @throws FileSystemException On error parsing the file name. */ - FileOperationProvider[] getOperationProviders(String scheme) throws FileSystemException; + FileObject resolveFile(String name, FileSystemOptions fileSystemOptions) throws FileSystemException; /** * Resolves a URI into a {@link FileObject}. @@ -341,4 +293,52 @@ public interface FileSystemManager { */ FileObject resolveFile(URL url) throws FileSystemException; + /** + * Resolves a name, relative to this file name. Equivalent to calling + * {@code resolveName( path, NameScope.FILE_SYSTEM )}. + * + * @param root the base filename + * @param name The name to resolve. + * @return A {@link FileName} object representing the resolved file name. + * @throws FileSystemException If the name is invalid. + */ + FileName resolveName(FileName root, String name) throws FileSystemException; + + /** + * Resolves a name, relative to the "root" file name. Refer to {@link NameScope} for a description of how names are + * resolved. + * + * @param root the base filename + * @param name The name to resolve. + * @param scope The {@link NameScope} to use when resolving the name. + * @return A {@link FileName} object representing the resolved file name. + * @throws FileSystemException If the name is invalid. + */ + FileName resolveName(FileName root, String name, NameScope scope) throws FileSystemException; + + /** + * Resolves the uri to a filename. + * + * @param uri The uri to resolve. + * @return A FileName that matches the uri. + * @throws FileSystemException if this is not possible. + */ + FileName resolveURI(String uri) throws FileSystemException; + + /** + * Sets the logger to use. + * + * @param log The logger to use. + */ + void setLogger(Log log); + + /** + * Converts a local file into a {@link FileObject}. + * + * @param file The file to convert. + * @return The {@link FileObject} that represents the local file. Never returns null. + * @throws FileSystemException On error converting the file. + */ + FileObject toFileObject(File file) throws FileSystemException; + }