Class FileChangeDetector
java.lang.Object
de.iip_ecosphere.platform.tools.maven.python.FileChangeDetector
A simple MD5-hash based file change detector.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFileChangeDetector(File md5File, Logger logger, String task) Creates a file change detector instance. -
Method Summary
Modifier and TypeMethodDescriptioncheckHashes(List<File> files) Checksfilesfor existing/known hashes.static FilegetHashFileInTarget(org.apache.maven.project.MavenProject project, String hashFileName) Returns the name of a hash file with#FILE_EXTENSIONin the maven target folder.private StringgetHashFilePath(File file) Returns the file path to be used for MD5 hashing offile.voidReads the MD5 hash file.voidRemovesfilefrom the hashes.useHash(boolean useHash) Enable/disable the detector.voidWritesmd5Hashesto the hash file.
-
Field Details
-
FILE_EXTENSION
- See Also:
-
md5File
-
useHash
private boolean useHash -
logger
-
task
-
md5Hashes
-
-
Constructor Details
-
FileChangeDetector
Creates a file change detector instance.- Parameters:
md5File- the file where the hashes are/shall be storedlogger- the logger instancetask- a task description for logging (may be null or empty for no logging)
-
-
Method Details
-
useHash
Enable/disable the detector.- Parameters:
useHash- whether the detector/hashing shall be used- Returns:
- this (builder style)
-
readHashFile
public void readHashFile()Reads the MD5 hash file. -
writeHashFile
public void writeHashFile()Writesmd5Hashesto the hash file. -
remove
Removesfilefrom the hashes.- Parameters:
file- the file to remove
-
getHashFilePath
Returns the file path to be used for MD5 hashing offile.- Parameters:
file- the file- Returns:
- the file path
-
checkHashes
Checksfilesfor existing/known hashes.- Parameters:
files- the files- Returns:
- a subset of
filesto process
-
getHashFileInTarget
public static File getHashFileInTarget(org.apache.maven.project.MavenProject project, String hashFileName) Returns the name of a hash file with#FILE_EXTENSIONin the maven target folder.- Parameters:
project- the project determining the maven target folderhashFileName- the name of the hash file- Returns:
- the hash file
-