use of com.mizhousoft.cloudsdk.CloudSDKException in project cloud-sdk by mizhousoft.
the class AliyunObjectStorageServiceImpl method doDeleteObjects.
private void doDeleteObjects(String bucketName, Collection<String> objectNames) throws CloudSDKException {
DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucketName);
List<String> keyList = new ArrayList<>(objectNames);
deleteObjectsRequest.setKeys(keyList);
try {
ossClient.deleteObjects(deleteObjectsRequest);
// List<DeletedObject> deletedObjects = deleteResult.getDeletedObjects();
} catch (OSSException e) {
// List<DeleteError> deleteErrors = mde.getErrors();
throw new CloudSDKException(e.getMessage(), e);
} catch (ClientException e) {
throw new CloudSDKException(e.getMessage(), e);
} catch (Throwable e) {
throw new CloudSDKException(e.getMessage(), e);
}
}
use of com.mizhousoft.cloudsdk.CloudSDKException in project cloud-sdk by mizhousoft.
the class AliyunObjectStorageServiceImpl method copyObject.
/**
* {@inheritDoc}
*/
@Override
public void copyObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey) throws CloudSDKException {
try {
CopyObjectRequest request = new CopyObjectRequest(sourceBucketName, sourceKey, destinationBucketName, destinationKey);
ossClient.copyObject(request);
} catch (Throwable e) {
throw new CloudSDKException(e.getMessage(), e);
}
}
use of com.mizhousoft.cloudsdk.CloudSDKException in project cloud-sdk by mizhousoft.
the class TestAliyunObjectStorageServiceImpl method testputObject.
@Test
public void testputObject() {
String filePath = TestAliyunObjectStorageServiceImpl.class.getClassLoader().getResource("test.txt").getPath();
File localFile = new File(filePath);
try {
objectStoreageService.putObject(BUCKETNAME, OBJECTNAME, localFile);
} catch (CloudSDKException e) {
Assert.fail(e.getMessage());
}
}
use of com.mizhousoft.cloudsdk.CloudSDKException in project cloud-sdk by mizhousoft.
the class TestAliyunObjectStorageServiceImpl method testgenPresignedDownloadUrl.
@Test
public void testgenPresignedDownloadUrl() {
try {
long signExpired = 60 * 1000;
URL url = objectStoreageService.genPresignedDownloadUrl(BUCKETNAME, OBJECTNAME, signExpired);
System.out.println(url.toString());
} catch (CloudSDKException e) {
Assert.fail(e.getMessage());
}
}
Aggregations