/** * Based on the given {@link GetObjectRequest}, returns whether the specified request should * skip MD5 check on the requested object content. Specifically, MD5 check should be skipped if * one of the following conditions are true: * <ol> * <li>The system property {@value #DISABLE_GET_OBJECT_MD5_VALIDATION_PROPERTY} is set.</li> * <li>The request is a range-get operation</li> * <li>The request is a GET object operation that involves SSE-C</li> * </ol> * Otherwise, MD5 check should not be skipped. */ public boolean skipClientSideValidationPerRequest(GetObjectRequest request) { if (isGetObjectMd5ValidationDisabledByProperty()) { return true; } // Skip MD5 check for range get if (request.getRange() != null) { return true; } if (request.getSSECustomerKey() != null) { return true; } return false; }
/** * Returns the captured state of the download; or null if it should not be * captured (for security reason). */ private PersistableDownload captureDownloadState( final GetObjectRequest getObjectRequest, final File file) { if (getObjectRequest.getSSECustomerKey() == null) { return new PersistableDownload( getObjectRequest.getBucketName(), getObjectRequest.getKey(), getObjectRequest.getVersionId(), getObjectRequest.getRange(), getObjectRequest.getResponseHeaders(), getObjectRequest.isRequesterPays(), file.getAbsolutePath(), getLastFullyDownloadedPartNumber(), getObjectMetadata().getLastModified().getTime(), getLastFullyDownloadedFilePosition()); } return null; }
/** * Creates a #GetObjectMetadataRequest by copying values for common members * from the input #GetObjectRequest. */ public static GetObjectMetadataRequest createGetObjectMetadataRequestFrom(GetObjectRequest getObjectRequest) { return new GetObjectMetadataRequest(getObjectRequest.getBucketName(), getObjectRequest.getKey()) .withVersionId(getObjectRequest.getVersionId()) .withRequesterPays(getObjectRequest.isRequesterPays()) .withSSECustomerKey(getObjectRequest.getSSECustomerKey()) .withPartNumber(getObjectRequest.getPartNumber()); } }
req.getVersionId()).withUnmodifiedSinceConstraint(req.getUnmodifiedSinceConstraint()) .withModifiedSinceConstraint(req.getModifiedSinceConstraint()) .withResponseHeaders(req.getResponseHeaders()).withSSECustomerKey(req.getSSECustomerKey()) .withGeneralProgressListener(req.getGeneralProgressListener());
populateSSE_C(request, getObjectRequest.getSSECustomerKey()); final ProgressListener listener = getObjectRequest.getGeneralProgressListener(); publishProgress(listener, ProgressEventType.TRANSFER_STARTED_EVENT);
return true; if (getObjectRequest.getSSECustomerKey() != null) { return true;
/** * Returns the captured state of the download; or null if it should not be * captured (for security reason). */ private PersistableDownload captureDownloadState( final GetObjectRequest getObjectRequest, final File file) { if (getObjectRequest.getSSECustomerKey() == null) { return new PersistableDownload( getObjectRequest.getBucketName(), getObjectRequest.getKey(), getObjectRequest.getVersionId(), getObjectRequest.getRange(), getObjectRequest.getResponseHeaders(), getObjectRequest.isRequesterPays(), file.getAbsolutePath()); } return null; }
getObjectRequest.getBucketName(), getObjectRequest.getKey()); if (getObjectRequest.getSSECustomerKey() != null) { getObjectMetadataRequest.setSSECustomerKey(getObjectRequest.getSSECustomerKey());
/** * Based on the given {@link GetObjectRequest}, returns whether the specified request should * skip MD5 check on the requested object content. Specifically, MD5 check should be skipped if * one of the following conditions are true: * <ol> * <li>The system property {@value #DISABLE_GET_OBJECT_MD5_VALIDATION_PROPERTY} is set.</li> * <li>The request is a range-get operation</li> * <li>The request is a GET object operation that involves SSE-C</li> * </ol> * Otherwise, MD5 check should not be skipped. */ public boolean skipClientSideValidationPerRequest(GetObjectRequest request) { if (isGetObjectMd5ValidationDisabledByProperty()) { return true; } // Skip MD5 check for range get if (request.getRange() != null) { return true; } if (request.getSSECustomerKey() != null) { return true; } return false; }
populateSSE_C(request, getObjectRequest.getSSECustomerKey());
/** * Returns the captured state of the download; or null if it should not be * captured (for security reason). */ private PersistableDownload captureDownloadState( final GetObjectRequest getObjectRequest, final File file) { if (getObjectRequest.getSSECustomerKey() == null) { return new PersistableDownload( getObjectRequest.getBucketName(), getObjectRequest.getKey(), getObjectRequest.getVersionId(), getObjectRequest.getRange(), getObjectRequest.getResponseHeaders(), getObjectRequest.isRequesterPays(), file.getAbsolutePath()); } return null; }
return true; if (getObjectRequest.getSSECustomerKey() != null) { return true;
/** * Returns the captured state of the download; or null if it should not be * captured (for security reason). */ private PersistableDownload captureDownloadState( final GetObjectRequest getObjectRequest, final File file) { if (getObjectRequest.getSSECustomerKey() == null) { return new PersistableDownload( getObjectRequest.getBucketName(), getObjectRequest.getKey(), getObjectRequest.getVersionId(), getObjectRequest.getRange(), getObjectRequest.getResponseHeaders(), getObjectRequest.isRequesterPays(), file.getAbsolutePath(), getLastFullyDownloadedPartNumber(), getObjectMetadata().getLastModified().getTime()); } return null; }
/** * Creates a #GetObjectMetadataRequest by copying values for common members * from the input #GetObjectRequest. */ public static GetObjectMetadataRequest createGetObjectMetadataRequestFrom(GetObjectRequest getObjectRequest) { return new GetObjectMetadataRequest(getObjectRequest.getBucketName(), getObjectRequest.getKey()) .withVersionId(getObjectRequest.getVersionId()) .withRequesterPays(getObjectRequest.isRequesterPays()) .withSSECustomerKey(getObjectRequest.getSSECustomerKey()) .withPartNumber(getObjectRequest.getPartNumber()); } }
getObjectRequest.getBucketName(), getObjectRequest.getKey()); if (getObjectRequest.getSSECustomerKey() != null) { getObjectMetadataRequest.setSSECustomerKey(getObjectRequest.getSSECustomerKey());
/** * Downloads each part of the object into a separate file synchronously and * combines all the files into a single file. */ private void downloadInParallel(int partCount) throws Exception { if (lastFullyMergedPartNumber == null) { lastFullyMergedPartNumber = 0; } for (int i = lastFullyMergedPartNumber + 1; i <= partCount; i++) { GetObjectRequest getPartRequest = new GetObjectRequest(req.getBucketName(), req.getKey(), req.getVersionId()).withUnmodifiedSinceConstraint(req.getUnmodifiedSinceConstraint()) .withModifiedSinceConstraint(req.getModifiedSinceConstraint()) .withResponseHeaders(req.getResponseHeaders()).withSSECustomerKey(req.getSSECustomerKey()) .withGeneralProgressListener(req.getGeneralProgressListener()); getPartRequest.setMatchingETagConstraints(req.getMatchingETagConstraints()); getPartRequest.setNonmatchingETagConstraints(req.getNonmatchingETagConstraints()); getPartRequest.setRequesterPays(req.isRequesterPays()); futureFiles.add( executor.submit(new DownloadPartCallable(s3, getPartRequest.withPartNumber(i), dstfile))); } truncateDestinationFileIfNecessary(); Future<File> future = executor.submit(new CompleteMultipartDownload(futureFiles, dstfile, download, ++lastFullyMergedPartNumber)); ((DownloadMonitor) download.getMonitor()).setFuture(future); }
populateSSE_C(request, getObjectRequest.getSSECustomerKey()); final ProgressListener listener = getObjectRequest.getGeneralProgressListener(); publishProgress(listener, ProgressEventType.TRANSFER_STARTED_EVENT);
populateSSE_C(request, getObjectRequest.getSSECustomerKey());