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

      indicator = "d";
        break;
      }
    }
    return indicator;
  }
  
  public void purgeCache(IContainer root, boolean deep)
    throws CVSException
  {
    int depth = deep ? 2 : 0;
    try
    {
      if ((root.exists()) || (root.isPhantom())) {
        getWorkspaceSynchronizer().flushSyncInfo(RESOURCE_SYNC_KEY, root, depth);
      }
      if ((root.exists()) || (root.isPhantom())) {
        getWorkspaceSynchronizer().flushSyncInfo(FOLDER_SYNC_KEY, root, depth);
      }
      if (deep) {
        removePendingCacheWritesUnder(root);
      } else {
        removePendingCacheWrite(root);
      }
    }
    catch (CoreException e)
    {
      if (e.getStatus().getCode() == 368) {
        return;
      }
      throw CVSException.wrapException(e);
    }
  }
  
  public boolean isPhantom(IResource resource)
  {
    return (resource.isPhantom()) || (hasPendingCacheWrite(resource));
  }
  
  public IResource[] members(IContainer folder)
    throws CoreException
  {
    IResource[] pendingWrites = getPendingCacheWrites();
    if (pendingWrites != null)
    {
      HashSet cachedResources = new HashSet();
      for (int i = 0; i < pendingWrites.length; i++)
      {
        IResource resource = pendingWrites[i];
        if (resource.getParent().equals(folder)) {
          cachedResources.add(resource);
        }
      }
      if (cachedResources.size() != 0)
      {
        IResource[] resources = folder.members(true);
        IResource[] cachedResourcesArray = (IResource[])cachedResources.toArray(new IResource[cachedResources.size()]);
        IResource[] finalResources = new IResource[resources.length + cachedResourcesArray.length];
        System.arraycopy(resources, 0, finalResources, 0, resources.length);
        System.arraycopy(cachedResourcesArray, 0, finalResources, resources.length, cachedResourcesArray.length);
        return finalResources;
      }
    }
    try
    {
      return folder.members(true);
    }
    catch (CoreException e)
    {
      if (e.getStatus().getCode() == 368) {
        return new IResource[0];
      }
      throw e;
    }
  }
  
  /* Error */
  private boolean hasPendingCacheWrite(IResource resource)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 289	org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache:pendingCacheWrites	Ljava/util/Map;
    //   4: dup
    //   5: astore_2
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 289	org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache:pendingCacheWrites	Ljava/util/Map;
    //   11: aload_1
    //   12: invokeinterface 331 2 0
    //   17: aload_2
    //   18: monitorexit
    //   19: ireturn
    //   20: aload_2
    //   21: monitorexit
    //   22: athrow
    // Line number table:
    //   Java source line #355	-> byte code offset #0
    //   Java source line #356	-> byte code offset #7
    //   Java source line #355	-> byte code offset #20
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	23	0	this	SynchronizerSyncInfoCache
    //   0	23	1	resource	IResource
    //   5	16	2	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	19	20	finally
    //   20	22	20	finally
  }
  
  private byte[] getPendingCacheWrite(IResource resource)
  {
    synchronized (pendingCacheWrites)
    {
      Object object = pendingCacheWrites.get(resource);
      if ((object instanceof byte[])) {
        return (byte[])object;
      }
      return null;
    }
  }
  
  private boolean hasPendingCacheRemoval(IResource resource)
  {
    synchronized (pendingCacheWrites)
    {
      Object object = pendingCacheWrites.get(resource);
      return object == BYTES_REMOVED;
    }
  }
  
  private void setPendingCacheWrite(IResource resource, byte[] syncBytes)
  {
    synchronized (pendingCacheWrites)
    {
      pendingCacheWrites.put(resource, syncBytes);
    }
  }
  
  private void setPendingCacheWriteToDelete(IResource resource)
  {
    synchronized (pendingCacheWrites)
    {
      pendingCacheWrites.put(resource, BYTES_REMOVED);
    }
  }
  
  private void removePendingCacheWrite(IResource resource)
  {
    synchronized (pendingCacheWrites)
    {
      pendingCacheWrites.remove(resource);
    }
  }
  
  private void removePendingCacheWritesUnder(IContainer root)
  {
    synchronized (pendingCacheWrites)
    {
      IPath fullPath = root.getFullPath();
      for (Iterator iter = pendingCacheWrites.keySet().iterator(); iter.hasNext();)
      {
        IResource resource = (IResource)iter.next();
        if (fullPath.isPrefixOf(resource.getFullPath())) {
          iter.remove();
        }
      }
    }
  }
  
  private IResource[] getPendingCacheWrites()
  {
    synchronized (pendingCacheWrites)
    {
      if (pendingCacheWrites.isEmpty()) {
        return null;
      }
      return (IResource[])pendingCacheWrites.keySet().toArray(new IResource[pendingCacheWrites.size()]);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.SynchronizerSyncInfoCache
 * 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.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;

class UpdateContentCachingService$1
  extends RemoteFolderTreeBuilder
{
  private final CVSRepositoryLocation val$repository;
  
  UpdateContentCachingService$1(CVSRepositoryLocation $anonymous0, ICVSFolder $anonymous1, CVSTag $anonymous2, CVSRepositoryLocation paramCVSRepositoryLocation1)
  {
    super($anonymous0, $anonymous1, $anonymous2);val$repository = paramCVSRepositoryLocation1;
  }
  
  protected RemoteFolder createRemoteFolder(ICVSFolder local, RemoteFolder parent, FolderSyncInfo folderSyncInfo)
  {
    return new RemoteFolderSandbox(parent, local.getName(), val$repository, folderSyncInfo.getRepository(), folderSyncInfo.getTag(), folderSyncInfo.getIsStatic());
  }
  
  protected RemoteFile createRemoteFile(RemoteFolder remote, byte[] syncBytes)
    throws CVSException
  {
    return new UpdateContentCachingService.2(this, remote, syncBytes);
  }
  
  protected boolean isPruneEmptyDirectories()
  {
    return true;
  }
}

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

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

class UpdateContentCachingService$2
  extends RemoteFile
{
  final UpdateContentCachingService.1 this$1;
  
  UpdateContentCachingService$2(UpdateContentCachingService.1 param1, RemoteFolder $anonymous0, byte[] $anonymous1)
    throws CVSException
  {
    super($anonymous0, $anonymous1);this$1 = param1;
  }
  
  public boolean isModified(IProgressMonitor monitor)
    throws CVSException
  {
    return false;
  }
  
  public void delete()
  {
    RemoteFolderSandbox parent = (RemoteFolderSandbox)getParent();
    parent.remove(this);
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
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.Session;
import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;

public class UpdateContentCachingService$SandboxUpdate
  extends Update
{
  final UpdateContentCachingService this$0;
  
  public UpdateContentCachingService$SandboxUpdate(UpdateContentCachingService paramUpdateContentCachingService)
  {
    this$0 = paramUpdateContentCachingService;
  }
  
  protected boolean shouldRetrieveAbsentDirectories(Session session)
  {
    return UpdateContentCachingService.access$0(this$0);
  }
  
  protected IStatus commandFinished(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor, IStatus status)
    throws CVSException
  {
    return status;
  }
  
  protected IStatus doExecute(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, String[] arguments, ICommandOutputListener listener, IProgressMonitor monitor)
    throws CVSException
  {
    session.registerResponseHandler(new UpdateContentCachingService.SandboxUpdatedHandler(this$0, 4));
    session.registerResponseHandler(new UpdateContentCachingService.SandboxUpdatedHandler(this$0, 2));
    session.registerResponseHandler(new UpdateContentCachingService.SandboxUpdatedHandler(this$0, 3));
    session.registerResponseHandler(new UpdateContentCachingService.SandboxUpdatedHandler(this$0, 1));
    return super.doExecute(session, globalOptions, localOptions, arguments, listener, monitor);
  }
}

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

import java.util.Date;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.UpdatedHandler;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;

public class UpdateContentCachingService$SandboxUpdatedHandler
  extends UpdatedHandler
{
  final UpdateContentCachingService this$0;
  
  public UpdateContentCachingService$SandboxUpdatedHandler(UpdateContentCachingService paramUpdateContentCachingService, int type)
  {
    super(type);
    this$0 = paramUpdateContentCachingService;
  }
  
  protected void receiveTargetFile(Session session, ICVSFile mFile, String entryLine, Date modTime, boolean binary, boolean readOnly, boolean executable, IProgressMonitor monitor)
    throws CVSException
  {
    ResourceSyncInfo info = new ResourceSyncInfo(entryLine, modTime);
    
    mFile.setSyncInfo(info, 1);
    
    session.receiveFile(mFile, binary, getHandlerType(), monitor);
    try
    {
      if (executable) {
        mFile.setExecutable(true);
      }
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.UpdateContentCachingService.SandboxUpdatedHandler
 * 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.Date;
import java.util.Iterator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
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.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
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.Session;
import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.client.UpdatedHandler;
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
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.CVSRepositoryLocation;
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.ResourceSyncInfo;

public class UpdateContentCachingService
  implements IUpdateMessageListener
{
  private CVSRepositoryLocation repository;
  private ICVSFolder remoteRoot;
  private final CVSTag tag;
  private final int depth;
  private boolean fetchAbsentDirectories = true;
  private ArrayList removed = new ArrayList();
  
  public class SandboxUpdate
    extends Update
  {
    public SandboxUpdate() {}
    
    protected boolean shouldRetrieveAbsentDirectories(Session session)
    {
      return fetchAbsentDirectories;
    }
    
    protected IStatus commandFinished(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor, IStatus status)
      throws CVSException
    {
      return status;
    }
    
    protected IStatus doExecute(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, String[] arguments, ICommandOutputListener listener, IProgressMonitor monitor)
      throws CVSException
    {
      session.registerResponseHandler(new UpdateContentCachingService.SandboxUpdatedHandler(UpdateContentCachingService.this, 4));
      session.registerResponseHandler(new UpdateContentCachingService.SandboxUpdatedHandler(UpdateContentCachingService.this, 2));
      session.registerResponseHandler(new UpdateContentCachingService.SandboxUpdatedHandler(UpdateContentCachingService.this, 3));
      session.registerResponseHandler(new UpdateContentCachingService.SandboxUpdatedHandler(UpdateContentCachingService.this, 1));
      return super.doExecute(session, globalOptions, localOptions, arguments, listener, monitor);
    }
  }
  
  public class SandboxUpdatedHandler
    extends UpdatedHandler
  {
    public SandboxUpdatedHandler(int type)
    {
      super();
    }
    
    protected void receiveTargetFile(Session session, ICVSFile mFile, String entryLine, Date modTime, boolean binary, boolean readOnly, boolean executable, IProgressMonitor monitor)
      throws CVSException
    {
      ResourceSyncInfo info = new ResourceSyncInfo(entryLine, modTime);
      
      mFile.setSyncInfo(info, 1);
      
      session.receiveFile(mFile, binary, getHandlerType(), monitor);
      try
      {
        if (executable) {
          mFile.setExecutable(true);
        }
      }
      catch (CVSException e)
      {
        CVSProviderPlugin.log(e);
      }
    }
  }
  
  public static RemoteFolder buildRemoteTree(CVSRepositoryLocation repository, ICVSFolder root, CVSTag tag, int depth, IProgressMonitor monitor)
    throws CVSException
  {
    monitor.beginTask(null, 100);
    try
    {
      RemoteFolder tree = buildBaseTree(repository, root, tag, Policy.subMonitorFor(monitor, 50));
      UpdateContentCachingService service = new UpdateContentCachingService(repository, tree, tag, depth);
      service.setFetchAbsentDirectories(getFetchAbsentDirectories(root));
      if (!service.cacheFileContents(Policy.subMonitorFor(monitor, 50))) {
        return null;
      }
      return tree;
    }
    finally
    {
      monitor.done();
    }
  }
  
  private void setFetchAbsentDirectories(boolean fetchAbsentDirectories)
  {
    this.fetchAbsentDirectories = fetchAbsentDirectories;
  }
  
  private static boolean getFetchAbsentDirectories(ICVSFolder root)
  {
    IResource resource = root.getIResource();
    if (resource != null)
    {
      IProject project = resource.getProject();
      RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
      if ((provider instanceof CVSTeamProvider))
      {
        CVSTeamProvider cp = (CVSTeamProvider)provider;
        try
        {
          return cp.getFetchAbsentDirectories();
        }
        catch (CVSException e)
        {
          CVSProviderPlugin.log(e);
        }
      }
    }
    return CVSProviderPlugin.getPlugin().getFetchAbsentDirectories();
  }
  
  private static RemoteFolder buildBaseTree(CVSRepositoryLocation repository, ICVSFolder root, CVSTag tag, IProgressMonitor progress)
    throws CVSException
  {
    try
    {
      RemoteFolderTreeBuilder builder = new RemoteFolderTreeBuilder(repository, root, tag)
      {
        private final CVSRepositoryLocation val$repository;
        
        protected RemoteFolder createRemoteFolder(ICVSFolder local, RemoteFolder parent, FolderSyncInfo folderSyncInfo)
        {
          return new RemoteFolderSandbox(parent, local.getName(), val$repository, folderSyncInfo.getRepository(), folderSyncInfo.getTag(), folderSyncInfo.getIsStatic());
        }
        
        protected RemoteFile createRemoteFile(RemoteFolder remote, byte[] syncBytes)
          throws CVSException
        {
          return new UpdateContentCachingService.2(this, remote, syncBytes);
        }
        
        protected boolean isPruneEmptyDirectories()
        {
          return true;
        }
      };
      progress.beginTask(null, 100);
      IProgressMonitor subProgress = Policy.infiniteSubMonitorFor(progress, 100);
      subProgress.beginTask(null, 512);
      subProgress.subTask(NLS.bind(CVSMessages.RemoteFolderTreeBuilder_buildingBase, new String[] { root.getName() }));
      RemoteFolder tree = builder.buildBaseTree(null, root, subProgress);
      Object localObject2;
      if (tree == null)
      {
        FolderSyncInfo folderSyncInfo = root.getFolderSyncInfo();
        if (folderSyncInfo == null) {
          return null;
        }
        return new RemoteFolderSandbox(null, root.getName(), repository, folderSyncInfo.getRepository(), folderSyncInfo.getTag(), folderSyncInfo.getIsStatic());
      }
      return tree;
    }
    finally
    {
      progress.done();
    }
  }
  
  public static RemoteFile buildRemoteTree(CVSRepositoryLocation repository, ICVSFile file, CVSTag tag, IProgressMonitor monitor)
    throws CVSException
  {
    monitor.beginTask(null, 100);
    try
    {
      RemoteFolderTreeBuilder builder = new RemoteFolderTreeBuilder(repository, file.getParent(), tag);
      RemoteFile remote = builder.buildTree(file, Policy.subMonitorFor(monitor, 10));
      if (remote == null) {
        return null;
      }
      byte[] syncBytes = remote.getSyncBytes();
      if (builder.getFileDiffs().length > 0) {
        remote.getStorage(Policy.subMonitorFor(monitor, 90));
      }
      remote.setSyncBytes(syncBytes, 1);
      return remote;
    }
    catch (TeamException e)
    {
      throw CVSException.wrapException(e);
    }
    finally
    {
      monitor.done();
    }
  }
  
  public UpdateContentCachingService(CVSRepositoryLocation repository, RemoteFolder tree, CVSTag tag, int depth)
  {
    this.repository = repository;
    remoteRoot = tree;
    this.tag = tag;
    this.depth = depth;
  }
  
  private boolean cacheFileContents(IProgressMonitor monitor)
    throws CVSException
  {
    monitor.beginTask(null, 100);
    Policy.checkCanceled(monitor);
    Session session = new Session(repository, remoteRoot, false);
    session.open(Policy.subMonitorFor(monitor, 10), false);
    try
    {
      Policy.checkCanceled(monitor);
      IStatus status = new SandboxUpdate().execute(session, 
        Command.NO_GLOBAL_OPTIONS, 
        getLocalOptions(), 
        new String[] { "." }, 
        new UpdateListener(this), 
        Policy.subMonitorFor(monitor, 90));
      if (!status.isOK())
      {
        if (status.getCode() == -10)
        {
          CVSServerException e = new CVSServerException(status);
          if ((!e.isNoTagException()) && (e.containsErrors())) {
            throw e;
          }
          return false;
        }
        if ((status.getSeverity() == 4) && (isReportableError(status))) {
          throw new CVSException(status);
        }
      }
      for (Iterator iterator = removed.iterator(); iterator.hasNext();)
      {
        ICVSResource resource = (ICVSResource)iterator.next();
        if (resource.exists()) {
          resource.delete();
        }
      }
    }
    finally
    {
      session.close();
      monitor.done();
    }
    session.close();
    monitor.done();
    
    return true;
  }
  
  private boolean isReportableError(IStatus status)
  {
    return (CVSStatus.isInternalError(status)) || (status.getCode() == -6) || (status.getCode() == -27) || (status.getCode() == -28);
  }
  
  private Command.LocalOption[] getLocalOptions()
  {
    ArrayList options = new ArrayList();
    if (tag != null) {
      options.add(Update.makeTagOption(tag));
    }
    if (depth != 2) {
      options.add(Command.DO_NOT_RECURSE);
    }
    if (fetchAbsentDirectories) {
      options.add(Update.RETRIEVE_ABSENT_DIRECTORIES);
    }
    if (!options.isEmpty()) {
      return (Command.LocalOption[])options.toArray(new Command.LocalOption[options.size()]);
    }
    return Command.NO_LOCAL_OPTIONS;
  }
  
  public void directoryDoesNotExist(ICVSFolder commandRoot, String path)
  {
    try
    {
      removed.add(commandRoot.getChild(path));
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
  }
  
  public void directoryInformation(ICVSFolder commandRoot, String path, boolean newDirectory) {}
  
  public void fileDoesNotExist(ICVSFolder parent, String filename)
  {
    try
    {
      removed.add(parent.getChild(filename));
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
  }
  
  public void fileInformation(int type, ICVSFolder parent, String filename) {}
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
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.util.Util;

public class BaserevInfo
{
  private static final String BASEREV_PREFIX = "B";
  private String name;
  private String revision;
  
  public BaserevInfo(String entryLine)
    throws CVSException
  {
    setEntryLine(entryLine);
  }
  
  public BaserevInfo(String name, String revision)
  {
    this.name = name;
    this.revision = revision;
  }
  
  public String getEntryLine()
  {
    StringBuffer result = new StringBuffer();
    result.append("B");
    result.append(name);
    result.append("/");
    result.append(revision);
    result.append("/");
    return result.toString();
  }
  
  private void setEntryLine(String entryLine)
    throws CVSException
  {
    if (entryLine.startsWith("B")) {
      entryLine = entryLine.substring(1);
    }
    String[] strings = Util.parseIntoSubstrings(entryLine, "/");
    if ((strings.length != 2) && (strings.length != 3))
    {
      IStatus status = new CVSStatus(4, NLS.bind(CVSMessages.BaseRevInfo_malformedEntryLine, new String[] { entryLine }));
      throw new CVSException(status);
    }
    name = strings[0];
    if (name.length() == 0)
    {
      IStatus status = new CVSStatus(4, NLS.bind(CVSMessages.BaseRevInfo_malformedEntryLine, new String[] { entryLine }));
      throw new CVSException(status);
    }
    revision = strings[1];
    if (revision.length() == 0)
    {
      IStatus status = new CVSStatus(4, NLS.bind(CVSMessages.BaseRevInfo_malformedEntryLine, new String[] { entryLine }));
      throw new CVSException(status);
    }
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getRevision()
  {
    return revision;
  }
}

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

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.variants.ResourceVariantByteStore;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;

public class CVSBaseResourceVariantTree
  extends ResourceVariantByteStore
{
  public void dispose() {}
  
  public byte[] getBytes(IResource resource)
    throws TeamException
  {
    if (resource.getType() == 1)
    {
      byte[] bytes = EclipseSynchronizer.getInstance().getSyncBytes(resource);
      if (bytes != null) {
        if (ResourceSyncInfo.isDeletion(bytes)) {
          bytes = ResourceSyncInfo.convertFromDeletion(bytes);
        } else if (ResourceSyncInfo.isAddition(bytes)) {
          bytes = (byte[])null;
        }
      }
      return bytes;
    }
    FolderSyncInfo info = EclipseSynchronizer.getInstance().getFolderSync((IContainer)resource);
    if (info == null) {
      return null;
    }
    return info.getBytes();
  }
  
  public boolean isVariantKnown(IResource resource)
    throws TeamException
  {
    return getBytes(resource) != null;
  }
  
  public boolean flushBytes(IResource resource, int depth)
    throws TeamException
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean setBytes(IResource resource, byte[] bytes)
    throws TeamException
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean deleteBytes(IResource resource)
    throws TeamException
  {
    throw new UnsupportedOperationException();
  }
  
  public IResource[] members(IResource resource)
    throws TeamException
  {
    if (resource.getType() == 1) {
      return new IResource[0];
    }
    return EclipseSynchronizer.getInstance().members((IContainer)resource);
  }
}

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

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.variants.PersistantResourceVariantByteStore;
import org.eclipse.team.core.variants.ResourceVariantByteStore;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.core.subscribers.DescendantResourceVariantByteStore;

public class CVSDescendantResourceVariantByteStore
  extends DescendantResourceVariantByteStore
{
  public CVSDescendantResourceVariantByteStore(ResourceVariantByteStore baseCache, PersistantResourceVariantByteStore remoteCache)
  {
    super(baseCache, remoteCache);
  }
  
  protected boolean isDescendant(IResource resource, byte[] baseBytes, byte[] remoteBytes)
    throws TeamException
  {
    if (resource.getType() != 1) {
      return true;
    }
    try
    {
      return ResourceSyncInfo.isLaterRevisionOnSameBranch(remoteBytes, baseBytes);
    }
    catch (CVSException e)
    {
      throw TeamException.asTeamException(e);
    }
  }
  
  public boolean setBytes(IResource resource, byte[] bytes)
    throws TeamException
  {
    boolean changed = super.setBytes(resource, bytes);
    if ((resource.getType() == 1) && (getBytes(resource) != null) && (!parentHasSyncBytes(resource))) {
      CVSProviderPlugin.log(new TeamException(NLS.bind(CVSMessages.ResourceSynchronizer_missingParentBytesOnSet, new String[] { ((PersistantResourceVariantByteStore)getRemoteStore()).getSyncName().toString(), resource.getFullPath().toString() })));
    }
    return changed;
  }
  
  protected boolean parentHasSyncBytes(IResource resource)
    throws TeamException
  {
    if (resource.getType() == 4) {
      return true;
    }
    return getBytes(resource.getParent()) != null;
  }
  
  public boolean isVariantKnown(IResource resource)
    throws TeamException
  {
    return ((PersistantResourceVariantByteStore)getRemoteStore()).isVariantKnown(resource);
  }
  
  public IStatus handleResourceChanges(IResource[] changedResources, boolean canModifyWorkspace)
  {
    List errors = new ArrayList();
    for (int i = 0; i < changedResources.length; i++)
    {
      IResource resource = changedResources[i];
      try
      {
        if (isInCVSProject(resource)) {
          if ((resource.getType() == 1) && (
            (resource.exists()) || (resource.isPhantom())))
          {
            byte[] remoteBytes = getBytes(resource);
            if (remoteBytes == null)
            {
              if (isVariantKnown(resource)) {
                if ((getBaseStore().getBytes(resource) != null) && 
                  (canModifyWorkspace)) {
                  flushBytes(resource, 0);
                }
              }
            }
            else
            {
              byte[] localBytes = getBaseStore().getBytes(resource);
              if (((localBytes == null) || (!isDescendant(resource, localBytes, remoteBytes))) && 
                (canModifyWorkspace)) {
                flushBytes(resource, 0);
              }
            }
          }
          else if (resource.getType() == 2)
          {
            if ((getBaseStore().getBytes(resource) != null) && (canModifyWorkspace)) {
              flushBytes(resource, 0);
            }
          }
        }
      }
      catch (TeamException e)
      {
        errors.add(e);
      }
    }
    for (Iterator iter = errors.iterator(); iter.hasNext();)
    {
      TeamException e = (TeamException)iter.next();
      CVSProviderPlugin.log(e);
    }
    return Status.OK_STATUS;
  }
  
  private boolean isInCVSProject(IResource resource)
  {
    return RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) != null;
  }
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.core.variants.PersistantResourceVariantByteStore;
import org.eclipse.team.core.variants.ResourceVariantByteStore;
import org.eclipse.team.core.variants.ResourceVariantTree;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;

public class CVSResourceVariantTree
  extends ResourceVariantTree
{
  private CVSTag tag;
  private boolean cacheFileContentsHint;
  private CVSSyncTreeSubscriber subscriber;
  
  public CVSResourceVariantTree(ResourceVariantByteStore cache, CVSTag tag, boolean cacheFileContentsHint)
  {
    super(cache);
    this.tag = tag;
    this.cacheFileContentsHint = cacheFileContentsHint;
  }
  
  public ResourceVariantByteStore getByteStore()
  {
    return super.getByteStore();
  }
  
  protected byte[] getBytes(IResource local, IResourceVariant remote)
    throws TeamException
  {
    if (remote != null) {
      return super.getBytes(local, remote);
    }
    if (local.getType() == 2) {
      return getBaseBytes((IContainer)local, getTag(local));
    }
    return null;
  }
  
  protected IResourceVariant[] fetchMembers(IResourceVariant remote, IProgressMonitor progress)
    throws TeamException
  {
    ICVSRemoteResource[] children = remote != null ? ((RemoteResource)remote).members(progress) : new ICVSRemoteResource[0];
    IResourceVariant[] result = new IResourceVariant[children.length];
    for (int i = 0; i < children.length; i++) {
      result[i] = ((IResourceVariant)children[i]);
    }
    return result;
  }
  
  protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor)
    throws TeamException
  {
    return (IResourceVariant)CVSWorkspaceRoot.getRemoteTree(resource, getTag(resource), isCacheFileContentsHint(), depth, monitor);
  }
  
  public IResource[] collectChanges(IResource local, IResourceVariant remote, int depth, IProgressMonitor monitor)
    throws TeamException
  {
    return super.collectChanges(local, remote, depth, monitor);
  }
  
  public IResource[] members(IResource resource)
    throws TeamException
  {
    if (resource.getType() == 1) {
      return new IResource[0];
    }
    Set members = new HashSet();
    members.addAll(Arrays.asList(super.members(resource)));
    try
    {
      IResource[] localMembers = EclipseSynchronizer.getInstance().members((IContainer)resource);
      for (int i = 0; i < localMembers.length; i++)
      {
        IResource local = localMembers[i];
        if (local.getType() != 1)
        {
          ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
          if (folder.isCVSFolder()) {
            members.add(local);
          }
        }
      }
    }
    catch (CoreException e)
    {
      throw CVSException.wrapException(e);
    }
    return (IResource[])members.toArray(new IResource[members.size()]);
  }
  
  public IResource[] roots()
  {
    return subscriber.roots();
  }
  
  public IResourceVariant getResourceVariant(IResource resource)
    throws TeamException
  {
    byte[] remoteBytes = getByteStore().getBytes(resource);
    if (remoteBytes == null) {
      return null;
    }
    if (resource.getType() == 1)
    {
      byte[] parentBytes = getParentBytes(resource);
      if (parentBytes == null)
      {
        IProject project = resource.getProject();
        if ((project.exists()) && (RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()) != null))
        {
          IStatus status = new CVSStatus(4, 4, NLS.bind(CVSMessages.ResourceSynchronizer_missingParentBytesOnGet, new String[] { getSyncName(getByteStore()).toString(), resource.getFullPath().toString() }), resource);
          CVSProviderPlugin.log(status);
        }
        return null;
      }
      return RemoteFile.fromBytes(resource, remoteBytes, parentBytes);
    }
    return RemoteFolder.fromBytes(resource, remoteBytes);
  }
  
  private String getSyncName(ResourceVariantByteStore cache)
  {
    if ((cache instanceof PersistantResourceVariantByteStore)) {
      return ((PersistantResourceVariantByteStore)cache).getSyncName().toString();
    }
    return cache.getClass().getName();
  }
  
  private byte[] getParentBytes(IResource resource)
    throws TeamException
  {
    IContainer parent = resource.getParent();
    byte[] bytes = getByteStore().getBytes(parent);
    if (bytes == null) {
      bytes = getBaseBytes(parent, getTag(resource));
    }
    return bytes;
  }
  
  private byte[] getBaseBytes(IContainer parent, CVSTag tag)
    throws CVSException
  {
    ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor(parent);
    FolderSyncInfo info = local.getFolderSyncInfo();
    byte[] bytes;
    byte[] bytes;
    if (info == null)
    {
      bytes = (byte[])null;
    }
    else
    {
      MutableFolderSyncInfo newInfo = info.cloneMutable();
      newInfo.setTag(tag);
      newInfo.setStatic(false);
      bytes = newInfo.getBytes();
    }
    return bytes;
  }
  
  private boolean hasLocalSyncInfo(IContainer folder)
  {
    ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor(folder);
    try
    {
      return local.getFolderSyncInfo() != null;
    }
    catch (CVSException localCVSException) {}
    return true;
  }
  
  public CVSTag getTag(IResource resource)
  {
    return tag;
  }
  
  public void dispose()
  {
    getByteStore().dispose();
  }
  
  protected boolean setVariant(IResource local, IResourceVariant remote)
    throws TeamException
  {
    if ((local.getType() == 2) && (remote != null) && 
      (!hasLocalSyncInfo((IFolder)local)) && 
      (hasLocalSyncInfo(local.getParent())))
    {
      CVSTag tag = CVSWorkspaceRoot.getCVSFolderFor(local.getParent()).getFolderSyncInfo().getTag();
      FolderSyncInfo info = null;
      try
      {
        info = FolderSyncInfo.getFolderSyncInfo(remote.asBytes());
      }
      catch (CVSException e)
      {
        Status status = new Status(4, "org.eclipse.team.cvs.core", 
          NLS.bind(CVSMessages.CVSResourceVariantTree_GettingSyncInfoError, local.getProjectRelativePath().toString()), 
          e);
        throw new CVSException(status);
      }
      MutableFolderSyncInfo newInfo = info.cloneMutable();
      newInfo.setTag(tag);
      ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IFolder)local);
      cvsFolder.setFolderSyncInfo(newInfo);
    }
    if ((remote == null) && (!isManaged(local)))
    {
      boolean changed = getByteStore().getBytes(local) != null;
      flushVariants(local, 0);
      return changed;
    }
    boolean changed = super.setVariant(local, remote);
    if ((local.getType() == 1) && (getByteStore().getBytes(local) != null) && (!parentHasSyncBytes(local))) {
      CVSProviderPlugin.log(new TeamException(NLS.bind(CVSMessages.ResourceSynchronizer_missingParentBytesOnSet,
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