KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > filesystem > IFileSystem


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.filesystem;
12
13 import java.net.URI JavaDoc;
14 import org.eclipse.core.filesystem.provider.FileSystem;
15 import org.eclipse.core.runtime.*;
16
17 /**
18  * This is the main interface to a single file system. Each file system instance
19  * manages interaction with all files in the backing store represented by a
20  * particular URI scheme.
21  * <p>
22  * File systems are registered using the "filesystems" extension point.
23  * </p>
24  * <p>
25  * This interface is not intended to be implemented by clients. File system
26  * implementations must subclass {@link FileSystem} rather than implementing
27  * this interface directly.
28  * </p>
29  *
30  * @see EFS#getFileSystem(String)
31  * @since org.eclipse.core.filesystem 1.0
32  */

33 public interface IFileSystem extends IAdaptable {
34
35     /**
36      * Returns the file attributes supported by this file system. This value
37      * is a bit mask of the <code>EFS.ATTRIBUTE_*</code> constants.
38      *
39      * @return the file attributes supported by this file system.
40      */

41     public int attributes();
42
43     /**
44      * Returns whether this file system supports deletion
45      *
46      * @return <code>true</code> if this file system allows deletion
47      * of files and directories, and <code>false</code> otherwise
48      */

49     public boolean canDelete();
50
51     /**
52      * Returns whether this file system supports modification.
53      *
54      * @return <code>true</code> if this file system allows modification
55      * of files and directories, and <code>false</code> otherwise
56      */

57     public boolean canWrite();
58
59     /**
60      * Returns a file tree containing information about the complete sub-tree
61      * rooted at the given store. Returns <code>null</code> if this file
62      * system does not support the creation of such file trees.
63      * <p>
64      * A file tree accurately represents the state of a portion of a file system
65      * at the time it is created, but it is never updated. Clients using a file
66      * tree must tolerate the fact that the actual file system contents may
67      * change after the tree is generated.
68      * </p>
69      *
70      * @param root The store to use as the root of the file tree
71      * @param monitor a progress monitor, or <code>null</code> if progress
72      * reporting and cancellation are not desired
73      * @return an {@link IFileTree} containing the sub-tree of the given store,
74      * or <code>null</code>
75      * @exception CoreException if this method fails. Reasons include:
76      * <ul>
77      * <li>Problems occurred while contacting the file system.</li>
78      * </ul>
79      * @see IFileTree
80      */

81     public IFileTree fetchFileTree(IFileStore root, IProgressMonitor monitor) throws CoreException;
82
83     /**
84      * Returns the file store in this file system corresponding to the
85      * given local file. Returns <code>null</code> if this file system
86      * cannot provide an {@link IFileStore} corresponding to a local file.
87      *
88      * @param file The file to be converted
89      * @return The {@link IFileStore} corresponding to the given file, or <code>null</code>
90      * @see IFileStore#toLocalFile(int, IProgressMonitor)
91      */

92     public IFileStore fromLocalFile(java.io.File JavaDoc file);
93
94     /**
95      * Returns the URI scheme of this file system.
96      *
97      * @return the URI scheme of this file system.
98      */

99     public String JavaDoc getScheme();
100
101     /**
102      * Returns a handle to a file store in this file system. This is a handle-only
103      * method; this method succeeds regardless of whether a file exists at that
104      * path in this file system.
105      * <p>
106      * This is a convenience method for file systems that do not make use
107      * of the authority {@link java.net.URI} component, such as a host or user
108      * information. The provided path argument is interpreted as the path component
109      * of the file system's {@link java.net.URI}. For example, this method can
110      * be used to safely navigate within the local file system.
111      * </p>
112      *
113      * @param path A path to a file store within the scheme of this file system.
114      * @return A handle to a file store in this file system
115      * @see EFS#getLocalFileSystem()
116      */

117     public IFileStore getStore(IPath path);
118
119     /**
120      * Returns a handle to a file store in this file system. This is a handle-only
121      * method; this method succeeds regardless of whether a file exists at that
122      * path in this file system. The provided URI must have the appropriate scheme
123      * and component parts for the file system on which this method is called.
124      *
125      * @param uri The URI of the file store to return.
126      * @return A handle to a file store in this file system
127      */

128     public IFileStore getStore(URI JavaDoc uri);
129
130     /**
131      * Returns whether this file system is case sensitive. A case sensitive
132      * file system treats files with names that differ only in case as different
133      * files. For example, "HELLO", "Hello", and "hello" would be three different
134      * files or directories in a case sensitive file system.
135      *
136      * @return <code>true</code> if this file system is case sensitive, and
137      * <code>false</code> otherwise.
138      */

139     public boolean isCaseSensitive();
140
141 }
142
Popular Tags