cdx.scorebot.util
Class IntegrityCheck

java.lang.Object
  extended by cdx.scorebot.util.IntegrityCheck

public abstract class IntegrityCheck
extends java.lang.Object

an abstract test which tests the validity of retrieved content

Author:
David Underhill

Field Summary
static java.lang.String JUST_READ
           
static java.lang.String MD5
           
static java.lang.String REGEXP
           
 
Method Summary
static boolean checkIntegrity(java.lang.String checkType, java.lang.String expected, java.lang.String content)
          Checks to see if fileRead meets the integrity criteria
static ConfigString prepCheckTypes(boolean ableToRead, boolean md5, boolean regExp)
          prepare what kind of checks are valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JUST_READ

public static final java.lang.String JUST_READ
See Also:
Constant Field Values

MD5

public static final java.lang.String MD5
See Also:
Constant Field Values

REGEXP

public static final java.lang.String REGEXP
See Also:
Constant Field Values
Method Detail

prepCheckTypes

public static ConfigString prepCheckTypes(boolean ableToRead,
                                          boolean md5,
                                          boolean regExp)
prepare what kind of checks are valid

Parameters:
ableToRead - whether or not to allow just simple check for whether or not the file was retrieved (required if the other two options are false)
md5 - whether or not to allow checks of MD5 hashes
regExp - whether or not to allow checks via regular expressions
Returns:
the configuration option with possible values

checkIntegrity

public static boolean checkIntegrity(java.lang.String checkType,
                                     java.lang.String expected,
                                     java.lang.String content)
Checks to see if fileRead meets the integrity criteria

Parameters:
checkType - what kind of integrity check to perform
expected - what content is expected
content - the actual contents of the file whose integrity is being checked
Returns:
true if the content is correct, and false if it failed this integrity check