本文整理汇总了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;
}
}
}
示例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);
}
示例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);
}
示例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;
}
示例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\\");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}