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 String
protected String
calculateChecksum
(InputStream inputStream) void
execute()
This is the interface into the rule.getFile()
getType()
void
setChecksum
(String checksum) The expected checksum value.void
The file to check.void
setNonexistentFileMessage
(String nonexistentFileMessage) The friendly message to use when the file does not exist.void
The checksum algorithm to use.toString()
Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessage
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevel
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
file
-
checksum
-
type
-
nonexistentFileMessage
-
-
Constructor Details
-
RequireFileChecksum
public RequireFileChecksum()
-
-
Method Details
-
execute
Description copied from class:AbstractEnforcerRule
This 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:
execute
in classAbstractEnforcerRule
- Throws:
EnforcerRuleException
- the enforcer rule exception
-
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:
IOException
EnforcerRuleException
-
toString
-