本文整理了Java中org.jclouds.blobstore.BlobStore.containerExists()
方法的一些代码示例,展示了BlobStore.containerExists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlobStore.containerExists()
方法的具体详情如下:
包路径:org.jclouds.blobstore.BlobStore
类名称:BlobStore
方法名:containerExists
[英]determines if a service-level container exists
[中]确定服务级别容器是否存在
代码示例来源:origin: gaul/s3proxy
private static void handleContainerExists(BlobStore blobStore,
String containerName) throws IOException, S3Exception {
if (!blobStore.containerExists(containerName)) {
throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET);
}
}
代码示例来源:origin: gaul/s3proxy
BlobStore blobStore, String containerName,
String blobName) throws IOException, S3Exception {
if (!blobStore.containerExists(containerName)) {
代码示例来源:origin: gaul/s3proxy
private static void handleContainerDelete(HttpServletResponse response,
BlobStore blobStore, String containerName)
throws IOException, S3Exception {
if (!blobStore.containerExists(containerName)) {
throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET);
}
String blobStoreType = getBlobStoreType(blobStore);
if (blobStoreType.equals("b2")) {
// S3 allows deleting a container with in-progress MPU while B2 does
// not. Explicitly cancel uploads for B2.
for (MultipartUpload mpu : blobStore.listMultipartUploads(
containerName)) {
blobStore.abortMultipartUpload(mpu);
}
}
if (!blobStore.deleteContainerIfEmpty(containerName)) {
throw new S3Exception(S3ErrorCode.BUCKET_NOT_EMPTY);
}
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
}
代码示例来源:origin: gaul/s3proxy
throw new S3Exception(S3ErrorCode.ACCESS_DENIED);
if (!blobStore.containerExists(containerName)) {
throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET);
代码示例来源:origin: Nextdoor/bender
private static void handleContainerExists(BlobStore blobStore,
String containerName) throws IOException, S3Exception {
if (!blobStore.containerExists(containerName)) {
throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET);
}
}
代码示例来源:origin: org.gaul/s3proxy
private static void handleContainerExists(BlobStore blobStore,
String containerName) throws IOException, S3Exception {
if (!blobStore.containerExists(containerName)) {
throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET);
}
}
代码示例来源:origin: org.apache.jclouds/jclouds-blobstore
@Override
public boolean containerExists(String container) {
return delegate().containerExists(container);
}
代码示例来源:origin: org.apache.jclouds.karaf/commands
@Override
protected Object doExecute() throws Exception {
BlobStore blobStore = getBlobStore();
for (String container : containerNames) {
if (!blobStore.containerExists(container)) {
throw new ContainerNotFoundException(container, "while checking existence");
}
}
return null;
}
}
代码示例来源:origin: com.netflix.archaius/archaius-jclouds
public BlobStoreConfigurationSource(BlobStoreContext ctx) {
this.ctx = checkNotNull(ctx, "ctx");
String container = containerName.get();
checkState(ctx.getBlobStore().containerExists(container), "%s: container %s doesn't exist", ctx.unwrap()
.getName(), container);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void run() {
try {
assert view.getBlobStore().containerExists(containerName) : String.format("container %s doesn't exist", containerName);
} catch (Exception e) {
Throwables.propagate(e);
}
}
});
代码示例来源:origin: jclouds/legacy-jclouds
public void run() {
try {
assert !view.getBlobStore().containerExists(containerName) : "container " + containerName
+ " still exists";
} catch (Exception e) {
propagateIfPossible(e);
}
}
});
代码示例来源:origin: apache/jackrabbit-oak
/**
* Delete the cloud container and all its contents.
*
*/
public void deleteBucket() {
Preconditions.checkNotNull(context);
if (context.getBlobStore().containerExists(cloudContainer)) {
context.getBlobStore().deleteContainer(cloudContainer);
}
context.close();
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test(groups = { "integration", "live" })
public void containerDoesntExist() {
assert !view.getBlobStore().containerExists("forgetaboutit");
assert !view.getBlobStore().containerExists("cloudcachestorefunctionalintegrationtest-first");
}
代码示例来源:origin: com.commercehub.dropwizard/dropwizard-jclouds-blobstore
@Override
protected Result check() throws Exception {
BlobStore blobStore = blobStoreContext.getBlobStore();
if (blobStore.containerExists(container)) {
return Result.healthy();
}
return Result.unhealthy("container does not exist: %s", container);
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
/**
* Delete the cloud container and all its contents.
*
*/
public void deleteBucket() {
Preconditions.checkNotNull(context);
if (context.getBlobStore().containerExists(cloudContainer)) {
context.getBlobStore().deleteContainer(cloudContainer);
}
context.close();
}
代码示例来源:origin: apache/jclouds
public void run() {
try {
assert view.getBlobStore().containerExists(containerName) : String.format("container %s doesn't exist", containerName);
} catch (Exception e) {
Throwables.propagate(e);
}
}
});
代码示例来源:origin: apache/attic-whirr
public BlobClusterStateStore(ClusterSpec spec) {
this.spec = spec;
this.context = BlobStoreContextBuilder.build(spec);
this.container = checkNotNull(spec.getStateStoreContainer());
this.blobName = checkNotNull(spec.getStateStoreBlob());
/* create container if it does not already exists */
if (!context.getBlobStore().containerExists(container)) {
context.getBlobStore().createContainerInLocation(null, container);
}
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public void run() {
PageSet<? extends StorageMetadata> list = view.getBlobStore().list();
assert Iterables.any(list, new Predicate<StorageMetadata>() {
public boolean apply(StorageMetadata md) {
return containerName.equals(md.getName()) && location.equals(md.getLocation());
}
}) : String.format("container %s/%s not found in list %s", location, containerName, list);
assertTrue(view.getBlobStore().containerExists(containerName), containerName);
}
代码示例来源:origin: apache/jclouds
public void testDeleteContainer_EmptyContanier() {
boolean result;
blobStore.createContainerInLocation(null, CONTAINER_NAME);
result = blobStore.containerExists(CONTAINER_NAME);
assertTrue(result, "Container doesn't exists");
TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);
// delete container
blobStore.deleteContainer(CONTAINER_NAME);
result = blobStore.containerExists(CONTAINER_NAME);
assertFalse(result, "Container still exists");
TestUtils.directoryExists(TARGET_CONTAINER_NAME, false);
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test(groups = { "integration", "live" })
public void containerExists() throws InterruptedException {
String containerName = getContainerName();
try {
assert view.getBlobStore().containerExists(containerName);
} finally {
returnContainer(containerName);
}
}
内容来源于网络,如有侵权,请联系作者删除!