Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2008 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 org.eclipse.core.runtime.*; |
14 |
|
15 |
/** |
16 |
* Extension of IFileStore which provides a distinct notion between the |
17 |
* logical model of a file and its physical model. The logical model can be any |
18 |
* arbitrary model of the file as Eclipse sees it, but the physical model |
19 |
* always reflects the file as it is modeled by the operating system on which |
20 |
* the store physically resides on disk. |
21 |
* @author crecoskie |
22 |
* @since 3.5 |
23 |
* |
24 |
*/ |
25 |
public interface IFileStore2 extends IFileStore { |
26 |
/** |
27 |
* Returns <code>true</code> if this file has a physical, one-to-one representation |
28 |
* with a file as modeled by the operating system where the store physically resides on disk. |
29 |
* Stores which reside inside archive files, databases, etc. must respond <code>false</code>. |
30 |
* @return boolean |
31 |
*/ |
32 |
public boolean isPhysical(); |
33 |
|
34 |
/** |
35 |
* Returns a String corresponding to the name of the physical file |
36 |
* as modeled by the operating system where the store physically resides on disk. |
37 |
* |
38 |
* @return String |
39 |
*/ |
40 |
public String getPhysicalName(); |
41 |
|
42 |
/** |
43 |
* Returns a String corresponding to the absolute path with which |
44 |
* this store is associated, as modeled by the operating system where |
45 |
* the store physically resides on disk. |
46 |
* |
47 |
* @return String |
48 |
*/ |
49 |
public String getPhysicalLocation(); |
50 |
|
51 |
/** |
52 |
* <p>Returns an IFileStore representing the file's physical parent |
53 |
* as modeled by the operating system where the store physically resides on disk.</p> |
54 |
* |
55 |
* <p>This is a handle only method; the parent |
56 |
* is returned regardless of whether this store or the parent store exists.</p> |
57 |
* |
58 |
* <p>This method returns <code>null</code> when this store represents the root |
59 |
* directory of a file system.</p> |
60 |
* |
61 |
* @return The parent store, or <code>null</code> if this store is the root |
62 |
* of a file system. |
63 |
* |
64 |
* @exception CoreException if this store does not have a physical representation (isPhysical() returns false); |
65 |
*/ |
66 |
public IFileStore getPhysicalParent() throws CoreException; |
67 |
|
68 |
/** |
69 |
* Returns an array of type IFileStore[] representing the store's physical children |
70 |
* as modeled by the operating system where the store physically resides on disk. |
71 |
* Returns an empty array if there are no children. |
72 |
* Returns null if this file does not have a physical representation (isPhysical() returns false). |
73 |
* |
74 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
75 |
* is applicable). |
76 |
* @param monitor a progress monitor, or <code>null</code> if progress |
77 |
* reporting and cancellation are not desired |
78 |
* @return The children of this store, or an empty array if this |
79 |
* store has no children. |
80 |
* @exception CoreException if this method fails. Reasons include: |
81 |
* <ul> |
82 |
* <li> This store does not exist.</li> |
83 |
* <li> This store does not have a physical representation (isPhysical() returns <code>false</code>). |
84 |
* </ul> |
85 |
* @see IFileStore2#getLogicalChildren(int, IProgressMonitor) |
86 |
*/ |
87 |
public IFileStore[] getPhysicalChildren(int options, IProgressMonitor monitor) throws CoreException; |
88 |
|
89 |
/** |
90 |
* Returns a child store with the provided physical name whose physical parent is |
91 |
* this store. This is a handle-only method; a child is provided regardless |
92 |
* of whether this store or the child store exists, or whether this store |
93 |
* represents a directory or not. |
94 |
* </p> |
95 |
* |
96 |
* @param name The name of the child store to return |
97 |
* @return A child file store. |
98 |
* @exception CoreException if this store does not have a physical representation (isPhysical() returns <code>false</code>). |
99 |
*/ |
100 |
public IFileStore getPhysicalChild(String name) throws CoreException; |
101 |
|
102 |
/** |
103 |
* Returns a handle to the member store identified by the given path. The |
104 |
* path is treated as relative to this store's physical location. |
105 |
* |
106 |
* <p> |
107 |
* This is a handle-only method; a store is provided regardless |
108 |
* of whether this store or the member store exists, or whether this store |
109 |
* represents a directory or not. |
110 |
* </p> |
111 |
* |
112 |
* @param physicalPath the path of the member store |
113 |
* @return the member store |
114 |
* @exception CoreException if this store does not have a physical |
115 |
* representation (isPhysical() returns <code>false</code>). |
116 |
* |
117 |
* @since 3.5 |
118 |
*/ |
119 |
public IFileStore getFileStorePhysical(IPath physicalPath) throws CoreException; |
120 |
|
121 |
/** |
122 |
* Returns whether this store is a physical parent of the provided store. This |
123 |
* is equivalent to, but typically more efficient than, the following: |
124 |
* <code> |
125 |
* while (true) { |
126 |
* other = other.getPhyisicalParent(); |
127 |
* if (other == null) |
128 |
* return false; |
129 |
* if (this.equals(other)) |
130 |
* return true; |
131 |
* } |
132 |
* </code> |
133 |
* <p> |
134 |
* This is a handle only method; this test works regardless of whether |
135 |
* this store or the parameter store exists. |
136 |
* </p> |
137 |
* |
138 |
* @param other The store to test for parentage. |
139 |
* @return <code>true</code> if this store is a parent of the provided |
140 |
* store, and <code>false</code> otherwise. |
141 |
* @exception CoreException if either or both of this store and/or <code>other</code> |
142 |
* does not have a physical representation (isPhysical() returns <code>false</code>). |
143 |
*/ |
144 |
public boolean isPhysicalParentOf(IFileStore other) throws CoreException; |
145 |
|
146 |
/** |
147 |
* Returns the names of the files and directories physically contained within this store. |
148 |
* |
149 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
150 |
* is applicable). |
151 |
* @param monitor a progress monitor, or <code>null</code> if progress |
152 |
* reporting and cancellation are not desired |
153 |
* @return The names of the children of this store, or an empty array if this |
154 |
* store has no children. |
155 |
* @exception CoreException if this method fails. Reasons include: |
156 |
* <ul> |
157 |
* <li> This store does not exist.</li> |
158 |
* <li> This store does not have a physical representation (isPhysical() returns <code>false</code>) |
159 |
* </ul> |
160 |
*/ |
161 |
public String[] getPhysicalChildNames(int options, IProgressMonitor monitor) throws CoreException; |
162 |
|
163 |
/** |
164 |
* Returns an {@link IFileInfo} instance for each file and directory contained |
165 |
* within this store. The parent-child relationship reflects the physical files |
166 |
* as modeled by the operating system where the store physically resides on disk. |
167 |
* |
168 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
169 |
* is applicable). |
170 |
* @param monitor a progress monitor, or <code>null</code> if progress |
171 |
* reporting and cancellation are not desired |
172 |
* @return An array of information about the children of this store, or an empty |
173 |
* array if this store has no children. |
174 |
* @exception CoreException if this method fails. Reasons include: |
175 |
* <ul> |
176 |
* <li> This store does not exist.</li> |
177 |
* <li> This store does not have a physical representation (isPhysical() returns <code>false</code>) |
178 |
* </ul> |
179 |
* @see IFileTree#getChildInfos(IFileStore) |
180 |
*/ |
181 |
public IFileInfo[] getPhysicalChildInfos(int options, IProgressMonitor monitor) throws CoreException; |
182 |
|
183 |
/** |
184 |
* Returns the logical name for this store. This name need not be the same as its name |
185 |
* as modeled by the operating system where the store physically resides on disk. |
186 |
* |
187 |
* @return String |
188 |
*/ |
189 |
public String getLogicalName(); |
190 |
|
191 |
/** |
192 |
* <p>Returns an IFileStore representing the store's logical parent. |
193 |
* The parent need not be the same as the physical parent as modeled |
194 |
* by the operating system where the store physically resides on disk.</p> |
195 |
* |
196 |
* <p>This is a handle only method; the parent |
197 |
* is returned regardless of whether this store or the parent store exists. This |
198 |
* method returns <code>null</code> when this store represents the root |
199 |
* directory of a file system.</p> |
200 |
* |
201 |
* @return The parent store, or <code>null</code> if this store is the root |
202 |
* of a file system. |
203 |
* |
204 |
*/ |
205 |
public IFileStore getLogicalParent() throws CoreException; |
206 |
|
207 |
/** |
208 |
* Returns an array of type IFileStore[] representing the store's logical children. |
209 |
* These children need not be the same as the phyiscal children as modeled by the |
210 |
* operating system where the store physically resides on disk. |
211 |
* Returns an empty array if there are no children. |
212 |
* Returns null if this file does not have a physical representation (isPhysical() returns false). |
213 |
* |
214 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
215 |
* is applicable). |
216 |
* @param monitor a progress monitor, or <code>null</code> if progress |
217 |
* reporting and cancellation are not desired |
218 |
* @return The children of this store, or an empty array if this |
219 |
* store has no children. |
220 |
* @exception CoreException if this method fails. Reasons include: |
221 |
* <ul> |
222 |
* <li> This store does not exist.</li> |
223 |
* </ul> |
224 |
* @see IFileStore2#getLogicalChildren(int, IProgressMonitor) |
225 |
*/ |
226 |
public IFileStore[] getLogicalChildren(int options, IProgressMonitor monitor) throws CoreException; |
227 |
|
228 |
/** |
229 |
* Returns a child store with the provided logical name whose logical parent is |
230 |
* this store. This is a handle-only method; a child is provided regardless |
231 |
* of whether this store or the child store exists, or whether this store |
232 |
* represents a directory or not. |
233 |
* </p> |
234 |
* |
235 |
* @param name The name of the child store to return |
236 |
* @return A child file store. |
237 |
*/ |
238 |
public IFileStore getLogicalChild(String name); |
239 |
|
240 |
/** |
241 |
* Returns a handle to the member store identified by the given path. The |
242 |
* path is treated as relative to this store's logical path. I.e., segments of the path |
243 |
* resolved against logical children of this store. |
244 |
* |
245 |
* <p> |
246 |
* This is a handle-only method; a store is provided regardless |
247 |
* of whether this store or the member store exists, or whether this store |
248 |
* represents a directory or not. |
249 |
* </p> |
250 |
* |
251 |
* @param logicalPath the path of the member store |
252 |
* @return the member store |
253 |
* |
254 |
* @since 3.5 |
255 |
*/ |
256 |
public IFileStore getFileStoreLogical(IPath logicalPath); |
257 |
|
258 |
/** |
259 |
* Returns whether this store is a logical parent of the provided store. This |
260 |
* is equivalent to, but typically more efficient than, the following: |
261 |
* <code> |
262 |
* while (true) { |
263 |
* other = other.getLogicalParent(); |
264 |
* if (other == null) |
265 |
* return false; |
266 |
* if (this.equals(other)) |
267 |
* return true; |
268 |
* } |
269 |
* </code> |
270 |
* <p> |
271 |
* This is a handle only method; this test works regardless of whether |
272 |
* this store or the parameter store exists. |
273 |
* </p> |
274 |
* |
275 |
* @param other The store to test for parentage. |
276 |
* @return <code>true</code> if this store is a parent of the provided |
277 |
* store, and <code>false</code> otherwise. |
278 |
*/ |
279 |
public boolean isLogicalParentOf(IFileStore other); |
280 |
|
281 |
/** |
282 |
* Returns the names of the files and directories logically contained within this store. |
283 |
* |
284 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
285 |
* is applicable). |
286 |
* @param monitor a progress monitor, or <code>null</code> if progress |
287 |
* reporting and cancellation are not desired |
288 |
* @return The names of the children of this store, or an empty array if this |
289 |
* store has no children. |
290 |
* @exception CoreException if this method fails. Reasons include: |
291 |
* <ul> |
292 |
* <li> This store does not exist.</li> |
293 |
* </ul> |
294 |
*/ |
295 |
public String[] getLogicalChildNames(int options, IProgressMonitor monitor) throws CoreException; |
296 |
|
297 |
/** |
298 |
* Returns an {@link IFileInfo} instance for each file and directory contained |
299 |
* within this store. The parent-child relationship reflects the logical model as seen by |
300 |
* EFS, and does not necessarily reflect the physical layout |
301 |
* as modeled by the operating system where the store physically resides on disk. |
302 |
* |
303 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
304 |
* is applicable). |
305 |
* @param monitor a progress monitor, or <code>null</code> if progress |
306 |
* reporting and cancellation are not desired |
307 |
* @return An array of information about the children of this store, or an empty |
308 |
* array if this store has no children. |
309 |
* @exception CoreException if this method fails. Reasons include: |
310 |
* <ul> |
311 |
* <li> This store does not exist.</li> |
312 |
* </ul> |
313 |
* @see IFileTree#getChildInfos(IFileStore) |
314 |
*/ |
315 |
public IFileInfo[] getLogicalChildInfos(int options, IProgressMonitor monitor) throws CoreException; |
316 |
|
317 |
} |