本文整理了Java中org.jclouds.blobstore.BlobStore.createContainerInLocation()
方法的一些代码示例,展示了BlobStore.createContainerInLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlobStore.createContainerInLocation()
方法的具体详情如下:
包路径:org.jclouds.blobstore.BlobStore
类名称:BlobStore
方法名:createContainerInLocation
[英]Creates a namespace for your blobs
A container is a namespace for your objects. Depending on the service, the scope can be global, identity, or sub-identity scoped. For example, in Amazon S3, containers are called buckets, and they must be uniquely named such that no-one else in the world conflicts. In other blobstores, the naming convention of the container is less strict. All blobstores allow you to list your containers and also the contents within them. These contents can either be blobs, folders, or virtual paths.
[中]为blob创建名称空间
容器是对象的名称空间。根据服务的不同,作用域可以是全局、标识或子标识作用域。例如,在AmazonS3中,容器被称为bucket,它们的命名必须是唯一的,这样世界上就没有其他人会冲突了。在其他Blobstore中,容器的命名约定没有那么严格。所有Blobstore都允许您列出容器以及其中的内容。这些内容可以是blob、文件夹或虚拟路径。
代码示例来源:origin: apache/usergrid
if ( blobStore.createContainerInLocation(null, bucketName) ) {
logger.info( "Created bucket {}", bucketName );
代码示例来源:origin: apache/usergrid
if ( blobStore.createContainerInLocation( null, bucketName ) ) {
logger.info( "Created bucket " + bucketName );
代码示例来源:origin: gaul/s3proxy
@Override
public boolean createContainerInLocation(Location location,
String container, CreateContainerOptions options) {
return delegate().createContainerInLocation(
location, container, options) &&
writeStore.createContainerInLocation(
location, container, options);
}
代码示例来源:origin: rackerlabs/blueflood
private void createContainer() {
String containerName = CONTAINER_DATE_FORMAT.format(new Date());
blobStore.createContainerInLocation(null, containerName);
lastContainerCreated = containerName;
}
代码示例来源:origin: gaul/s3proxy
created = blobStore.createContainerInLocation(location,
containerName, options);
} catch (AuthorizationException ae) {
代码示例来源:origin: org.apache.jclouds/jclouds-blobstore
@Override
public boolean createContainerInLocation(Location location,
String container) {
return delegate().createContainerInLocation(location, container);
}
代码示例来源:origin: Nextdoor/bender
@Override
public boolean createContainerInLocation(Location location,
String container, CreateContainerOptions createContainerOptions) {
return delegate().createContainerInLocation(location, container,
createContainerOptions);
}
代码示例来源:origin: org.apache.whirr/whirr-core
private String generateRandomContainerName() {
String candidate;
do {
candidate = RandomStringUtils.randomAlphanumeric(12).toLowerCase();
} while(!context.getBlobStore().createContainerInLocation(defaultLocation, candidate));
LOG.info("Created blob cache container '{}' located in '{}'", candidate, defaultLocation);
return candidate;
}
代码示例来源:origin: org.apache.camel/camel-jclouds
/**
* Checks if container exists and creates one if not.
*
* @param blobStore The {@link BlobStore} to use.
* @param container The container name to check against.
* @param locationId The locationId to create the container if not found.
*/
public static void ensureContainerExists(BlobStore blobStore, String container, String locationId) {
if (blobStore != null && !Strings.isNullOrEmpty(container) && !blobStore.containerExists(container)) {
blobStore.createContainerInLocation(getLocationById(blobStore, locationId), container);
}
}
代码示例来源:origin: org.apache.james/blob-objectstorage
public CompletableFuture<ContainerName> createContainer(ContainerName name) {
return CompletableFuture.supplyAsync(() -> blobStore.createContainerInLocation(DEFAULT_LOCATION, name.value()))
.thenApply(created -> {
if (created) {
return name;
} else {
throw new ObjectStoreException("Unable to create container " + name.value());
}
});
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test(groups = { "integration", "live" })
public void testDuplicateCreateContainer() {
BlobStore blobStore = view.getBlobStore();
Location location = null;
String container = "container";
boolean created;
created = blobStore.createContainerInLocation(location, container);
assertTrue(created);
created = blobStore.createContainerInLocation(location, container);
assertFalse(created);
}
}
代码示例来源:origin: org.apache.whirr/whirr-core
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: 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: apache/attic-whirr
private String generateRandomContainerName(BlobStoreContext context) {
String candidate;
do {
candidate = RandomStringUtils.randomAlphanumeric(12).toLowerCase();
} while(!context.getBlobStore().createContainerInLocation(null, candidate));
LOG.info("Created temporary container '{}'", candidate);
return candidate;
}
代码示例来源:origin: apache/attic-whirr
private String generateRandomContainerName(BlobStoreContext context) {
String candidate;
do {
candidate = RandomStringUtils.randomAlphanumeric(12).toLowerCase();
} while(!context.getBlobStore().createContainerInLocation(null, candidate));
return candidate;
}
代码示例来源:origin: jclouds/legacy-jclouds
protected static void createContainerAndEnsureEmpty(BlobStoreContext context, final String containerName)
throws InterruptedException {
context.getBlobStore().createContainerInLocation(null, containerName);
if (context.getConsistencyModel() == ConsistencyModel.EVENTUAL)
Thread.sleep(1000);
context.getBlobStore().clearContainer(containerName);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testLargerThanOnePageNoOptions() {
blobstore.createContainerInLocation(null, "goodies");
for (int i = 0; i < 1001; i++) {
blobstore.putBlob("goodies", blobstore.blobBuilder(i + "").payload(i + "").build());
}
Iterable<? extends StorageMetadata> listing = concatter.execute("goodies", new ListContainerOptions());
assertEquals(Iterables.size(listing), 1001);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void test() throws IOException {
blobstore.createContainerInLocation(null, "goodies");
for (int i = 0; i < 1001; i++) {
blobstore.putBlob("goodies", blobstore.blobBuilder(i + "").payload(i + "").build());
}
assertEquals(blobstore.countBlobs("goodies"), 1001);
blobstore.clearContainer("goodies");
assertEquals(blobstore.countBlobs("goodies"), 0);
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testStrategies() throws IOException {
blobstore.createContainerInLocation(null, "poo");
for (int i = 0; i < 1001; i++) {
blobstore.putBlob("poo", blobstore.blobBuilder(i + "").payload(i + "").build());
}
ListContainerAndRecurseThroughFolders lister = new ListContainerAndRecurseThroughFolders(
new ConcatenateContainerLists(blobstore));
assertEquals(lister.execute("poo", ListContainerOptions.NONE).size(), 1001);
blobstore.clearContainer("poo");
assertEquals(lister.execute("poo", ListContainerOptions.NONE).size(), 0);
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test(groups = { "integration", "live" })
public void testPutTwiceIsOkAndDoesntOverwrite() throws InterruptedException {
String containerName = getContainerName();
try {
view.getBlobStore().createContainerInLocation(null, containerName);
Blob blob = view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build();
view.getBlobStore().putBlob(containerName, blob);
view.getBlobStore().createContainerInLocation(null, containerName);
assertEquals(view.getBlobStore().countBlobs(containerName), 1);
} finally {
returnContainer(containerName);
}
}
内容来源于网络,如有侵权,请联系作者删除!