Search in sources :

Example 1 with DataGridChecksumException

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.");
    }
}
Also used : IRODSFileFactory(org.irods.jargon.core.pub.io.IRODSFileFactory) JargonException(org.irods.jargon.core.exception.JargonException) DataGridChecksumException(com.emc.metalnx.core.domain.exceptions.DataGridChecksumException) DataObjectAO(org.irods.jargon.core.pub.DataObjectAO) IRODSFile(org.irods.jargon.core.pub.io.IRODSFile)

Aggregations

DataGridChecksumException (com.emc.metalnx.core.domain.exceptions.DataGridChecksumException)1 JargonException (org.irods.jargon.core.exception.JargonException)1 DataObjectAO (org.irods.jargon.core.pub.DataObjectAO)1 IRODSFile (org.irods.jargon.core.pub.io.IRODSFile)1 IRODSFileFactory (org.irods.jargon.core.pub.io.IRODSFileFactory)1