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

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

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

BlobStore.deleteContainer介绍

[英]This will delete everything inside a container recursively.
[中]这将递归删除容器中的所有内容。

代码示例

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

public void deleteBucket() {
  String accessId = System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR );
  String secretKey = System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR );
  Properties overrides = new Properties();
  overrides.setProperty( "s3" + ".identity", accessId );
  overrides.setProperty( "s3" + ".credential", secretKey );
  Blob bo = null;
  BlobStore blobStore = null;
  final Iterable<? extends Module> MODULES = ImmutableSet
      .of(new JavaUrlHttpCommandExecutorServiceModule(), new Log4JLoggingModule(),
          new NettyPayloadModule());
  BlobStoreContext context =
      ContextBuilder.newBuilder("s3").credentials( accessId, secretKey ).modules( MODULES )
          .overrides( overrides ).buildView( BlobStoreContext.class );
  blobStore = context.getBlobStore();
  blobStore.deleteContainer( bucketName );
}

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

/**
 * Delete the configured s3 bucket.
 */
public void deleteBucket() {
  logger.debug("\n\nDelete bucket\n");
  String accessId = System.getProperty(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR);
  String secretKey = System.getProperty(SDKGlobalConfiguration.SECRET_KEY_ENV_VAR);
  Properties overrides = new Properties();
  overrides.setProperty("s3" + ".identity", accessId);
  overrides.setProperty("s3" + ".credential", secretKey);
  final Iterable<? extends Module> MODULES = ImmutableSet
    .of(new JavaUrlHttpCommandExecutorServiceModule(),
      new Log4JLoggingModule(),
      new NettyPayloadModule());
  BlobStoreContext context =
    ContextBuilder.newBuilder("s3").credentials(accessId, secretKey).modules(MODULES)
      .overrides(overrides).buildView(BlobStoreContext.class);
  BlobStore blobStore = context.getBlobStore();
  blobStore.deleteContainer( bucketName );
}

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

blobStore.deleteContainer(s.getName());
} catch ( ContainerNotFoundException cnfe ) {
  logger.warn("Attempted to delete bucket {} but it is already deleted", cnfe );

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

@Override
public void deleteContainer(String container) {
  delegate().deleteContainer(container);
  writeStore.deleteContainer(container);
}

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

blobStore.deleteContainer(bucketName);
  Assert.fail("Blob does not exist: " + expectedFileName);
blobStore.deleteContainer(bucketName);
assertEquals(numOfFiles, numWeWant);
assertNotNull(bo);
blobStore.deleteContainer(bucketName);

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

blobStore.deleteContainer( bucketName );

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

blobStore.deleteContainer( bucketName );
blobStore.deleteContainer( bucketName );

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

@Override
protected void after() {
  logger.debug("S3 proxy is stopping");
  try {
    s3Proxy.stop();
    BlobStore blobStore = blobStoreContext.getBlobStore();
    for (StorageMetadata metadata : blobStore.list()) {
      blobStore.deleteContainer(metadata.getName());
    }
    blobStoreContext.close();
  } catch (Exception e) {
    throw new RuntimeException("Unable to stop S3 proxy", e);
  }
  FileUtils.deleteQuietly(blobStoreLocation);
  logger.debug("S3 proxy has stopped");
}

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

@Override
public void deleteContainer(String container) {
  delegate().deleteContainer(container);
  writeStore.deleteContainer(container);
}

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

public void deleteBucket() throws IOException {
  try {
    blobStore.deleteContainer(this.name);
  } finally {
    // pool.returnObject(container);
  }
  this.close();
}

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

public synchronized void dropAndClose() {
  if (container != null && temporary) {
   LOG.info("Removing blob cache '{}'", container);
   context.getBlobStore().deleteContainer(container);
  }
  context.close();
 }
}

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

private static void deleteContainerOrWarnIfUnable(BlobStoreContext context, String containerName) {
 try {
   context.getBlobStore().deleteContainer(containerName);
 } catch (Throwable ex) {
   System.err.printf("unable to delete container %s, ignoring...%n", containerName);
   ex.printStackTrace();
   blackListContainers.add(containerName);
 }
}

代码示例来源: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: 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: org.apache.jackrabbit/oak-blob-plugins

/**
 * 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: org.apache.jclouds.karaf/commands

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

   for (String container : containerNames) {
     blobStore.deleteContainer(container);
     cacheProvider.getProviderCacheForType("container").remove(blobStore.getContext().unwrap().getId(),
         container);
   }
   return null;
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-jclouds

@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
  try {
    context.getBlobStore().deleteContainer(containerName);
  } catch (Exception e){}
  context.close();
  Entities.destroyAll(mgmt);
}

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

@Test(groups = { "integration", "live" })
public void deleteContainerIfEmpty() throws InterruptedException {
 final String containerName = getContainerName();
 try {
   view.getBlobStore().deleteContainer(containerName);
   assertNotExists(containerName);
 } finally {
   // this container is now deleted, so we can't reuse it directly
   recycleContainer(containerName);
 }
}

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

@Test(groups = { "integration", "live" })
public void deleteContainerWithContents() throws InterruptedException {
 String containerName = getContainerName();
 try {
   addBlobToContainer(containerName, "test");
   view.getBlobStore().deleteContainer(containerName);
   assertNotExists(containerName);
 } finally {
   recycleContainer(containerName);
 }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-jclouds

public void testCreateListDestroyContainer() throws IOException {
  context.getBlobStore().createContainerInLocation(null, testContainerName);
  context.getBlobStore().list(testContainerName);
  PageSet<? extends StorageMetadata> ps = context.getBlobStore().list();
  assertHasItemNamed(ps, testContainerName);
  
  Blob b = context.getBlobStore().blobBuilder("my-blob-1").payload(Streams.newInputStreamWithContents("hello world")).build();
  context.getBlobStore().putBlob(testContainerName, b);
  
  Blob b2 = context.getBlobStore().getBlob(testContainerName, "my-blob-1");
  Assert.assertEquals(Streams.readFullyStringAndClose(b2.getPayload().openStream()), "hello world");
  
  context.getBlobStore().deleteContainer(testContainerName);
}

相关文章