Class FileWatcher
- java.lang.Object
-
- jetbrains.buildServer.configuration.ChangeObserver
-
- jetbrains.buildServer.configuration.FileWatcher
-
- All Implemented Interfaces:
ChangeProvider
,jetbrains.buildServer.log.Loggable
public class FileWatcher extends ChangeObserver implements ChangeProvider
Watches for changes in one file.
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_CHECK_INTERVAL_MS
-
Constructor Summary
Constructors Constructor Description FileWatcher(java.io.File file)
FileWatcher(java.io.File file, java.util.concurrent.ScheduledExecutorService scheduler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
changesDetected()
Returns true if changes in file detectedjava.lang.String
describe(boolean verbose)
java.io.File
getFile()
java.lang.String
getRequestor()
Returns (short) string representation of this change sourcevoid
resetChanged()
Call to reset changes statusjava.lang.String
toString()
-
Methods inherited from class jetbrains.buildServer.configuration.ChangeObserver
checkForModifications, clear, clearListeners, getSleepingPeriod, registerChangeProvider, registerListener, runActionWithDisabledObserver, setSkipListenersNotification, setSleepingPeriod, shutdownAll, start, stop, unregisterChangeProvider, unregisterListener
-
-
-
-
Field Detail
-
DEFAULT_CHECK_INTERVAL_MS
public static final long DEFAULT_CHECK_INTERVAL_MS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileWatcher
public FileWatcher(@NotNull java.io.File file)
- Parameters:
file
- file to watch changes in. May denote a directory as well, its lastModified attribute will be monitored for the change
-
FileWatcher
public FileWatcher(@NotNull java.io.File file, @NotNull java.util.concurrent.ScheduledExecutorService scheduler)
- Parameters:
scheduler
- executor that will be used to schedule watcher tasksfile
- file to watch changes in. May denote a directory as well, its lastModified attribute will be monitored for the change
-
-
Method Detail
-
changesDetected
public boolean changesDetected()
Returns true if changes in file detected- Specified by:
changesDetected
in interfaceChangeProvider
- Returns:
- true if changes in file detected
- See Also:
ChangeProvider.resetChanged()
-
resetChanged
public void resetChanged()
Call to reset changes status- Specified by:
resetChanged
in interfaceChangeProvider
-
getRequestor
public java.lang.String getRequestor()
Description copied from interface:ChangeProvider
Returns (short) string representation of this change source- Specified by:
getRequestor
in interfaceChangeProvider
- Returns:
- (short) string representation of this change source
-
getFile
@NotNull public java.io.File getFile()
- Returns:
- monitored file
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
describe
@NotNull public java.lang.String describe(boolean verbose)
- Specified by:
describe
in interfacejetbrains.buildServer.log.Loggable
-
-