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.FileSystemException;
22  import org.apache.commons.vfs.FileSystemManager;
23  import org.apache.commons.vfs.FileSystemOptions;
24  
25  import java.io.File;
26  
27  /***
28   * Allows VFS components to access the services they need, such as the file
29   * replicator.  A VFS component is supplied with a context as part of its
30   * initialisation.
31   *
32   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
33   * @version $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Mi, 29 Nov 2006) $
34   * @see VfsComponent#setContext
35   */
36  public interface VfsComponentContext
37  {
38      /***
39       * Locate a file by name.  See
40       * {@link FileSystemManager#resolveFile(FileObject, String)} for a
41       * description of how this works.
42       */
43      FileObject resolveFile(FileObject baseFile, String name, FileSystemOptions fileSystemOptions)
44          throws FileSystemException;
45  
46      /***
47       * Locate a file by name.  See
48       * {@link FileSystemManager#resolveFile( String)} for a
49       * description of how this works.
50       */
51      FileObject resolveFile(String name, FileSystemOptions fileSystemOptions)
52          throws FileSystemException;
53  
54      FileName parseURI(String uri) throws FileSystemException;
55  
56      /***
57       * Locates a file replicator for the provider to use.
58       */
59      FileReplicator getReplicator() throws FileSystemException;
60  
61      /***
62       * Locates a temporary file store for the provider to use.
63       */
64      TemporaryFileStore getTemporaryFileStore() throws FileSystemException;
65  
66      /***
67       * Returns a {@link FileObject} for a local file.
68       */
69      FileObject toFileObject(File file)
70          throws FileSystemException;
71  
72      /***
73       * Returns the filesystem manager for the current context
74       *
75       * @return the filesystem manager
76       */
77      FileSystemManager getFileSystemManager();
78  }