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

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

本文整理了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

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

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

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

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

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);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@Override
  protected Object doExecute() throws Exception {
   BlobStore blobStore = getBlobStore();

   if (!blobStore.blobExists(containerName, blobName)) {
     throw new KeyNotFoundException(containerName, blobName, "while checking existence");
   }
   return null;
  }
}

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

public void run() {
   try {
     assert !view.getBlobStore().blobExists(containerName, name) : String.format("found %s in %s", name,
        containerName);
   } catch (Exception e) {
     Throwables.propagateIfPossible(e);
   }
  }
});

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

public void run() {
   try {
     assert view.getBlobStore().blobExists(containerName, name) : String.format(
        "could not find %s in %s: %s", name, containerName, ImmutableSet.copyOf(Iterables.transform(
           view.getBlobStore().list(containerName), new Function<StorageMetadata, String>() {
            public String apply(StorageMetadata from) {
              return from.getName();
            }
           })));
   } catch (Exception e) {
     Throwables.propagateIfPossible(e);
   }
  }
});

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

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

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

@Override
  public boolean isInStorage() {
    BlobStoreContext context = createContext();

    try {
      BlobStore store = createBlobStore(context);
      return store.blobExists(getContainer(), getPath());

    } finally {
      context.close();
    }
  }
}

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

@Test(groups = { "integration", "live" })
public void blobNotFound() throws InterruptedException {
 String container = getContainerName();
 String name = "test";
 try {
   assert !view.getBlobStore().blobExists(container, name);
 } finally {
   returnContainer(container);
 }
}

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

@Test(groups = { "integration", "live" })
public void blobNotFound() throws InterruptedException {
 String container = getContainerName();
 String name = "test";
 try {
   assert !view.getBlobStore().blobExists(container, name);
 } finally {
   returnContainer(container);
 }
}

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

@Override
  public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
    throws EntityNotFoundException
  {
    if( !blobStore.blobExists( container, ref.identity().toString() ) )
    {
      throw new EntityNotFoundException( ref );
    }
    blobStore.removeBlob( container, ref.identity().toString() );
  }
}

相关文章