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
@Named("requireFileChecksum") public class RequireFileChecksum extends AbstractStandardEnforcerRuleRule to validate a binary file to match the specified checksum.- See Also:
RequireTextFileChecksum
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringchecksumprivate java.io.Filefileprivate java.lang.StringnonexistentFileMessageprivate java.lang.Stringtype
-
Constructor Summary
Constructors Constructor Description RequireFileChecksum()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringcalculateChecksum()protected java.lang.StringcalculateChecksum(java.io.InputStream inputStream)voidexecute()This is the interface into the rule.java.lang.StringgetChecksum()java.io.FilegetFile()java.lang.StringgetNonexistentFileMessage()java.lang.StringgetType()voidsetChecksum(java.lang.String checksum)The expected checksum value.voidsetFile(java.io.File file)The file to check.voidsetNonexistentFileMessage(java.lang.String nonexistentFileMessage)The friendly message to use when the file does not exist.voidsetType(java.lang.String type)The checksum algorithm to use.java.lang.StringtoString()-
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, getRuleName
-
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
-
-
-
Method Detail
-
execute
public void execute() throws EnforcerRuleExceptionDescription 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 exceptionEnforcerRuleError- in order to brake a build immediately
-
setFile
public void setFile(java.io.File file)
The file to check.- Parameters:
file- file
-
getFile
public java.io.File getFile()
-
setChecksum
public void setChecksum(java.lang.String checksum)
The expected checksum value.- Parameters:
checksum- checksum
-
getChecksum
public java.lang.String getChecksum()
-
setType
public void setType(java.lang.String type)
The checksum algorithm to use. Possible values: "md5", "sha1", "sha256", "sha384", "sha512".- Parameters:
type- algorithm
-
getType
public java.lang.String getType()
-
setNonexistentFileMessage
public void setNonexistentFileMessage(java.lang.String nonexistentFileMessage)
The friendly message to use when the file does not exist.- Parameters:
nonexistentFileMessage- message
-
getNonexistentFileMessage
public java.lang.String getNonexistentFileMessage()
-
calculateChecksum
protected java.lang.String calculateChecksum() throws EnforcerRuleException- Throws:
EnforcerRuleException
-
calculateChecksum
protected java.lang.String calculateChecksum(java.io.InputStream inputStream) throws java.io.IOException, EnforcerRuleException- Throws:
java.io.IOExceptionEnforcerRuleException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-