KickJava   Java API By Example, From Geeks To Geeks.

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


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.runtime.IProgressMonitor;
15 import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
16
17 /**
18  * The CVS analog of a directory. CVS folders have access to synchronization information
19  * that describes the association between the folder and the remote repository.
20  *
21  * @see ICVSResource
22  * @see ICVSFile
23  */

24 public interface ICVSFolder extends ICVSResource {
25     
26     public static final int FILE_MEMBERS = 1;
27     public static final int FOLDER_MEMBERS = 2;
28     public static final int IGNORED_MEMBERS = 4;
29     public static final int UNMANAGED_MEMBERS = 8;
30     public static final int MANAGED_MEMBERS = 16;
31     public static final int EXISTING_MEMBERS = 32;
32     public static final int PHANTOM_MEMBERS = 64;
33     public static final int ALL_MEMBERS = FILE_MEMBERS
34         | FOLDER_MEMBERS
35         | IGNORED_MEMBERS
36         | UNMANAGED_MEMBERS
37         | MANAGED_MEMBERS
38         | EXISTING_MEMBERS
39         | PHANTOM_MEMBERS;
40     public static final int ALL_EXISTING_MEMBERS = FILE_MEMBERS
41         | FOLDER_MEMBERS
42         | IGNORED_MEMBERS
43         | UNMANAGED_MEMBERS
44         | MANAGED_MEMBERS
45         | EXISTING_MEMBERS;
46     public static final int ALL_UNIGNORED_MEMBERS = FILE_MEMBERS
47         | FOLDER_MEMBERS
48         | UNMANAGED_MEMBERS
49         | MANAGED_MEMBERS
50         | EXISTING_MEMBERS
51         | PHANTOM_MEMBERS;
52     
53     /**
54      * Answers and array of <code>ICVSResource</code> elements that are immediate
55      * children of this remote resource, in no particular order. The server may be contacted.
56      *
57      * @param monitor a progress monitor to indicate the duration of the operation, or
58      * <code>null</code> if progress reporting is not required.
59      *
60      * @return array of immediate children of this remote resource.
61      */

62     public ICVSResource[] fetchChildren(IProgressMonitor monitor) throws CVSException;
63     
64     /**
65      * Answer the immediate children of the resource that are known
66      * at the time of invocation. The server is never contacted.
67      * The flags indicate the type of members to be included.
68      * Here are the rules for specifying just one flag:
69      *
70      * a) FILE_MEMBERS and FOLDER_MEMBERS will return managed
71      * and unmanaged resource of the corresponding type
72      * b) IGNORED_MEMBERS, MANAGED_RESOURCES and UNMANAGED_RESOURCES
73      * will return files and folders of the given type
74      * c) EXISTING_MEMBERS and PHANTOM_MEMBERS will return existing
75      * and phantom resource of the corresponding type
76      *
77      * Note: Unmanaged resources are those that are neither managed or ignored.
78      *
79      * If all of the flags from either group a), group b) or group c)
80      * are not present, the same rule for default types applies.
81      * For example,
82      * - FILE_MEMBERS | FOLDER_MEMBERS will return all managed
83      * and unmanaged, existing and phantom files and folders.
84      * - IGNORED_MEMBERS | UNMANAGED_MEMBERS will return all
85      * ignored or unmanaged, existing or phantom files and folders
86      * If a flag from each group is present, the result is the
87      * union of the sets. For example,
88      * - FILE_MEMBERS | IGNORED_MEMBERS | EXISTING_MEMBERS will return all
89      * existing ignored files.
90      */

91     public ICVSResource[] members(int flags) throws CVSException;
92     
93     /**
94      * Answers a child folder of this resource with the given name or <code>null</code> if
95      * the given folder does not have a child with that name.
96      */

97     public ICVSFolder getFolder(String JavaDoc name) throws CVSException;
98     
99     /**
100      * Answers a child file of this resource with the given name or <code>null</code> if
101      * the given folder does not have a child with that name.
102      */

103     public ICVSFile getFile(String JavaDoc name) throws CVSException;
104
105     /**
106      * Return the child resource at the given path relative to
107      * the receiver.
108      */

109     public ICVSResource getChild(String JavaDoc path) throws CVSException;
110     
111     /**
112      * Create the folder if it did not exist before. Does only
113      * work if the direct subfolder did exist.
114      *
115      * @throws CVSException if for some reason it was not possible to create the folder
116      */

117     public void mkdir() throws CVSException;
118
119     /**
120      * Answers the folder's synchronization information or <code>null</code> if the folder
121      * is not a CVS folder.
122      * <p>
123      * To modify the folder sync info the caller must call <code>setFolderSyncInfo</code> with
124      * new sync information.</p>
125      */

126     public FolderSyncInfo getFolderSyncInfo() throws CVSException;
127     
128     /**
129      * Set the folder sync information for this folder. Setting the folder information
130      * to <code>null</code> is not supported. The only mechanism for removing an existing
131      * CVS folder is to delete the resource.
132      */

133     public void setFolderSyncInfo(FolderSyncInfo folderInfo) throws CVSException;
134     
135     /**
136      * Accepts the visitor on all files and all subFolder in the folder. Files are
137      * visited first, then all the folders..
138      */

139     public void acceptChildren(ICVSResourceVisitor visitor) throws CVSException;
140     
141     /**
142      * Answers <code>true</code> if the folder has valid CVS synchronization information and
143      * <code>false</code> otherwise.
144      *
145      * Note: This method does not throw an exception so this method does not differentiate
146      * between a folder not be shared with CVS and a folder that is shared but whose sync info has
147      * become corrupt. Use getFolderSyncInfo() to differentiate between these situations.
148      *
149      * Also Note: A folder that is a CVS folder may not exist in the workspace. The purpose of
150      * such a folder is to act as a remotely existing folder that does not exist locally.
151      * This is normally done in order to remember outgoing file deletions when a parent
152      * folder is deleted.
153      * Creating the folder will result in a folder that is mapped to a remote folder.
154      */

155     public boolean isCVSFolder() throws CVSException;
156     
157     /**
158      * Runs the given action as an atomic cvs local workspace operation
159      * rooted at this cvs folder.
160      * <p>
161      * After running a method that modifies cvs resource state in the
162      * local workspace, registered listeners receive after-the-fact
163      * notification in the form of a resource state change event. In addition,
164      * any resource state information persistance is batched.
165      * This method allows clients to call a number of
166      * methods that modify resources and only have resource
167      * change event notifications reported at the end of the entire
168      * batch.
169      * </p>
170      * <p>
171      * If this method is called in the dynamic scope of another such
172      * call, this method simply runs the action.
173      * </p>
174      *
175      * @param job the action to perform
176      * @param monitor a progress monitor, or <code>null</code> if progress
177      * reporting and cancellation are not desired
178      * @exception CVSException if the operation failed.
179      */

180     public void run(ICVSRunnable job, IProgressMonitor monitor) throws CVSException;
181 }
182
Popular Tags