blobStore.list(bucketName, new ListContainerOptions().recursive());
bucketName, blob, PutOptions.Builder.multipart() );
public static PutOptions multipart(boolean val) { PutOptions options = new PutOptions(); return options.multipart(val); } }
String containerName) throws IOException, S3Exception { String blobStoreType = getBlobStoreType(blobStore); ListContainerOptions options = new ListContainerOptions(); String encodingType = request.getParameter("encoding-type"); String delimiter = request.getParameter("delimiter"); if (delimiter != null) { options.delimiter(delimiter); } else { options.recursive(); options.prefix(prefix); options.afterMarker(marker); options.maxResults(maxKeys);
public synchronized void downloadNewFiles(File downloadDir) { log.info("Downloading new files since {}", lastMarker); BlobStoreContext ctx = ContextBuilder.newBuilder(provider) .credentials(user, key) .overrides(new Properties() {{ setProperty(LocationConstants.PROPERTY_ZONE, zone); }}) .buildView(BlobStoreContext.class); // threadsafe according to https://jclouds.apache.org/documentation/userguide/blobstore-guide/ BlobStore store = ctx.getBlobStore(); ListContainerOptions options = new ListContainerOptions().maxResults(batchSize).afterMarker(lastMarker); PageSet<? extends StorageMetadata> pages = store.list(container, options); //Gets key within the time range specified NavigableMap<Long, String> mapWithinRange = getBlobsWithinRange(pages); //Download only for keys within that range for(Map.Entry<Long, String> blobMeta : mapWithinRange.entrySet()) { log.info("Downloading file: " + blobMeta.getValue()); downloadWorkers.submit(new BlobDownload(downloadDir, store, container, blobMeta.getValue())); lastMarker = blobMeta.getValue(); synchronized (CloudFilesManager.this) { // this is where we resume from. MarkerUtils.writeLastMarker(blobMeta.getValue()); } } log.info("Updated the last marker value as " + lastMarker); }
throws IOException, S3Exception { int status = HttpServletResponse.SC_OK; GetOptions options = new GetOptions(); options.ifETagMatches(ifMatch); options.ifETagDoesntMatch(ifNoneMatch); HttpHeaders.IF_MODIFIED_SINCE); if (ifModifiedSince != -1) { options.ifModifiedSince(new Date(ifModifiedSince)); HttpHeaders.IF_UNMODIFIED_SINCE); if (ifUnmodifiedSince != -1) { options.ifUnmodifiedSince(new Date(ifUnmodifiedSince)); String[] ranges = range.split("-", 2); if (ranges[0].isEmpty()) { options.tail(Long.parseLong(ranges[1])); } else if (ranges[1].isEmpty()) { options.startAt(Long.parseLong(ranges[0])); } else { options.range(Long.parseLong(ranges[0]), Long.parseLong(ranges[1]));
CopyOptions.Builder options = CopyOptions.builder(); options.ifMatch(ifMatch); options.ifNoneMatch(ifNoneMatch); options.ifModifiedSince(new Date(ifModifiedSince)); options.ifUnmodifiedSince(new Date(ifUnmodifiedSince)); options.contentMetadata(contentMetadata.build()); options.userMetadata(userMetadata.build()); eTag = blobStore.copyBlob( sourceContainerName, sourceBlobName, destContainerName, destBlobName, options.build()); } catch (KeyNotFoundException knfe) { throw new S3Exception(S3ErrorCode.NO_SUCH_KEY, knfe);
PutOptions options = new PutOptions().setBlobAccess(access); options.multipart(true);
/** * @see GetOptions#ifUnmodifiedSince(Date) */ public static GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { GetOptions options = new GetOptions(); return options.ifUnmodifiedSince(ifUnmodifiedSince); }
return; PutOptions options = new PutOptions().setBlobAccess(access);
CreateContainerOptions options = new CreateContainerOptions(); String acl = request.getHeader("x-amz-acl"); if ("public-read".equalsIgnoreCase(acl)) { options.publicRead();
private static void handleAbortMultipartUpload(HttpServletResponse response, BlobStore blobStore, String containerName, String blobName, String uploadId) throws IOException, S3Exception { if (Quirks.MULTIPART_REQUIRES_STUB.contains(getBlobStoreType( blobStore))) { if (!blobStore.blobExists(containerName, uploadId)) { throw new S3Exception(S3ErrorCode.NO_SUCH_UPLOAD); } blobStore.removeBlob(containerName, uploadId); } // TODO: how to reconstruct original mpu? MultipartUpload mpu = MultipartUpload.create(containerName, blobName, uploadId, createFakeBlobMetadata(blobStore), new PutOptions()); blobStore.abortMultipartUpload(mpu); response.sendError(HttpServletResponse.SC_NO_CONTENT); }
public void testETagMatchesAfterIfUnmodified() { ifUnmodifiedSince(now).ifETagMatches(etag); }
public void testETagDoesntMatchAfterIfModified() { ifModifiedSince(now).ifETagDoesntMatch(etag); }
public void testIfUnmodifiedAfterETagMatches() { ifETagMatches(etag).ifUnmodifiedSince(now); }
public void testIfModifiedAfterETagDoesntMatch() { ifETagDoesntMatch(etag).ifModifiedSince(now); }
/** * @see ListOptions#afterMarker(String) */ public static ListOptions afterMarker(String marker) { ListOptions options = new ListOptions(); return options.afterMarker(marker); }
public synchronized boolean hasNewFiles() { // see if there are any files since lastMarker. BlobStoreContext ctx = ContextBuilder.newBuilder(provider) .credentials(user, key) .overrides(new Properties() {{ setProperty(LocationConstants.PROPERTY_ZONE, zone); }}) .buildView(BlobStoreContext.class); BlobStore store = ctx.getBlobStore(); ListContainerOptions options = new ListContainerOptions().maxResults(batchSize).afterMarker(lastMarker); PageSet<? extends StorageMetadata> pages = store.list(container, options); log.debug("Saw {} new files since {}", pages.size() == batchSize ? "many" : Integer.toString(pages.size()), lastMarker); boolean emptiness = getBlobsWithinRange(pages).isEmpty(); if(emptiness) { log.warn("No file found within range {}", new Range(START_TIME, STOP_TIME)); } else { log.debug("New files found within range {}", new Range(START_TIME, STOP_TIME)); } return !emptiness; }
final String uploadedFile = blobStore.putBlob( bucketName, blob, PutOptions.Builder.multipart() );
mpu = MultipartUpload.create(containerName, blobName, uploadId, stubBlob.getMetadata(), new PutOptions().setBlobAccess(access)); } else { mpu = MultipartUpload.create(containerName, blobName, uploadId, new MutableBlobMetadataImpl(), new PutOptions());