Class FilesWatcher
- java.lang.Object
-
- jetbrains.buildServer.configuration.FilesWatcher
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFilesWatcher.WatchedFilesProviderAllows to dynamically specify list of watched files/directories
-
Field Summary
Fields Modifier and Type Field Description static StringTEAMCITY_FILES_WATCHER_INIT_STATE_DELAY_PROP
-
Constructor Summary
Constructors Constructor Description FilesWatcher(FilesWatcher.WatchedFilesProvider filesProvider)Constructs files watcher from the specified watched files provider.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanchangesDetected()Computes whether files state has been changed.booleancheckForModifications()Performs unscheduled checking for modifications.Stringdescribe(boolean verbose)protected FilesStatedetectChanges()List<File>getModifiedFiles()Returns modified filesList<File>getNewFiles()Returns files detected as newList<File>getRemovedFiles()Returns files detected as removedlonggetSleepingPeriod()Returns sleeping periodbooleanisStarted()voidregisterListener(ChangeListener listener)Deprecated.voidregisterListener(FileWatcherListener listener)Registers FileWatcherListenervoidrunActionWithDisabledObserver(Runnable runnable)Runs the specified runnable with paused changes watcher thread.voidsetSleepingPeriod(long time)Sets sleeping period in this observer.static voidshutdownAll()Shutdowns internal executor servicevoidstart()Starts observer, should be called only oncevoidstop()Stops observerStringtoString()voidunregisterListener(ChangeListener listener)Deprecated.voidunregisterListener(FileWatcherListener listener)Removes previously registered listenervoidwaitForReadyState()
-
-
-
Field Detail
-
TEAMCITY_FILES_WATCHER_INIT_STATE_DELAY_PROP
public static final String TEAMCITY_FILES_WATCHER_INIT_STATE_DELAY_PROP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FilesWatcher
public FilesWatcher(@NotNull FilesWatcher.WatchedFilesProvider filesProvider)Constructs files watcher from the specified watched files provider.- Parameters:
filesProvider- watched files provider- See Also:
FilesWatcher.WatchedFilesProvider
-
-
Method Detail
-
changesDetected
public boolean changesDetected()
Computes whether files state has been changed.- Returns:
- true if files changes and false otherwise
-
getNewFiles
@NotNull public List<File> getNewFiles()
Returns files detected as new- Returns:
- new files
-
getRemovedFiles
@NotNull public List<File> getRemovedFiles()
Returns files detected as removed- Returns:
- removed files
-
getModifiedFiles
@NotNull public List<File> getModifiedFiles()
Returns modified files- Returns:
- modified files
-
describe
@NotNull public String describe(boolean verbose)
-
registerListener
@Deprecated public void registerListener(@NotNull ChangeListener listener)
Deprecated.Registers ChangeListener- Parameters:
listener- ChangeListener
-
registerListener
public void registerListener(@NotNull FileWatcherListener listener)Registers FileWatcherListener- Parameters:
listener- ChangeListener- Since:
- 10.0
-
unregisterListener
@Deprecated public void unregisterListener(@NotNull ChangeListener listener)
Deprecated.Removes previously registered ChangeListener
-
unregisterListener
public void unregisterListener(@NotNull FileWatcherListener listener)Removes previously registered listener- Since:
- 10.0
-
start
public void start()
Starts observer, should be called only once
-
stop
public void stop()
Stops observer
-
setSleepingPeriod
public void setSleepingPeriod(long time)
Sets sleeping period in this observer. The observer should be restarted after this.- Parameters:
time- sleeping period
-
getSleepingPeriod
public long getSleepingPeriod()
Returns sleeping period- Returns:
- sleeping period
-
runActionWithDisabledObserver
public void runActionWithDisabledObserver(@NotNull Runnable runnable)Runs the specified runnable with paused changes watcher thread. After the runnable finishes the watcher will be activated.- Parameters:
runnable- runnable
-
checkForModifications
public boolean checkForModifications()
Performs unscheduled checking for modifications.
-
detectChanges
@Nullable protected FilesState detectChanges()
- Returns:
- null if no changes detected or current files state if changes were detected
-
shutdownAll
public static void shutdownAll()
Shutdowns internal executor service
-
isStarted
public boolean isStarted()
- Returns:
- true if this files watcher is started
- Since:
- 10.0
-
waitForReadyState
public void waitForReadyState()
- Since:
- 10.0
-
-