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

 new String[] { getSyncName(getByteStore()), local.getFullPath().toString() })));
    }
    return changed;
  }
  
  private boolean isManaged(IResource local)
  {
    try
    {
      return CVSWorkspaceRoot.getCVSResourceFor(local).isManaged();
    }
    catch (CVSException localCVSException) {}
    return false;
  }
  
  private boolean parentHasSyncBytes(IResource resource)
    throws TeamException
  {
    if (resource.getType() == 4) {
      return true;
    }
    return getParentBytes(resource) != null;
  }
  
  protected IResource[] collectedMembers(IResource local, IResource[] members)
    throws TeamException
  {
    IResource[] resources = getStoredMembers(local);
    List children = new ArrayList();
    List changedResources = new ArrayList();
    children.addAll(Arrays.asList(members));
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      if (!children.contains(resource))
      {
        flushVariants(resource, 2);
        changedResources.add(resource);
      }
    }
    return (IResource[])changedResources.toArray(new IResource[changedResources.size()]);
  }
  
  private IResource[] getStoredMembers(IResource local)
    throws TeamException
  {
    try
    {
      if ((local.getType() != 1) && ((local.exists()) || (local.isPhantom())))
      {
        IResource[] allChildren = ((IContainer)local).members(true);
        List childrenWithSyncBytes = new ArrayList();
        for (int i = 0; i < allChildren.length; i++)
        {
          IResource resource = allChildren[i];
          if (getByteStore().getBytes(resource) != null) {
            childrenWithSyncBytes.add(resource);
          }
        }
        return (IResource[])childrenWithSyncBytes.toArray(
          new IResource[childrenWithSyncBytes.size()]);
      }
    }
    catch (CoreException e)
    {
      throw TeamException.asTeamException(e);
    }
    return new IResource[0];
  }
  
  protected IResource[] refresh(IResource resource, int depth, IProgressMonitor monitor)
    throws TeamException
  {
    IResource[] changedResources = (IResource[])null;
    monitor.beginTask(null, 100);
    
    int count = 0;
    int waitTime = 10;
    while ((count < 15) && (
      (isJobInFamilyRunning(ResourcesPlugin.FAMILY_AUTO_BUILD)) || (
      isJobInFamilyRunning(ResourcesPlugin.FAMILY_MANUAL_BUILD))))
    {
      try
      {
        Thread.sleep(waitTime);
      }
      catch (InterruptedException localInterruptedException) {}
      count++;
      if (count >= 10) {
        waitTime = 1000;
      } else if (count >= 5) {
        waitTime = 100;
      }
      Policy.checkCanceled(monitor);
    }
    try
    {
      changedResources = super.refresh(resource, depth, Policy.subMonitorFor(monitor, 99));
    }
    catch (TeamException e)
    {
      if (!resource.getProject().isAccessible()) {
        return new IResource[0];
      }
      TeamException e;
      throw e;
    }
    finally
    {
      monitor.done();
    }
    monitor.done();
    if (changedResources == null) {
      return new IResource[0];
    }
    return changedResources;
  }
  
  private boolean isJobInFamilyRunning(Object family)
  {
    Job[] jobs = Job.getJobManager().find(family);
    if ((jobs != null) && (jobs.length > 0)) {
      for (int i = 0; i < jobs.length; i++)
      {
        Job job = jobs[i];
        if (job.getState() != 0) {
          return true;
        }
      }
    }
    return false;
  }
  
  public ICVSRemoteResource buildTree(RemoteFolderTree parent, IResource resource, boolean immutable, IProgressMonitor monitor)
    throws TeamException
  {
    Policy.checkCanceled(monitor);
    
    byte[] remoteBytes = getByteStore().getBytes(resource);
    if (remoteBytes == null) {
      return null;
    }
    if (resource.getType() == 1)
    {
      if (immutable) {
        remoteBytes = ResourceSyncInfo.setTag(remoteBytes, new CVSTag(ResourceSyncInfo.getRevision(remoteBytes), 2));
      }
      if (parent == null) {
        return (ICVSRemoteResource)getResourceVariant(resource);
      }
      return new RemoteFile(parent, remoteBytes);
    }
    RemoteFolderTree remote = RemoteFolderTree.fromBytes(parent, resource, remoteBytes);
    IResource[] members = members(resource);
    List children = new ArrayList();
    for (int i = 0; i < members.length; i++)
    {
      IResource member = members[i];
      ICVSRemoteResource child = buildTree(remote, member, immutable, monitor);
      if (child != null) {
        children.add(child);
      }
    }
    remote.setChildren((ICVSRemoteResource[])children.toArray(new ICVSRemoteResource[children.size()]));
    return remote;
  }
  
  public boolean isCacheFileContentsHint()
  {
    return cacheFileContentsHint;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree
 * 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.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
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.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.core.BackgroundEventHandler;
import org.eclipse.team.internal.core.BackgroundEventHandler.Event;
import org.eclipse.team.internal.core.BackgroundEventHandler.ResourceEvent;

public class DeferredResourceChangeHandler
  extends BackgroundEventHandler
{
  private static final int IGNORE_FILE_CHANGED = 1;
  private static final int RECREATED_CVS_RESOURCE = 2;
  private static final int CONFLICTING_DELETION = 3;
  
  public DeferredResourceChangeHandler()
  {
    super(CVSMessages.DeferredResourceChangeHandler_0, CVSMessages.DeferredResourceChangeHandler_1);
  }
  
  private Set changedIgnoreFiles = new HashSet();
  private Set recreatedResources = new HashSet();
  private Set conflictingDeletion = new HashSet();
  
  protected void processEvent(BackgroundEventHandler.Event event, IProgressMonitor monitor)
    throws TeamException
  {
    int type = event.getType();
    switch (type)
    {
    case 1: 
      changedIgnoreFiles.add(event.getResource());
      break;
    case 2: 
      recreatedResources.add(event.getResource());
      break;
    case 3: 
      conflictingDeletion.add(event.getResource());
    }
  }
  
  private IContainer[] getParents(Set files)
  {
    Set parents = new HashSet();
    for (Iterator iter = files.iterator(); iter.hasNext();)
    {
      IFile file = (IFile)iter.next();
      parents.add(file.getParent());
    }
    return (IContainer[])parents.toArray(new IContainer[parents.size()]);
  }
  
  public void ignoreFileChanged(IFile file)
  {
    if (isSharedWithCVS(file)) {
      queueEvent(new BackgroundEventHandler.ResourceEvent(file, 1, 0), false);
    }
  }
  
  public void recreated(IResource resource)
  {
    if (isSharedWithCVS(resource)) {
      queueEvent(new BackgroundEventHandler.ResourceEvent(resource, 2, 0), false);
    }
  }
  
  protected boolean doDispatchEvents(IProgressMonitor monitor)
  {
    boolean workDone = (!changedIgnoreFiles.isEmpty()) || (!recreatedResources.isEmpty());
    try
    {
      EclipseSynchronizer.getInstance().ignoreFilesChanged(getParents(changedIgnoreFiles));
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    changedIgnoreFiles.clear();
    
    Map recreations = getResourcesByProject((IResource[])recreatedResources.toArray(new IResource[recreatedResources.size()]));
    recreatedResources.clear();
    for (Iterator iter = recreations.values().iterator(); iter.hasNext();)
    {
      List resources = (List)iter.next();
      try
      {
        EclipseSynchronizer.getInstance().resourcesRecreated((IResource[])resources.toArray(new IResource[resources.size()]), monitor);
      }
      catch (CVSException e)
      {
        CVSProviderPlugin.log(e);
      }
    }
    IResource[] deletions = (IResource[])conflictingDeletion.toArray(new IResource[conflictingDeletion.size()]);
    conflictingDeletion.clear();
    for (int i = 0; i < deletions.length; i++)
    {
      IResource resource = deletions[i];
      ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
      try
      {
        if ((!cvsResource.isFolder()) && (cvsResource.isManaged())) {
          cvsResource.unmanage(monitor);
        }
      }
      catch (CVSException e)
      {
        CVSProviderPlugin.log(e);
      }
    }
    return workDone;
  }
  
  private Map getResourcesByProject(IResource[] resources)
  {
    Map result = new HashMap();
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      IProject project = resource.getProject();
      List projectResources = (List)result.get(project);
      if (projectResources == null)
      {
        projectResources = new ArrayList();
        result.put(project, projectResources);
      }
      projectResources.add(resource);
    }
    return result;
  }
  
  public void handleConflictingDeletion(IResource local)
  {
    if (isSharedWithCVS(local)) {
      queueEvent(new BackgroundEventHandler.ResourceEvent(local, 3, 0), false);
    }
  }
  
  private boolean isSharedWithCVS(IResource resource)
  {
    return CVSTeamProvider.isSharedWithCVS(resource.getProject());
  }
  
  protected Object getJobFamiliy()
  {
    return this;
  }
}

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

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
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.CVSTag;
import org.eclipse.team.internal.ccvs.core.resources.CVSEntryLineTag;
import org.eclipse.team.internal.ccvs.core.util.Util;

public class FolderSyncInfo
{
  public static final String VIRTUAL_DIRECTORY = "CVSROOT/Emptydir";
  protected String repository;
  protected String root;
  private CVSEntryLineTag tag;
  protected boolean isStatic;
  
  public FolderSyncInfo(String repo, String root, CVSTag tag, boolean isStatic)
  {
    Assert.isNotNull(repo);
    Assert.isNotNull(root);
    repository = repo;
    
    this.root = root.intern();
    ensureRepositoryRelativeToRoot();
    this.isStatic = isStatic;
    setTag(tag);
  }
  
  private void ensureRepositoryRelativeToRoot()
  {
    try
    {
      rootDir = getRootDirectory();
    }
    catch (CVSException localCVSException)
    {
      String rootDir;
      return;
    }
    String rootDir;
    if (repository.startsWith(rootDir)) {
      repository = repository.substring(rootDir.length());
    }
    if (repository.startsWith("/")) {
      repository = repository.substring("/".length());
    }
  }
  
  public boolean equals(Object other)
  {
    if (other == this) {
      return true;
    }
    if (!(other instanceof FolderSyncInfo)) {
      return false;
    }
    FolderSyncInfo syncInfo = (FolderSyncInfo)other;
    if (!getRoot().equals(syncInfo.getRoot())) {
      return false;
    }
    if (!getRepository().equals(syncInfo.getRepository())) {
      return false;
    }
    if (getIsStatic() != syncInfo.getIsStatic()) {
      return false;
    }
    if ((getTag() == null) || (syncInfo.getTag() == null))
    {
      if ((getTag() == null) && (syncInfo.getTag() != null) && (syncInfo.getTag().getType() != 0)) {
        return false;
      }
      if ((syncInfo.getTag() == null) && (getTag() != null) && (getTag().getType() != 0)) {
        return false;
      }
    }
    else if (!getTag().equals(syncInfo.getTag()))
    {
      return false;
    }
    return true;
  }
  
  public String getRoot()
  {
    return root;
  }
  
  private String getRootDirectory()
    throws CVSException
  {
    try
    {
      String root = getRoot();
      int index = root.indexOf('@');
      if (index == -1)
      {
        index = root.indexOf(':');
        if (index == 0)
        {
          index = root.indexOf(':', index + 1);
          index = root.indexOf(':', index + 1);
        }
        if (index == -1)
        {
          index = root.indexOf("/");
          if (index != -1) {
            index--;
          }
        }
      }
      else
      {
        index = root.indexOf(':', index + 1);
      }
      index++;
      
      char c = root.charAt(index);
      while (Character.isDigit(c)) {
        c = root.charAt(++index);
      }
      return root.substring(index);
    }
    catch (IndexOutOfBoundsException e)
    {
      IStatus status = new CVSStatus(4, CVSMessages.FolderSyncInfo_Maleformed_root_4, e);
      throw new CVSException(status);
    }
  }
  
  public CVSEntryLineTag getTag()
  {
    return tag;
  }
  
  public String getRepository()
  {
    return repository;
  }
  
  public boolean getIsStatic()
  {
    return isStatic;
  }
  
  public String getRemoteLocation()
    throws CVSException
  {
    return Util.appendPath(getRootDirectory(), getRepository());
  }
  
  public int hashCode()
  {
    return getRoot().hashCode() | getRepository().hashCode();
  }
  
  protected void setTag(CVSTag tag)
  {
    if ((tag == null) || (tag.equals(CVSTag.DEFAULT))) {
      this.tag = null;
    } else {
      this.tag = new CVSEntryLineTag(tag);
    }
  }
  
  public String toString()
  {
    return getRoot() + "/" + getRepository() + "/" + getTag();
  }
  
  public MutableFolderSyncInfo cloneMutable()
  {
    MutableFolderSyncInfo newSync = new MutableFolderSyncInfo(this);
    return newSync;
  }
  
  public boolean isSameMapping(FolderSyncInfo other)
  {
    if (other == null) {
      return false;
    }
    return (getRoot().equals(other.getRoot())) && (getRepository().equals(other.getRepository()));
  }
  
  public byte[] getBytes()
    throws CVSException
  {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(out);
    try
    {
      dos.writeUTF(getRoot());
      dos.writeUTF(getRepository());
      CVSEntryLineTag t = getTag();
      if (t == null) {
        dos.writeUTF("");
      } else {
        dos.writeUTF(t.toString());
      }
      dos.writeBoolean(getIsStatic());
      dos.close();
    }
    catch (IOException e)
    {
      throw CVSException.wrapException(e);
    }
    return out.toByteArray();
  }
  
  public static FolderSyncInfo getFolderSyncInfo(byte[] bytes)
    throws CVSException
  {
    Assert.isNotNull(bytes, "getFolderSyncInfo cannot be called with null parameter");
    ByteArrayInputStream in = new ByteArrayInputStream(bytes);
    DataInputStream dis = new DataInputStream(in);
    try
    {
      String root = dis.readUTF();
      String repository = dis.readUTF();
      String tagName = dis.readUTF();
      CVSEntryLineTag tag;
      CVSEntryLineTag tag;
      if (tagName.length() == 0) {
        tag = null;
      } else {
        tag = new CVSEntryLineTag(tagName);
      }
      isStatic = dis.readBoolean();
    }
    catch (IOException e)
    {
      boolean isStatic;
      Status status = new Status(4, "org.eclipse.team.cvs.core", NLS.bind(CVSMessages.FolderSyncInfo_InvalidSyncInfoBytes, new String(bytes)), e);
      CVSException ex = new CVSException(status);
      throw ex;
    }
    boolean isStatic;
    CVSEntryLineTag tag;
    String repository;
    String root;
    return new FolderSyncInfo(repository, root, tag, isStatic);
  }
  
  public boolean isVirtualDirectory()
  {
    return getRepository().equals("CVSROOT/Emptydir");
  }
  
  public FolderSyncInfo asImmutable()
  {
    return this;
  }
}

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

import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.team.core.variants.ResourceVariantByteStore;
import org.eclipse.team.internal.ccvs.core.CVSTag;

public class MultiTagResourceVariantTree
  extends CVSResourceVariantTree
{
  Map resources = new HashMap();
  
  public MultiTagResourceVariantTree(ResourceVariantByteStore cache, boolean cacheFileContentsHint)
  {
    super(cache, null, cacheFileContentsHint);
  }
  
  public void addResource(IResource resource, CVSTag tag)
  {
    Assert.isNotNull(resource);
    Assert.isNotNull(tag);
    resources.put(resource, tag);
  }
  
  public CVSTag getTag(IResource resource)
  {
    return (CVSTag)resources.get(resource);
  }
}

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

import org.eclipse.team.internal.ccvs.core.CVSTag;

public class MutableFolderSyncInfo
  extends FolderSyncInfo
{
  public MutableFolderSyncInfo(FolderSyncInfo info)
  {
    this(info.getRepository(), info.getRoot(), info.getTag(), info.getIsStatic());
  }
  
  public MutableFolderSyncInfo(String repo, String root, CVSTag tag, boolean isStatic)
  {
    super(repo, root, tag, isStatic);
  }
  
  public void setTag(CVSTag tag)
  {
    super.setTag(tag);
  }
  
  public void setRepository(String repository)
  {
    this.repository = repository;
  }
  
  public void setStatic(boolean isStatic)
  {
    this.isStatic = isStatic;
  }
  
  public FolderSyncInfo asImmutable()
  {
    return new FolderSyncInfo(getRepository(), getRoot(), getTag(), getIsStatic());
  }
  
  public void setRoot(String root)
  {
    this.root = root;
  }
}

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

import java.util.Date;
import org.eclipse.core.runtime.Assert;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;

public class MutableResourceSyncInfo
  extends ResourceSyncInfo
{
  protected MutableResourceSyncInfo(ResourceSyncInfo info)
  {
    name = info.getName();
    setRevision(info.getRevision());
    setTag(info.getTag());
    timeStamp = info.getTimeStamp();
    isDirectory = info.isDirectory();
    keywordMode = info.getKeywordMode();
    isDeleted = info.isDeleted();
    if (info.isMergedWithConflicts()) {
      setSyncType(3);
    } else if (info.isMerged()) {
      setSyncType(2);
    } else {
      setSyncType(1);
    }
  }
  
  public MutableResourceSyncInfo(String name, String revision)
  {
    Assert.isNotNull(name);
    this.name = name;
    setRevision(revision);
  }
  
  public void setRevision(String revision)
  {
    super.setRevision(revision);
  }
  
  public void setTimeStamp(Date timeStamp)
  {
    this.timeStamp = timeStamp;
  }
  
  public void setTimeStamp(Date timeStamp, boolean clearMerged)
  {
    setTimeStamp(timeStamp);
    if (clearMerged) {
      setSyncType(1);
    }
  }
  
  public void setKeywordMode(Command.KSubstOption keywordMode)
  {
    this.keywordMode = keywordMode;
  }
  
  public void setTag(CVSTag tag)
  {
    super.setTag(tag);
  }
  
  public void setDeleted(boolean isDeleted)
  {
    this.isDeleted = isDeleted;
  }
  
  public void setAdded()
  {
    setRevision("0");
  }
  
  public void setMerged()
  {
    if (syncType == 1) {
      syncType = 2;
    }
  }
  
  public void setEntryLine(String entryLine)
    throws CVSException
  {
    super.setEntryLine(entryLine);
  }
}

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

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.ParseException;
import java.util.Date;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
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.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.util.CVSDateFormatter;
import org.eclipse.team.internal.ccvs.core.util.Util;

public class NotifyInfo
{
  public static final char EDIT = 'E';
  public static final char UNEDIT = 'U';
  public static final char COMMIT = 'C';
  public static final char[] ALL = { 'E', 'U', 'C' };
  protected static final String TAB_SEPARATOR = "\t";
  private String filename;
  private char notificationType;
  private Date timeStamp;
  private char[] watches;
  
  public NotifyInfo(String filename, char notificationType, Date timeStamp, char[] watches)
  {
    this.filename = filename;
    this.notificationType = notificationType;
    this.timeStamp = timeStamp;
    this.watches = watches;
  }
  
  public NotifyInfo(IContainer parent, String line)
    throws CVSException
  {
    String[] strings = Util.parseIntoSubstrings(line, "/");
    if (strings.length != 4)
    {
      IStatus status = new CVSStatus(4, -14, NLS.bind(CVSMessages.NotifyInfo_MalformedLine, new String[] { line }), parent);
      throw new CVSException(status);
    }
    filename = strings[0];
    
    String type = strings[1];
    if (type.length() != 1)
    {
      IStatus status = new CVSStatus(4, -14, NLS.bind(CVSMessages.NotifyInfo_MalformedNotificationType, new String[] { line }), parent);
      throw new CVSException(status);
    }
    notificationType = type.charAt(0);
    
    String date = strings[2];
    try
    {
      timeStamp = CVSDateFormatter.entryLineToDate(date);
    }
    catch (ParseException localParseException)
    {
      IStatus status = new CVSStatus(4, -14, NLS.bind(CVSMessages.NotifyInfo_MalformedNotifyDate, new String[] { line }), parent);
      throw new CVSException(status);
    }
    String watchesString = strings[3];
    if (watchesString.length() > 0)
    {
      watches = new char[watchesString.length()];
      for (int i = 0; i < watchesString.length(); i++) {
        watches[i] = watchesString.charAt(i);
      }
    }
    else
    {
      watches = null;
    }
  }
  
  public String getNotifyLine()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append(getName());
    buffer.append("/");
    buffer.append(notificationType);
    buffer.append("/");
    buffer.append(CVSDateFormatter.dateToEntryLine(timeStamp));
    buffer.append("/");
    if (watches != null) {
      for (int i = 0; i < watches.length; i++)
      {
        char c = watches[i];
        buffer.append(c);
      }
    }
    return buffer.toString();
  }
  
  public String getServerLine(ICVSFolder parent)
    throws CVSException
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append(notificationType);
    buffer.append("\t");
    buffer.append(getServerTimestamp());
    buffer.append("\t");
    buffer.append(getHost());
    buffer.append("\t");
    buffer.append(getWorkingDirectory(parent));
    buffer.append("\t");
    if (watches != null) {
      for (int i = 0; i < watches.length; i++)
      {
        char c = watches[i];
        buffer.append(c);
      }
    }
    return buffer.toString();
  }
  
  private String getServerTimestamp()
  {
    return CVSDateFormatter.dateToNotifyServer(timeStamp);
  }
  
  private String getWorkingDirectory(ICVSFolder parent)
    throws CVSException
  {
    return parent.getIResource().getLocation().toString();
  }
  
  private String getHost()
    throws CVSException
  {
    try
    {
      return InetAddress.getLocalHost().getHostName();
    }
    catch (UnknownHostException e)
    {
      throw CVSException.wrapException(e);
    }
  }
  
  public String getName()
  {
    return filename;
  }
  
  public char getNotificationType()
  {
    return notificationType;
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.team.internal.core.subscribers.BatchingLock.IFlushOperation;
import org.eclipse.team.internal.core.subscribers.BatchingLock.ThreadInfo;

public class ReentrantLock$CVSThreadInfo
  extends BatchingLock.ThreadInfo
{
  private Set changedFolders;
  final ReentrantLock this$0;
  
  public ReentrantLock$CVSThreadInfo(ReentrantLock paramReentrantLock, BatchingLock.IFlushOperation operation)
  {
    super(paramReentrantLock, operation);this$0 = paramReentrantLock;changedFolders = new HashSet();
  }
  
  public void addChangedFolder(IContainer container)
  {
    changedFolders.add(container);
  }
  
  public boolean isEmpty()
  {
    return (changedFolders.isEmpty()) && (super.isEmpty());
  }
  
  public IContainer[] getChangedFolders()
  {
    return (IContainer[])changedFolders.toArray(new IContainer[changedFolders.size()]);
  }
  
  /* Error */
  public void flush(org.eclipse.core.runtime.IProgressMonitor monitor)
    throws org.eclipse.team.core.TeamException
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: invokespecial 67	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:flush	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   5: goto +15 -> 20
    //   8: astore_2
    //   9: aload_0
    //   10: getfield 63	org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock$CVSThreadInfo:changedFolders	Ljava/util/Set;
    //   13: invokeinterface 70 1 0
    //   18: aload_2
    //   19: athrow
    //   20: aload_0
    //   21: getfield 63	org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock$CVSThreadInfo:changedFolders	Ljava/util/Set;
    //   24: invokeinterface 70 1 0
    //   29: return
    // Line number table:
    //   Java source line #53	-> byte code offset #0
    //   Java source line #54	-> byte code offset #8
    //   Java source line #57	-> byte code offset #9
    //   Java source line #58	-> byte code offset #18
    //   Java source line #57	-> byte code offset #20
    //   Java source line #59	-> byte code offset #29
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	30	0	this	CVSThreadInfo
    //   0	30	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   8	11	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	8	8	finally
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.Assert;
import org.eclipse.team.internal.core.subscribers.BatchingLock;
import org.eclipse.team.internal.core.subscribers.BatchingLock.IFlushOperation;
import org.eclipse.team.internal.core.subscribers.BatchingLock.ThreadInfo;

public class ReentrantLock
  extends BatchingLock
{
  public class CVSThreadInfo
    extends BatchingLock.ThreadInfo
  {
    private Set changedFolders = new HashSet();
    
    public CVSThreadInfo(BatchingLock.IFlushOperation operation)
    {
      super(operation);
    }
    
    public void addChangedFolder(IContainer container)
    {
      changedFolders.add(container);
    }
    
    public boolean isEmpty()
    {
      return (changedFolders.isEmpty()) && (super.isEmpty());
    }
    
    public IContainer[] getChangedFolders()
    {
      return (IContainer[])changedFolders.toArray(new IContainer[changedFolders.size()]);
    }
    
    /* Error */
    public void flush(org.eclipse.core.runtime.IProgressMonitor monitor)
      throws org.eclipse.team.core.TeamException
    {
      // Byte code:
      //   0: aload_0
      //   1: aload_1
      //   2: invokespecial 67	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:flush	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
      //   5: goto +15 -> 20
      //   8: astore_2
      //   9: aload_0
      //   10: getfield 63	org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock$CVSThreadInfo:changedFolders	Ljava/util/Set;
      //   13: invokeinterface 70 1 0
      //   18: aload_2
      //   19: athrow
      //   20: aload_0
      //   21: getfield 63	org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock$CVSThreadInfo:changedFolders	Ljava/util/Set;
      //   24: invokeinterface 70 1 0
      //   29: return
      // Line number table:
      //   Java source line #53	-> byte code offset #0
      //   Java source line #54	-> byte code offset #8
      //   Java source line #57	-> byte code offset #9
      //   Java source line #58	-> byte code offset #18
      //   Java source line #57	-> byte code offset #20
      //   Java source line #59	-> byte code offset #29
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	30	0	this	CVSThreadInfo
      //   0	30	1	monitor	org.eclipse.core.runtime.IProgressMonitor
      //   8	11	2	localObject	Object
      // Exception table:
      //   from	to	target	type
      //   0	8	8	finally
    }
  }
  
  protected BatchingLock.ThreadInfo createThreadInfo(BatchingLock.IFlushOperation operation)
  {
    return new CVSThreadInfo(operation);
  }
  
  public void folderChanged(IContainer folder)
  {
    CVSThreadInfo info = (CVSThreadInfo)getThreadInfo();
    Assert.isNotNull(info, "Folder changed outside of resource lock");
    info.addChangedFolder(folder);
  }
}

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

import java.text.ParseException;
import java.util.Date;
import org.eclipse.core.runtime.Assert;
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.CVSTag;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSEntryLineTag;
import org.eclipse.team.internal.ccvs.core.util.CVSDateFormatter;
import org.eclipse.team.internal.ccvs.core.util.Util;

public class ResourceSyncInfo
{
  private static final String DEFAULT_PERMISSIONS = "u=rw,g=rw,o=r";
  private static final String DEFAULT_EXECUTABLE_PERMISSIONS = "u=rwx,g=rwx,o=rx";
  private static final String DELETED_PREFIX = "-";
  private static final byte DELETED_PREFIX_BYTE = 45;
  public static final String LOCKEDBY_REGEX = "\\slocked by.+$";
  public static final String ADDED_REVISION = "0";
  protected static final int TYPE_REGULAR = 1;
  protected static final int TYPE_MERGED = 2;
  protected static final int TYPE_MERGED_WITH_CONFLICTS = 3;
  protected static final int TYPE_DELETED_AND_RESTORED = 4;
  protected static final String TIMESTAMP_DUMMY = "dummy timestamp";
  protected static final String TIMESTAMP_MERGED = "Result of merge";
  protected static final String TIMESTAMP_MERGED_WITH_CONFLICT = "Result of merge+";
  protected static final String TIMESTAMP_DELETED_AND_RESTORED = "restored+";
  protected static final String TIMESTAMP_SERVER_MERGED = "+modified";
  protected static final String TIMESTAMP_SERVER_MERGED_WITH_CONFLICT = "+=";
  protected boolean isDirectory = false;
  protected boolean isDeleted = false;
  protected static final String DIRECTORY_PREFIX = "D";
  protected static final String SEPARATOR = "/";
  protected static final byte SEPARATOR_BYTE = 47;
  protected String name;
  protected String revision;
  protected Date timeStamp;
  protected Command.KSubstOption keywordMode;
  protected CVSEntryLineTag tag;
  protected int syncType = 1;
  
  protected ResourceSyncInfo() {}
  
  public ResourceSyncInfo(byte[] entryLine)
    throws CVSException
  {
    this(new String(entryLine), null);
  }
  
  public ResourceSyncInfo(String entryLine, Date timestamp)
    throws CVSException
  {
    Assert.isNotNull(entryLine);
    setEntryLine(entryLine);
    if (timestamp != null) {
      timeStamp = timestamp;
    }
  }
  
  public ResourceSyncInfo(String name)
  {
    Assert.isNotNull(name);
    this.name = name;
    isDirectory = true;
  }
  
  public boolean isDirectory()
  {
    return isDirectory;
  }
  
  public boolean isNeedsMerge(Date otherTimestamp)
  {
    return (syncType == 3) && (timeStamp != null) && (timeStamp.equals(otherTimestamp));
  }
  
  public boolean isMergedWithConflicts()
  {
    return syncType == 3;
  }
  
  public boolean isMerged()
  {
    return (syncType == 2) || (isMergedWithConflicts());
  }
  
  public boolean isAdded()
  {
    if (!isDirectory) {
      return getRevision().equals("0");
    }
    return false;
  }
  
  public boolean isDeleted()
  {
    return isDeleted;
  }
  
  public String getEntryLine()
  {
    return getEntryLine(true, null);
  }
  
  public String getServerEntryLine(Date fileTimestamp)
  {
    if ((fileTimestamp != null) && ((isMerged()) || (isMergedWithConflicts())))
    {
      String serverTimestamp;
      String serverTimestamp;
      if (isNeedsMerge(fileTimestamp)) {
        serverTimestamp = "+=";
      } else {
        serverTimestamp = "+modified";
      }
      return getEntryLine(true, serverTimestamp);
    }
    return getEntryLine(false, null);
  }
  
  public CVSTag getTag()
  {
    return tag;
  }
  
  public Date getTimeStamp()
  {
    return timeStamp;
  }
  
  public String getRevision()
  {
    return revision;
  }
  
  public String getName()
  {
    return name;
  }
  
  public Command.KSubstOption getKeywordMode()
  {
    return keywordMode;
  }
  
  public static String getDefaultPermissions()
  {
    return "u=rw,g=rw,o=r";
  }
  
  public static String getDefaultExecutablePermissions()
  {
    return "u=rwx,g=rwx,o=rx";
  }
  
  public boolean equals(Object other)
  {
    if ((other instanceof ResourceSyncInfo))
    {
      ResourceSyncInfo syncInfo = (ResourceSyncInfo)other;
      if (other == this) {
        return true;
      }
      if (getName() == syncInfo.getName()) {
        return true;
      }
      return getName().equals(syncInfo.getName());
    }
    return false;
  }
  
  public int hashCode()
  {
    return getName().hashCode();
  }
  
  public String toString()
  {
    return getEntryLine(true, null);
  }
  
  public MutableResourceSyncInfo cloneMutable()
  {
    MutableResourceSyncInfo newSync = new MutableResourceSyncInfo(this);
    return newSync;
  }
  
  protected void setTag(CVSTag tag)
  {
    if (tag != null) {
      this.tag = new CVSEntryLineTag(tag);
    } else {
      this.tag = null;
    }
  }
  
  protected void setSyncType(int syncType)
  {
    this.syncType = syncType;
  }
  
  protected void setRevision(String revision)
  {
    if ((revision == null) || (revision.equals("0")))
    {
      this.revision = "0";
      timeStamp = null;
      syncType = 1;
      isDeleted = false;
    }
    else if (revision.startsWith("-"))
    {
      this.revision = revision.substring("-".length());
      isDeleted = true;
    }
    else
    {
      this.revision = revision;
      isDeleted = false;
    }
    this.revision = this.revision.replaceFirst("\\slocked by.+$", "");
  }
  
  protected void setEntryLine(String entryLine)
    throws CVSException
  {
    String[] strings = Util.parseIntoSubstrings(entryLine, "/");
    if (strings.length < 6) {
      throw new CVSException(CVSMessages.Malformed_entry_line___11 + entryLine);
    }
    isDirectory = strings[0].equals("D");
    
    name = strings[1];
    if (name.length() == 0) {
      throw new CVSException(CVSMessages.Malformed_entry_line__missing_name___12 + entryLine);
    }
    String rev = strings[2];
    if ((rev.length() == 0) && (!isDirectory())) {
      throw new CVSException(CVSMessages.Malformed_entry_line__missing_revision___13 + entryLine);
    }
    setRevision(rev);
    
    String date = strings[3];
    if (date.indexOf("+modified") != -1)
    {
      syncType = 2;
      date = null;
    }
    else if (date.indexOf("+=") != -1)
    {
      syncType = 3;
      date = null;
    }
    else if (date.indexOf("Result of merge+") != -1)
    {
      date = date.substring(date.indexOf("+") + 1);
      syncType = 3;
    }
    else if (date.indexOf("Result of merge") != -1)
    {
      syncType = 2;
      date = null;
    }
    else if (date.indexOf("restored+") != -1)
    {
      syncType = 4;
      date = date.substring(date.indexOf("+") + 1);
    }
    if ((date == null) || ("".equals(date))) {
      timeStamp = null;
    } else {
      try
      {
        timeStamp = CVSDateFormatter.entryLineToDate(date);
      }
      catch (ParseException localParseException)
      {
        timeStamp = null;
      }
    }
    keywordMode = Command.KSubstOption.fromMode(strings[4]);
    String tagEntry;
    String tagEntry;
    if (strings.length == 6)
    {
      tagEntry = strings[5];
    }
    else
    {
      StringBuffer buffer = new StringBuffer();
      for (int i = 5; i < strings.length; i++)
      {
        buffer.append(strings[i]);
        if (i < strings.length - 1) {
          buffer.append("/");
        }
      }
      tagEntry = buffer.toString();
    }
    if (tagEntry.length() > 0) {
      tag = new CVSEntryLineTag(tagEntry);
    } else {
      tag = null;
    }
  }
  
  private String getEntryLine(boolean includeTimeStamp, String timestampOverride)
  {
    StringBuffer result = new StringBuffer();
    if (isDirectory)
    {
      result.append("D");
      result.append("/");
      result.append(name);
      for (int i = 0; i < 4; i++) {
        result.append("/");
      }
    }
    else
    {
      result.append("/");
      result.append(name);
      result.append("/");
      if (isDeleted) {
        result.append("-");
      }
      result.append(revision);
      result.append("/");
      if (includeTimeStamp)
      {
        String entryLineTimestamp = "";
        if (timestampOverride != null) {
          entryLineTimestamp = timestampOverride;
        } else {
          switch (syncType)
          {
          case 1: 
            if (timeStamp == null) {
              entryLineTimestamp = "dummy timestamp";
            } else {
              entryLineTimestamp = CVSDateFormatter.dateToEntryLine(timeStamp);
            }
            break;
          case 2: 
            entryLineTimestamp = "Result of merge"; break;
          case 3: 
            entryLineTimestamp = "Result o
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