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

Java BosClientConfiguration类代码示例

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

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



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

示例1: init

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
@PostConstruct
public void init() {
    location = Enum.valueOf(StoreLocation.class, coreConfig.getValue("app.upload.file.store"));
    switch (location) {
        case Cloud: {
            apikey = coreConfig.getValue("bae.app.apikey");
            secretKey = coreConfig.getValue("bae.app.secretkey");
            bucket = coreConfig.getValue("bae.bcs.bucket");

            BosClientConfiguration config = new BosClientConfiguration();
            config.setCredentials(new DefaultBceCredentials(apikey, secretKey));
            config.setEndpoint(host);
            // config.setEndpoint(coreConfig.getValue("app.domain"));
            // 设置HTTP最大连接数为10
            config.setMaxConnections(10);
            bosClient = new BosClient(config);
            break;
        }
        case FastDFS: {
            fastdfsClient = FastdfsClientFactory.getFastdfsClient();
            break;
        }
    }
}
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:25,代码来源:AppFileUtils.java


示例2: BaiduBOSImpl

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
public BaiduBOSImpl(BaiduBOSConfig baiduBOSConfig) {
	this.baiduBOSConfig = baiduBOSConfig;
	BosClientConfiguration config = new BosClientConfiguration();
	config.setCredentials(
			new DefaultBceCredentials(baiduBOSConfig.getAccessKeyId(), baiduBOSConfig.getAccessKeySecret()));
	config.setEndpoint(baiduBOSConfig.getEndPoint());
	bosClient = new BosClient(config);
}
 
开发者ID:MinsxCloud,项目名称:minsx-ccs,代码行数:9,代码来源:BaiduBOSImpl.java


示例3: initial

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
@Before
public void initial() {
	BosClientConfiguration config = new BosClientConfiguration();
	config.setEndpoint("http://su.bcebos.com");
    config.setCredentials(new DefaultBceCredentials("c93dd9d3411740419a0ff0f16cfce2fc", "c7244fc343a8474682663f0a31d4d798"));
    bosClient = new BosClient(config);
}
 
开发者ID:MinsxCloud,项目名称:minsx-ccs,代码行数:8,代码来源:BosTest.java


示例4: getClient

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
public static BosClient getClient(){
		 // 初始化一个BosClient
	    BosClientConfiguration config = new BosClientConfiguration();
//	    config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID,SECRET_ACCESS_KEY));
//	    config.setEndpoint(ENDPOINT);
	    config.setCredentials(new DefaultBceCredentials(DiaowenProperty.ACCESS_KEY_ID,DiaowenProperty.SECRET_ACCESS_KEY));
	    config.setEndpoint(DiaowenProperty.ENDPOINT);
	    BosClient client = new BosClient(config);
	    return client;
	}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:11,代码来源:BaiduBOS.java


示例5: main

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    AppFileUtils utils = new AppFileUtils();
    utils.apikey = "e46c7e6c281a4d3da7545c685bb5db1c";
    utils.secretKey = "89d1c208bee145f49ca88ef1bbd12302";
    utils.bucket = "onegymbucket";
    utils.location = StoreLocation.Disk;
    BosClientConfiguration config = new BosClientConfiguration();
    config.setCredentials(new DefaultBceCredentials(utils.apikey, utils.secretKey));
    config.setEndpoint(host);
    // config.setEndpoint(coreConfig.getValue("app.domain"));
    // 设置HTTP最大连接数为10
    config.setMaxConnections(10);
    BosClient bosClient = new BosClient(config);
    // 构造ListObjectsRequest请求
    ListObjectsRequest listObjectsRequest = new ListObjectsRequest(utils.bucket);
    // 递归列出fun目录下的所有文件
    listObjectsRequest.setPrefix("static/uploadFiles/manager1/2015-11-12");
    ListObjectsResponse listing = bosClient.listObjects(listObjectsRequest);
    // 遍历所有Object
    System.out.println("Objects:");
    for (BosObjectSummary objectSummary : listing.getContents()) {
        System.out.println(objectSummary.getKey());
    }

    System.out.println(StringUtils.substringAfterLast("http://bj.bcebos.com/v1/onegymbucket/static/uploadFiles/manager1/2015-11-12/483bdc2b9ee8413d99e91293237615c9/ccc.jpg", "onegymbucket/"));

    String fileUrl = "http://10.87.13.157:9011/fileWeb/CSAOFWeb/魏总2修.jpg";
    URL url = new URL(FilenameUtils.getFullPath(fileUrl) + Encodes.urlEncode(getFileName(fileUrl)));
    String storeFile = "D:\\data\\files\\images\\oa\\news\\魏总2修1111111111111.jpg";
    FileUtils.copyURLToFile(url, new File(storeFile));
    utils.uploadCompressImage(new File(storeFile), 0.7f, "D:\\data\\files\\images\\oa\\news\\");
}
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:33,代码来源:AppFileUtils.java


示例6: main

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	    String ENDPOINT = "http://bj.bcebos.com";
	    BosClientConfiguration config = new BosClientConfiguration();
	    config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
	    config.setEndpoint(ENDPOINT);
	    BosClient client = new BosClient(config);	    
//	    File targetFile = new File("C:\\Users\\lenovo\\Desktop\\清华大学MBA.txt");
//	    String storePath = "/static/test/";
//	    putObject(client, targetFile, storePath);
//	    deleteObject(client, "http://bj.bcebos.com/v1/onegymbucket/static/test/aaa.jpg");
        //上传url文件
        String fileurl = "http://bj.bcebos.com/v1/onegymbucket/static/uploadFiles/manager1/2015-10-28/e082e0bfc93d40d29b62afd087ee9f88/logo.jpg";
        String uploadedUrl =uploadFromUrl(client, BUCKET, fileurl, AppFileUtils.getFileBaseName(fileurl), "/static/uploadFiles/");
        System.out.println("uploadedUrl is: "+uploadedUrl);
	}
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:16,代码来源:BCE.java


示例7: initialize

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
@PostConstruct
private void initialize() {
  this.bucket = configuration.getBucket();
  BosClientConfiguration config = new BosClientConfiguration();
  config.setCredentials(new DefaultBceCredentials(configuration.getAccessKey(), configuration.getSecretKey()));
  config.setEndpoint(configuration.getEndPoint());
  bos = new BosClient(config);
}
 
开发者ID:perrywang,项目名称:dionysus,代码行数:9,代码来源:BOSService.java


示例8: BOSService

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
public BOSService(BOSServiceBuilder builder) {
  this.bucket = builder.getBucket();
  BosClientConfiguration config = new BosClientConfiguration();
  BceCredentials credential = new DefaultBceCredentials(builder.getAccessKey(),
      builder.getSecretKey());
  config.setCredentials(credential);
  config.setEndpoint(builder.getEndPoint());
  bos = new BosClient(config);
}
 
开发者ID:perrywang,项目名称:dionysus,代码行数:10,代码来源:BOSService.java


示例9: VodClient

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
/**
 * Constructs a new client using the client configuration.
 *
 * @param vodConfig The client configuration options controlling how this client connects to Vod services
 *            (e.g. proxy settings, retry counts, etc).
 */
public VodClient(BceClientConfiguration vodConfig) {
    // enable HTTP Async manner for PUT method
    super(vodConfig, responseHandlers, true);

    BosClientConfiguration bosConfig = new BosClientConfiguration(vodConfig, null).withRegion(Region.CN_N1);
    bosClient = new BosClient(bosConfig);

}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:15,代码来源:VodClient.java


示例10: init

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
@PostConstruct
public void init() {
    BosClientConfiguration config = new BosClientConfiguration();
    config.setCredentials(new DefaultBceCredentials(key, secret));
    config.setEndpoint(url);
    client = new BosClient(config);
}
 
开发者ID:chocotan,项目名称:lolibox,代码行数:8,代码来源:BaiduStorageService.java


示例11: bosUploadDocument

import com.baidubce.services.bos.BosClientConfiguration; //导入依赖的package包/类
/**
 * publish a Document.
 *
 * @param bucketName  The bucket name response from register.
 * @param objectName  The object name response from register.
 * @param file  The Document file need to be uploaded.
 * @param endpoint  The bos endpoint response from register.
 *
 * @return A PublishDocumentResponse object containing the information returned by Document.
 */
private void bosUploadDocument(String bucketName, String objectName, File file, String endpoint) {
    BosClientConfiguration config = new BosClientConfiguration(this.config);
    config.setEndpoint(endpoint);
    BosClient bosClient = new BosClient(config);

    PutObjectResponse response = bosClient.putObject(bucketName, objectName, file);
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:18,代码来源:DocClient.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DefaultBatchConfigurer类代码示例发布时间:2022-05-22
下一篇:
Java CliDriver类代码示例发布时间: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