Skip to main content
summaryrefslogtreecommitdiffstats
blob: d2ac3043cb9e14d21a5a6ba601f3c63cceb86f7e (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
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.core.variants;

import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;

/**
 * This interface is used by <code>SyncInfo</code> instances
 * to provide access to the base and remote resources that correspond to 
 * a local resource.
 * 
 * @see org.eclipse.team.core.synchronize.SyncInfo
 * @since 3.0
 */
public interface IResourceVariant {
	
	/**
	 * Answers the name of the remote resource. The name may be
	 * displayed to the user.
	 * 
	 * @return name of the resource variant.
	 */
	public String getName();
	
	/**
	 * Answers if the remote resource may have children.
	 * 
	 * @return <code>true</code> if the remote resource may have children and 
	 * <code>false</code> otherwise.
	 */
	public boolean isContainer();
	
	/**
	 * Return an instance of IStorage or <code>null</code> if the remote resource
	 * does not have contents (i.e. is a folder). Since the <code>ISorage#getContents()</code>
	 * method does not accept an <code>IProgressMonitor</code>, this method must ensure that the contents
	 * access by the resulting <code>IStorage</code> is cached locally (hence the <code>IProgressMonitor</code> 
	 * argument to this method). Implementations of this method should
	 * ensure that the resulting <code>IStorage</code> is accessing locally cached contents and is not
	 * contacting the server.
	 * <p>
	 * The returned storage object may be an instance of (@link org.eclipse.core.resources.IEncodedStorage}
	 * in which case clients can determine the character encoding of the contents.
	 * 
	 * @return an <code>IStorage</code> that provides access to the contents of 
	 * the remote resource or <code>null</code> if the remote resource is a container.
	 */
	public IStorage getStorage(IProgressMonitor monitor) throws TeamException;
	
	/**
	 * Return a content identifier that is used to differentiate versions
	 * or revisions of the same resource.
	 * 
	 * @return a String that identifies the version of the subscriber resource
	 * @throws TeamException
	 */
	public String getContentIdentifier();
	
	/**
	 * Return an array of bytes that can be used to uniquely identify this
	 * resource variant when compared to other resource variants and could
	 * also potentially be used to recreate a resource variant handle.
	 * @return the bytes that uniquely identify this resource variant
	 */
	public byte[] asBytes();
	
	/**
	 * Returns whether the remote resource is equal to the provided object.
	 * @param object the object to be compared
	 * @return whether the object is equal to the remote resource
	 */
	public boolean equals(Object object);

}

Back to the top