public abstract class FileWatcher
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
baseDirectory |
protected java.lang.String[] |
fileList |
protected boolean |
force |
protected Logger |
logger |
protected HostItem |
server |
protected java.util.Map<java.lang.String,byte[]> |
sha512 |
protected boolean |
stop |
protected java.lang.Thread |
thread |
protected long |
time |
protected HostItem |
tracker |
Constructor and Description |
---|
FileWatcher(Logger logger,
long millis,
HostItem server,
HostItem tracker,
java.lang.String baseDirectory)
Constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getFileList()
FileList getter
|
java.util.Map<java.lang.String,byte[]> |
getSha512Map()
Sha512 map getter
|
protected void |
initSha512()
Init sha512 map.
|
protected abstract void |
registerTracker()
Register server on tracker
|
void |
run()
Runnable implementation
|
void |
setStop()
Ask the thread to stop
|
void |
setThread(java.lang.Thread thread)
Set thread
|
void |
trigger()
Allow a manual check
|
protected boolean |
updateFileList()
Update fileList and returns true if different than old list.
|
protected abstract void |
writeLog(java.lang.Exception e,
LogLevel logLevel)
Implementation of writeLog
|
protected abstract void |
writeLog(java.lang.String text,
LogLevel logLevel)
Implementation of writeLog
|
protected java.lang.String[] fileList
protected Logger logger
protected volatile boolean stop
protected long time
protected boolean force
protected HostItem server
protected HostItem tracker
protected java.lang.String baseDirectory
protected java.util.Map<java.lang.String,byte[]> sha512
protected java.lang.Thread thread
public FileWatcher(Logger logger, long millis, HostItem server, HostItem tracker, java.lang.String baseDirectory)
logger
- Loggermillis
- Time interval before recheckserver
- HostItem for the servertracker
- HostItem for the trackerbaseDirectory
- Directory to search filespublic java.lang.String[] getFileList()
public java.util.Map<java.lang.String,byte[]> getSha512Map()
public void trigger()
public void run()
run
in interface java.lang.Runnable
protected abstract void registerTracker()
protected boolean updateFileList()
public void setStop()
protected void initSha512()
protected abstract void writeLog(java.lang.String text, LogLevel logLevel)
text
- Text to loglogLevel
- level of loggingprotected abstract void writeLog(java.lang.Exception e, LogLevel logLevel)
e
- exception to loglogLevel
- level of loggingpublic void setThread(java.lang.Thread thread)
thread
- Thread