Class FilesWatcher
- java.lang.Object
-
- jetbrains.buildServer.configuration.FilesWatcher
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
FilesWatcher.WatchedFilesProvider
Allows to dynamically specify list of watched files/directories
-
Field Summary
Fields Modifier and Type Field Description static String
TEAMCITY_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 boolean
changesDetected()
Computes whether files state has been changed.boolean
checkForModifications()
Performs unscheduled checking for modifications.String
describe(boolean verbose)
protected FilesState
detectChanges()
List<File>
getModifiedFiles()
Returns modified filesList<File>
getNewFiles()
Returns files detected as newList<File>
getRemovedFiles()
Returns files detected as removedlong
getSleepingPeriod()
Returns sleeping periodboolean
isStarted()
void
registerListener(ChangeListener listener)
Deprecated.void
registerListener(FileWatcherListener listener)
Registers FileWatcherListenervoid
runActionWithDisabledObserver(Runnable runnable)
Runs the specified runnable with paused changes watcher thread.void
setSleepingPeriod(long time)
Sets sleeping period in this observer.static void
shutdownAll()
Shutdowns internal executor servicevoid
start()
Starts observer, should be called only oncevoid
stop()
Stops observerString
toString()
void
unregisterListener(ChangeListener listener)
Deprecated.void
unregisterListener(FileWatcherListener listener)
Removes previously registered listenervoid
waitForReadyState()
-
-
-
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
-
-