com.microsoft.tfs.core.clients.versioncontrol.localworkspace
Class WorkspaceWatcher

java.lang.Object
  extended by com.microsoft.tfs.core.clients.versioncontrol.localworkspace.WorkspaceWatcher

public class WorkspaceWatcher
extends java.lang.Object


Constructor Summary
WorkspaceWatcher(Workspace workspace)
           
 
Method Summary
 void addSkippedItem(java.lang.String localItem)
           
 void ensureWatching()
          If a PathWatcher is created but the path to watch on disk does not exist, then the PathWatcher will not start asynchronously watching for changes on disk.
 void forceFullScan()
           
 boolean isAsynchronous()
          True if the WorkspaceWatcher should, in the background, scan the workspace for changes in response to local disk events noticed by the PathWatchers.
 boolean isScanNecessary()
          Returns true if a scan is necessary on this workspace.
 void locationChanged()
          When the location of the workspace (local or server) changes, the Workspace object should inform the WorkspaceWatcher by calling this method.
 void markPathChanged(java.lang.String path)
          Allows callers to explicitly add a path to the changed paths list for partial scans.
 void pathChanged(PathWatcher sender)
           
 void removeSkippedItem(java.lang.String localItem)
           
 void scan(com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.LocalWorkspaceProperties wp, com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.WorkspaceVersionTable lv, com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.LocalPendingChangesTable pc)
          Performs a scan of the workspace if necessary.
 void setAsynchronous(boolean value)
           
 void stopWatching()
          Stops all watchers.
 void workingFoldersChanged(WorkingFolder[] workingFolders)
          Call this to inform the WorkspaceWatcher that the working folders for the Workspace have changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkspaceWatcher

public WorkspaceWatcher(Workspace workspace)
Method Detail

isAsynchronous

public boolean isAsynchronous()
True if the WorkspaceWatcher should, in the background, scan the workspace for changes in response to local disk events noticed by the PathWatchers. The scan of the workspace may detect new pending changes and alert subscribers to the PendingChangesChanged and PendingChangeCandidatesChanged events on VersionControlServer. The background scans are rate-limited by the QueuedActionLimiter.


setAsynchronous

public void setAsynchronous(boolean value)

locationChanged

public void locationChanged()
When the location of the workspace (local or server) changes, the Workspace object should inform the WorkspaceWatcher by calling this method. The WorkspaceWatcher will respond by either spinning up PathWatchers or spinning them down, as appropriate.


stopWatching

public void stopWatching()
Stops all watchers. The watchers may be started again automatically by the next call to poll() or another method. This method is mainly to support an application switching away from a workspace (perhaps to use another), so that the old workspace's watchers are no longer hooked up.


ensureWatching

public void ensureWatching()
If a PathWatcher is created but the path to watch on disk does not exist, then the PathWatcher will not start asynchronously watching for changes on disk. (It will still be invalidated, and our polling architecture will work fine.) Call EnsureWatching to try and start each PathWatcher again. This is called every time we perform baseline maintenance on the local workspace properties table, for example.


workingFoldersChanged

public void workingFoldersChanged(WorkingFolder[] workingFolders)
Call this to inform the WorkspaceWatcher that the working folders for the Workspace have changed. The WorkspaceWatcher will ensure that it is watching the new working folders, in addition to whatever it was already watching.


markPathChanged

public void markPathChanged(java.lang.String path)
Allows callers to explicitly add a path to the changed paths list for partial scans.


forceFullScan

public void forceFullScan()
                   throws java.io.IOException
Throws:
java.io.IOException

scan

public void scan(com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.LocalWorkspaceProperties wp,
                 com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.WorkspaceVersionTable lv,
                 com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.LocalPendingChangesTable pc)
Performs a scan of the workspace if necessary.

Parameters:
wp - Workspace properties table
lv - Local version table
pc - Pending changes table

isScanNecessary

public boolean isScanNecessary()
Returns true if a scan is necessary on this workspace.


addSkippedItem

public void addSkippedItem(java.lang.String localItem)

pathChanged

public void pathChanged(PathWatcher sender)

removeSkippedItem

public void removeSkippedItem(java.lang.String localItem)


© 2015 Microsoft. All rights reserved.