• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BlobBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jclouds.blobstore.domain.BlobBuilder的典型用法代码示例。如果您正苦于以下问题:Java BlobBuilder类的具体用法?Java BlobBuilder怎么用?Java BlobBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BlobBuilder类属于org.jclouds.blobstore.domain包,在下文中一共展示了BlobBuilder类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: syncToBlobStore

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
/**
 * Synchronizes the object to the BLOB store. The {@link CloudFileChannelTransport} is used here
 * to construct the payload, and run a pre and post action.
 * @param writeMetaData 	Whether to also write metadata or not
 * @throws IOException
 */
protected void syncToBlobStore(boolean writeMetaData) throws IOException {
	// Should we write?
	if (cloudFileOptions.contains(StandardOpenOption.WRITE) ||
			cloudFileOptions.contains(StandardOpenOption.APPEND) || writeShouldSync) {
		syncCount.incrementAndGet();
		LOG.debug("Executing pre-sync interceptor action {} for local file store '{}' to cloud path '{}'",
				transport.getClass().getName(), localPath, path);
		transport.preSyncToCloud(this, writeMetaData);
		LOG.debug("Executed pre-sync interceptor action {} for local file store '{}' to cloud path '{}' OK",
				transport.getClass().getName(), localPath, path);
		LOG.debug("Synchronizing from local file store '{}' to cloud path '{}'", localPath, path);
		File pathFile = localPath.toFile();
		
		// Sync to blob store
		Payload payload = transport.createPayload(localPath);
		try {
			// Read the file content from the channel so far
			BlobStore blobStore = context.getBlobStore();
			BlobBuilder blobBuilder = buildPayload(pathFile, payload, blobStore);
			transport.storeBlob(context, path.getContainerName(), blobBuilder.build(), getPutOption(), writeMetaData);
		} finally {
			payload.close();
		}

		LOG.info("Synchronized from local file store '{}' to cloud path '{}' OK", localPath, path);
		LOG.debug("Executing post-sync interceptor action {} for local file store '{}' to cloud path '{}'",
				transport.getClass().getName(), localPath, path);
		transport.postSyncToCloud(this, writeMetaData);
		LOG.debug("Executed post-sync interceptor action {} for local file store '{}' to cloud path '{}' OK",
				transport.getClass().getName(), localPath, path);
	}
}
 
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:39,代码来源:CloudFileChannel.java


示例2: OSSBlobUtils

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Inject
protected OSSBlobUtils(
      BlobBuilder blobBuilder,
      Provider<BlobBuilder> blobBuilders,
      ClearListStrategy clearContainerStrategy,
      GetDirectoryStrategy getDirectoryStrategy,
      MkdirStrategy mkdirStrategy,
      CountListStrategy countBlobsStrategy,
      DeleteDirectoryStrategy rmDirStrategy) {
   super(blobBuilders, clearContainerStrategy, getDirectoryStrategy, mkdirStrategy, countBlobsStrategy, rmDirStrategy);
   this.blobBuilder = blobBuilder;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:13,代码来源:OSSBlobUtils.java


示例3: configure

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
protected void configure() {
   bind(OSSApi.class).to(OSSApiImpl.class);
   bind(BlobStore.class).to(OSSBlobStore.class);
   bind(BlobRequestSigner.class).to(OSSBlobRequestSigner.class);
   bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
   bind(BlobBuilder.class).to(OSSBlobBuilder.class);
   bind(BlobUtils.class).to(OSSBlobUtils.class);
   bind(LocationsSupplier.class).to(OSSLocationsSupplier.class);
   bind(RegionIdsSupplier.class).to(OSSRegionIdsSupplier.class);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:12,代码来源:OSSBlobStoreContextModule.java


示例4: addContentMetdataFromHttpRequest

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
private static void addContentMetdataFromHttpRequest(
        BlobBuilder.PayloadBlobBuilder builder,
        HttpServletRequest request) {
    ImmutableMap.Builder<String, String> userMetadata =
            ImmutableMap.builder();
    for (String headerName : Collections.list(request.getHeaderNames())) {
        if (startsWithIgnoreCase(headerName, USER_METADATA_PREFIX)) {
            userMetadata.put(
                    headerName.substring(USER_METADATA_PREFIX.length()),
                    Strings.nullToEmpty(request.getHeader(headerName)));
        }
    }
    builder.cacheControl(request.getHeader(
                    HttpHeaders.CACHE_CONTROL))
            .contentDisposition(request.getHeader(
                    HttpHeaders.CONTENT_DISPOSITION))
            .contentEncoding(request.getHeader(
                    HttpHeaders.CONTENT_ENCODING))
            .contentLanguage(request.getHeader(
                    HttpHeaders.CONTENT_LANGUAGE))
            .userMetadata(userMetadata.build());
    String contentType = request.getContentType();
    if (contentType != null) {
        builder.contentType(contentType);
    }
    long expires = request.getDateHeader(HttpHeaders.EXPIRES);
    if (expires != -1) {
        builder.expires(new Date(expires));
    }
}
 
开发者ID:gaul,项目名称:s3proxy,代码行数:31,代码来源:S3ProxyHandler.java


示例5: blobBuilder

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
public BlobBuilder blobBuilder() {
   return blobBuilder;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:5,代码来源:OSSBlobUtils.java


示例6: handleInitiateMultipartUpload

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
private void handleInitiateMultipartUpload(HttpServletRequest request,
        HttpServletResponse response, BlobStore blobStore,
        String containerName, String blobName)
        throws IOException, S3Exception {
    ByteSource payload = ByteSource.empty();
    BlobBuilder.PayloadBlobBuilder builder = blobStore
            .blobBuilder(blobName)
            .payload(payload);
    addContentMetdataFromHttpRequest(builder, request);
    builder.contentLength(payload.size());

    BlobAccess access;
    String cannedAcl = request.getHeader("x-amz-acl");
    if (cannedAcl == null || cannedAcl.equalsIgnoreCase("private")) {
        access = BlobAccess.PRIVATE;
    } else if (cannedAcl.equalsIgnoreCase("public-read")) {
        access = BlobAccess.PUBLIC_READ;
    } else if (CANNED_ACLS.contains(cannedAcl)) {
        throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED);
    } else {
        response.sendError(HttpServletResponse.SC_BAD_REQUEST);
        return;
    }
    PutOptions options = new PutOptions().setBlobAccess(access);

    MultipartUpload mpu = blobStore.initiateMultipartUpload(containerName,
            builder.build().getMetadata(), options);

    if (Quirks.MULTIPART_REQUIRES_STUB.contains(getBlobStoreType(
            blobStore))) {
        blobStore.putBlob(containerName, builder.name(mpu.id()).build(),
                options);
    }

    try (Writer writer = response.getWriter()) {
        response.setContentType(XML_CONTENT_TYPE);
        XMLStreamWriter xml = xmlOutputFactory.createXMLStreamWriter(
                writer);
        xml.writeStartDocument();
        xml.writeStartElement("InitiateMultipartUploadResult");
        xml.writeDefaultNamespace(AWS_XMLNS);

        writeSimpleElement(xml, "Bucket", containerName);
        writeSimpleElement(xml, "Key", blobName);
        writeSimpleElement(xml, "UploadId", mpu.id());

        xml.writeEndElement();
        xml.flush();
    } catch (XMLStreamException xse) {
        throw new IOException(xse);
    }
}
 
开发者ID:gaul,项目名称:s3proxy,代码行数:53,代码来源:S3ProxyHandler.java


示例7: blobBuilder

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
default BlobBuilder blobBuilder(String name) {
    return delegate().blobBuilder(name);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:5,代码来源:IForwardingBlobStore.java


示例8: blobBuilder

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
public BlobBuilder blobBuilder(String s) {
    return delegate.blobBuilder(s);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:5,代码来源:EncryptedBlobStore.java


示例9: blobBuilder

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
public BlobBuilder blobBuilder(String s) {
    return nearStore.blobBuilder(s);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:5,代码来源:BounceBlobStore.java


示例10: blobBuilder

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
public BlobBuilder blobBuilder(String name) {
    return blobUtils.blobBuilder().name(name);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:5,代码来源:NullBlobStore.java


示例11: blobBuilder

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
public BlobBuilder blobBuilder(String name) {
    return delegate().blobBuilder(name);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:5,代码来源:ForwardingBlobStore.java


示例12: blobBuilder

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
public BlobBuilder blobBuilder(String name) {
    return app.getBlobStore(0).blobBuilder(name);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:5,代码来源:AutoConfigBlobStore.java


示例13: blobBuilder

import org.jclouds.blobstore.domain.BlobBuilder; //导入依赖的package包/类
@Override
public BlobBuilder blobBuilder(String name) {
    throw new UnsupportedOperationException("async is not supported");
}
 
开发者ID:mhurne,项目名称:jclouds-gridfs-blobstore,代码行数:5,代码来源:NotSupportedAsyncBlobStore.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Keypair类代码示例发布时间:2022-05-22
下一篇:
Java WordOccurrence类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap