KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Red Hat Incorporated - is/setExecutable() code
11  *******************************************************************************/

12 package org.eclipse.team.internal.ccvs.core;
13
14 import java.util.Date JavaDoc;
15
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.team.core.TeamException;
18 import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
19 import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
20
21 /**
22  * The CVS analog of a file. CVS files have access to synchronization information
23  * that describes their association with the CVS repository. CVS files also provide
24  * mechanisms for sending and receiving content.
25  *
26  * @see ICVSResource
27  */

28 public interface ICVSFile extends ICVSResource, ICVSStorage {
29     
30     // Constants used to indicate the type of updated response from the server
31
public static final int UPDATED = 1;
32     public static final int MERGED = 2;
33     public static final int UPDATE_EXISTING = 3;
34     public static final int CREATED = 4;
35     
36     // Constants used to indicate temporary watches
37
public static final int NO_NOTIFICATION = 0;
38     public static final int NOTIFY_ON_EDIT = 1;
39     public static final int NOTIFY_ON_UNEDIT = 2;
40     public static final int NOTIFY_ON_COMMIT = 4;
41     public static final int NOTIFY_ON_ALL = NOTIFY_ON_EDIT | NOTIFY_ON_UNEDIT | NOTIFY_ON_COMMIT;
42     
43     // Constants used to indicate modification state when setting sync info
44
public static final int UNKNOWN = 0;
45     public static final int CLEAN = 1;
46     public static final int DIRTY = 2;
47
48     /**
49      * Answers the workspace synchronization information for this resource. This would
50      * typically include information from the <b>Entries</b> file that is used to track
51      * the base revisions of local CVS resources.
52      *
53      * @return the synchronization information for this resource, or <code>null</code>
54      * if the resource does not have synchronization information available.
55      */

56     public byte[] getSyncBytes() throws CVSException;
57
58     /**
59      * Called to set the workspace synchronization information for a resource. To
60      * clear sync information call <code>unmanage</code>. The sync info will
61      * become the persisted between workbench sessions.
62      *
63      * Note: This method makes use of a ResourceSyncInfo object which has the parsed
64      * contents of the resource sync info. Clients can manipulate the values using
65      * MutableResourceSyncInfo and then set the sync info using this method.
66      *
67      * @param info the resource synchronization to associate with this resource.
68      */

69     public void setSyncInfo(ResourceSyncInfo info, int modificationState) throws CVSException;
70         
71     /**
72      * Called to set the workspace synchronization information for a resource. To
73      * clear sync information call <code>unmanage</code>. The sync info will
74      * become the persisted between workbench sessions.
75      *
76      * Note: This method sets the sync info to the bytes provided as-is. It is the caller's
77      * responsibility to ensure that these bytes are of the proper format. Use with caution.
78      *
79      * @param info the resource synchronization to associate with this resource.
80      */

81     public void setSyncBytes(byte[] syncBytes, int modificationState) throws CVSException;
82     
83     /**
84      * Sets the file to read-only (<code>true</code>) or writable (<code>false</code>).
85      *
86      * This method is used by the command framework and should not be used by other clients.
87      * Other clients should use <code>edit</code> and <code>unedit</code> instead as they
88      * will report the change to the server if appropriate.
89      */

90     void setReadOnly(boolean readOnly) throws CVSException;
91     
92     /**
93      * Answers whether the file is read-only or not. If a file is read-only, <code>edit</code>
94      * should be invoked to make the file editable.
95      */

96     boolean isReadOnly() throws CVSException;
97     
98     /**
99      * Sets the file to be executable (<code>ture</code>) or not executable
100      * (<code>false</code>) if the platform supports it.
101      */

102     public void setExecutable(boolean executable) throws CVSException;
103
104     /**
105      * Answers whether the file is executable or not.
106      *
107      * @returns <code>false</code> if the platform doesn't support the executable flag.
108      */

109     public boolean isExecutable() throws CVSException;
110     
111     /**
112      * Copy the resource to another file in the same directory
113      *
114      * This method is used by the command framework and should not be used by other clients.
115      */

116     void copyTo(String JavaDoc filename) throws CVSException;
117     
118     /**
119      * Answers the current timestamp for this file with second precision.
120      *
121      * This method is used by the command framework and should not be used by other clients.
122      */

123     Date JavaDoc getTimeStamp();
124
125     /**
126      * If the date is <code>null</code> then the current time is used. After setTimeStamp is
127      * invoked, it is assumed that the file is CLEAN. If this is not the case, it is the clients
128      * responsibility to invoke setSyncBytes() with the appropriate modification state.
129      *
130      * This method is used by the command framework and should not be used by other clients.
131      */

132     void setTimeStamp(Date JavaDoc date) throws CVSException;
133     
134     /**
135      * Answers <code>true</code> if the file has changed since it was last updated
136      * from the repository, if the file does not exist, or is not managed. And <code>false</code>
137      * if it has not changed.
138      */

139     boolean isModified(IProgressMonitor monitor) throws CVSException;
140     
141     /**
142      * Answers the revision history for this file. This is similar to the
143      * output of the log command.
144      */

145     public ILogEntry[] getLogEntries(IProgressMonitor monitor) throws TeamException;
146     
147     /**
148      * Mark the file as checked out to allow local editing (analogous to "cvs edit").
149      * If this method is invoked when <code>isCheckedOut()</code> returns <code>false</code>,
150      * a notification message that will be sent to the server on the next connection
151      * If <code>isCheckedOut()</code> returns <code>true</code> then nothing is done.
152      *
153      * @param notifications the set of operations for which the local user would like notification
154      * while the local file is being edited.
155      * @param notifyForWritable
156      */

157     public void edit(int notifications, boolean notifyForWritable, IProgressMonitor monitor) throws CVSException;
158
159     /**
160      * Undo a checkout of the file (analogous to "cvs unedit").
161      * If this method is invoked when <code>isCheckedOut()</code> returns <code>true</code>,
162      * a notification message that will be sent to the server on the next connection
163      * If <code>isCheckedOut()</code> returns <code>false</code> then nothing is done.
164      */

165     public void unedit(IProgressMonitor monitor) throws CVSException;
166
167     /**
168      * This method is invoked by the checked-in handler after the file
169      * has been committed.
170      * @param entryLine the entry line recieved from the server (can be null)
171      * @param commit whether the checkin is comming from a cvs commit or not
172      */

173     public void checkedIn(String JavaDoc entryLine, boolean commit) throws CVSException;
174         
175     /**
176      * Answer any pending notification information associated with the receiver.
177      *
178      * This method is used by the command framework and should not be used by other clients.
179      */

180     public NotifyInfo getPendingNotification() throws CVSException;
181     
182     /**
183      * Indicate to the file that the pending notification was successfully communicated to the server.
184      *
185      * This method is used by the command framework and should not be used by other clients.
186      */

187     public void notificationCompleted() throws CVSException;
188     
189     /**
190      * Indicate whether the file has been "cvs edit"ed. This is determined by
191      * looking in the CVS/Base folder for a file of the same name as the
192      * file (i.e. no files are read so the method can be called by time critical
193      * code like menu enablement).
194      *
195      * @return boolean
196      */

197     public boolean isEdited() throws CVSException;
198
199 }
200
Popular Tags