org.eclipse.team.cvs.core_3.3.400.I20110510-0800

    throws CVSException
  {
    this(parent, 0, syncBytes);
  }
  
  RemoteFile(RemoteFolder parent, int workspaceSyncState, byte[] syncBytes)
    throws CVSException
  {
    this(parent, ResourceSyncInfo.getName(syncBytes), workspaceSyncState, syncBytes);
  }
  
  private RemoteFile(RemoteFolder parent, String name, int workspaceSyncState, byte[] syncBytes)
  {
    super(parent, name);
    this.syncBytes = syncBytes;
    setWorkspaceSyncState(workspaceSyncState);
  }
  
  public void accept(ICVSResourceVisitor visitor)
    throws CVSException
  {
    visitor.visitFile(this);
  }
  
  public void accept(ICVSResourceVisitor visitor, boolean recurse)
    throws CVSException
  {
    visitor.visitFile(this);
  }
  
  public InputStream getContents(IProgressMonitor monitor)
    throws CVSException
  {
    try
    {
      return getStorage(monitor).getContents();
    }
    catch (CoreException e)
    {
      throw CVSException.wrapException(e);
    }
  }
  
  /* Error */
  protected void fetchContents(IProgressMonitor monitor)
    throws TeamException
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_0
    //   2: invokevirtual 578	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:getSyncBytes	()[B
    //   5: invokevirtual 581	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:aboutToReceiveContents	([B)V
    //   8: aload_0
    //   9: aload_1
    //   10: invokespecial 587	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:internalFetchContents	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   13: aload_0
    //   14: invokevirtual 576	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:isContentsCached	()Z
    //   17: ifne +28 -> 45
    //   20: aload_0
    //   21: new 241	java/io/ByteArrayInputStream
    //   24: dup
    //   25: iconst_0
    //   26: newarray <illegal type>
    //   28: invokespecial 536	java/io/ByteArrayInputStream:<init>	([B)V
    //   31: aload_1
    //   32: invokevirtual 597	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:setContents	(Ljava/io/InputStream;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   35: goto +10 -> 45
    //   38: astore_2
    //   39: aload_0
    //   40: invokevirtual 575	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:doneReceivingContents	()V
    //   43: aload_2
    //   44: athrow
    //   45: aload_0
    //   46: invokevirtual 575	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:doneReceivingContents	()V
    //   49: return
    // Line number table:
    //   Java source line #194	-> byte code offset #0
    //   Java source line #195	-> byte code offset #8
    //   Java source line #198	-> byte code offset #13
    //   Java source line #199	-> byte code offset #20
    //   Java source line #201	-> byte code offset #38
    //   Java source line #202	-> byte code offset #39
    //   Java source line #203	-> byte code offset #43
    //   Java source line #202	-> byte code offset #45
    //   Java source line #204	-> byte code offset #49
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	50	0	this	RemoteFile
    //   0	50	1	monitor	IProgressMonitor
    //   38	6	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	38	38	finally
  }
  
  private void internalFetchContents(IProgressMonitor monitor)
    throws CVSException
  {
    monitor.beginTask(CVSMessages.RemoteFile_getContents, 100);
    monitor.subTask(CVSMessages.RemoteFile_getContents);
    if (getRevision().equals("0"))
    {
      CVSTag tag = getSyncInfo().getTag();
      if (tag == null) {
        tag = CVSTag.DEFAULT;
      }
      RemoteFolderMemberFetcher fetcher = new RemoteFolderMemberFetcher((RemoteFolder)getParent(), tag);
      fetcher.updateFileRevisions(new ICVSFile[] { this }, Policy.subMonitorFor(monitor, 10));
    }
    Session session = new Session(getRepository(), parent, false);
    session.open(Policy.subMonitorFor(monitor, 10), false);
    try
    {
      IStatus status = Command.UPDATE.execute(
        session, 
        Command.NO_GLOBAL_OPTIONS, 
        new Command.LocalOption[] {
        Update.makeTagOption(new CVSTag(getRevision(), 2)), 
        Update.IGNORE_LOCAL_CHANGES }, 
        new ICVSResource[] { this }, 
        null, 
        Policy.subMonitorFor(monitor, 80));
      if (status.getCode() == -10) {
        throw new CVSServerException(status);
      }
    }
    finally
    {
      session.close();
      monitor.done();
    }
    session.close();
    monitor.done();
  }
  
  /* Error */
  public ILogEntry getLogEntry(IProgressMonitor monitor)
    throws CVSException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 534	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:entry	Lorg/eclipse/team/internal/ccvs/core/ILogEntry;
    //   4: ifnonnull +182 -> 186
    //   7: aload_1
    //   8: invokestatic 557	org/eclipse/team/internal/ccvs/core/Policy:monitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   11: astore_1
    //   12: aload_1
    //   13: getstatic 521	org/eclipse/team/internal/ccvs/core/CVSMessages:RemoteFile_getLogEntries	Ljava/lang/String;
    //   16: bipush 100
    //   18: invokeinterface 648 3 0
    //   23: new 276	org/eclipse/team/internal/ccvs/core/client/Session
    //   26: dup
    //   27: aload_0
    //   28: invokevirtual 590	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:getRepository	()Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;
    //   31: aload_0
    //   32: getfield 535	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:parent	Lorg/eclipse/team/internal/ccvs/core/resources/RemoteFolder;
    //   35: iconst_0
    //   36: invokespecial 566	org/eclipse/team/internal/ccvs/core/client/Session:<init>	(Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;Z)V
    //   39: astore_2
    //   40: aload_2
    //   41: aload_1
    //   42: bipush 10
    //   44: invokestatic 558	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   47: iconst_0
    //   48: invokevirtual 565	org/eclipse/team/internal/ccvs/core/client/Session:open	(Lorg/eclipse/core/runtime/IProgressMonitor;Z)V
    //   51: new 283	org/eclipse/team/internal/ccvs/core/resources/RemoteFile$LogEntryListener
    //   54: dup
    //   55: aload_0
    //   56: aconst_null
    //   57: invokespecial 603	org/eclipse/team/internal/ccvs/core/resources/RemoteFile$LogEntryListener:<init>	(Lorg/eclipse/team/internal/ccvs/core/resources/RemoteFile;Lorg/eclipse/team/internal/ccvs/core/resources/RemoteFile$LogEntryListener;)V
    //   60: astore_3
    //   61: getstatic 526	org/eclipse/team/internal/ccvs/core/client/Command:LOG	Lorg/eclipse/team/internal/ccvs/core/client/Log;
    //   64: aload_2
    //   65: getstatic 523	org/eclipse/team/internal/ccvs/core/client/Command:NO_GLOBAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;
    //   68: iconst_1
    //   69: anewarray 272	org/eclipse/team/internal/ccvs/core/client/Command$LocalOption
    //   72: dup
    //   73: iconst_0
    //   74: aload_0
    //   75: invokevirtual 586	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:getRevision	()Ljava/lang/String;
    //   78: invokestatic 561	org/eclipse/team/internal/ccvs/core/client/Log:makeRevisionOption	(Ljava/lang/String;)Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;
    //   81: aastore
    //   82: iconst_1
    //   83: anewarray 266	org/eclipse/team/internal/ccvs/core/ICVSResource
    //   86: dup
    //   87: iconst_0
    //   88: aload_0
    //   89: aastore
    //   90: new 278	org/eclipse/team/internal/ccvs/core/client/listeners/LogListener
    //   93: dup
    //   94: aload_0
    //   95: aload_3
    //   96: invokespecial 569	org/eclipse/team/internal/ccvs/core/client/listeners/LogListener:<init>	(Lorg/eclipse/team/internal/ccvs/core/resources/RemoteFile;Lorg/eclipse/team/internal/ccvs/core/client/listeners/ILogEntryListener;)V
    //   99: aload_1
    //   100: bipush 90
    //   102: invokestatic 558	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   105: invokevirtual 562	org/eclipse/team/internal/ccvs/core/client/Log:execute	(Lorg/eclipse/team/internal/ccvs/core/client/Session;[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;[Lorg/eclipse/team/internal/ccvs/core/ICVSResource;Lorg/eclipse/team/internal/ccvs/core/client/listeners/ICommandOutputListener;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
    //   108: astore 4
    //   110: aload_3
    //   111: invokevirtual 602	org/eclipse/team/internal/ccvs/core/resources/RemoteFile$LogEntryListener:getEntries	()[Lorg/eclipse/team/internal/ccvs/core/ILogEntry;
    //   114: astore 5
    //   116: aload 5
    //   118: arraylength
    //   119: iconst_1
    //   120: if_icmpne +11 -> 131
    //   123: aload_0
    //   124: aload 5
    //   126: iconst_0
    //   127: aaload
    //   128: putfield 534	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:entry	Lorg/eclipse/team/internal/ccvs/core/ILogEntry;
    //   131: aload 4
    //   133: invokeinterface 649 1 0
    //   138: bipush -10
    //   140: if_icmpne +24 -> 164
    //   143: new 279	org/eclipse/team/internal/ccvs/core/connection/CVSServerException
    //   146: dup
    //   147: aload 4
    //   149: invokespecial 570	org/eclipse/team/internal/ccvs/core/connection/CVSServerException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   152: athrow
    //   153: astore 6
    //   155: aload_1
    //   156: invokeinterface 646 1 0
    //   161: aload 6
    //   163: athrow
    //   164: aload_1
    //   165: invokeinterface 646 1 0
    //   170: goto +12 -> 182
    //   173: astore 7
    //   175: aload_2
    //   176: invokevirtual 564	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   179: aload 7
    //   181: athrow
    //   182: aload_2
    //   183: invokevirtual 564	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   186: aload_0
    //   187: getfield 534	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:entry	Lorg/eclipse/team/internal/ccvs/core/ILogEntry;
    //   190: areturn
    // Line number table:
    //   Java source line #241	-> byte code offset #0
    //   Java source line #242	-> byte code offset #7
    //   Java source line #243	-> byte code offset #12
    //   Java source line #244	-> byte code offset #23
    //   Java source line #245	-> byte code offset #40
    //   Java source line #248	-> byte code offset #51
    //   Java source line #249	-> byte code offset #61
    //   Java source line #250	-> byte code offset #64
    //   Java source line #251	-> byte code offset #65
    //   Java source line #252	-> byte code offset #68
    //   Java source line #253	-> byte code offset #74
    //   Java source line #254	-> byte code offset #82
    //   Java source line #255	-> byte code offset #90
    //   Java source line #256	-> byte code offset #99
    //   Java source line #249	-> byte code offset #105
    //   Java source line #257	-> byte code offset #110
    //   Java source line #258	-> byte code offset #116
    //   Java source line #259	-> byte code offset #123
    //   Java source line #261	-> byte code offset #131
    //   Java source line #262	-> byte code offset #143
    //   Java source line #264	-> byte code offset #153
    //   Java source line #265	-> byte code offset #155
    //   Java source line #266	-> byte code offset #161
    //   Java source line #265	-> byte code offset #164
    //   Java source line #267	-> byte code offset #173
    //   Java source line #268	-> byte code offset #175
    //   Java source line #269	-> byte code offset #179
    //   Java source line #268	-> byte code offset #182
    //   Java source line #271	-> byte code offset #186
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	191	0	this	RemoteFile
    //   0	191	1	monitor	IProgressMonitor
    //   39	144	2	session	Session
    //   60	51	3	listener	LogEntryListener
    //   108	40	4	status	IStatus
    //   114	11	5	entries	ILogEntry[]
    //   153	9	6	localObject1	Object
    //   173	7	7	localObject2	Object
    // Exception table:
    //   from	to	target	type
    //   51	153	153	finally
    //   51	173	173	finally
  }
  
  /* Error */
  public ILogEntry[] getLogEntries(IProgressMonitor monitor)
    throws CVSException
  {
    // Byte code:
    //   0: aload_1
    //   1: invokestatic 557	org/eclipse/team/internal/ccvs/core/Policy:monitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   4: astore_1
    //   5: aload_1
    //   6: getstatic 521	org/eclipse/team/internal/ccvs/core/CVSMessages:RemoteFile_getLogEntries	Ljava/lang/String;
    //   9: bipush 100
    //   11: invokeinterface 648 3 0
    //   16: new 276	org/eclipse/team/internal/ccvs/core/client/Session
    //   19: dup
    //   20: aload_0
    //   21: invokevirtual 590	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:getRepository	()Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;
    //   24: aload_0
    //   25: getfield 535	org/eclipse/team/internal/ccvs/core/resources/RemoteFile:parent	Lorg/eclipse/team/internal/ccvs/core/resources/RemoteFolder;
    //   28: iconst_0
    //   29: invokespecial 566	org/eclipse/team/internal/ccvs/core/client/Session:<init>	(Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;Z)V
    //   32: astore_2
    //   33: aload_2
    //   34: aload_1
    //   35: bipush 10
    //   37: invokestatic 558	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   40: iconst_0
    //   41: invokevirtual 565	org/eclipse/team/internal/ccvs/core/client/Session:open	(Lorg/eclipse/core/runtime/IProgressMonitor;Z)V
    //   44: invokestatic 552	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:getPlugin	()Lorg/eclipse/team/internal/ccvs/core/CVSProviderPlugin;
    //   47: invokevirtual 553	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:getQuietness	()Lorg/eclipse/team/internal/ccvs/core/client/Command$QuietOption;
    //   50: astore_3
    //   51: invokestatic 552	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:getPlugin	()Lorg/eclipse/team/internal/ccvs/core/CVSProviderPlugin;
    //   54: getstatic 525	org/eclipse/team/internal/ccvs/core/client/Command:VERBOSE	Lorg/eclipse/team/internal/ccvs/core/client/Command$QuietOption;
    //   57: invokevirtual 554	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:setQuietness	(Lorg/eclipse/team/internal/ccvs/core/client/Command$QuietOption;)V
    //   60: new 283	org/eclipse/team/internal/ccvs/core/resources/RemoteFile$LogEntryListener
    //   63: dup
    //   64: aload_0
    //   65: aconst_null
    //   66: invokespecial 603	org/eclipse/team/internal/ccvs/core/resources/RemoteFile$LogEntryListener:<init>	(Lorg/eclipse/team/internal/ccvs/core/resources/RemoteFile;Lorg/eclipse/team/internal/ccvs/core/resources/RemoteFile$LogEntryListener;)V
    //   69: astore 4
    //   71: getstatic 526	org/eclipse/team/internal/ccvs/core/client/Command:LOG	Lorg/eclipse/team/internal/ccvs/core/client/Log;
    //   74: aload_2
    //   75: getstatic 523	org/eclipse/team/internal/ccvs/core/client/Command:NO_GLOBAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;
    //   78: getstatic 524	org/eclipse/team/internal/ccvs/core/client/Command:NO_LOCAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;
    //   81: iconst_1
    //   82: anewarray 266	org/eclipse/team/internal/ccvs/core/ICVSResource
    //   85: dup
    //   86: iconst_0
    //   87: aload_0
    //   88: aastore
    //   89: new 278	org/eclipse/team/internal/ccvs/core/client/listeners/LogListener
    //   92: dup
    //   93: aload_0
    //   94: aload 4
    //   96: invokespecial 569	org/eclipse/team/internal/ccvs/core/client/listeners/LogListener:<init>	(Lorg/eclipse/team/internal/ccvs/core/resources/RemoteFile;Lorg/eclipse/team/internal/ccvs/core/client/listeners/ILogEntryListener;)V
    //   99: aload_1
    //   100: bipush 90
    //   102: invokestatic 558	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   105: invokevirtual 562	org/eclipse/team/internal/ccvs/core/client/Log:execute	(Lorg/eclipse/team/internal/ccvs/core/client/Session;[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;[Lorg/eclipse/team/internal/ccvs/core/ICVSResource;Lorg/eclipse/team/internal/ccvs/core/client/listeners/ICommandOutputListener;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
    //   108: astore 5
    //   110: aload 5
    //   112: invokeinterface 649 1 0
    //   117: bipush -10
    //   119: if_icmpne +13 -> 132
    //   122: new 279	org/eclipse/team/internal/ccvs/core/connection/CVSServerException
    //   125: dup
    //   126: aload 5
    //   128: invokespecial 570	org/eclipse/team/internal/ccvs/core/connection/CVSServerException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   131: athrow
    //   132: aload 4
    //   134: invokevirtual 602	org/eclipse/team/internal/ccvs/core/resources/RemoteFile$LogEntryListener:getEntries	()[Lorg/eclipse/team/internal/ccvs/core/ILogEntry;
    //   137: astore 7
    //   139: invokestatic 552	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:getPlugin	()Lorg/eclipse/team/internal/ccvs/core/CVSProviderPlugin;
    //   142: aload_3
    //   143: invokevirtual 554	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:setQuietness	(Lorg/eclipse/team/internal/ccvs/core/client/Command$QuietOption;)V
    //   146: aload_1
    //   147: invokeinterface 646 1 0
    //   152: aload_2
    //   153: invokevirtual 564	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   156: aload 7
    //   158: areturn
    //   159: astore 6
    //   161: invokestatic 552	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:getPlugin	()Lorg/eclipse/team/internal/ccvs/core/CVSProviderPlugin;
    //   164: aload_3
    //   165: invokevirtual 554	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:setQuietness	(Lorg/eclipse/team/internal/ccvs/core/client/Command$QuietOption;)V
    //   168: aload_1
    //   169: invokeinterface 646 1 0
    //   174: aload 6
    //   176: athrow
    //   177: astore 8
    //   179: aload_2
    //   180: invokevirtual 564	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   183: aload 8
    //   185: athrow
    // Line number table:
    //   Java source line #278	-> byte code offset #0
    //   Java source line #279	-> byte code offset #5
    //   Java source line #280	-> byte code offset #16
    //   Java source line #281	-> byte code offset #33
    //   Java source line #283	-> byte code offset #44
    //   Java source line #285	-> byte code offset #51
    //   Java source line #286	-> byte code offset #60
    //   Java source line #287	-> byte code offset #71
    //   Java source line #288	-> byte code offset #74
    //   Java source line #289	-> byte code offset #75
    //   Java source line #290	-> byte code offset #81
    //   Java source line #291	-> byte code offset #99
    //   Java source line #287	-> byte code offset #105
    //   Java source line #292	-> byte code offset #110
    //   Java source line #293	-> byte code offset #122
    //   Java source line #295	-> byte code offset #132
    //   Java source line #297	-> byte code offset #139
    //   Java source line #298	-> byte code offset #146
    //   Java source line #301	-> byte code offset #152
    //   Java source line #295	-> byte code offset #156
    //   Java source line #296	-> byte code offset #159
    //   Java source line #297	-> byte code offset #161
    //   Java source line #298	-> byte code offset #168
    //   Java source line #299	-> byte code offset #174
    //   Java source line #300	-> byte code offset #177
    //   Java source line #301	-> byte code offset #179
    //   Java source line #302	-> byte code offset #183
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	186	0	this	RemoteFile
    //   0	186	1	monitor	IProgressMonitor
    //   32	148	2	session	Session
    //   50	115	3	quietness	org.eclipse.team.internal.ccvs.core.client.Command.QuietOption
    //   69	64	4	listener	LogEntryListener
    //   108	19	5	status	IStatus
    //   159	16	6	localObject1	Object
    //   137	20	7	arrayOfILogEntry	ILogEntry[]
    //   177	7	8	localObject2	Object
    // Exception table:
    //   from	to	target	type
    //   51	139	159	finally
    //   44	152	177	finally
    //   159	177	177	finally
  }
  
  public String getRevision()
  {
    try
    {
      return ResourceSyncInfo.getRevision(syncBytes);
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    return "0";
  }
  
  private Command.KSubstOption getKeywordMode()
  {
    try
    {
      return ResourceSyncInfo.getKeywordMode(syncBytes);
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    return Command.KSubstOption.getDefaultTextMode();
  }
  
  public RemoteFile toRevision(String revision)
  {
    RemoteFolder newParent = new RemoteFolder(null, parent.getRepository(), parent.getRepositoryRelativePath(), parent.getTag());
    RemoteFile file = new RemoteFile(newParent, getWorkspaceSyncState(), getName(), revision, getKeywordMode(), CVSTag.DEFAULT);
    newParent.setChildren(new ICVSRemoteResource[] { file });
    return file;
  }
  
  public ResourceSyncInfo getSyncInfo()
  {
    try
    {
      return new ResourceSyncInfo(syncBytes);
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    return null;
  }
  
  public String getRemoteLocation(ICVSFolder stopSearching)
    throws CVSException
  {
    return parent.getRemoteLocation(stopSearching) + "/" + getName();
  }
  
  public String getRepositoryRelativePath()
  {
    String parentPath = parent.getRepositoryRelativePath();
    return parentPath + "/" + getName();
  }
  
  public ICVSRepositoryLocation getRepository()
  {
    return parent.getRepository();
  }
  
  public void setSyncInfo(ResourceSyncInfo fileInfo, int modificationState)
  {
    setSyncBytes(fileInfo.getBytes(), modificationState);
  }
  
  public void setRevision(String revision)
    throws CVSException
  {
    syncBytes = ResourceSyncInfo.setRevision(syncBytes, revision);
  }
  
  public InputStream getContents()
    throws CVSException
  {
    if (!fetching) {
      if (isContentsCached()) {
        try
        {
          InputStream cached = getCachedContents();
          if (cached != null) {
            return cached;
          }
        }
        catch (TeamException e)
        {
          throw CVSException.wrapException(e);
        }
      }
    }
    return new ByteArrayInputStream(new byte[0]);
  }
  
  protected InputStream getCachedContents()
    throws TeamException
  {
    if (isHandleCached())
    {
      RemoteFile file = (RemoteFile)getCachedHandle();
      if (file != null)
      {
        byte[] newSyncBytes = file.getSyncBytes();
        if (newSyncBytes != null) {
          syncBytes = newSyncBytes;
        }
      }
    }
    return super.getCachedContents();
  }
  
  public void setContents(InputStream stream, int responseType, boolean keepLocalHistory, IProgressMonitor monitor)
    throws CVSException
  {
    try
    {
      setContents(stream, monitor);
    }
    catch (TeamException e)
    {
      throw CVSException.wrapException(e);
    }
  }
  
  public void setReadOnly(boolean readOnly) {}
  
  public boolean isReadOnly()
  {
    return true;
  }
  
  public Date getTimeStamp()
  {
    return getSyncInfo().getTimeStamp();
  }
  
  public void setTimeStamp(Date date) {}
  
  public void copyTo(String mFile) {}
  
  public ICVSRemoteResource[] members(IProgressMonitor progress)
  {
    return new ICVSRemoteResource[0];
  }
  
  public boolean isContainer()
  {
    return false;
  }
  
  public boolean isFolder()
  {
    return false;
  }
  
  public IStatus tag(CVSTag tag, Command.LocalOption[] localOptions, IProgressMonitor monitor)
    throws CVSException
  {
    monitor = Policy.monitorFor(monitor);
    monitor.beginTask(null, 100);
    Session session = new Session(getRepository(), getParent(), true);
    session.open(Policy.subMonitorFor(monitor, 10), true);
    try
    {
      return Command.RTAG.execute(
        session, 
        Command.NO_GLOBAL_OPTIONS, 
        localOptions, 
        new CVSTag(getRevision(), 2), 
        tag, 
        new ICVSRemoteResource[] { this }, 
        Policy.subMonitorFor(monitor, 90));
    }
    finally
    {
      session.close();
    }
  }
  
  public boolean equals(Object target)
  {
    if (this == target) {
      return true;
    }
    if (!(target instanceof RemoteFile)) {
      return false;
    }
    RemoteFile remote = (RemoteFile)target;
    return (super.equals(target)) && (remote.getRevision().equals(getRevision()));
  }
  
  public void edit(int notifications, boolean notifyForWritable, IProgressMonitor monitor) {}
  
  public void unedit(IProgressMonitor monitor) {}
  
  public void notificationCompleted() {}
  
  public NotifyInfo getPendingNotification()
  {
    return null;
  }
  
  public ICVSRemoteResource forTag(ICVSRemoteFolder parent, CVSTag tag)
  {
    return new RemoteFile((RemoteFolder)parent, getWorkspaceSyncState(), getName(), getRevision(), getKeywordMode(), tag);
  }
  
  public ICVSRemoteResource forTag(CVSTag tag)
  {
    RemoteFolderTree remoteFolder = new RemoteFolderTree(null, getRepository(), 
      ((ICVSRemoteFolder)getParent()).getRepositoryRelativePath(), 
      tag);
    RemoteFile remoteFile = (RemoteFile)forTag(remoteFolder, tag);
    remoteFolder.setChildren(new ICVSRemoteResource[] { remoteFile });
    return remoteFile;
  }
  
  public void checkedIn(String info, boolean commit) {}
  
  public boolean isEdited()
  {
    return false;
  }
  
  public byte[] getSyncBytes()
  {
    return syncBytes;
  }
  
  public void setSyncBytes(byte[] syncBytes, int modificationState)
  {
    if (fetching)
    {
      RemoteFile file = (RemoteFile)getCachedHandle();
      if (file == null) {
        cacheHandle();
      } else if (file != this) {
        file.setSyncBytes(syncBytes, modificationState);
      }
    }
    this.syncBytes = syncBytes;
  }
  
  public String toString()
  {
    return super.toString() + " " + getRevision();
  }
  
  public String getContentIdentifier()
  {
    return getRevision();
  }
  
  public void aboutToReceiveContents(byte[] entryLine)
  {
    try
    {
      entryLine = ResourceSyncInfo.setSlot(syncBytes, 3, new byte[0]);
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    setSyncBytes(entryLine, 1);
    fetching = true;
  }
  
  public void doneReceivingContents()
  {
    fetching = false;
  }
  
  public boolean isContentsCached()
  {
    return super.isContentsCached();
  }
  
  public void setContents(IFile file, IProgressMonitor monitor)
    throws TeamException, CoreException
  {
    setContents(file.getContents(), monitor);
  }
  
  public void setExecutable(boolean executable)
    throws CVSException
  {
    this.executable = executable;
    if (!isHandleCached()) {
      cacheHandle();
    }
    RemoteFile file = (RemoteFile)getCachedHandle();
    if (file != this) {
      file.setExecutable(executable);
    }
  }
  
  public boolean isExecutable()
    throws CVSException
  {
    return executable;
  }
  
  public CachedResourceVariant getCachedHandle()
  {
    return super.getCachedHandle();
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == IFileRevision.class) {
      return new CVSResourceVariantFileRevision(this);
    }
    return super.getAdapter(adapter);
  }
  
  public CVSURI toCVSURI()
  {
    ResourceSyncInfo info = getSyncInfo();
    return new CVSURI(getRepository(), new Path(getRepositoryRelativePath()), info.getTag(), info.getRevision());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.RemoteFile
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ccvs.core.resources;

import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.client.listeners.IUpdateMessageListener;

class RemoteFolder$1
  implements IUpdateMessageListener
{
  final RemoteFolder this$0;
  private final boolean[] val$exists;
  
  RemoteFolder$1(RemoteFolder paramRemoteFolder, boolean[] paramArrayOfBoolean)
  {
    this$0 = paramRemoteFolder;val$exists = paramArrayOfBoolean;
  }
  
  public void directoryInformation(ICVSFolder parent, String path, boolean newDirectory)
  {
    val$exists[0] = true;
  }
  
  public void directoryDoesNotExist(ICVSFolder parent, String path)
  {
    val$exists[0] = false;
  }
  
  public void fileInformation(int type, ICVSFolder parent, String filename)
  {
    if (type == 1) {
      val$exists[0] = false;
    }
  }
  
  public void fileDoesNotExist(ICVSFolder parent, String filename)
  {
    val$exists[0] = false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.RemoteFolder.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ccvs.core.resources;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.client.RTag;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.client.listeners.IUpdateMessageListener;
import org.eclipse.team.internal.ccvs.core.client.listeners.UpdateListener;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableFolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
import org.eclipse.team.internal.ccvs.core.util.Util;

public class RemoteFolder
  extends RemoteResource
  implements ICVSRemoteFolder, ICVSFolder
{
  protected static final int CHILD_DOES_NOT_EXIST = 1000;
  protected FolderSyncInfo folderInfo;
  private ICVSRemoteResource[] children;
  private ICVSRepositoryLocation repository;
  
  public static RemoteFolder fromBytes(IResource local, byte[] bytes)
    throws CVSException
  {
    Assert.isNotNull(bytes);
    Assert.isTrue(local.getType() != 1);
    FolderSyncInfo syncInfo = FolderSyncInfo.getFolderSyncInfo(bytes);
    return new RemoteFolder(null, local.getName(), KnownRepositories.getInstance().getRepository(syncInfo.getRoot()), syncInfo.getRepository(), syncInfo.getTag(), syncInfo.getIsStatic());
  }
  
  public RemoteFolder(RemoteFolder parent, ICVSRepositoryLocation repository, String repositoryRelativePath, CVSTag tag)
  {
    this(parent, repositoryRelativePath == null ? "" : Util.getLastSegment(repositoryRelativePath), repository, repositoryRelativePath, tag, false);
  }
  
  public RemoteFolder(RemoteFolder parent, String name, ICVSRepositoryLocation repository, String repositoryRelativePath, CVSTag tag, boolean isStatic)
  {
    super(parent, name);
    if (repository != null) {
      folderInfo = new FolderSyncInfo(repositoryRelativePath.toString(), repository.getLocation(false), tag, isStatic);
    }
    this.repository = repository;
  }
  
  public void accept(ICVSResourceVisitor visitor)
    throws CVSException
  {
    visitor.visitFolder(this);
  }
  
  public void accept(ICVSResourceVisitor visitor, boolean recurse)
    throws CVSException
  {
    visitor.visitFolder(this);
    ICVSResource[] resources;
    ICVSResource[] resources;
    if (recurse) {
      resources = members(127);
    } else {
      resources = members(1);
    }
    for (int i = 0; i < resources.length; i++) {
      resources[i].accept(visitor, recurse);
    }
  }
  
  public boolean exists(IProgressMonitor monitor)
    throws TeamException
  {
    try
    {
      members(monitor);
      return true;
    }
    catch (CVSException e)
    {
      if (e.getStatus().getCode() == -17) {
        return false;
      }
      throw e;
    }
  }
  
  protected boolean exists(ICVSRemoteResource child, IProgressMonitor monitor)
    throws CVSException
  {
    return exists(child, getTag(), monitor);
  }
  
  protected boolean exists(ICVSRemoteResource child, CVSTag tag, IProgressMonitor monitor)
    throws CVSException
  {
    IProgressMonitor progress = Policy.monitorFor(monitor);
    progress.beginTask(CVSMessages.RemoteFolder_exists, 100);
    try
    {
      boolean[] exists = { true };
      IUpdateMessageListener listener = new IUpdateMessageListener()
      {
        private final boolean[] val$exists;
        
        public void directoryInformation(ICVSFolder parent, String path, boolean newDirectory)
        {
          val$exists[0] = true;
        }
        
        public void directoryDoesNotExist(ICVSFolder parent, String path)
        {
          val$exists[0] = false;
        }
        
        public void fileInformation(int type, ICVSFolder parent, String filename)
        {
          if (type == 1) {
            val$exists[0] = false;
          }
        }
        
        public void fileDoesNotExist(ICVSFolder parent, String filename)
        {
          val$exists[0] = false;
        }
      };
      List localOptions = new ArrayList();
      localOptions.add(Update.RETRIEVE_ABSENT_DIRECTORIES);
      if ((tag != null) && (tag.getType() != 0)) {
        localOptions.add(Update.makeTagOption(tag));
      }
      boolean retry = false;
      Session session = new Session(getRepository(), this, false);
      session.open(Policy.subMonitorFor(progress, 10), false);
      try
      {
        IStatus status = Command.UPDATE.execute(
          session, 
          new Command.GlobalOption[] { Command.DO_NOT_CHANGE }, 
          (Command.LocalOption[])localOptions.toArray(new Command.LocalOption[localOptions.size()]), 
          new ICVSResource[] { child }, new UpdateListener(listener), 
          Policy.subMonitorFor(progress, 70));
        if (status.getCode() == -10)
        {
          CVSServerException e = new CVSServerException(status);
          if ((e.isNoTagException()) && (child.isContainer())) {
            retry = true;
          } else if (e.containsErrors()) {
            throw e;
          }
        }
      }
      finally
      {
        session.close();
      }
      session.close();
      if (retry)
      {
        Policy.checkCanceled(progress);
        return exists(child, null, Policy.subMonitorFor(progress, 20));
      }
      return exists[0];
    }
    finally
    {
      progress.done();
    }
  }
  
  public ICVSRemoteResource[] getMembers(IProgressMonitor monitor)
    throws TeamException
  {
    return getMembers(getTag(), monitor);
  }
  
  protected ICVSRemoteResource[] getMembers(CVSTag tag, IProgressMonitor monitor)
    throws CVSException
  {
    RemoteFolderMemberFetcher fetcher = new RemoteFolderMemberFetcher(this, tag);
    fetcher.fetchMembers(Policy.monitorFor(monitor));
    
    return children;
  }
  
  public ICVSResource[] members(int flags)
    throws CVSException
  {
    List result = new ArrayList();
    ICVSRemoteResource[] resources = getChildren();
    if (children == null) {
      return new ICVSResource[0];
    }
    if (((flags & 0x20) == 0) && ((flags & 0x40) == 64)) {
      return new ICVSResource[0];
    }
    boolean includeFiles = ((flags & 0x1) != 0) || ((flags & 0x3) == 0);
    boolean includeFolders = ((flags & 0x2) != 0) || ((flags & 0x3) == 0);
    boolean includeManaged = ((flags & 0x10) != 0) || ((flags & 0x1C) == 0);
    boolean includeUnmanaged = ((flags & 0x8) != 0) || ((flags & 0x1C) == 0);
    boolean includeIgnored = (flags & 0x4) != 0;
    for (int i = 0; i < resources.length; i++)
    {
      ICVSResource cvsResource = resources[i];
      if (((includeFiles) && (!cvsResource.isFolder())) || (
        (includeFolders) && (cvsResource.isFolder())))
      {
        boolean isManaged = cvsResource.isManaged();
        boolean isIgnored = cvsResource.isIgnored();
        if (((isManaged) && (includeManaged)) || ((isIgnored) && (includeIgnored)) || (
          (!isManaged) && (!isIgnored) && (includeUnmanaged))) {
          result.add(cvsResource);
        }
      }
    }
    return (ICVSResource[])result.toArray(new ICVSResource[result.size()]);
  }
  
  public ICVSFolder getFolder(String name)
    throws CVSException
  {
    if ((name.equals(".")) || (name.equals("./"))) {
      return this;
    }
    ICVSResource child = getChild(name);
    if (child.isFolder()) {
      return (ICVSFolder)child;
    }
    IStatus status = new CVSStatus(4, 1000, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { name, getName() }), child.getIResource());
    throw new CVSException(status);
  }
  
  public ICVSFile getFile(String name)
    throws CVSException
  {
    ICVSResource child = getChild(name);
    if (!child.isFolder()) {
      return (ICVSFile)child;
    }
    IStatus status = new CVSStatus(4, 1000, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { name, getName() }), child.getIResource());
    throw new CVSException(status);
  }
  
  public Command.LocalOption[] getLocalOptions()
  {
    return Command.NO_LOCAL_OPTIONS;
  }
  
  public String getRepositoryRelativePath()
  {
    return getFolderSyncInfo().getRepository();
  }
  
  public String getRelativePath(ICVSFolder ancestor)
    throws CVSException
  {
    if (ancestor == this) {
      return ".";
    }
    if (parent == null)
    {
      IStatus status = new CVSStatus(4, 4, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { getName(), ancestor.getName() }), this);
      throw new CVSException(status);
    }
    return super.getRelativePath(ancestor);
  }
  
  public ICVSRepositoryLocation getRepository()
  {
    return repository;
  }
  
  public boolean isExpandable()
  {
    return true;
  }
  
  public boolean
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

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd