KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > resources > IResourceProxy


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.resources;
12
13 import org.eclipse.core.runtime.IPath;
14 import org.eclipse.core.runtime.QualifiedName;
15
16 /**
17  * A lightweight interface for requesting information about a resource.
18  * All of the "get" methods on a resource proxy have trivial performance cost.
19  * Requesting the full path or the actual resource handle will cause extra objects
20  * to be created and will thus have greater cost.
21  * <p>
22  * When a resource proxy is used within an {@link IResourceProxyVisitor},
23  * it is a transient object that is only valid for the duration of a single visit method.
24  * A proxy should not be referenced once the single resource visit is complete.
25  * The equals and hashCode methods should not be relied on.
26  * </p>
27  * <p>
28  * A proxy can also be created using {@link IResource#createProxy()}. In
29  * this case the proxy is valid indefinitely, but will not remain in sync with
30  * the state of the corresponding resource.
31  * </p>
32  * <p>
33  * This interface is not intended to be implemented by clients.
34  * </p>
35  * @see IResourceProxyVisitor
36  * @since 2.1
37  */

38 public interface IResourceProxy {
39     /**
40      * Returns the modification stamp of the resource being visited.
41      *
42      * @return the modification stamp, or <code>NULL_STAMP</code> if the
43      * resource either does not exist or exists as a closed project
44      * @see IResource#getModificationStamp()
45      */

46     public long getModificationStamp();
47
48     /**
49      * Returns whether the resource being visited is accessible.
50      *
51      * @return <code>true</code> if the resource is accessible, and
52      * <code>false</code> otherwise
53      * @see IResource#isAccessible()
54      */

55     public boolean isAccessible();
56
57     /**
58      * Returns whether the resource being visited is derived.
59      *
60      * @return <code>true</code> if the resource is marked as derived, and
61      * <code>false</code> otherwise
62      * @see IResource#isDerived()
63      */

64     public boolean isDerived();
65
66     /**
67      * Returns whether the resource being visited is a linked resource.
68      *
69      * @return <code>true</code> if the resource is linked, and
70      * <code>false</code> otherwise
71      * @see IResource#isLinked()
72      */

73     public boolean isLinked();
74
75     /**
76      * Returns whether the resource being visited is a phantom resource.
77      *
78      * @return <code>true</code> if the resource is a phantom resource, and
79      * <code>false</code> otherwise
80      * @see IResource#isPhantom()
81      */

82     public boolean isPhantom();
83
84     /**
85      * Returns whether the resource being visited is a team private member.
86      *
87      * @return <code>true</code> if the resource is a team private member, and
88      * <code>false</code> otherwise
89      * @see IResource#isTeamPrivateMember()
90      */

91     public boolean isTeamPrivateMember();
92
93     /**
94      * Returns the simple name of the resource being visited.
95      *
96      * @return the name of the resource
97      * @see IResource#getName()
98      */

99     public String JavaDoc getName();
100
101     /**
102      * Returns the value of the session property of the resource being
103      * visited, identified by the given key. Returns <code>null</code> if this
104      * resource has no such property.
105      * <p>
106      * Note that this method can return an out of date property value, or a
107      * value that no longer exists, if session properties are being modified
108      * concurrently with the resource visit.
109      * </p>
110      *
111      * @param key the qualified name of the property
112      * @return the string value of the session property,
113      * or <code>null</code> if the resource has no such property
114      * @see IResource#getSessionProperty(QualifiedName)
115      */

116     public Object JavaDoc getSessionProperty(QualifiedName key);
117
118     /**
119      * Returns the type of the resource being visited.
120      *
121      * @return the resource type
122      * @see IResource#getType()
123      */

124     public int getType();
125
126     /**
127      * Returns the full workspace path of the resource being visited.
128      * <p>
129      * Note that this is not a &quot;free&quot; proxy operation. This method
130      * will generally cause a path object to be created. For an optimal
131      * visitor, only call this method when absolutely necessary. Note that the
132      * simple resource name can be obtained from the proxy with no cost.
133      * </p>
134      * @return the full path of the resource
135      * @see IResource#getFullPath()
136      */

137     public IPath requestFullPath();
138
139     /**
140      * Returns the handle of the resource being visited.
141      * <p>
142      * Note that this is not a &quot;free&quot; proxy operation. This method will
143      * generally cause both a path object and a resource object to be created.
144      * For an optimal visitor, only call this method when absolutely necessary.
145      * Note that the simple resource name can be obtained from the proxy with no
146      * cost, and the full path of the resource can be obtained through the proxy
147      * with smaller cost.
148      * </p>
149      * @return the resource handle
150      */

151     public IResource requestResource();
152 }
153
Popular Tags