本文整理了Java中org.jclouds.blobstore.BlobStore.directoryExists()
方法的一些代码示例,展示了BlobStore.directoryExists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlobStore.directoryExists()
方法的具体详情如下:
包路径:org.jclouds.blobstore.BlobStore
类名称:BlobStore
方法名:directoryExists
[英]Determines if a directory exists
[中]确定目录是否存在
代码示例来源:origin: org.apache.jclouds/jclouds-blobstore
@Override
public boolean directoryExists(String container, String directory) {
return delegate().directoryExists(container, directory);
}
代码示例来源:origin: com.amysta.jclouds/jclouds-blobstore
@Override
public boolean directoryExists(String container, String directory) {
return delegate().directoryExists(container, directory);
}
代码示例来源:origin: Nextdoor/bender
@Override
public boolean directoryExists(String container, String directory) {
return delegate().directoryExists(container, directory);
}
代码示例来源:origin: apache/jclouds
@Override
public boolean directoryExists(String container, String directory) {
return delegate().directoryExists(container, directory);
}
代码示例来源:origin: org.apache.jclouds/jclouds-blobstore
public void execute(final String containerName, String directory) {
Set<String> names = Sets.newHashSet();
names.add(directory);
for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
names.add(directory + suffix);
}
Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
for (final String name : names) {
responses.put(name, userExecutor.submit(new Callable<Void>() {
@Override public Void call() throws Exception {
blobstore.removeBlob(containerName, name);
return null;
}
}));
}
String message = String.format("deleting directory %s in containerName: %s", directory,
containerName);
Map<String, Exception> exceptions;
try {
exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message);
} catch (TimeoutException te) {
throw propagate(te);
}
if (!exceptions.isEmpty())
throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions));
assert !blobstore.directoryExists(containerName, directory) : String.format(
"still exists %s: %s", message, exceptions);
}
}
代码示例来源:origin: jclouds/legacy-jclouds
public void execute(String containerName, String directory) {
Set<String> names = Sets.newHashSet();
names.add(directory);
for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
names.add(directory + suffix);
}
Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
for (String name : names) {
responses.put(name, ablobstore.removeBlob(containerName, name));
}
String message = String.format("deleting directory %s in containerName: %s", directory,
containerName);
Map<String, Exception> exceptions;
try {
exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message);
} catch (TimeoutException te) {
throw propagate(te);
}
if (exceptions.size() > 0)
throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions));
assert !blobstore.directoryExists(containerName, directory) : String.format(
"still exists %s: %s", message, exceptions);
}
}
代码示例来源:origin: com.amysta.jclouds/jclouds-blobstore
public void execute(final String containerName, String directory) {
Set<String> names = Sets.newHashSet();
names.add(directory);
for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
names.add(directory + suffix);
}
Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
for (final String name : names) {
responses.put(name, userExecutor.submit(new Callable<Void>() {
@Override public Void call() throws Exception {
blobstore.removeBlob(containerName, name);
return null;
}
}));
}
String message = String.format("deleting directory %s in containerName: %s", directory,
containerName);
Map<String, Exception> exceptions;
try {
exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message);
} catch (TimeoutException te) {
throw propagate(te);
}
if (!exceptions.isEmpty())
throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions));
assert !blobstore.directoryExists(containerName, directory) : String.format(
"still exists %s: %s", message, exceptions);
}
}
代码示例来源:origin: Nextdoor/bender
public void execute(final String containerName, String directory) {
Set<String> names = Sets.newHashSet();
names.add(directory);
for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
names.add(directory + suffix);
}
Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
for (final String name : names) {
responses.put(name, userExecutor.submit(new Callable<Void>() {
@Override public Void call() throws Exception {
blobstore.removeBlob(containerName, name);
return null;
}
}));
}
String message = String.format("deleting directory %s in containerName: %s", directory,
containerName);
Map<String, Exception> exceptions;
try {
exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message);
} catch (TimeoutException te) {
throw propagate(te);
}
if (!exceptions.isEmpty())
throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions));
assert !blobstore.directoryExists(containerName, directory) : String.format(
"still exists %s: %s", message, exceptions);
}
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-blobstore
public void execute(String containerName, String directory) {
Set<String> names = Sets.newHashSet();
names.add(directory);
for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
names.add(directory + suffix);
}
Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
for (String name : names) {
responses.put(name, ablobstore.removeBlob(containerName, name));
}
String message = String.format("deleting directory %s in containerName: %s", directory,
containerName);
Map<String, Exception> exceptions;
try {
exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message);
} catch (TimeoutException te) {
throw propagate(te);
}
if (exceptions.size() > 0)
throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions));
assert !blobstore.directoryExists(containerName, directory) : String.format(
"still exists %s: %s", message, exceptions);
}
}
代码示例来源:origin: org.jclouds/jclouds-blobstore
public void execute(String containerName, String directory) {
Set<String> names = Sets.newHashSet();
names.add(directory);
for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
names.add(directory + suffix);
}
Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
for (String name : names) {
responses.put(name, ablobstore.removeBlob(containerName, name));
}
String message = String.format("deleting directory %s in containerName: %s", directory,
containerName);
Map<String, Exception> exceptions;
try {
exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message);
} catch (TimeoutException te) {
throw propagate(te);
}
if (exceptions.size() > 0)
throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions));
assert !blobstore.directoryExists(containerName, directory) : String.format(
"still exists %s: %s", message, exceptions);
}
}
代码示例来源:origin: apache/jclouds
public void execute(final String containerName, String directory) {
Set<String> names = Sets.newHashSet();
names.add(directory);
for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
names.add(directory + suffix);
}
Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
for (final String name : names) {
responses.put(name, userExecutor.submit(new Callable<Void>() {
@Override public Void call() throws Exception {
blobstore.removeBlob(containerName, name);
return null;
}
}));
}
String message = String.format("deleting directory %s in containerName: %s", directory,
containerName);
Map<String, Exception> exceptions;
try {
exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message);
} catch (TimeoutException te) {
throw propagate(te);
}
if (!exceptions.isEmpty())
throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions));
assert !blobstore.directoryExists(containerName, directory) : String.format(
"still exists %s: %s", message, exceptions);
}
}
代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-storage-blobstore
/**
* Get the indicated object from storage.
*
* @param oid
* the Object ID to retrieve
* @return DigitalObject the instantiated DigitalObject requested
* @throws StorageException
* if any errors occur
*/
@Override
public DigitalObject getObject(String oid) throws StorageException {
if (oid == null) {
throw new StorageException("Error; Null OID received");
}
if (!BlobStoreClient.getClient().directoryExists(BlobStoreClient.getContainerName(), oid)) {
throw new StorageException("Error; Object with OID does not exist in storage");
}
// Instantiate and return
return new BlobStoreDigitalObject(oid);
}
代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-storage-blobstore
/**
* Perform the actual removal from Fedora
*
* @param fedoraPid
* the Fedora PID to remove from storage
* @throws StorageException
* if any errors occur
*/
private void removeBlobStoreObject(String oid) throws StorageException {
if (BlobStoreClient.getClient().directoryExists(BlobStoreClient.getContainerName(), oid)) {
BlobStoreClient.getClient().deleteDirectory(BlobStoreClient.getContainerName(), oid);
} else {
throw new StorageException("Object " + oid + " doesn't exist to be deleted");
}
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testDirectoryEndingWithSlash() throws InterruptedException {
String containerName = getContainerName();
try {
BlobStore blobStore = view.getBlobStore();
blobStore.createDirectory(containerName, "someDir");
// According to the S3 documentation, a directory is nothing but a blob
// whose name ends with a '/'. So let's try to remove the blob we just
// created.
blobStore.removeBlob(containerName, "someDir/");
// The directory "someDir" shouldn't exist since we removed it. If this
// test succeeds, it confirms that a directory (or folder) is nothing
// but a blob with a name ending in '/'.
assertEquals(blobStore.directoryExists(containerName, "someDir"), false);
} finally {
returnContainer(containerName);
}
}
}
代码示例来源:origin: apache/jclouds
public void testDirectoryEndingWithSlash() throws InterruptedException {
String containerName = getContainerName();
try {
BlobStore blobStore = view.getBlobStore();
blobStore.createDirectory(containerName, "someDir");
// According to the S3 documentation, a directory is nothing but a blob
// whose name ends with a '/'. So let's try to remove the blob we just
// created.
blobStore.removeBlob(containerName, "someDir/");
// The directory "someDir" shouldn't exist since we removed it. If this
// test succeeds, it confirms that a directory (or folder) is nothing
// but a blob with a name ending in '/'.
assertEquals(blobStore.directoryExists(containerName, "someDir"), false);
} finally {
returnContainer(containerName);
}
}
代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-storage-blobstore
/**
* Create a new object in storage. An object identifier may be provided, or
* a null value will try to have Fedora auto-generate the new OID.
*
* @param oid
* the Object ID to use during creation, null is allowed
* @return DigitalObject the instantiated DigitalObject created
* @throws StorageException
* if any errors occur
*/
@Override
public synchronized DigitalObject createObject(String oid) throws StorageException {
// log.debug("createObject({})", oid);
if (oid == null) {
throw new StorageException("Error; Null OID recieved");
}
// Can we see object?
if (BlobStoreClient.getClient().directoryExists(BlobStoreClient.getContainerName(), oid)) {
throw new StorageException("Error; object '" + oid + "' already exists in Blobstore");
}
BlobStoreClient.getClient().createDirectory(BlobStoreClient.getContainerName(), oid);
// Instantiate and return
return new BlobStoreDigitalObject(oid);
}
代码示例来源:origin: apache/jclouds
String directory = "directory";
assert !view.getBlobStore().directoryExists(containerName, directory);
assert view.getBlobStore().directoryExists(containerName, directory);
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName);
assert !view.getBlobStore().directoryExists(containerName, directory + "/" + directory);
view.getBlobStore().createDirectory(containerName, directory + "/" + directory);
assert view.getBlobStore().directoryExists(containerName, directory + "/" + directory);
assert view.getBlobStore().directoryExists(containerName, directory);
assertThat(view.getBlobStore().directoryExists(containerName, directory + "/" + directory)).isFalse();
代码示例来源:origin: jclouds/legacy-jclouds
String directory = "directory";
assert !view.getBlobStore().directoryExists(containerName, directory);
assert view.getBlobStore().directoryExists(containerName, directory);
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName);
assert !view.getBlobStore().directoryExists(containerName, directory + "/" + directory);
view.getBlobStore().createDirectory(containerName, directory + "/" + directory);
assert view.getBlobStore().directoryExists(containerName, directory + "/" + directory);
assert view.getBlobStore().directoryExists(containerName, directory);
assert view.getBlobStore().directoryExists(containerName, directory + "/" + directory);
内容来源于网络,如有侵权,请联系作者删除!