Class RequireFileChecksum
java.lang.Object
org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
org.apache.maven.enforcer.rules.checksum.RequireFileChecksum
- All Implemented Interfaces:
EnforcerRuleBase
- Direct Known Subclasses:
RequireTextFileChecksum
Rule to validate a binary file to match the specified checksum.
- Author:
- Edward Samson, Lyubomyr Shaydariv
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected StringcalculateChecksum(InputStream inputStream) voidexecute()getFile()getLog()getType()voidsetChecksum(String checksum) The expected checksum value.voidThe file to check.voidsetLog(EnforcerLogger arg0) voidsetNonexistentFileMessage(String nonexistentFileMessage) The friendly message to use when the file does not exist.voidThe checksum algorithm to use.toString()Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevel, getRuleName
-
Constructor Details
-
RequireFileChecksum
public RequireFileChecksum()
-
-
Method Details
-
execute
- Specified by:
executein classAbstractEnforcerRule- Throws:
EnforcerRuleException
-
setFile
The file to check.- Parameters:
file- file
-
getFile
-
setChecksum
The expected checksum value.- Parameters:
checksum- checksum
-
getChecksum
-
setType
The checksum algorithm to use. Possible values: "md5", "sha1", "sha256", "sha384", "sha512".- Parameters:
type- algorithm
-
getType
-
setNonexistentFileMessage
The friendly message to use when the file does not exist.- Parameters:
nonexistentFileMessage- message
-
getNonexistentFileMessage
-
calculateChecksum
- Throws:
EnforcerRuleException
-
calculateChecksum
protected String calculateChecksum(InputStream inputStream) throws IOException, EnforcerRuleException - Throws:
IOExceptionEnforcerRuleException
-
toString
-
setLog
- Specified by:
setLogin interfaceEnforcerRuleBase
-
getLog
-