本文整理汇总了Java中org.jclouds.blobstore.BlobStore.blobExists方法的典型用法代码示例。如果您正苦于以下问题:Java BlobStore.blobExists方法的具体用法?Java BlobStore.blobExists怎么用?Java BlobStore.blobExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jclouds.blobstore.BlobStore
的用法示例。
在下文中一共展示了BlobStore.blobExists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerAddress
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
private void registerAddress(String cluster, InetSocketAddress address) throws HekateException {
try (BlobStoreContext ctx = createContext()) {
BlobStore store = ctx.getBlobStore();
String file = cluster + '/' + AddressUtils.toFileName(address);
try {
if (!store.blobExists(container, file)) {
Blob blob = store.blobBuilder(file)
.type(StorageType.BLOB)
.payload(new byte[]{1})
.build();
store.putBlob(container, blob);
if (log.isInfoEnabled()) {
log.info("Registered address to the cloud store [container={}, file={}]", container, file);
}
}
} catch (ResourceNotFoundException | HttpResponseException e) {
throw new HekateException("Failed to register the seed node address to the cloud store "
+ "[container=" + container + ", file=" + file + ']', e);
}
}
}
示例2: unregisterAddress
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
private void unregisterAddress(String cluster, InetSocketAddress address) {
try (BlobStoreContext ctx = createContext()) {
BlobStore store = ctx.getBlobStore();
String file = cluster + '/' + AddressUtils.toFileName(address);
try {
if (store.blobExists(container, file)) {
store.removeBlob(container, file);
if (log.isInfoEnabled()) {
log.info("Unregistered address from the cloud store [container={}, file={}]", container, file);
}
}
} catch (ResourceNotFoundException | HttpResponseException e) {
if (log.isWarnEnabled()) {
log.warn("Failed to unregister the seed node address from the cloud store "
+ "[container={}, file={}, cause={}]", container, file, e.toString());
}
}
}
}
示例3: handleAbortMultipartUpload
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
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);
}
示例4: delete
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean delete(String id, String root, String filePath) {
ContainerAndName can = getContainerAndName(id, root, filePath);
BlobStore store = getBlobStore();
if (!store.blobExists(can.container, can.name)) {
return false;
} else {
store.removeBlob(can.container, can.name);
deleteContainerIfEmpty(can.container);
return true;
}
}