org.jclouds.blobstore.BlobStore.blobExists()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(231)

本文整理了Java中org.jclouds.blobstore.BlobStore.blobExists()方法的一些代码示例,展示了BlobStore.blobExists()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlobStore.blobExists()方法的具体详情如下:
包路径:org.jclouds.blobstore.BlobStore
类名称:BlobStore
方法名:blobExists

BlobStore.blobExists介绍

[英]Determines if a blob exists
[中]确定是否存在blob

代码示例

代码示例来源:origin: apache/usergrid

  1. if (!blobStore.blobExists(bucketName, expectedFileName)) {
  2. blobStore.deleteContainer(bucketName);
  3. Assert.fail("Blob does not exist: " + expectedFileName);

代码示例来源:origin: apache/usergrid

  1. if ( !blobStore.blobExists( bucketName, expectedFileName ) ) {
  2. assert ( false );

代码示例来源:origin: gaul/s3proxy

  1. private static void handleAbortMultipartUpload(HttpServletResponse response,
  2. BlobStore blobStore, String containerName, String blobName,
  3. String uploadId) throws IOException, S3Exception {
  4. if (Quirks.MULTIPART_REQUIRES_STUB.contains(getBlobStoreType(
  5. blobStore))) {
  6. if (!blobStore.blobExists(containerName, uploadId)) {
  7. throw new S3Exception(S3ErrorCode.NO_SUCH_UPLOAD);
  8. }
  9. blobStore.removeBlob(containerName, uploadId);
  10. }
  11. // TODO: how to reconstruct original mpu?
  12. MultipartUpload mpu = MultipartUpload.create(containerName,
  13. blobName, uploadId, createFakeBlobMetadata(blobStore),
  14. new PutOptions());
  15. blobStore.abortMultipartUpload(mpu);
  16. response.sendError(HttpServletResponse.SC_NO_CONTENT);
  17. }

代码示例来源:origin: jclouds/legacy-jclouds

  1. @Override
  2. public boolean containsKey(Object key) {
  3. String realKey = prefixer.apply(checkNotNull(key, "key").toString());
  4. return blobstore.blobExists(containerName, realKey);
  5. }

代码示例来源:origin: org.jclouds/jclouds-blobstore

  1. @Override
  2. public boolean containsKey(Object key) {
  3. String realKey = prefixer.apply(checkNotNull(key, "key").toString());
  4. return blobstore.blobExists(containerName, realKey);
  5. }

代码示例来源:origin: org.apache.whirr/whirr-core

  1. private void checkExistsBlob(String name) throws IOException {
  2. if (container == null || !context.getBlobStore().blobExists(container, name)) {
  3. throw new IOException("Blob not found: " + container + ":" + name);
  4. }
  5. }

代码示例来源:origin: opendedup/sdfs

  1. @Override
  2. public boolean objectClaimed(String key) throws IOException {
  3. if (!this.clustered)
  4. return true;
  5. String blb = "claims/" + key + "/"
  6. + EncyptUtils.encHashArchiveName(Main.DSEID, Main.chunkStoreEncryptionEnabled);
  7. return blobStore.blobExists(this.name, blb);
  8. }

代码示例来源:origin: apache/attic-whirr

  1. private void checkExistsBlob(String name) throws IOException {
  2. if (container == null || !context.getBlobStore().blobExists(container, name)) {
  3. throw new IOException("Blob not found: " + container + ":" + name);
  4. }
  5. }

代码示例来源:origin: opendedup/sdfs

  1. @Override
  2. public boolean isCheckedOut(String name, long volumeID) throws IOException {
  3. if (!this.clustered)
  4. return true;
  5. String blb = "claims/" + name + "/"
  6. + EncyptUtils.encHashArchiveName(volumeID, Main.chunkStoreEncryptionEnabled);
  7. return blobStore.blobExists(this.name, blb);
  8. }

代码示例来源:origin: Nextdoor/bender

  1. @Override
  2. public boolean blobExists(String container, String name) {
  3. return delegate().blobExists(container, name);
  4. }

代码示例来源:origin: apache/karaf-cellar

  1. /**
  2. * Sign out member to the {@link DiscoveryService}.
  3. */
  4. @Override
  5. public void signOut() {
  6. if (blobStore.blobExists(container, ipAddress)) {
  7. blobStore.removeBlob(container, ipAddress);
  8. } else {
  9. LOGGER.debug("CELLAR CLOUD: could not find the IP address of the current node in the blob store");
  10. }
  11. }

代码示例来源:origin: opendedup/sdfs

  1. @Override
  2. public boolean fileExists(long id) throws IOException {
  3. try {
  4. String haName = EncyptUtils.encHashArchiveName(id, Main.chunkStoreEncryptionEnabled);
  5. return blobStore.blobExists(this.name, "blocks/" + haName);
  6. } catch (Exception e) {
  7. SDFSLogger.getLog().error("unable to get id", e);
  8. throw new IOException(e);
  9. }
  10. }

代码示例来源:origin: org.apache.jclouds.karaf/commands

  1. @Override
  2. protected Object doExecute() throws Exception {
  3. BlobStore blobStore = getBlobStore();
  4. if (!blobStore.blobExists(containerName, blobName)) {
  5. throw new KeyNotFoundException(containerName, blobName, "while checking existence");
  6. }
  7. return null;
  8. }
  9. }

代码示例来源:origin: jclouds/legacy-jclouds

  1. public void run() {
  2. try {
  3. assert !view.getBlobStore().blobExists(containerName, name) : String.format("found %s in %s", name,
  4. containerName);
  5. } catch (Exception e) {
  6. Throwables.propagateIfPossible(e);
  7. }
  8. }
  9. });

代码示例来源:origin: jclouds/legacy-jclouds

  1. public void run() {
  2. try {
  3. assert view.getBlobStore().blobExists(containerName, name) : String.format(
  4. "could not find %s in %s: %s", name, containerName, ImmutableSet.copyOf(Iterables.transform(
  5. view.getBlobStore().list(containerName), new Function<StorageMetadata, String>() {
  6. public String apply(StorageMetadata from) {
  7. return from.getName();
  8. }
  9. })));
  10. } catch (Exception e) {
  11. Throwables.propagateIfPossible(e);
  12. }
  13. }
  14. });

代码示例来源:origin: apache/jclouds

  1. @Test(dataProvider = "ignoreOnMacOSX")
  2. public void testGetDirectoryBlob() throws IOException {
  3. blobStore.createContainerInLocation(null, CONTAINER_NAME);
  4. String blobKey = TestUtils.createRandomBlobKey("a/b/c/directory-", "/");
  5. blobStore.putBlob(CONTAINER_NAME, createDirBlob(blobKey));
  6. assertTrue(blobStore.blobExists(CONTAINER_NAME, blobKey));
  7. Blob blob = blobStore.getBlob(CONTAINER_NAME, blobKey);
  8. assertEquals(blob.getMetadata().getName(), blobKey, "Created blob name is different");
  9. assertTrue(!blobStore.blobExists(CONTAINER_NAME,
  10. blobKey.substring(0, blobKey.length() - 1)));
  11. }

代码示例来源:origin: perfectsense/dari

  1. @Override
  2. public boolean isInStorage() {
  3. BlobStoreContext context = createContext();
  4. try {
  5. BlobStore store = createBlobStore(context);
  6. return store.blobExists(getContainer(), getPath());
  7. } finally {
  8. context.close();
  9. }
  10. }
  11. }

代码示例来源:origin: jclouds/legacy-jclouds

  1. @Test(groups = { "integration", "live" })
  2. public void blobNotFound() throws InterruptedException {
  3. String container = getContainerName();
  4. String name = "test";
  5. try {
  6. assert !view.getBlobStore().blobExists(container, name);
  7. } finally {
  8. returnContainer(container);
  9. }
  10. }

代码示例来源:origin: apache/jclouds

  1. @Test(groups = { "integration", "live" })
  2. public void blobNotFound() throws InterruptedException {
  3. String container = getContainerName();
  4. String name = "test";
  5. try {
  6. assert !view.getBlobStore().blobExists(container, name);
  7. } finally {
  8. returnContainer(container);
  9. }
  10. }

代码示例来源:origin: apache/attic-polygene-java

  1. @Override
  2. public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
  3. throws EntityNotFoundException
  4. {
  5. if( !blobStore.blobExists( container, ref.identity().toString() ) )
  6. {
  7. throw new EntityNotFoundException( ref );
  8. }
  9. blobStore.removeBlob( container, ref.identity().toString() );
  10. }
  11. }

相关文章