@Override
public MultipartPart call() throws BackgroundException {
try {
final HttpRange range = HttpRange.byLength(offset, length);
final MultipartPart part = session.getClient().multipartUploadPartCopy(multipart, partNumber,
containerService.getContainer(source).getName(), containerService.getKey(source),
null, null, null, null, range.getStart(), range.getEnd(), source.attributes().getVersionId());
if(log.isInfoEnabled()) {
log.info(String.format("Received response %s for part number %d", part, partNumber));
}
return new MultipartPart(partNumber,
null == part.getLastModified() ? new Date(System.currentTimeMillis()) : part.getLastModified(),
null == part.getEtag() ? StringUtils.EMPTY : part.getEtag(),
part.getSize());
}
catch(S3ServiceException e) {
throw new S3ExceptionMappingService().map("Cannot copy {0}", e, source);
}
}
});