use of com.emc.metalnx.core.domain.exceptions.DataGridChecksumException in project metalnx-web by irods-contrib.
the class FileOperationServiceImpl method computeChecksum.
@Override
public void computeChecksum(String path, String filename) throws DataGridChecksumException, DataGridConnectionRefusedException {
if (path == null || path.isEmpty() || filename == null || filename.isEmpty())
throw new DataGridChecksumException("Could not calculate checksum. File path is invalid.");
logger.info("Computing checksum for {} ({})", filename, path);
IRODSFileFactory irodsFileFactory = irodsServices.getIRODSFileFactory();
DataObjectAO dataObjectAO = irodsServices.getDataObjectAO();
IRODSFile file;
try {
file = irodsFileFactory.instanceIRODSFile(path, filename);
dataObjectAO.computeMD5ChecksumOnDataObject(file);
} catch (JargonException e) {
logger.error("Could not calculate checksum: {}", e.getMessage());
throw new DataGridChecksumException("Could not calculate checksum.");
}
}
Aggregations