Skip to main content
summaryrefslogtreecommitdiffstats
blob: 494371c783a768e4544f013af694d5fbcbfb45b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package org.eclipse.team.ccvs.core;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */

import java.io.InputStream;
import java.io.OutputStream;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.CVSException;

/**
 * The CVS analog of a file. CVS files have access to synchronization information
 * that describes their association with the CVS repository. CVS files also provide 
 * mechanisms for sending and receiving content.
 * 
 * @see ICVSResource
 */
public interface ICVSFile extends ICVSResource {
	
	// Constants used to indicate the type of updated response from the server
	public static final int UPDATED = 1;
	public static final int MERGED = 2;
	public static final int UPDATE_EXISTING = 3;
	public static final int CREATED = 4;
	
	public static final long NULL_TIMESTAMP = 0;
	
	/**
	 * Answers the size of the file. 
	 */
	long getSize();
	
 	/**
	 * Gets an input stream for reading from the file.
	 * It is the responsibility of the caller to close the stream when finished.
 	 */
	InputStream getInputStream() throws CVSException;
	
	/**
	 * Set the contents of the file to the contents of the provided input stream
	 * 
	 * @param responseType the type of reponse that was received from the server
	 * 
	 *    UPDATED - could be a new file or an existing file
	 *    MERGED - merging remote changes with local changes. Failure could result in loss of local changes
	 *    CREATED - contents for a file that doesn't exist locally
	 *    UPDATE_EXISTING - Replacing a local file with no local changes with remote changes.
	 */
	public void setContents(InputStream stream, int responseType, boolean keepLocalHistory, IProgressMonitor monitor) throws CVSException;

	/**
	 * Sets the file's read-only permission.
	 */
	void setReadOnly(boolean readOnly) throws CVSException;
	
	/**
	 * Answers if the file is read-only.
	 */
	boolean isReadOnly() throws CVSException;
	
	/**
	 * Move the resource to another location. Does overwrite without
	 * promting.
	 */
	void copyTo(String filename) throws CVSException;
	
	/**
	 * Answers the current timestamp for this file. The returned format must be in the
	 * following format:
	 *
	 * E MMM dd HH:mm:ss yyyy
	 * 
	 * @throws CVSFileNotFoundException if exists() = false
	 */
	long getTimeStamp();

	/**
	 * Sets the current timestamp for this file. The supplied date must be in the
	 * following format:
	 *
	 * E MMM dd HH:mm:ss yyyy
	 *
	 * If the date is <code>null</code> then the current time is used as 
	 * the timestamp.
	 */
	void setTimeStamp(long date) throws CVSException;
	
	/**
	 * Answers <code>true</code> if the file differs from its base. If the file has no
	 * base, it is not dirty
	 */
	boolean isDirty() throws CVSException;
	
	/**
	 * Answers <code>true</code> if the file has changed since it was last updated
	 * from the repository, if the file does not exist, or is not managed. And <code>false</code> 
	 * if it has not changed.
	 */
	boolean isModified() throws CVSException;
}

Back to the top