Class RequireFileChecksum
java.lang.Object
org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
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.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected StringcalculateChecksum(InputStream inputStream) voidexecute()This is the interface into the rule.getFile()getType()voidsetChecksum(String checksum) The expected checksum value.voidThe file to check.voidsetNonexistentFileMessage(String nonexistentFileMessage) The friendly message to use when the file does not exist.voidThe checksum algorithm to use.toString()Methods inherited from class AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class AbstractEnforcerRule
getCacheId, getLevel, getRuleNameMethods inherited from class AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
file
-
checksum
-
type
-
nonexistentFileMessage
-
-
Constructor Details
-
RequireFileChecksum
public RequireFileChecksum()
-
-
Method Details
-
execute
Description copied from class:AbstractEnforcerRuleThis is the interface into the rule. This method should throw an exception containing a reason message if the rule fails the check. The plugin will then decide based on the fail flag and rule level if it should stop or just log the message as a warning.- Specified by:
executein classAbstractEnforcerRule- Throws:
EnforcerRuleException- the enforcer rule exception
-
setFile
-
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
-