KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > core > ICVSResource


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.team.internal.ccvs.core;
12
13
14 import org.eclipse.core.resources.IResource;
15 import org.eclipse.core.runtime.IProgressMonitor;
16 import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
17
18 /**
19  * The CVS analog of file system files and directories. These are handles to
20  * state maintained by a CVS client. That is, the CVS resource does not
21  * actually contain data but rather represents CVS state and behavior. You are
22  * free to manipulate handles for CVS resources that do not exist but be aware
23  * that some methods require that an actual resource be available.
24  * <p>
25  * The CVS client has been designed to work on these handles uniquely. As such, the
26  * handle could be to a remote resource or a local resource and the client could
27  * perform CVS operations ignoring the actual location of the resources.</p>
28  *
29  * @see ICVSFolder
30  * @see ICVSFile
31  */

32 public interface ICVSResource {
33     
34     /**
35      * Answers the name of the resource.
36      *
37      * @return the name of the resource this handle represents. It can never
38      * be <code>null</code>.
39      */

40     public String JavaDoc getName();
41     
42     /**
43      * Answers if this resource has CVS synchronization information associated
44      * with it.
45      *
46      * @return <code>true</code> if the resource is
47      */

48     public boolean isManaged() throws CVSException;
49
50     /**
51      * Unmanage the given resource by purging any CVS synchronization associated with the
52      * resource. The only way a resource can become managed is by running the
53      * appropriate CVS commands (e.g. add/commit/update).
54      */

55     public void unmanage(IProgressMonitor monitor) throws CVSException;
56
57     /**
58      * Answer whether the resource could be ignored because it is in the one of the
59      * ignore lists maintained by CVS. Even if a resource is ignored, it can still be
60      * added to a repository, at which time it should never be ignored by the CVS
61      * client.
62      *
63      * @return <code>true</code> if this resource is listed in one of the ignore
64      * files maintained by CVS and <code>false</code> otherwise.
65      */

66     public boolean isIgnored() throws CVSException;
67     
68     /**
69      * Add the following pattern to the file's parent ignore list
70      *
71      * XXX This should really be a method of ICVSFolder
72      */

73     public void setIgnoredAs(String JavaDoc pattern) throws CVSException;
74             
75     /**
76      * Answers if the handle is a file or a folder handle.
77      *
78      * @return <code>true</code> if this is a folder handle and <code>false</code> if
79      * it is a file handle.
80      */

81     public boolean isFolder();
82     
83     /**
84      * Answers if the resource identified by this handle exists.
85      *
86      * @return <code>true</code> if the resource represented by this handle
87      * exists and <code>false</code> false otherwise.
88      */

89     public boolean exists() throws CVSException;
90
91     /**
92      * Answers the underlying IResource for the cvs resource (or null if there
93      * is not a corresponding local resource).
94      *
95      * @return the IResource that corresponds to the CVS resource
96      */

97     public IResource getIResource();
98     
99     /**
100      * Answers the local relative path from the given ancestor to the receiver.
101      * This method will return a path for files that are themselves not added
102      * to CVS control but who have an ancestor that is under CVS control.
103      *
104      * @return the ancestor relative path for this resource.
105      */

106     public String JavaDoc getRelativePath(ICVSFolder ancestor) throws CVSException;
107
108     /**
109      * Return the repository relative path of the remote resource. Return
110      * <code>null</code> if the resource is not under CVS control.
111      *
112      * @return
113      * @throws CVSException
114      */

115     public String JavaDoc getRepositoryRelativePath() throws CVSException;
116     
117     /**
118      * Get the absolute remote location of a resource. This method is used by
119      * the CVS command infrastructure during command execution. The root is used
120      * in situations where the resource is not under CVS control. The remote
121      * path that the resource would have if it was is determined by recursively
122      * searching the resource's parent until a managed folder is found. The
123      * provided root is used to stop the recursive search if no managed parent
124      * is found.
125      *
126      * @param root the root folder of the command.
127      *
128      * @return the remote location.
129      */

130     public String JavaDoc getRemoteLocation(ICVSFolder root) throws CVSException;
131     
132     /**
133      * Answers the workspace synchronization information for this resource. This would
134      * typically include information from the <b>Entries</b> file that is used to track
135      * the base revisions of local CVS resources.
136      *
137      * @return the synchronization information for this resource, or <code>null</code>
138      * if the resource does not have synchronization information available.
139      */

140     public ResourceSyncInfo getSyncInfo() throws CVSException;
141
142     /**
143      * Deletes the resource represented by the handle.
144      */

145     public void delete() throws CVSException;
146     
147     /**
148      * Give the folder that contains this resource. If the resource is not managed
149      * then the result of the operation is not specified.
150      *
151      * @return a handle to the parent of this resource.
152      */

153     public ICVSFolder getParent();
154
155     /**
156      * Accept a vistor to this resource.
157      */

158     public void accept(ICVSResourceVisitor visitor) throws CVSException;
159     
160     /**
161      * Accept a visitor to this resource. The recurse parameter corresponds to the CVS
162      * -l (do not recurse) and -R (recurse) options. If recurse is false, only the resource
163      * and it's children are visited. Otherwise, the resource and all it's decendants are
164      * visited.
165      */

166     public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException;
167     
168     /**
169      * Method isModified.
170      * @return boolean
171      */

172     public boolean isModified(IProgressMonitor monitor) throws CVSException;
173 }
174
Popular Tags