public final class CheckerCommand extends Object
Main class for the checksum checker tool, which calculates checksums for each bitstream whose ID is in the most_recent_checksum table, and compares it against the last calculated checksum for that bitstream.
| Constructor and Description |
|---|
CheckerCommand(Context context)
Default constructor uses DSpace plugin manager to construct dependencies.
|
| Modifier and Type | Method and Description |
|---|---|
protected MostRecentChecksum |
checkBitstream(Bitstream bitstream)
Check a specified bitstream.
|
protected ChecksumResult |
compareChecksums(String checksumA,
String checksumB)
Compares two checksums.
|
protected ChecksumResult |
getChecksumResultByCode(ChecksumResultCode checksumResultCode) |
ChecksumResultsCollector |
getCollector()
Get the collector that holds/logs the results for this process run.
|
BitstreamDispatcher |
getDispatcher()
Get dispatcher being used by this run of the checker.
|
Date |
getProcessStartDate()
Get time at which checker process began.
|
boolean |
isReportVerbose()
Determine if any errors are reported
|
void |
process()
Uses the options set up on this checker to determine a mode of execution,
and then accepts bitstream ids from the dispatcher and checks their
bitstreams against the db records.
|
protected void |
processBitstream(MostRecentChecksum info)
Process general case bitstream.
|
protected void |
processDeletedBitstream(MostRecentChecksum info)
Process bitstream that was marked 'deleted' in bitstream table.
|
protected void |
processNullInfoBitstream(MostRecentChecksum info)
Process bitstream whose ID was not found in most_recent_checksum or
bitstream table.
|
void |
setCollector(ChecksumResultsCollector collector)
Set the collector that holds/logs the results for this process run.
|
void |
setDispatcher(BitstreamDispatcher dispatcher)
Set the dispatcher to be used by this run of the checker.
|
void |
setProcessStartDate(Date startDate)
Set time at which checker process began.
|
void |
setReportVerbose(boolean reportVerbose)
Set report errors only
|
public CheckerCommand(Context context)
context - Contextpublic void process()
throws SQLException
Uses the options set up on this checker to determine a mode of execution, and then accepts bitstream ids from the dispatcher and checks their bitstreams against the db records.
N.B. a valid BitstreamDispatcher must be provided using setBitstreamDispatcher before calling this method
SQLException - if database errorprotected MostRecentChecksum checkBitstream(Bitstream bitstream) throws SQLException
bitstream - the bitstreamSQLException - if database errorprotected ChecksumResult compareChecksums(String checksumA, String checksumB) throws SQLException
checksumA - the first checksumchecksumB - the second checksumSQLException - if database errorprotected void processDeletedBitstream(MostRecentChecksum info) throws SQLException
info - a deleted bitstream.SQLException - if database errorprotected void processNullInfoBitstream(MostRecentChecksum info) throws SQLException
info - A not found BitStreamInfo
TODO is this method required?SQLException - if database errorprotected void processBitstream(MostRecentChecksum info) throws SQLException
Process general case bitstream.
Note: bitstream will have timestamp indicating it was "checked", even if actual checksumming never took place.
TODO Why does bitstream have a timestamp indicating it's checked if checksumming doesn't occur?info - BitstreamInfo to handleSQLException - if database errorprotected ChecksumResult getChecksumResultByCode(ChecksumResultCode checksumResultCode) throws SQLException
SQLExceptionpublic BitstreamDispatcher getDispatcher()
public void setDispatcher(BitstreamDispatcher dispatcher)
dispatcher - Dispatcher to use.public ChecksumResultsCollector getCollector()
public void setCollector(ChecksumResultsCollector collector)
collector - the collector to be used for this runpublic Date getProcessStartDate()
public void setProcessStartDate(Date startDate)
startDate - start timepublic boolean isReportVerbose()
public void setReportVerbose(boolean reportVerbose)
reportVerbose - true to report only errors in the logs.Copyright © 2016 DuraSpace. All rights reserved.