KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > core > resources > RemoteFile


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.resources;
13
14 import java.io.ByteArrayInputStream JavaDoc;
15 import java.io.InputStream JavaDoc;
16 import java.util.*;
17
18 import org.eclipse.core.resources.IFile;
19 import org.eclipse.core.resources.IResource;
20 import org.eclipse.core.runtime.*;
21 import org.eclipse.team.core.TeamException;
22 import org.eclipse.team.core.history.IFileRevision;
23 import org.eclipse.team.core.variants.CachedResourceVariant;
24 import org.eclipse.team.internal.ccvs.core.*;
25 import org.eclipse.team.internal.ccvs.core.client.*;
26 import org.eclipse.team.internal.ccvs.core.client.Command.*;
27 import org.eclipse.team.internal.ccvs.core.client.listeners.ILogEntryListener;
28 import org.eclipse.team.internal.ccvs.core.client.listeners.LogListener;
29 import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
30 import org.eclipse.team.internal.ccvs.core.filehistory.CVSResourceVariantFileRevision;
31 import org.eclipse.team.internal.ccvs.core.filesystem.CVSURI;
32 import org.eclipse.team.internal.ccvs.core.syncinfo.*;
33
34 /**
35  * This class provides the implementation of ICVSRemoteFile and IManagedFile for
36  * use by the repository and sync view.
37  */

38 public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
39     
40     /*
41      * Listener for accumulating the entries fetched using the "cvs log" command
42      */

43     private final class LogEntryListener implements ILogEntryListener {
44         private final List entries = new ArrayList();
45         public void handleLogEntryReceived(ILogEntry entry) {
46             if (entry.getRemoteFile().getRepositoryRelativePath().equals(getRepositoryRelativePath())) {
47                 entries.add(entry);
48             }
49         }
50         public ILogEntry[] getEntries() {
51             return (ILogEntry[])entries.toArray(new ILogEntry[entries.size()]);
52         }
53     }
54
55     // sync info in byte form
56
private byte[] syncBytes;
57     // cache the log entry for the remote file
58
private ILogEntry entry;
59     // state that indicates that the handle is actively fetching content
60
private boolean fetching = false;
61     // executable bit
62
private boolean executable = false;
63             
64     /**
65      * Static method which creates a file as a single child of its parent.
66      * This should only be used when one is only interested in the file alone.
67      *
68      * The returned RemoteFile represents the base of the local resource.
69      * If the local resource does not have a base, then null is returned
70      * even if the resource does exists remotely (e.g. created by another party).
71      */

72     public static RemoteFile getBase(RemoteFolder parent, ICVSFile managed) throws CVSException {
73         Assert.isNotNull(parent, "A parent folder must be provided for file " + managed.getName()); //$NON-NLS-1$
74
byte[] syncBytes = managed.getSyncBytes();
75         if ((syncBytes == null) || ResourceSyncInfo.isAddition(syncBytes)) {
76             // Either the file is unmanaged or has just been added (i.e. doesn't necessarily have a remote)
77
return null;
78         }
79         if (ResourceSyncInfo.isDeletion(syncBytes)) {
80             syncBytes = ResourceSyncInfo.convertFromDeletion(syncBytes);
81         }
82         RemoteFile file = new RemoteFile(parent, syncBytes);
83         parent.setChildren(new ICVSRemoteResource[] {file});
84         return file;
85     }
86     
87     /**
88      * This method is used by the CVS subscribers to create file handles.
89      */

90     public static RemoteFile fromBytes(IResource local, byte[] bytes, byte[] parentBytes) throws CVSException {
91         Assert.isNotNull(bytes);
92         Assert.isTrue(local.getType() == IResource.FILE);
93         RemoteFolder parent = RemoteFolder.fromBytes(local.getParent(), parentBytes);
94         RemoteFile file = new RemoteFile(parent, bytes);
95         parent.setChildren(new ICVSRemoteResource[] {file});
96         return file;
97     }
98     
99     /**
100      * Create a remote file handle for the given file path that is relative to the
101      * given location.
102      */

103     public static RemoteFile create(String JavaDoc filePath, ICVSRepositoryLocation location) {
104         return create(filePath, location, null, null);
105     }
106     
107     /**
108      * Create a remote file handle for the given file path that is relative to the
109      * given location.
110      */

111     public static RemoteFile create(String JavaDoc filePath, ICVSRepositoryLocation location, CVSTag tag, String JavaDoc revision) {
112         Assert.isNotNull(filePath);
113         Assert.isNotNull(location);
114         IPath path = new Path(null, filePath);
115         RemoteFolder parent = new RemoteFolder(null /* parent */, location, path.removeLastSegments(1).toString(), tag /* tag */);
116         RemoteFile file = new RemoteFile(parent, Update.STATE_NONE, path.lastSegment(), revision /* revision */, null /* keyword mode */, tag /* tag */);
117         parent.setChildren(new ICVSRemoteResource[] {file});
118         return file;
119     }
120     
121     /**
122      * Constructor for RemoteFile that should be used when nothing is know about the
123      * file ahead of time.
124      * @param parent the folder that is the parent of the file
125      * @param workspaceSyncState the workspace state (use Update.STATE_NONE if unknown)
126      * @param name the name of the file
127      * @param revision revision of the file or <code>null</code> if the revision is not known
128      * @param keywordMode keyword mode of the file or <code>null</code> if the mode is not known
129      * @param tag tag for the file
130      */

131     public RemoteFile(RemoteFolder parent, int workspaceSyncState, String JavaDoc name, String JavaDoc revision, KSubstOption keywordMode, CVSTag tag) {
132         this(parent, name, workspaceSyncState, getSyncBytes(name, revision, keywordMode, tag));
133     }
134     
135     private static byte[] getSyncBytes(String JavaDoc name, String JavaDoc revision, KSubstOption keywordMode, CVSTag tag) {
136         if (revision == null) {
137             revision = ResourceSyncInfo.ADDED_REVISION;
138         }
139         if (keywordMode == null) {
140             // Always use a blank mode for remote files so that
141
// the proper mode will be obtained when the contents
142
// are fetched
143
keywordMode = KSubstOption.fromMode(""); //$NON-NLS-1$
144
}
145         MutableResourceSyncInfo newInfo = new MutableResourceSyncInfo(name, revision);
146         newInfo.setKeywordMode(keywordMode);
147         newInfo.setTag(tag);
148         return newInfo.getBytes();
149     }
150     
151     public RemoteFile(RemoteFolder parent, byte[] syncBytes) throws CVSException {
152         this(parent, Update.STATE_NONE, syncBytes);
153     }
154     
155     /* package */ RemoteFile(RemoteFolder parent, int workspaceSyncState, byte[] syncBytes) throws CVSException {
156         this(parent, ResourceSyncInfo.getName(syncBytes), workspaceSyncState, syncBytes);
157     }
158
159     private RemoteFile(RemoteFolder parent, String JavaDoc name, int workspaceSyncState, byte[] syncBytes) {
160         super(parent, name);
161         this.syncBytes = syncBytes;
162         setWorkspaceSyncState(workspaceSyncState);
163     }
164
165     /**
166      * @see ICVSResource#accept(ICVSResourceVisitor)
167      */

168     public void accept(ICVSResourceVisitor visitor) throws CVSException {
169         visitor.visitFile(this);
170     }
171
172     /**
173      * @see ICVSResource#accept(ICVSResourceVisitor, boolean)
174      */

175     public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException {
176         visitor.visitFile(this);
177     }
178     
179     /**
180      * @see ICVSRemoteFile#getContents()
181      */

182     public InputStream JavaDoc getContents(IProgressMonitor monitor) throws CVSException {
183         try {
184             return getStorage(monitor).getContents();
185         } catch (CoreException e) {
186             throw CVSException.wrapException(e);
187         }
188     }
189     
190     protected void fetchContents(IProgressMonitor monitor) throws TeamException {
191         try {
192             aboutToReceiveContents(getSyncBytes());
193             internalFetchContents(monitor);
194             // If the fetch succeeded but no contents were cached from the server
195
// than we can assume that the remote file has no contents.
196
if (!isContentsCached()) {
197                 setContents(new ByteArrayInputStream JavaDoc(new byte[0]), monitor);
198             }
199         } finally {
200             doneReceivingContents();
201         }
202     }
203     
204     private void internalFetchContents(IProgressMonitor monitor) throws CVSException {
205         monitor.beginTask(CVSMessages.RemoteFile_getContents, 100);
206         monitor.subTask(CVSMessages.RemoteFile_getContents);
207         if (getRevision().equals(ResourceSyncInfo.ADDED_REVISION)) {
208             // The revision of the remote file is not known so we need to use the tag to get the status of the file
209
CVSTag tag = getSyncInfo().getTag();
210             if (tag == null) tag = CVSTag.DEFAULT;
211             RemoteFolderMemberFetcher fetcher = new RemoteFolderMemberFetcher((RemoteFolder)getParent(), tag);
212             fetcher.updateFileRevisions(new ICVSFile[] { this }, Policy.subMonitorFor(monitor, 10));
213         }
214         Session session = new Session(getRepository(), parent, false /* create backups */);
215         session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
216         try {
217             IStatus status = Command.UPDATE.execute(
218                 session,
219                 Command.NO_GLOBAL_OPTIONS,
220                 new LocalOption[] {
221                     Update.makeTagOption(new CVSTag(getRevision(), CVSTag.VERSION)),
222                     Update.IGNORE_LOCAL_CHANGES },
223                 new ICVSResource[] { this },
224                 null,
225                 Policy.subMonitorFor(monitor, 80));
226             if (status.getCode() == CVSStatus.SERVER_ERROR) {
227                 throw new CVSServerException(status);
228             }
229         } finally {
230             session.close();
231             monitor.done();
232         }
233     }
234
235     /*
236      * @see ICVSRemoteFile#getLogEntry(IProgressMonitor)
237      */

238     public ILogEntry getLogEntry(IProgressMonitor monitor) throws CVSException {
239         if (entry == null) {
240             monitor = Policy.monitorFor(monitor);
241             monitor.beginTask(CVSMessages.RemoteFile_getLogEntries, 100);
242             Session session = new Session(getRepository(), parent, false /* output to console */);
243             session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
244             try {
245                 try {
246                     LogEntryListener listener = new LogEntryListener();
247                     IStatus status = Command.LOG.execute(
248                         session,
249                         Command.NO_GLOBAL_OPTIONS,
250                         new LocalOption[] {
251                             Log.makeRevisionOption(getRevision())},
252                         new ICVSResource[] { RemoteFile.this },
253                         new LogListener(RemoteFile.this, listener),
254                         Policy.subMonitorFor(monitor, 90));
255                     ILogEntry[] entries = listener.getEntries();
256                     if (entries.length == 1) {
257                         entry = entries[0];
258                     }
259                     if (status.getCode() == CVSStatus.SERVER_ERROR) {
260                         throw new CVSServerException(status);
261                     }
262                 } finally {
263                     monitor.done();
264                 }
265             } finally {
266                 session.close();
267             }
268         }
269         return entry;
270     }
271     
272     /**
273      * @see ICVSRemoteFile#getLogEntries()
274      */

275     public ILogEntry[] getLogEntries(IProgressMonitor monitor) throws CVSException {
276         monitor = Policy.monitorFor(monitor);
277         monitor.beginTask(CVSMessages.RemoteFile_getLogEntries, 100);
278         Session session = new Session(getRepository(), parent, false /* output to console */);
279         session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
280         try {
281             QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
282             try {
283                 CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
284                 LogEntryListener listener = new LogEntryListener();
285                 IStatus status = Command.LOG.execute(
286                     session,
287                     Command.NO_GLOBAL_OPTIONS, Command.NO_LOCAL_OPTIONS,
288                     new ICVSResource[] { RemoteFile.this }, new LogListener(RemoteFile.this, listener),
289                     Policy.subMonitorFor(monitor, 90));
290                 if (status.getCode() == CVSStatus.SERVER_ERROR) {
291                     throw new CVSServerException(status);
292                 }
293                 return listener.getEntries();
294             } finally {
295                 CVSProviderPlugin.getPlugin().setQuietness(quietness);
296                 monitor.done();
297             }
298         } finally {
299             session.close();
300         }
301     }
302     
303     /**
304      * @see ICVSRemoteFile#getRevision()
305      */

306     public String JavaDoc getRevision() {
307         try {
308             return ResourceSyncInfo.getRevision(syncBytes);
309         } catch (CVSException e) {
310             CVSProviderPlugin.log(e);
311             return ResourceSyncInfo.ADDED_REVISION;
312         }
313     }
314     
315     private KSubstOption getKeywordMode() {
316         try {
317             return ResourceSyncInfo.getKeywordMode(syncBytes);
318         } catch (CVSException e) {
319             CVSProviderPlugin.log(e);
320             return KSubstOption.getDefaultTextMode();
321         }
322     }
323     
324     /*
325      * Get a different revision of the remote file.
326      *
327      * We must also create a new parent since the child is accessed through the parent from within CVS commands.
328      * Therefore, we need a new parent so that we can fetch the contents of the remote file revision
329      */

330     public RemoteFile toRevision(String JavaDoc revision) {
331         RemoteFolder newParent = new RemoteFolder(null, parent.getRepository(), parent.getRepositoryRelativePath(), parent.getTag());
332         RemoteFile file = new RemoteFile(newParent, getWorkspaceSyncState(), getName(), revision, getKeywordMode(), CVSTag.DEFAULT);
333         newParent.setChildren(new ICVSRemoteResource[] {file});
334         return file;
335     }
336
337     /**
338      * @see ICVSFile#getSyncInfo()
339      */

340     public ResourceSyncInfo getSyncInfo() {
341         try {
342             return new ResourceSyncInfo(syncBytes);
343         } catch (CVSException e) {
344             CVSProviderPlugin.log(e);
345             return null;
346         }
347     }
348     
349     /**
350      * @see ICVSResource#getRemoteLocation(ICVSFolder)
351      */

352     public String JavaDoc getRemoteLocation(ICVSFolder stopSearching) throws CVSException {
353         return parent.getRemoteLocation(stopSearching) + Session.SERVER_SEPARATOR + getName();
354     }
355     
356     /**
357      * Get the remote path for the receiver relative to the repository location path
358      */

359     public String JavaDoc getRepositoryRelativePath() {
360         String JavaDoc parentPath = parent.getRepositoryRelativePath();
361         return parentPath + Session.SERVER_SEPARATOR + getName();
362     }
363     
364     /**
365      * Return the server root directory for the repository
366      */

367     public ICVSRepositoryLocation getRepository() {
368         return parent.getRepository();
369     }
370     
371     /**
372      * @see IManagedFile#setFileInfo(FileProperties)
373      */

374     public void setSyncInfo(ResourceSyncInfo fileInfo, int modificationState) {
375         setSyncBytes(fileInfo.getBytes(),modificationState);
376     }
377
378     /**
379      * Set the revision for this remote file.
380      *
381      * @param revision to associated with this remote file
382      */

383     public void setRevision(String JavaDoc revision) throws CVSException {
384         syncBytes = ResourceSyncInfo.setRevision(syncBytes, revision);
385     }
386     
387     public InputStream JavaDoc getContents() throws CVSException {
388         if (!fetching) {
389             // Return the cached contents
390
if (isContentsCached()) {
391                 try {
392                     InputStream JavaDoc cached = getCachedContents();
393                     if (cached != null) {
394                         return cached;
395                     }
396                 } catch (TeamException e) {
397                     throw CVSException.wrapException(e);
398                 }
399             }
400         }
401         // There was nothing cached so return an empty stream.
402
// This is done to allow the contents to be fetched
403
// (i.e. update sends empty contents and real contents are sent back)
404
return new ByteArrayInputStream JavaDoc(new byte[0]);
405     }
406
407     protected InputStream JavaDoc getCachedContents() throws TeamException {
408         if (isHandleCached()) {
409             RemoteFile file = (RemoteFile)getCachedHandle();
410             if (file != null) {
411                 byte[] newSyncBytes = file.getSyncBytes();
412                 if (newSyncBytes != null) {
413                     // Make sure the sync bytes match the content that is being accessed
414
syncBytes = newSyncBytes;
415                 }
416             }
417         }
418         return super.getCachedContents();
419     }
420     
421     public void setContents(InputStream JavaDoc stream, int responseType, boolean keepLocalHistory, IProgressMonitor monitor) throws CVSException {
422         try {
423             setContents(stream, monitor);
424         } catch (TeamException e) {
425             throw CVSException.wrapException(e);
426         }
427     }
428     
429     /*
430      * @see ICVSFile#setReadOnly(boolean)
431      */

432     public void setReadOnly(boolean readOnly) {
433         // RemoteFiles are always read only
434
}
435
436     /*
437      * @see ICVSFile#isReadOnly()
438      */

439     public boolean isReadOnly() {
440         return true;
441     }
442     
443     /*
444      * @see ICVSFile#getTimeStamp()
445      */

446     public Date getTimeStamp() {
447         return getSyncInfo().getTimeStamp();
448     }
449
450     /*
451      * @see ICVSFile#setTimeStamp(Date)
452      */

453     public void setTimeStamp(Date date) {
454         // RemoteFiles are not muttable so do not support timestamp changes
455
}
456
457     /**
458      * @see ICVSFile#moveTo(String)
459      */

460     public void copyTo(String JavaDoc mFile) {
461         // Do nothing
462
}
463     
464     /*
465      * @see IRemoteResource#members(IProgressMonitor)
466      */

467     public ICVSRemoteResource[] members(IProgressMonitor progress) {
468         return new ICVSRemoteResource[0];
469     }
470
471     /*
472      * @see IRemoteResource#isContainer()
473      */

474     public boolean isContainer() {
475         return false;
476     }
477
478     /*
479      * @see ICVSResource#isFolder()
480      */

481     public boolean isFolder() {
482         return false;
483     }
484     
485     /*
486      * @see ICVSResource#tag(CVSTag, LocalOption[], IProgressMonitor)
487      *
488      * The revision of the remote file is used as the base for the tagging operation
489      */

490      public IStatus tag(final CVSTag tag, final LocalOption[] localOptions, IProgressMonitor monitor) throws CVSException {
491         monitor = Policy.monitorFor(monitor);
492         monitor.beginTask(null, 100);
493         Session session = new Session(getRepository(), getParent(), true /* output to console */);
494         session.open(Policy.subMonitorFor(monitor, 10), true /* open for modification */);
495         try {
496             return Command.RTAG.execute(
497                 session,
498                 Command.NO_GLOBAL_OPTIONS,
499                 localOptions,
500                 new CVSTag(getRevision(), CVSTag.VERSION),
501                 tag,
502                 new ICVSRemoteResource[] { RemoteFile.this },
503             Policy.subMonitorFor(monitor, 90));
504         } finally {
505             session.close();
506         }
507      }
508     
509     public boolean equals(Object JavaDoc target) {
510         if (this == target)
511             return true;
512         if (!(target instanceof RemoteFile))
513             return false;
514         RemoteFile remote = (RemoteFile) target;
515         return super.equals(target) && remote.getRevision().equals(getRevision());
516     }
517
518     /**
519      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#checkout(int)
520      */

521     public void edit(int notifications, boolean notifyForWritable, IProgressMonitor monitor) {
522         // do nothing
523
}
524
525     /**
526      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#uncheckout()
527      */

528     public void unedit(IProgressMonitor monitor) {
529         // do nothing
530
}
531
532     /**
533      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#notificationCompleted()
534      */

535     public void notificationCompleted() {
536         // do nothing
537
}
538
539     /**
540      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getPendingNotification()
541      */

542     public NotifyInfo getPendingNotification() {
543         return null;
544     }
545
546     /**
547      * @see RemoteResource#forTag(ICVSRemoteFolder, CVSTag)
548      */

549     public ICVSRemoteResource forTag(ICVSRemoteFolder parent, CVSTag tag) {
550         return new RemoteFile((RemoteFolder)parent, getWorkspaceSyncState(), getName(), getRevision(), getKeywordMode(), tag);
551     }
552
553     /**
554      * @see org.eclipse.team.internal.ccvs.core.ICVSRemoteResource#forTag(org.eclipse.team.internal.ccvs.core.CVSTag)
555      */

556     public ICVSRemoteResource forTag(CVSTag tag) {
557         RemoteFolderTree remoteFolder = new RemoteFolderTree(null, getRepository(),
558             ((ICVSRemoteFolder)getParent()).getRepositoryRelativePath(),
559             tag);
560         RemoteFile remoteFile = (RemoteFile)forTag(remoteFolder, tag);
561         remoteFolder.setChildren(new ICVSRemoteResource[] { remoteFile });
562         return remoteFile;
563     }
564     /**
565      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#committed(org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo)
566      */

567     public void checkedIn(String JavaDoc info, boolean commit) {
568         // do nothing
569
}
570     /**
571      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#isEdited()
572      */

573     public boolean isEdited() {
574         return false;
575     }
576     /**
577      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getSyncBytes()
578      */

579     public byte[] getSyncBytes() {
580         return syncBytes;
581     }
582     /**
583      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#setSyncBytes(byte[])
584      */

585     public void setSyncBytes(byte[] syncBytes, int modificationState) {
586         if (fetching) {
587             RemoteFile file = (RemoteFile)getCachedHandle();
588             if (file == null) {
589                 cacheHandle();
590             } else if (file != this) {
591                 file.setSyncBytes(syncBytes, modificationState);
592             }
593         }
594         this.syncBytes = syncBytes;
595     }
596
597     public String JavaDoc toString() {
598         return super.toString() + " " + getRevision(); //$NON-NLS-1$
599
}
600
601     /* (non-Javadoc)
602      * @see org.eclipse.team.core.sync.IRemoteResource#getContentIdentifier()
603      */

604     public String JavaDoc getContentIdentifier() {
605         return getRevision();
606     }
607
608     /**
609      * Callback which indicates that the remote file is about to receive contents that should be cached
610      * @param entryLine
611      */

612     public void aboutToReceiveContents(byte[] entryLine) {
613         setSyncBytes(entryLine, ICVSFile.CLEAN);
614         fetching = true;
615     }
616
617     /**
618      * The contents for the file have already been provided.
619      */

620     public void doneReceivingContents() {
621         fetching = false;
622     }
623     
624     /* (non-Javadoc)
625      * @see org.eclipse.team.core.synchronize.ResourceVariant#isContentsCached()
626      */

627     public boolean isContentsCached() {
628         // Made public for use by FileContentCachingService
629
return super.isContentsCached();
630     }
631
632     /**
633      * Cache the contents of the given IFile as the contents for this remote file handle.
634      * The caller must ensure that the local file is mapped to the same revision and is
635      * not modified since it was loaded from CVS.
636      * @param file
637      * @throws CoreException
638      * @throws TeamException
639      */

640     public void setContents(IFile file, IProgressMonitor monitor) throws TeamException, CoreException {
641         setContents(file.getContents(), monitor);
642     }
643
644     /* (non-Javadoc)
645      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#setExecutable(boolean)
646      */

647     public void setExecutable(boolean executable) throws CVSException {
648         // store executable bit;
649
this.executable = executable;
650         RemoteFile file = (RemoteFile)getCachedHandle();
651         if (file != this) {
652             file.setExecutable(executable);
653         }
654     }
655
656     /* (non-Javadoc)
657      * @see org.eclipse.team.internal.ccvs.core.ICVSFile#isExecutable()
658      */

659     public boolean isExecutable() throws CVSException {
660         // return executable bit
661
return executable;
662     }
663     
664     public CachedResourceVariant getCachedHandle() {
665         return super.getCachedHandle();
666     }
667     
668     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
669         if (adapter == IFileRevision.class)
670             return new CVSResourceVariantFileRevision(this);
671         return super.getAdapter(adapter);
672     }
673     
674     public CVSURI toCVSURI() {
675         ResourceSyncInfo info = getSyncInfo();
676         return new CVSURI(getRepository(), new Path(getRepositoryRelativePath()), info.getTag(), info.getRevision());
677     }
678 }
679
Popular Tags