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.core.history; 12 13 import java.net.URI; 14 15 import org.eclipse.core.resources.IStorage; 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.IProgressMonitor; 18 import org.eclipse.team.core.history.provider.FileRevision; 19 20 21 /** 22 * Represents an individual revision of a file. 23 * 24 * <p> 25 * This interface is not intended to be implemented by clients. Clients can 26 * instead subclass {@link FileRevision}. 27 * 28 * @since 3.2 29 */ 30 public interface IFileRevision { 31 32 /** 33 * Returns the storage for this file revision. 34 * If the returned storage is an instance of 35 * <code>IFile</code> clients can assume that this 36 * file state represents the current state of 37 * the returned <code>IFile</code>. 38 * @param monitor a progress monitor 39 * @return IStorage containing file storage 40 * @throws CoreException 41 */ 42 public IStorage getStorage(IProgressMonitor monitor) throws CoreException; 43 44 /** 45 * Returns the name of the file to which this state is associated 46 * @return String containing the name of the file 47 */ 48 public String getName(); 49 50 /** 51 * Returns the URI of the file to which this state is associated 52 * or <code>null</code> if the file does not have a URI. 53 * @return URI of the file to which this state is associated 54 */ 55 public URI getURI(); 56 57 /** 58 * Returns the time stamp of this revision as a long or <code>-1</code> 59 * if the timestamp is unknown. 60 * 61 * @return a long that represents the time of this revision as the number of milliseconds 62 * since the base time 63 * 64 * @see java.lang.System#currentTimeMillis() 65 */ 66 public long getTimestamp(); 67 68 /** 69 * Returns whether the file represented by this state exists. 70 * @return whether the file represented by this state exists 71 */ 72 public boolean exists(); 73 74 /** 75 * Returns the <em>unique</em> identifier for this file revision 76 * or <code>null</code> if one is not available. If <code>null</code> 77 * is returned, clients can use the timestamp to differentiate 78 * revisions. 79 * @return the <em>unique</em> identifier for this file revision 80 * or <code>null</code> 81 */ 82 public String getContentIdentifier(); 83 84 /** 85 * Returns the author of this revision or <code>null</code> if 86 * this information is not available. 87 * 88 * @return the author of this revision or <code>null</code> 89 */ 90 public String getAuthor(); 91 92 /** 93 * Returns the comment for this file revision or <code>null</code> if 94 * this information is not available. 95 * 96 * @return the comment for this file revision or <code>null</code> 97 */ 98 public String getComment(); 99 100 /** 101 * Returns the set of tags available for this file revision. 102 * 103 * @return an array of ITag's if ITags exist for this revision or an empty ITag array 104 * if no tags exist 105 */ 106 public ITag[] getTags(); 107 108 /** 109 * Returns whether this particular file revision has at least one supported property 110 * missing. If the revision is missing some queries 111 * clients can use {@link #withAllProperties(IProgressMonitor)}. 112 * 113 * @return whether this particular file revision has at least one supported property 114 * missing 115 */ 116 public boolean isPropertyMissing(); 117 118 /** 119 * Returns an {@link IFileRevision} with all supported properties present. 120 * @param monitor a monitor 121 * @return a complete version of this file revision or null 122 * @throws CoreException 123 */ 124 public IFileRevision withAllProperties(IProgressMonitor monitor) throws CoreException; 125 } 126