当前位置: 首页>>代码示例>>Java>>正文


Java BlobStore.blobExists方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:26,代码来源:CloudStoreSeedNodeProvider.java

示例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());
            }
        }
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:23,代码来源:CloudStoreSeedNodeProvider.java

示例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);
}
 
开发者ID:gaul,项目名称:s3proxy,代码行数:20,代码来源:S3ProxyHandler.java

示例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;
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:17,代码来源:BlobStoreFileSystemHandler.java


注:本文中的org.jclouds.blobstore.BlobStore.blobExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。