public FixityResult calculateChecksum(DigitalObject digitalObject,
List<Parameter> parameters) {
// The returned FixityResult & ServiceReport
FixityResult retResult = null;
ServiceReport retReport = null;
try {
// Let's get the requested message digest from the params (or default)
URI requestedAlgId = this.getDigestIdFromParameters(parameters);
// OK let's try to get the digest algorithm
MessageDigest messDigest =
MessageDigest.getInstance(JavaDigestUtils.getJavaAlgorithmName(requestedAlgId));
// Now calc the result, we need the bytes from the object
// so let's get the stream
InputStream inStream = digitalObject.getContent().getInputStream();
// Catch the special case of no data in the file
if (this.addStreamBytesToDigest(messDigest,
inStream,
JavaDigest.DEFAULT_CHUNK_SIZE) < 1) {
// log it, and create a new service report
JavaDigest.log.severe(JavaDigest.NO_DATA_MESSAGE);
retResult = this.createErrorResult(ServiceReport.Status.TOOL_ERROR, JavaDigest.NO_DATA_MESSAGE);
// Return the result
return retResult;
}
// OK, success so create the result
retReport = new ServiceReport(ServiceReport.Type.INFO,
ServiceReport.Status.SUCCESS,
JavaDigest.SUCCESS_MESSAGE);
// And wrap it in the result
retResult = new FixityResult(JavaDigestUtils.getDefaultAlgorithmId().toString(),