View Javadoc

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.vfs.provider;
18  
19  import org.apache.commons.vfs.FileName;
20  import org.apache.commons.vfs.FileObject;
21  import org.apache.commons.vfs.FileSystemConfigBuilder;
22  import org.apache.commons.vfs.FileSystemException;
23  import org.apache.commons.vfs.FileSystemOptions;
24  
25  import java.util.Collection;
26  
27  
28  /***
29   * A file provider.  Each file provider is responsible for handling files for
30   * a particular URI scheme.
31   * <p/>
32   * <p>A file provider may also implement {@link VfsComponent}.
33   *
34   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
35   * @version $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Mi, 29 Nov 2006) $
36   */
37  public interface FileProvider
38  {
39      /***
40       * Locates a file object, by absolute URI.
41       *
42       * @param baseFile          The base file to use for resolving the individual parts of
43       *                          a compound URI.
44       * @param uri               The absolute URI of the file to find.
45       * @param fileSystemOptions
46       */
47      FileObject findFile(final FileObject baseFile, final String uri, final FileSystemOptions fileSystemOptions)
48          throws FileSystemException;
49  
50      /***
51       * Creates a layered file system.
52       *
53       * @param scheme            The URI scheme for the layered file system.
54       * @param file              The file to build the file system on.
55       * @param fileSystemOptions
56       */
57      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      public FileSystemConfigBuilder getConfigBuilder();
64  
65      /***
66       * Get the filesystem capabilities.<br>
67       * These are the same as on the filesystem, but available before the first filesystem was
68       * instanciated.
69       */
70      public Collection getCapabilities();
71  
72      public FileName parseUri(FileName root, String uri) throws FileSystemException;
73  }