Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2009 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 |
|
12 |
package org.eclipse.core.filesystem; |
13 |
|
14 |
import org.eclipse.core.runtime.*; |
15 |
|
16 |
/** |
17 |
* An interface representing an instance of an IFileStoree that is backed one-to-one |
18 |
* by a physical file by the operating system on which the file physically resides on |
19 |
* disk. The file may or may not also be a directory. Stores that logically reside inside other |
20 |
* files such as archive files, databases, etc., are not considered to be physical, as they |
21 |
* do not have a one-to-one relationship with a unique file. |
22 |
* |
23 |
* @see IFileStore |
24 |
* @since 3.5 |
25 |
* @author crecoskie |
26 |
*/ |
27 |
public interface IPhysicalStore { |
28 |
/** |
29 |
* Returns a String corresponding to the name of the physical file |
30 |
* as modeled by the operating system where the store physically resides on disk. |
31 |
* |
32 |
* @return String |
33 |
*/ |
34 |
public String getPhysicalName(); |
35 |
|
36 |
/** |
37 |
* Returns a String corresponding to the absolute path with which |
38 |
* this store is associated, as modeled by the operating system where |
39 |
* the store physically resides on disk. |
40 |
* |
41 |
* @return String |
42 |
*/ |
43 |
public String getPhysicalLocation(); |
44 |
|
45 |
/** |
46 |
* <p>Returns an IFileStore representing the file's physical parent |
47 |
* as modeled by the operating system where the store physically resides on disk.</p> |
48 |
* |
49 |
* <p>This is a handle only method; the parent |
50 |
* is returned regardless of whether this store or the parent store exists.</p> |
51 |
* |
52 |
* <p>This method returns <code>null</code> when this store represents the root |
53 |
* directory of a file system.</p> |
54 |
* |
55 |
* @return The parent store, or <code>null</code> if this store is the root |
56 |
* of a file system. |
57 |
* |
58 |
*/ |
59 |
public IFileStore getPhysicalParent(); |
60 |
|
61 |
/** |
62 |
* Returns an array of type IFileStore[] representing the store's physical children |
63 |
* as modeled by the operating system where the store physically resides on disk. |
64 |
* Returns an empty array if there are no children. |
65 |
* |
66 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
67 |
* is applicable). |
68 |
* @param monitor a progress monitor, or <code>null</code> if progress |
69 |
* reporting and cancellation are not desired |
70 |
* @return The children of this store, or an empty array if this |
71 |
* store has no children. |
72 |
* @exception CoreException if this method fails. Reasons include: |
73 |
* <ul> |
74 |
* <li> This store does not exist.</li> |
75 |
* </ul> |
76 |
*/ |
77 |
public IFileStore[] getPhysicalChildren(int options, IProgressMonitor monitor) throws CoreException; |
78 |
|
79 |
/** |
80 |
* Returns a child store with the provided physical name whose physical parent is |
81 |
* this store. This is a handle-only method; a child is provided regardless |
82 |
* of whether this store or the child store exists, or whether this store |
83 |
* represents a directory or not. |
84 |
* </p> |
85 |
* |
86 |
* @param name The name of the child store to return |
87 |
* @return A child file store. |
88 |
*/ |
89 |
public IFileStore getPhysicalChild(String name); |
90 |
|
91 |
/** |
92 |
* Returns a handle to the member store identified by the given path. The |
93 |
* path is treated as relative to this store's physical location. |
94 |
* |
95 |
* <p> |
96 |
* This is a handle-only method; a store is provided regardless |
97 |
* of whether this store or the member store exists, or whether this store |
98 |
* represents a directory or not. |
99 |
* </p> |
100 |
* |
101 |
* @param physicalPath the path of the member store |
102 |
* @return the member store |
103 |
* @since 3.5 |
104 |
*/ |
105 |
public IFileStore getFileStorePhysical(IPath physicalPath); |
106 |
|
107 |
/** |
108 |
* Returns whether this store is a physical parent of the provided store. This |
109 |
* is equivalent to, but typically more efficient than, the following: |
110 |
* <code><p> |
111 |
* while (true) { |
112 |
* <dir>IPhysicalFile otherPhysical = other.getAdapter(IPhysicalFile.class);<BR> |
113 |
* |
114 |
* if(otherPhysical != null) {<BR> |
115 |
* <dir>other = otherPhysical.getPhyisicalParent();<BR> |
116 |
* if (other == null)<BR> |
117 |
* <dir>return false;</dir><BR> |
118 |
* if (this.equals(other))<BR> |
119 |
* <dir>return true;</dir><BR> |
120 |
* </dir> |
121 |
* }<BR> |
122 |
* |
123 |
* else<BR> |
124 |
* <dir>return false;</dir><BR> |
125 |
* </dir> |
126 |
* } |
127 |
* </code></p> |
128 |
* <p> |
129 |
* This is a handle only method; this test works regardless of whether |
130 |
* this store or the parameter store exists. |
131 |
* </p> |
132 |
* |
133 |
* @param other The store to test for parentage. |
134 |
* @return <code>true</code> if this store is a parent of the provided |
135 |
* store, and <code>false</code> otherwise. |
136 |
* @exception CoreException if <code>other</code> |
137 |
* does not have a physical representation (cannot be adapted to IPhysicalFile). |
138 |
*/ |
139 |
public boolean isPhysicalParentOf(IFileStore other) throws CoreException; |
140 |
|
141 |
/** |
142 |
* Returns the names of the files and directories physically contained within this store. |
143 |
* |
144 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
145 |
* is applicable). |
146 |
* @param monitor a progress monitor, or <code>null</code> if progress |
147 |
* reporting and cancellation are not desired |
148 |
* @return The names of the children of this store, or an empty array if this |
149 |
* store has no children. |
150 |
* @exception CoreException if this method fails. Reasons include: |
151 |
* <ul> |
152 |
* <li> This store does not exist.</li> |
153 |
* </ul> |
154 |
*/ |
155 |
public String[] getPhysicalChildNames(int options, IProgressMonitor monitor) throws CoreException; |
156 |
|
157 |
/** |
158 |
* Returns an {@link IFileInfo} instance for each file and directory contained |
159 |
* within this store. The parent-child relationship reflects the physical files |
160 |
* as modeled by the operating system where the store physically resides on disk. |
161 |
* |
162 |
* @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} |
163 |
* is applicable). |
164 |
* @param monitor a progress monitor, or <code>null</code> if progress |
165 |
* reporting and cancellation are not desired |
166 |
* @return An array of information about the children of this store, or an empty |
167 |
* array if this store has no children. |
168 |
* @exception CoreException if this method fails. Reasons include: |
169 |
* <ul> |
170 |
* <li> This store does not exist.</li> |
171 |
* </ul> |
172 |
* @see IFileTree#getChildInfos(IFileStore) |
173 |
*/ |
174 |
public IFileInfo[] getPhysicalChildInfos(int options, IProgressMonitor monitor) throws CoreException; |
175 |
|
176 |
} |