/** * 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())
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetObject"); if (getObjectRequest.getVersionId() != null) { request.addParameter("versionId", getObjectRequest.getVersionId());
/** * Creates a get request to retrieve an instruction file from S3. * * @param request The get request for the original object to be retrieved * from S3. * @return A get request to retrieve an instruction file from S3. */ public static GetObjectRequest createInstructionGetRequest(GetObjectRequest request) { return new GetObjectRequest(request.getBucketName(), request.getKey() + INSTRUCTION_SUFFIX, request.getVersionId()); }
/** * 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.getKey(), getObjectRequest, HttpMethodName.GET); if (getObjectRequest.getVersionId() != null) { request.addParameter("versionId", getObjectRequest.getVersionId());
/** * Creates a get request to retrieve an instruction file from S3. * * @param request The get request for the original object to be retrieved * from S3. * @return A get request to retrieve an instruction file from S3. */ public static GetObjectRequest createInstructionGetRequest(GetObjectRequest request) { return new GetObjectRequest(request.getBucketName(), request.getKey() + INSTRUCTION_SUFFIX, request.getVersionId()); }
/** * 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; }
/** * 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()); } }
/** * 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); }
if (getObjectRequest.getVersionId() != null) { request.addParameter("versionId", getObjectRequest.getVersionId());
getObjectRequest.getKey(), getObjectRequest, HttpMethodName.GET); if (getObjectRequest.getVersionId() != null) { request.addParameter("versionId", getObjectRequest.getVersionId());